上位机查询

ds1.0
fanluyan 2 years ago
parent 4a5a45caa5
commit 928a738eb6

@ -400,7 +400,7 @@ export default {
tabsActive: "first", tabsActive: "first",
rowData: {}, rowData: {},
requestid: "", requestid: "",
timer: null, uptimer: null,
i: 0, i: 0,
}; };
}, },
@ -430,14 +430,23 @@ export default {
// //
samphandleClick() { samphandleClick() {
this.samplingForm = {}; this.samplingForm = {};
this.i = 0;
clearInterval(this.uptimer);
this.uptimer = null;
}, },
// //
uphandleClick() { uphandleClick() {
this.upperComputer = {}; this.upperComputer = {};
this.i = 0;
clearInterval(this.uptimer);
this.uptimer = null;
}, },
//id //id
idhandleClick() { idhandleClick() {
this.idParameter = {}; this.idParameter = {};
this.i = 0;
clearInterval(this.uptimer);
this.uptimer = null;
}, },
// //
// -act=sampling [0xA4 ] --flag=[Request Set Flag, default is set=1, 0: request] --rf=[Request Flag] --reqtype=[Request Type] --maintime=[Main Time] --samplecount=[Sample Count] --samplingfreq=[Sample Frequency] --heartbeat=[Heartbeat Time] // -act=sampling [0xA4 ] --flag=[Request Set Flag, default is set=1, 0: request] --rf=[Request Flag] --reqtype=[Request Type] --maintime=[Main Time] --samplecount=[Sample Count] --samplingfreq=[Sample Frequency] --heartbeat=[Heartbeat Time]
@ -452,14 +461,14 @@ export default {
name: "flag", name: "flag",
value: 0, value: 0,
}, },
{ // {
name: "rf", // name: "rf",
value: 15, // value: 15,
}, // },
{ // {
name: "reqtype", // name: "reqtype",
value: "0xA4", // value: "0xA4",
}, // },
{ {
name: "maintime", name: "maintime",
value: "", value: "",
@ -504,14 +513,14 @@ export default {
name: "flag", name: "flag",
value: 1, value: 1,
}, },
{ // {
name: "rf", // name: "rf",
value: 15, // value: 15,
}, // },
{ // {
name: "reqtype", // name: "reqtype",
value: "0xA4", // value: "0xA4",
}, // },
{ {
name: "maintime", name: "maintime",
value: this.samplingForm.mainTime, value: this.samplingForm.mainTime,
@ -710,7 +719,7 @@ export default {
console.log(res); console.log(res);
this.requestid = res.data.requestId; this.requestid = res.data.requestId;
this.getinfo(); this.getinfo();
this.timer = window.setInterval(() => { this.uptimer = window.setInterval(() => {
this.getinfo(); this.getinfo();
this.i++; this.i++;
}, 1000); }, 1000);
@ -721,29 +730,49 @@ export default {
getTermCameraRequest({ requestid: this.requestid }) getTermCameraRequest({ requestid: this.requestid })
.then((res) => { .then((res) => {
if (res.data.success == 1) { if (res.data.success == 1) {
this.i = 0;
clearInterval(this.uptimer);
this.uptimer = null;
console.log("终止轮询");
// && res.data.result == 255 // && res.data.result == 255
console.log(JSON.parse(res.data.data)); console.log(JSON.parse(res.data.data));
this.samplingForm = JSON.parse(res.data.data); this.samplingForm = JSON.parse(res.data.data);
console.log(this.tabsActive);
this.upperComputer = JSON.parse(res.data.data); this.upperComputer = JSON.parse(res.data.data);
console.log(this.upperComputer);
let hexArray = this.upperComputer.ip
.toString(16)
.match(/.{1,2}/g)
.reverse();
console.log(hexArray);
for (let i = 0; i < hexArray.length; i++) {
console.log(hexArray[i]);
console.log(parseInt(hexArray[i], 16));
hexArray[i] = parseInt(hexArray[i], 16);
}
console.log(hexArray);
this.upperComputer.ip = hexArray.join(".");
this.idParameter = JSON.parse(res.data.data); this.idParameter = JSON.parse(res.data.data);
this.i = 0;
this.$message({ this.$message({
duration: 1500, duration: 1500,
showClose: true, showClose: true,
message: "信息已更新", message: "信息已更新",
type: "success", type: "success",
}); });
clearInterval(this.timer);
} else if (this.i > 9) { } else if (this.i > 9) {
this.loading = false; this.loading = false;
this.i = 0; this.i = 0;
clearInterval(this.uptimer);
this.uptimer = null;
this.$message({ this.$message({
duration: 1500, duration: 1500,
showClose: true, showClose: true,
message: "暂未获取到信息,请稍后再试!!", message: "暂未获取到信息,请稍后再试!!",
type: "warning", type: "warning",
}); });
clearInterval(this.timer);
} }
}) })
.catch(); .catch();
@ -816,7 +845,13 @@ export default {
this.isShow = false; this.isShow = false;
this.activeName = "2"; this.activeName = "2";
this.tabsActive = "first"; this.tabsActive = "first";
this.samplingForm = {};
this.upperComputer = {};
this.idParameter = {};
this.gpsForm = {}; this.gpsForm = {};
this.i = 0;
clearInterval(this.uptimer);
this.uptimer = null;
}, },
}, },
}; };

Loading…
Cancel
Save