fix: 表格验证 状态禁用 同步按钮
This commit is contained in:
parent
27e91b1e9b
commit
d3af6f1c79
|
@ -30,7 +30,7 @@ export default {
|
||||||
handleVerification() {
|
handleVerification() {
|
||||||
this.$emit("verification", this.form, (msg) => {
|
this.$emit("verification", this.form, (msg) => {
|
||||||
this.message = msg;
|
this.message = msg;
|
||||||
return;
|
return msg ? true : false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -45,7 +45,7 @@ export default {
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
},
|
},
|
||||||
handleVerification(e, callback) {
|
handleVerification(e, callback) {
|
||||||
this.$emit('handleVerification', this.form, callback);
|
this.$emit('handleVerification', this.form, callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-table
|
<!-- <el-form class="base-form" ref="baseForm" :model="baseForm" :rules="rules" auto-complete="on"> -->
|
||||||
|
<el-table
|
||||||
border
|
border
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:data="list"
|
:data="list"
|
||||||
|
@ -94,6 +95,9 @@
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<e-table-input @handleVerification="alarmValueTableCallback" :disabled="!scope.row.alarmSta" :form="scope.row" pops="alarmValue" />
|
<e-table-input @handleVerification="alarmValueTableCallback" :disabled="!scope.row.alarmSta" :form="scope.row" pops="alarmValue" />
|
||||||
|
<!-- <el-form-item :prop="'demoList.'+scope.$index+'.alarmValue'" :rules="tableFormRules.alarmValue" class="all">
|
||||||
|
<el-input v-model="scope.row.alarmValue" placeholder="请输入" clearable @focus="$refs.baseForm.clearValidate(`demoList.${scope.$index}.alarmValue`)"></el-input>
|
||||||
|
</el-form-item> -->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -122,7 +126,7 @@
|
||||||
align="center"
|
align="center"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<e-table-input @handleVerification="warnValueTableCallback" :disabled="!scope.row.warnSta" :form="scope.row" pops="warnValue" />
|
<e-table-input @handleVerification="warnValueTableCallback" :disabled="!scope.row.warnSta" :form="scope.row" pops="warnValue" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
|
@ -142,6 +146,8 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
<!-- </el-form> -->
|
||||||
|
|
||||||
|
|
||||||
<dialog-template
|
<dialog-template
|
||||||
:title="title"
|
:title="title"
|
||||||
|
@ -269,6 +275,9 @@ export default {
|
||||||
title: "修改",
|
title: "修改",
|
||||||
open: false,
|
open: false,
|
||||||
form: {},
|
form: {},
|
||||||
|
baseForm: {
|
||||||
|
list: []
|
||||||
|
},
|
||||||
updateIndex: null,
|
updateIndex: null,
|
||||||
isAck: false,
|
isAck: false,
|
||||||
disabledAck: false,
|
disabledAck: false,
|
||||||
|
@ -304,6 +313,7 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
ackList: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -316,35 +326,45 @@ export default {
|
||||||
deviceKey() {
|
deviceKey() {
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
|
list: {
|
||||||
|
deep: true,
|
||||||
|
handler: function () {
|
||||||
|
this.disabledAck = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleAlarmSta(v) {
|
handleAlarmSta(v) {
|
||||||
console.log(v)
|
console.log(v)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleDisableAce(status) {
|
||||||
|
if(status && this.disabledAck === false) {
|
||||||
|
this.disabledAck = status;
|
||||||
|
}
|
||||||
|
},
|
||||||
alarmValueTableCallback(row, callback) {
|
alarmValueTableCallback(row, callback) {
|
||||||
console.log(row)
|
|
||||||
if (!row.alarmSta) {
|
if (!row.alarmSta) {
|
||||||
callback();
|
this.handleDisableAce(callback());
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!row.alarmValue || row.alarmValue === 0) {
|
if(!row.alarmValue || row.alarmValue === 0) {
|
||||||
callback('告警值不能为空!')
|
this.handleDisableAce(callback('告警值不能为空!'));
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isExp =
|
const isExp =
|
||||||
/^((\-)*([1-9][0-9]*)|(\-)*(([0]\.\d{1,}|[1-9][0-9]*\.\d{1,})))$/;
|
/^((\-)*([1-9][0-9]*)|(\-)*(([0]\.\d{1,}|[1-9][0-9]*\.\d{1,})))$/;
|
||||||
|
|
||||||
if (row.alarmValue && !isExp.test(row.alarmValue)) {
|
if (row.alarmValue && !isExp.test(row.alarmValue)) {
|
||||||
callback("只可以输入大于0的数字类型!");
|
this.handleDisableAce(callback("只可以输入大于0的数字类型!"));
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!row.warnSta) {
|
if (!row.warnSta) {
|
||||||
callback();
|
this.handleDisableAce(callback());
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (this.uvpList.indexOf(row.type) >= 0) {
|
/*if (this.uvpList.indexOf(row.type) >= 0) {
|
||||||
|
@ -364,17 +384,18 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
callback();
|
this.handleDisableAce(callback());
|
||||||
|
return;
|
||||||
},
|
},
|
||||||
|
|
||||||
warnValueMaxTableCallback(row, callback) {
|
warnValueMaxTableCallback(row, callback) {
|
||||||
if (!row.warnSta) {
|
if (!row.warnSta) {
|
||||||
callback();
|
this.handleDisableAce(callback());
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!row.warnValueMax && row.warnValueMax !== 0) {
|
if (!row.warnValueMax && row.warnValueMax !== 0) {
|
||||||
callback();
|
this.handleDisableAce(callback());
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,7 +403,7 @@ export default {
|
||||||
/^((\-)*([1-9][0-9]*)|(\-)*([0-9]*)|(\-)*(([0]\.\d{1,}|[1-9][0-9]*\.\d{1,})))$/;
|
/^((\-)*([1-9][0-9]*)|(\-)*([0-9]*)|(\-)*(([0]\.\d{1,}|[1-9][0-9]*\.\d{1,})))$/;
|
||||||
|
|
||||||
if (row.warnValueMax && !isExp.test(row.warnValueMax)) {
|
if (row.warnValueMax && !isExp.test(row.warnValueMax)) {
|
||||||
callback("只可以输入数字类型!");
|
this.handleDisableAce(callback("只可以输入数字类型!"));
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,10 +411,10 @@ export default {
|
||||||
(row.warnValueMin || row.warnValueMin === 0) &&
|
(row.warnValueMin || row.warnValueMin === 0) &&
|
||||||
+row.warnValueMax < +row.warnValueMin
|
+row.warnValueMax < +row.warnValueMin
|
||||||
) {
|
) {
|
||||||
callback("需要大于最小预警值!");
|
this.handleDisableAce(callback("需要大于最小预警值!"));
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
callback();
|
this.handleDisableAce(callback());
|
||||||
},
|
},
|
||||||
|
|
||||||
warnValueMinTableCallback(row, callback) {
|
warnValueMinTableCallback(row, callback) {
|
||||||
|
@ -426,23 +447,23 @@ export default {
|
||||||
},
|
},
|
||||||
warnValueTableCallback(row, callback) {
|
warnValueTableCallback(row, callback) {
|
||||||
if (!row.warnSta) {
|
if (!row.warnSta) {
|
||||||
callback();
|
this.handleDisableAce(callback());
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!row.warnValue || row.warnValue === 0) {
|
if (!row.warnValue || row.warnValue === 0) {
|
||||||
callback("预警值不能为空!");
|
this.handleDisableAce(callback('预警值不能为空!'));
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const isExp =
|
const isExp =
|
||||||
/^((\-)*([1-9][0-9]*)|(\-)*(([0]\.\d{1,}|[1-9][0-9]*\.\d{1,})))$/;
|
/^((\-)*([1-9][0-9]*)|(\-)*(([0]\.\d{1,}|[1-9][0-9]*\.\d{1,})))$/;
|
||||||
|
|
||||||
if (row.warnValue && !isExp.test(row.warnValue)) {
|
if (row.warnValue && !isExp.test(row.warnValue)) {
|
||||||
callback("只可以输入大于0的数字类型!");
|
this.handleDisableAce(callback("只可以输入大于0的数字类型!"));
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
callback();
|
this.handleDisableAce(callback());
|
||||||
},
|
},
|
||||||
alarmValue(rule, value, callback) {
|
alarmValue(rule, value, callback) {
|
||||||
if (!this.form.alarmSta) {
|
if (!this.form.alarmSta) {
|
||||||
|
|
Loading…
Reference in New Issue