Merge pull request 'lukeyan' (#45) from lukeyan into master

Reviewed-on: #45
pull/46/head^2
lukeyan 1 year ago
commit fdfa7424f1

@ -16,6 +16,14 @@ export function saveSafeCalculation(data) {
data
})
}
// 未有数据时修改综合指数
export function saveSafeCalculationTwo(data) {
return request({
url: '/safety/system/tbSafeCalculationRule',
method: 'post',
data
})
}
// 指标表格数据
export function getIndexTable(params) {
return request({

@ -231,7 +231,7 @@
</td>
</tr>
<tr class="table_body">
<td @click="click_threelevel('93', '1')">企业技防设施连入平台情况</td>
<td @click="click_threelevel('93', '2')">企业技防设施连入平台情况</td>
</tr>
<tr class="table_body">
<td rowspan="3" @click="click_twolevel('94')">
@ -251,7 +251,7 @@
</tr>
<tr class="table_body">
<td @click="click_threelevel('100', '2')">
部门检查不合格及有缺的要求企业整改
部门检查不合格及有缺的要求企业整改
</td>
</tr>
<tr class="table_body">
@ -468,6 +468,17 @@ export default {
},
//
click_onelevel(id) {
let obj = document.querySelectorAll("td");
let index = 0;
if (id < 6) {
index = id - 3;
} else {
index = id - 4;
}
obj.forEach((item) => {
item.className = "";
});
obj[index].className = "lightcolor";
const massage = {
safeRuleId: id,
level: "1",
@ -477,6 +488,17 @@ export default {
},
//
click_twolevel(id) {
let obj = document.querySelectorAll("td");
let index = 0;
if (id < 6) {
index = id - 3;
} else {
index = id - 4;
}
obj.forEach((item) => {
item.className = "";
});
obj[index].className = "lightcolor";
const massage = {
safeRuleId: id,
level: "2",
@ -491,6 +513,18 @@ export default {
level: "3",
table_num: num,
};
let obj = document.querySelectorAll("td");
console.log("obj", obj);
let index = 0;
if (id < 6) {
index = id - 3;
} else {
index = id - 4;
}
obj.forEach((item) => {
item.className = "";
});
obj[index].className = "lightcolor";
this.$emit("back", massage);
bus.$emit("send_three", massage); //
},
@ -599,4 +633,8 @@ table {
}
}
}
.lightcolor {
background: #3c4b4a;
color: #54ffbe;
}
</style>

@ -17,7 +17,6 @@
</div>
<el-table
v-if="is_flag"
max-height="310"
:header-cell-style="table_header"
:data="tableData_all"
:cell-style="{ background: 'revert', 'text-align': 'center' }"
@ -27,13 +26,13 @@
<div class="table_cell">
<el-input
class="table_input"
type="number"
@blur="limit($event)"
v-model="scope.row.scoreLowerLimit"
></el-input>
<div class="input_text">~</div>
<el-input
class="table_input"
type="number"
@blur="limit($event)"
v-model="scope.row.scoreUpperLimit"
></el-input>
</div>
@ -156,9 +155,10 @@ import {
safeCalculation,
getIndexTable,
saveSafeCalculation,
saveSafeCalculationTwo,
getWarnTable,
saveWarnTable,
deleteWarn
deleteWarn,
} from "@/api/systemManagement/safeIndex";
export default {
name: "indexmassageThree",
@ -180,6 +180,8 @@ export default {
color: "", //
sortValue: "",
add_warn_disabled: false, //
save_flag: "",
person_flag: true,
};
},
created() {
@ -201,20 +203,48 @@ export default {
safeCalculation({ safeRuleId: this.three_level_id, levelIndex: 3 }).then(
(res) => {
console.log("3res", res);
this.tableData_all = []; //
this.tableData_warn = [];
// if
if (this.table_num === "1") {
this.is_flag = true;
if (res.data.calculationRule === null) {
this.tableData_all = [];
this.save_flag = "1"; //
} else {
this.tableData_all = JSON.parse(
res.data.calculationRule
).calculation;
this.save_flag = "2"; //
}
} else if (this.table_num === "2") {
//
this.is_flag = false;
}
this.tableData_all = []; //
this.tableData_warn = [];
if (res.data.calculationRule === null) {
this.tableData_all = [];
} else {
this.tableData_all = JSON.parse(
res.data.calculationRule
).calculation;
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);
this.safeRuleId = res.data.safeRuleId; // safeRuleIdsafeRuleIdsafeRuleId
@ -310,8 +340,8 @@ export default {
if (this.tableData_warn.length === index + 1) {
//
this.tableData_warn.splice(index, 1);
const params = `idList=${row.id}`
deleteWarn(params)
const params = `idList=${row.id}`;
deleteWarn(params);
if (this.tableData_warn.length < 4) {
this.add_warn_disabled = false; // 4
}
@ -321,31 +351,61 @@ export default {
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() {
console.log("this.tableData_all", this.tableData_all);
const obj = {
calculation: [],
};
obj.calculation = this.tableData_all.map((item) => ({
scoreLowerLimit: item.scoreLowerLimit,
scoreUpperLimit: item.scoreUpperLimit,
score: item.score,
}));
const params = {
calculationRule: JSON.stringify(obj),
id: this.id,
safeRuleId: this.safeRuleId,
};
console.log("params123", params);
saveSafeCalculation(params)
.then((res) => {
console.log("ressave", res);
this.$message.success("保存成功");
})
.catch((err) => {
console.log("errsave", err);
this.$message.warning("保存失败");
});
// 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 = {
calculation: [],
};
obj.calculation = this.tableData_all.map((item) => ({
scoreLowerLimit: item.scoreLowerLimit,
scoreUpperLimit: item.scoreUpperLimit,
score: item.score,
}));
const params = {
calculationRule: JSON.stringify(obj),
id: this.id == -1 ? null : this.id,
safeRuleId: this.safeRuleId,
};
console.log("params123", params);
if (this.save_flag === "2") {
console.log("this.tableData_all2", this.tableData_all);
saveSafeCalculation(params)
.then((res) => {
console.log("ressave", res);
this.$message.success("保存成功");
})
.catch((err) => {
console.log("errsave", err);
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() {
@ -355,7 +415,7 @@ export default {
this.$message.warning("请填入预警等级");
} else {
console.log("input_warn", input_warn);
console.log('this.tableData_warn', this.tableData_warn);
console.log("this.tableData_warn", this.tableData_warn);
const obj = {
calculation: [],
};

Loading…
Cancel
Save