lukeyan #45

Merged
lukeyan merged 3 commits from lukeyan into master 2 years ago

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

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

@ -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; // safeRuleIdsafeRuleIdsafeRuleId this.safeRuleId = res.data.safeRuleId; // safeRuleIdsafeRuleIdsafeRuleId
@ -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: [],
}; };

Loading…
Cancel
Save