Commit bcd98cac authored by lei's avatar lei

fix:排水系统弹窗控制修复

parent ea56db5b
......@@ -33,14 +33,14 @@
<div
class="button on"
:class="item.status == 1 ? 'active' : ''"
@click="openWaterPump(item)"
@click="openWaterPump(item, 1)"
>
开启
</div>
<div
class="button off"
:class="item.status == 0 ? 'active' : ''"
@click="closeWaterPump(item)"
@click="closeWaterPump(item, 0)"
>
关闭
</div>
......@@ -94,8 +94,8 @@
<el-input placeholder="" v-model="password" show-password></el-input>
</div>
<div>
<div class="button close" @click="submitPumpPassword(0)">关闭</div>
<div class="button" @click="submitPumpPassword(1)">开启</div>
<div class="button close" @click="upWindowShow = false">取消</div>
<div class="button" @click="submitPumpPassword()">确认</div>
</div>
</div>
</div>
......@@ -120,6 +120,7 @@ export default {
],
sumpData: [],
pumpList: [],
pumpStatus: 0, //水泵状态
};
},
created() {
......@@ -139,34 +140,39 @@ export default {
});
},
// 水泵开启按钮
openWaterPump(item) {
openWaterPump(item, status) {
this.upWindowShow = true;
// this.submitPumpPassword(pumpId, this.password, 0);
this.pumpId = item.pumpId;
this.pumpStatus = status;
},
// 水泵关闭按钮
closeWaterPump(item) {
closeWaterPump(item, status) {
this.upWindowShow = true;
this.pumpId = item.pumpId;
this.pumpStatus = status;
this.password = "";
},
//提交水泵密码
submitPumpPassword(status) {
submitPumpPassword() {
let pumpId = this.pumpId;
let password = this.password;
if (!password) {
return this.$modal.msgError("请输入密码");
}
updatePumpSwitch({ pumpId, password, status }).then((res) => {
if (res.code === 200) {
this.upWindowShow = false;
this.password = "";
this.$modal.msgSuccess(res.msg);
this.initPumpList();
} else {
this.$modal.msgError(res.msg);
updatePumpSwitch({ pumpId, password, status: this.pumpStatus }).then(
(res) => {
if (res.code === 200) {
this.upWindowShow = false;
this.password = "";
this.$modal.msgSuccess(res.msg);
this.initPumpList();
} else {
this.$modal.msgError(res.msg);
}
}
});
);
},
},
filters: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment