|
|
@ -17,7 +17,6 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<el-table
|
|
|
|
<el-table
|
|
|
|
v-if="is_flag"
|
|
|
|
v-if="is_flag"
|
|
|
|
max-height="310"
|
|
|
|
|
|
|
|
:header-cell-style="table_header"
|
|
|
|
:header-cell-style="table_header"
|
|
|
|
:data="tableData_all"
|
|
|
|
:data="tableData_all"
|
|
|
|
:cell-style="{ background: 'revert', 'text-align': 'center' }"
|
|
|
|
:cell-style="{ background: 'revert', 'text-align': 'center' }"
|
|
|
@ -27,13 +26,13 @@
|
|
|
|
<div class="table_cell">
|
|
|
|
<div class="table_cell">
|
|
|
|
<el-input
|
|
|
|
<el-input
|
|
|
|
class="table_input"
|
|
|
|
class="table_input"
|
|
|
|
type="number"
|
|
|
|
@blur="limit($event)"
|
|
|
|
v-model="scope.row.scoreLowerLimit"
|
|
|
|
v-model="scope.row.scoreLowerLimit"
|
|
|
|
></el-input>
|
|
|
|
></el-input>
|
|
|
|
<div class="input_text">~</div>
|
|
|
|
<div class="input_text">~</div>
|
|
|
|
<el-input
|
|
|
|
<el-input
|
|
|
|
class="table_input"
|
|
|
|
class="table_input"
|
|
|
|
type="number"
|
|
|
|
@blur="limit($event)"
|
|
|
|
v-model="scope.row.scoreUpperLimit"
|
|
|
|
v-model="scope.row.scoreUpperLimit"
|
|
|
|
></el-input>
|
|
|
|
></el-input>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -156,9 +155,10 @@ import {
|
|
|
|
safeCalculation,
|
|
|
|
safeCalculation,
|
|
|
|
getIndexTable,
|
|
|
|
getIndexTable,
|
|
|
|
saveSafeCalculation,
|
|
|
|
saveSafeCalculation,
|
|
|
|
|
|
|
|
saveSafeCalculationTwo,
|
|
|
|
getWarnTable,
|
|
|
|
getWarnTable,
|
|
|
|
saveWarnTable,
|
|
|
|
saveWarnTable,
|
|
|
|
deleteWarn
|
|
|
|
deleteWarn,
|
|
|
|
} from "@/api/systemManagement/safeIndex";
|
|
|
|
} from "@/api/systemManagement/safeIndex";
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
name: "indexmassageThree",
|
|
|
|
name: "indexmassageThree",
|
|
|
@ -180,6 +180,8 @@ export default {
|
|
|
|
color: "", // 预警新增的颜色
|
|
|
|
color: "", // 预警新增的颜色
|
|
|
|
sortValue: "",
|
|
|
|
sortValue: "",
|
|
|
|
add_warn_disabled: false, // 预警新增是否禁用,如果四条时则不可再新增
|
|
|
|
add_warn_disabled: false, // 预警新增是否禁用,如果四条时则不可再新增
|
|
|
|
|
|
|
|
save_flag: "",
|
|
|
|
|
|
|
|
person_flag: true,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
created() {
|
|
|
@ -201,20 +203,48 @@ export default {
|
|
|
|
safeCalculation({ safeRuleId: this.three_level_id, levelIndex: 3 }).then(
|
|
|
|
safeCalculation({ safeRuleId: this.three_level_id, levelIndex: 3 }).then(
|
|
|
|
(res) => {
|
|
|
|
(res) => {
|
|
|
|
console.log("3res", res);
|
|
|
|
console.log("3res", res);
|
|
|
|
|
|
|
|
this.tableData_all = []; // 清空表格内容
|
|
|
|
|
|
|
|
this.tableData_warn = [];
|
|
|
|
// if 在这里从请求回的数据里拿回关键字段判别两种表格中的一种
|
|
|
|
// if 在这里从请求回的数据里拿回关键字段判别两种表格中的一种
|
|
|
|
if (this.table_num === "1") {
|
|
|
|
if (this.table_num === "1") {
|
|
|
|
this.is_flag = true;
|
|
|
|
this.is_flag = true;
|
|
|
|
} else if (this.table_num === "2") {
|
|
|
|
|
|
|
|
this.is_flag = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.tableData_all = []; // 清空表格内容
|
|
|
|
|
|
|
|
this.tableData_warn = [];
|
|
|
|
|
|
|
|
if (res.data.calculationRule === null) {
|
|
|
|
if (res.data.calculationRule === null) {
|
|
|
|
this.tableData_all = [];
|
|
|
|
this.tableData_all = [];
|
|
|
|
|
|
|
|
this.save_flag = "1"; // 后台未传数据,通知待保存选择接口
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.tableData_all = JSON.parse(
|
|
|
|
this.tableData_all = JSON.parse(
|
|
|
|
res.data.calculationRule
|
|
|
|
res.data.calculationRule
|
|
|
|
).calculation;
|
|
|
|
).calculation;
|
|
|
|
|
|
|
|
this.save_flag = "2"; // 后台传数据,通知待保存选择接口
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (this.table_num === "2") {
|
|
|
|
|
|
|
|
// 是否的表格
|
|
|
|
|
|
|
|
this.is_flag = false;
|
|
|
|
|
|
|
|
if (res.data.calculationRule === null) {
|
|
|
|
|
|
|
|
this.tableData_all = [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
scoreLowerLimit: "是",
|
|
|
|
|
|
|
|
score: "",
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
scoreLowerLimit: "否",
|
|
|
|
|
|
|
|
score: "",
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.tableData_all = [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
scoreLowerLimit: "是",
|
|
|
|
|
|
|
|
score: JSON.parse(res.data.calculationRule).calculation[0]
|
|
|
|
|
|
|
|
.score,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
scoreLowerLimit: "否",
|
|
|
|
|
|
|
|
score: JSON.parse(res.data.calculationRule).calculation[1]
|
|
|
|
|
|
|
|
.score,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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混淆
|
|
|
@ -310,8 +340,8 @@ 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);
|
|
|
|
const params = `idList=${row.id}`
|
|
|
|
const params = `idList=${row.id}`;
|
|
|
|
deleteWarn(params)
|
|
|
|
deleteWarn(params);
|
|
|
|
if (this.tableData_warn.length < 4) {
|
|
|
|
if (this.tableData_warn.length < 4) {
|
|
|
|
this.add_warn_disabled = false; // 当预警数据不为4条时,接触新增禁用
|
|
|
|
this.add_warn_disabled = false; // 当预警数据不为4条时,接触新增禁用
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -321,8 +351,21 @@ export default {
|
|
|
|
console.log("roww", row);
|
|
|
|
console.log("roww", row);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
limit(e) {
|
|
|
|
|
|
|
|
console.log("e", e.target.value);
|
|
|
|
|
|
|
|
let reg = /^(0|[1-9][0-9]*)$/;
|
|
|
|
|
|
|
|
if (!reg.test(e.target.value)) {
|
|
|
|
|
|
|
|
this.person_flag = false;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.person_flag = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
save_data() {
|
|
|
|
save_data() {
|
|
|
|
console.log("this.tableData_all", this.tableData_all);
|
|
|
|
// const lower_input = this.tableData_all.map((item) => item.scoreLowerLimit);
|
|
|
|
|
|
|
|
// const upper_input = this.tableData_all.map((item) => item.scoreUpperLimit);
|
|
|
|
|
|
|
|
// ( /^\d+(?=\.{0,1}\d+$|$)/.test())
|
|
|
|
|
|
|
|
console.log("this.person_flag", this.person_flag);
|
|
|
|
|
|
|
|
if (this.person_flag) {
|
|
|
|
const obj = {
|
|
|
|
const obj = {
|
|
|
|
calculation: [],
|
|
|
|
calculation: [],
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -333,10 +376,12 @@ export default {
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
const params = {
|
|
|
|
const params = {
|
|
|
|
calculationRule: JSON.stringify(obj),
|
|
|
|
calculationRule: JSON.stringify(obj),
|
|
|
|
id: this.id,
|
|
|
|
id: this.id == -1 ? null : this.id,
|
|
|
|
safeRuleId: this.safeRuleId,
|
|
|
|
safeRuleId: this.safeRuleId,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
console.log("params123", params);
|
|
|
|
console.log("params123", params);
|
|
|
|
|
|
|
|
if (this.save_flag === "2") {
|
|
|
|
|
|
|
|
console.log("this.tableData_all2", this.tableData_all);
|
|
|
|
saveSafeCalculation(params)
|
|
|
|
saveSafeCalculation(params)
|
|
|
|
.then((res) => {
|
|
|
|
.then((res) => {
|
|
|
|
console.log("ressave", res);
|
|
|
|
console.log("ressave", res);
|
|
|
@ -346,6 +391,21 @@ export default {
|
|
|
|
console.log("errsave", err);
|
|
|
|
console.log("errsave", err);
|
|
|
|
this.$message.warning("保存失败");
|
|
|
|
this.$message.warning("保存失败");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
} else if (this.save_flag === "1") {
|
|
|
|
|
|
|
|
console.log("this.tableData_all1", this.tableData_all);
|
|
|
|
|
|
|
|
saveSafeCalculationTwo(params)
|
|
|
|
|
|
|
|
.then((res) => {
|
|
|
|
|
|
|
|
console.log("ressave", res);
|
|
|
|
|
|
|
|
this.$message.success("保存成功");
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
|
|
|
console.log("errsave", err);
|
|
|
|
|
|
|
|
this.$message.warning("保存失败");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.$message.warning("分级人数为大于等于0的整数");
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 保存预警数据
|
|
|
|
// 保存预警数据
|
|
|
|
save_data_warn() {
|
|
|
|
save_data_warn() {
|
|
|
@ -355,7 +415,7 @@ export default {
|
|
|
|
this.$message.warning("请填入预警等级");
|
|
|
|
this.$message.warning("请填入预警等级");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
console.log("input_warn", input_warn);
|
|
|
|
console.log("input_warn", input_warn);
|
|
|
|
console.log('this.tableData_warn', this.tableData_warn);
|
|
|
|
console.log("this.tableData_warn", this.tableData_warn);
|
|
|
|
const obj = {
|
|
|
|
const obj = {
|
|
|
|
calculation: [],
|
|
|
|
calculation: [],
|
|
|
|
};
|
|
|
|
};
|
|
|
|