|
|
@ -113,7 +113,6 @@
|
|
|
|
placeholder="请填入预警等级"
|
|
|
|
placeholder="请填入预警等级"
|
|
|
|
class="table_input_warn_level"
|
|
|
|
class="table_input_warn_level"
|
|
|
|
v-model="scope.row.alarmLevel"
|
|
|
|
v-model="scope.row.alarmLevel"
|
|
|
|
@blur="input_warn_blur($event)"
|
|
|
|
|
|
|
|
></el-input>
|
|
|
|
></el-input>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
@ -159,6 +158,7 @@ import {
|
|
|
|
saveSafeCalculation,
|
|
|
|
saveSafeCalculation,
|
|
|
|
getWarnTable,
|
|
|
|
getWarnTable,
|
|
|
|
saveWarnTable,
|
|
|
|
saveWarnTable,
|
|
|
|
|
|
|
|
deleteWarn
|
|
|
|
} from "@/api/systemManagement/safeIndex";
|
|
|
|
} from "@/api/systemManagement/safeIndex";
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
name: "indexmassageThree",
|
|
|
|
name: "indexmassageThree",
|
|
|
@ -180,7 +180,6 @@ export default {
|
|
|
|
color: "", // 预警新增的颜色
|
|
|
|
color: "", // 预警新增的颜色
|
|
|
|
sortValue: "",
|
|
|
|
sortValue: "",
|
|
|
|
add_warn_disabled: false, // 预警新增是否禁用,如果四条时则不可再新增
|
|
|
|
add_warn_disabled: false, // 预警新增是否禁用,如果四条时则不可再新增
|
|
|
|
input_warnning: "1", // 控制预警必填
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
created() {
|
|
|
@ -210,7 +209,13 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.tableData_all = []; // 清空表格内容
|
|
|
|
this.tableData_all = []; // 清空表格内容
|
|
|
|
this.tableData_warn = [];
|
|
|
|
this.tableData_warn = [];
|
|
|
|
this.tableData_all = JSON.parse(res.data.calculationRule).calculation;
|
|
|
|
if (res.data.calculationRule === null) {
|
|
|
|
|
|
|
|
this.tableData_all = [];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.tableData_all = JSON.parse(
|
|
|
|
|
|
|
|
res.data.calculationRule
|
|
|
|
|
|
|
|
).calculation;
|
|
|
|
|
|
|
|
}
|
|
|
|
console.log("this.tableData_all", this.tableData_all);
|
|
|
|
console.log("this.tableData_all", this.tableData_all);
|
|
|
|
this.safeRuleId = res.data.safeRuleId; // 此safeRuleId为保存表格数据时的safeRuleId,不和兄弟传来的safeRuleId混淆
|
|
|
|
this.safeRuleId = res.data.safeRuleId; // 此safeRuleId为保存表格数据时的safeRuleId,不和兄弟传来的safeRuleId混淆
|
|
|
|
this.id = res.data.id;
|
|
|
|
this.id = res.data.id;
|
|
|
@ -255,14 +260,6 @@ export default {
|
|
|
|
color: "#fff",
|
|
|
|
color: "#fff",
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
input_warn_blur(e) {
|
|
|
|
|
|
|
|
if (e.target.value === "") {
|
|
|
|
|
|
|
|
this.$message.warning("预警等级不能为空");
|
|
|
|
|
|
|
|
this.input_warnning = "1";
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.input_warnning = "0";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 点击添加一行数据
|
|
|
|
// 点击添加一行数据
|
|
|
|
add_data() {
|
|
|
|
add_data() {
|
|
|
|
this.tableData_all.push({
|
|
|
|
this.tableData_all.push({
|
|
|
@ -286,9 +283,10 @@ export default {
|
|
|
|
} else if (this.tableData_warn.length === 3) {
|
|
|
|
} else if (this.tableData_warn.length === 3) {
|
|
|
|
this.color = "green";
|
|
|
|
this.color = "green";
|
|
|
|
this.sortValue = "4";
|
|
|
|
this.sortValue = "4";
|
|
|
|
this.add_warn_disabled = true;
|
|
|
|
|
|
|
|
this.$message.warning("至多四条预警数据");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.tableData_warn.length >= 4) {
|
|
|
|
|
|
|
|
this.$message.warning("至多四条预警数据");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
this.tableData_warn.push({
|
|
|
|
this.tableData_warn.push({
|
|
|
|
id: "",
|
|
|
|
id: "",
|
|
|
|
safeRuleId: this.safeRuleId,
|
|
|
|
safeRuleId: this.safeRuleId,
|
|
|
@ -298,6 +296,7 @@ export default {
|
|
|
|
color: this.color,
|
|
|
|
color: this.color,
|
|
|
|
sortValue: this.sortValue,
|
|
|
|
sortValue: this.sortValue,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 点击删除一行数据
|
|
|
|
// 点击删除一行数据
|
|
|
|
delete_data(index, row) {
|
|
|
|
delete_data(index, row) {
|
|
|
@ -311,7 +310,9 @@ export default {
|
|
|
|
if (this.tableData_warn.length === index + 1) {
|
|
|
|
if (this.tableData_warn.length === index + 1) {
|
|
|
|
// 按顺序删,只能删最后一行
|
|
|
|
// 按顺序删,只能删最后一行
|
|
|
|
this.tableData_warn.splice(index, 1);
|
|
|
|
this.tableData_warn.splice(index, 1);
|
|
|
|
if (this.tableData_warn.length != 4) {
|
|
|
|
const params = `idList=${row.id}`
|
|
|
|
|
|
|
|
deleteWarn(params)
|
|
|
|
|
|
|
|
if (this.tableData_warn.length < 4) {
|
|
|
|
this.add_warn_disabled = false; // 当预警数据不为4条时,接触新增禁用
|
|
|
|
this.add_warn_disabled = false; // 当预警数据不为4条时,接触新增禁用
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -348,9 +349,13 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 保存预警数据
|
|
|
|
// 保存预警数据
|
|
|
|
save_data_warn() {
|
|
|
|
save_data_warn() {
|
|
|
|
if (this.input_warnning === "1") {
|
|
|
|
const input_warn = this.tableData_warn.map((item) => item.alarmLevel);
|
|
|
|
|
|
|
|
console.log("input_warn", input_warn);
|
|
|
|
|
|
|
|
if (input_warn.includes("")) {
|
|
|
|
this.$message.warning("请填入预警等级");
|
|
|
|
this.$message.warning("请填入预警等级");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
console.log("input_warn", input_warn);
|
|
|
|
|
|
|
|
console.log('this.tableData_warn', this.tableData_warn);
|
|
|
|
const obj = {
|
|
|
|
const obj = {
|
|
|
|
calculation: [],
|
|
|
|
calculation: [],
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -371,7 +376,6 @@ export default {
|
|
|
|
.then((res) => {
|
|
|
|
.then((res) => {
|
|
|
|
console.log(res);
|
|
|
|
console.log(res);
|
|
|
|
this.$message.success("保存成功");
|
|
|
|
this.$message.success("保存成功");
|
|
|
|
this.input_warnning = "1";
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
.catch((err) => {
|
|
|
|
console.log(err);
|
|
|
|
console.log(err);
|
|
|
|