修改参数成功后取消数据请求

pull/73/head
孙萌 2023-12-13 17:16:51 +08:00
parent f9f00dda10
commit 389cdb3b70
18 changed files with 312 additions and 229 deletions

View File

@ -5,6 +5,7 @@ Vue.use(Vuex)
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
nowInput:'',
lateSend: 100,//写入停止后 *100毫秒进行发送 例如10*100就是1000毫秒(1s) lateSend: 100,//写入停止后 *100毫秒进行发送 例如10*100就是1000毫秒(1s)
lateSendBtn: 10,//写入停止后 *100毫秒进行发送 例如10*100就是1000毫秒(1s) lateSendBtn: 10,//写入停止后 *100毫秒进行发送 例如10*100就是1000毫秒(1s)
equipmentList: [],//当前账户施肥设备 equipmentList: [],//当前账户施肥设备

View File

@ -162,6 +162,8 @@ export default {
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
e.currentTarget.select(); e.currentTarget.select();
}, },
// //
@ -204,15 +206,18 @@ selectValue(e) {
}, 100); }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state
this.api.postWriteFs(data).then((res) => { this.api.postWriteFs(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); store.nowInput=''
// this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null
}); });

View File

@ -279,6 +279,8 @@ export default {
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
e.currentTarget.select(); e.currentTarget.select();
}, },
// //
@ -346,15 +348,18 @@ export default {
}, 100); }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state
this.api.postControlWrite(data).then((res) => { this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); store.nowInput=''
// this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null
}); });

View File

@ -343,6 +343,8 @@ export default {
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
e.currentTarget.select(); e.currentTarget.select();
}, },
// //
@ -385,18 +387,22 @@ selectValue(e) {
}, 100); }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state
this.api.postWriteFs(data).then((res) => { this.api.postWriteFs(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); store.nowInput=''
// this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null
}); });
}, },
tableRowClassName({ row, rowIndex }) { tableRowClassName({ row, rowIndex }) {
if (rowIndex % 2 == 1) { if (rowIndex % 2 == 1) {

View File

@ -979,6 +979,8 @@ export default {
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
e.currentTarget.select(); e.currentTarget.select();
}, },
// //
@ -1061,15 +1063,18 @@ selectValue(e) {
}, 100); }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state
this.api.postWriteFs(data).then((res) => { this.api.postWriteFs(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); store.nowInput=''
// this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null
}); });

View File

@ -389,6 +389,8 @@ return num
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
e.currentTarget.select(); e.currentTarget.select();
}, },
getSendData(number) { getSendData(number) {
@ -499,15 +501,18 @@ return num
}, 100); }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state
this.api.postControlWrite(data).then((res) => { this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); store.nowInput=''
// this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null
}); });

View File

@ -267,6 +267,8 @@ return num
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
e.currentTarget.select(); e.currentTarget.select();
}, },
getSendData(number){ getSendData(number){
@ -377,15 +379,18 @@ getSendData(number){
}, 100); }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state
this.api.postWriteFs(data).then((res) => { this.api.postWriteFs(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); store.nowInput=''
// this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null
}); });

View File

@ -355,6 +355,8 @@ export default {
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
e.currentTarget.select(); e.currentTarget.select();
}, },
// //
@ -422,15 +424,18 @@ export default {
}, 100); }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state
this.api.postControlWrite(data).then((res) => { this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); store.nowInput=''
// this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null
}); });

View File

@ -193,10 +193,10 @@ export default {
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); // this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.$message.error(res.data.msg);
} }
if (this.nowSel.index != -1) { if (this.nowSel.index != -1) {
this.timer = null this.timer = null

View File

@ -118,6 +118,8 @@ export default {
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
e.currentTarget.select(); e.currentTarget.select();
}, },
// //
@ -160,15 +162,18 @@ selectValue(e) {
}, 100); }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state
this.api.postWriteFs(data).then((res) => { this.api.postWriteFs(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); store.nowInput=''
// this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null
}); });

View File

@ -303,6 +303,8 @@ export default {
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
e.currentTarget.select(); e.currentTarget.select();
}, },
// //
@ -370,15 +372,18 @@ selectValue(e) {
}, 100); }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state
this.api.postControlWrite(data).then((res) => { this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); store.nowInput=''
// this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null
}); });

View File

@ -149,6 +149,8 @@ export default {
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
e.currentTarget.select(); e.currentTarget.select();
}, },
// //
@ -216,15 +218,18 @@ selectValue(e) {
}, 100); }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state
this.api.postWriteFs(data).then((res) => { this.api.postWriteFs(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); store.nowInput=''
// this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null
}); });

View File

@ -185,6 +185,8 @@ export default {
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
e.currentTarget.select(); e.currentTarget.select();
}, },
// //
@ -252,15 +254,19 @@ export default {
}, 100); }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state
this.api.postControlWrite(data).then((res) => { this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); store.nowInput=''
// this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null
}); });

View File

@ -158,6 +158,8 @@ export default {
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
e.currentTarget.select(); e.currentTarget.select();
}, },
// //
@ -225,15 +227,18 @@ export default {
}, 100); }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state
this.api.postControlWrite(data).then((res) => { this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); store.nowInput=''
// this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null
}); });

View File

@ -275,6 +275,8 @@ return hexString;
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
e.currentTarget.select(); e.currentTarget.select();
}, },
// //
@ -342,15 +344,18 @@ return hexString;
}, 100); }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state
this.api.postControlWrite(data).then((res) => { this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); store.nowInput=''
// this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null
}); });

View File

@ -174,6 +174,8 @@ export default {
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
e.currentTarget.select(); e.currentTarget.select();
}, },
// //
@ -241,15 +243,18 @@ export default {
}, 100); }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state
this.api.postControlWrite(data).then((res) => { this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); store.nowInput=''
// this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null
}); });

View File

@ -279,6 +279,8 @@ export default {
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
e.currentTarget.select(); e.currentTarget.select();
}, },
// //
@ -346,15 +348,18 @@ export default {
}, 100); }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state
this.api.postControlWrite(data).then((res) => { this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); store.nowInput=''
// this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null
}); });

View File

@ -169,6 +169,8 @@ export default {
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state
store.nowInput=e.target.value
e.currentTarget.select(); e.currentTarget.select();
}, },
// //
@ -236,15 +238,18 @@ export default {
}, 100); }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state
this.api.postControlWrite(data).then((res) => { this.api.postControlWrite(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
this.dataInit(); store.nowInput=''
// this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.inputData[data.regAddress]=store.nowInput
this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null
}); });