bug修复 #43

Merged
lukeyan merged 1 commits from lukeyan into master 1 year ago

@ -1,28 +1,69 @@
<template> <template>
<div> <div>
<el-table class="company_table"> <el-table
<el-table-column prop="date" label="企业名称" width="300"> :data="table_data"
class="company_table"
:header-cell-style="table_header"
:cell-style="{ background: 'revert', 'text-align': 'center' }"
>
<el-table-column prop="companyName" label="企业名称" width="300">
</el-table-column> </el-table-column>
<el-table-column prop="date" label="平安指数" width="160"> <el-table-column prop="score" label="平安指数" width="160">
</el-table-column> </el-table-column>
<el-table-column label="指标得分"> <el-table-column label="指标得分">
<el-table-column prop="province" label="防疫安全" width="140"> <el-table-column
prop="tbSafeCompanyStatisticsScoreDetails[0].score"
label="防疫安全"
width="140"
>
</el-table-column> </el-table-column>
<el-table-column prop="city" label="内部治安安全" width="140"> <el-table-column
prop="tbSafeCompanyStatisticsScoreDetails[1].score"
label="内部治安安全"
width="140"
>
</el-table-column> </el-table-column>
<el-table-column prop="address" label="危化品运输安全" width="140"> <el-table-column
prop="tbSafeCompanyStatisticsScoreDetails[2].score"
label="危化品运输安全"
width="140"
>
</el-table-column> </el-table-column>
<el-table-column prop="zip" label="消防安全" width="140"> <el-table-column
prop="tbSafeCompanyStatisticsScoreDetails[3].score"
label="消防安全"
width="140"
>
</el-table-column> </el-table-column>
<el-table-column prop="zip" label="人员安全" width="140"> <el-table-column
prop="tbSafeCompanyStatisticsScoreDetails[4].score"
label="人员安全"
width="140"
>
</el-table-column> </el-table-column>
<el-table-column prop="zip" label="网络安全" width="140"> <el-table-column
prop="tbSafeCompanyStatisticsScoreDetails[5].score"
label="网络安全"
width="140"
>
</el-table-column> </el-table-column>
<el-table-column prop="zip" label="道路安全" width="140"> <el-table-column
prop="tbSafeCompanyStatisticsScoreDetails[6].score"
label="道路安全"
width="140"
>
</el-table-column> </el-table-column>
<el-table-column prop="zip" label="列管物品安全" width="140"> <el-table-column
prop="tbSafeCompanyStatisticsScoreDetails[7].score"
label="列管物品安全"
width="140"
>
</el-table-column> </el-table-column>
<el-table-column prop="zip" label="防攻击安全" width="140"> <el-table-column
prop="tbSafeCompanyStatisticsScoreDetails[8].score"
label="防攻击安全"
width="140"
>
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column prop="zip" label="操作"> </el-table-column> <el-table-column prop="zip" label="操作"> </el-table-column>
@ -31,13 +72,52 @@
</template> </template>
<script> <script>
export default { export default {
props: {
table_data: {
type: Array,
default: () => [],
},
},
data() { data() {
return {}; return {};
}, },
methods: {
//
table_header({ row, rowIndex }) {
console.log(row);
console.log(rowIndex);
return {
"text-align": "center", //
color: "#fff",
"border": "0.1px solid #425969",
};
},
},
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.company_table { /deep/.company_table.el-table {
width: 85.2vw; width: 85.2vw;
height: 65vh;
background: rgba(0,0,0,0);
border: 0.1px solid #425969;
thead {
color: #fff;
font-weight: 500;
border: 0.1px solid #425969;
background: linear-gradient(to right, #284f49, #2f6363, #233b38) !important;
& th {
background-color: transparent;
}
& tr {
background-color: transparent;
}
}
tr {
color: #fff;
background: #1C2A2C;
}
} }
</style> </style>

@ -56,20 +56,23 @@
</div> </div>
</div> </div>
<div class="table_body"> <div class="table_body">
<CompanyTable ref="companyTable"></CompanyTable> <CompanyTable
ref="companyTable"
:table_data="table_data"
></CompanyTable>
</div> </div>
</div> </div>
</el-card> </el-card>
</template> </template>
<script> <script>
import Season from "./components/season"; import Season from "./components/season";
import CompanyTable from "./components/companyTable" import CompanyTable from "./components/companyTable";
import { getSafeCompany } from "@/api/systemManagement/companyScore"; import { getSafeCompany } from "@/api/systemManagement/companyScore";
export default { export default {
name: "CompanyScore", name: "CompanyScore",
components: { components: {
Season, Season,
CompanyTable CompanyTable,
}, },
data() { data() {
return { return {
@ -78,8 +81,8 @@ export default {
date_state: "", date_state: "",
month_date: "", month_date: "",
season_date: "", // season_date: "", //
statistics_date: "", //
year_date: "", year_date: "",
statistics_date: "", //
search_company: "", search_company: "",
day_list: [ day_list: [
{ {
@ -95,6 +98,7 @@ export default {
label: "年度", label: "年度",
}, },
], ],
table_data: [],
}; };
}, },
created() {}, created() {},
@ -131,15 +135,18 @@ export default {
scoreType: this.date_state, scoreType: this.date_state,
statisticsDate: this.statistics_date, statisticsDate: this.statistics_date,
companyParamName: this.search_company, companyParamName: this.search_company,
levelIndex:'1' levelIndex: "1",
}; };
getSafeCompany(params).then((res) => { getSafeCompany(params)
console.log("res", res); .then((res) => {
this.$message.success('企业查询成功') console.log("res", res);
}).catch(err=>{ this.table_data = res.rows;
console.log(err); this.$message.success("企业查询成功");
this.$message.warning('企业查询失败') })
}) .catch((err) => {
console.log(err);
this.$message.warning("企业查询失败");
});
}, },
}, },
}; };
@ -194,7 +201,7 @@ export default {
width: 85.2vw; width: 85.2vw;
height: 71vh; height: 71vh;
margin-top: 3vh; margin-top: 3vh;
border: 0.1px solid #4d8f89; // border: 0.1px solid #4d8f89;
} }
/deep/.el-input--suffix .el-input__inner { /deep/.el-input--suffix .el-input__inner {
color: #fff; color: #fff;

@ -141,10 +141,14 @@ export default {
// //
for (let i = 0; i < rate_arr.length; i++) { for (let i = 0; i < rate_arr.length; i++) {
console.log(rate_arr[i]); console.log(rate_arr[i]);
console.log("Number(rate_arr[i])", Number(rate_arr[i])); console.log("String(rate_arr[i])", String(rate_arr[i]).indexOf("."));
this.all_data += Number(rate_arr[i]); if (String(rate_arr[i]).indexOf(".") <= 1) {
console.log("Number(rate_arr[i])", Number(rate_arr[i]));
this.all_data += Number(rate_arr[i]);
// console.log('this.all_data.toFixed(2)',this.all_data.toFixed(2));
}
} }
if (isNaN(this.all_data) || this.all_data != 1) { if (isNaN(this.all_data) || this.all_data.toFixed(2) != 1) {
this.$message.warning("保存失败,各指标占比应大于等于0且总和应等于1"); this.$message.warning("保存失败,各指标占比应大于等于0且总和应等于1");
} else { } else {
console.log("this.all_data", this.all_data); console.log("this.all_data", this.all_data);
@ -171,9 +175,11 @@ export default {
console.log(res); console.log(res);
// this.btn_loading = false; // this.btn_loading = false;
this.btn_flag = true; this.btn_flag = true;
this.$message.success('保存成功')
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);
this.$message.warning('保存失败')
}); });
} }
}, },

@ -124,9 +124,13 @@ export default {
for (let i = 0; i < rate_arr.length; i++) { for (let i = 0; i < rate_arr.length; i++) {
console.log(rate_arr[i]); console.log(rate_arr[i]);
console.log("Number(rate_arr[i])", Number(rate_arr[i])); console.log("Number(rate_arr[i])", Number(rate_arr[i]));
this.all_data += Number(rate_arr[i]); if (String(rate_arr[i]).indexOf(".") <= 1) {
console.log("Number(rate_arr[i])", Number(rate_arr[i]));
this.all_data += Number(rate_arr[i]);
// console.log('this.all_data.toFixed(2)',this.all_data.toFixed(2));
}
} }
if (isNaN(this.all_data) || this.all_data != 1) { if (isNaN(this.all_data) || this.all_data.toFixed(2) != 1) {
this.$message.warning("保存失败,各指标占比应大于等于0且总和应等于1"); this.$message.warning("保存失败,各指标占比应大于等于0且总和应等于1");
} else { } else {
console.log("this.all_data", this.all_data); console.log("this.all_data", this.all_data);
@ -153,9 +157,11 @@ export default {
console.log(res); console.log(res);
// this.btn_loading = false; // this.btn_loading = false;
this.btn_flag = true; this.btn_flag = true;
this.$message.success('保存成功')
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);
this.$message.warning('保存失败')
}); });
} }
}, },

@ -153,9 +153,18 @@
</div> </div>
<div class="index_massage"> <div class="index_massage">
<div class="table_title"></div> <div class="table_title"></div>
<IndexmassageOne v-show="this.level ==='1'" ref="indexmassageOne"></IndexmassageOne> <IndexmassageOne
<IndexmassageTwo v-show="this.level === '2'" ref="indexmassageTwo"></IndexmassageTwo> v-show="this.level === '1'"
<IndexmassageThree v-show="this.level === '3'" ref="indexmassageThree"></IndexmassageThree> ref="indexmassageOne"
></IndexmassageOne>
<IndexmassageTwo
v-show="this.level === '2'"
ref="indexmassageTwo"
></IndexmassageTwo>
<IndexmassageThree
v-show="this.level === '3'"
ref="indexmassageThree"
></IndexmassageThree>
</div> </div>
</div> </div>
</div> </div>
@ -176,7 +185,7 @@ export default {
IndexTable, IndexTable,
IndexmassageOne, IndexmassageOne,
IndexmassageTwo, IndexmassageTwo,
IndexmassageThree IndexmassageThree,
}, },
data() { data() {
return { return {
@ -196,6 +205,7 @@ export default {
rate_eight: "", rate_eight: "",
rate_nine: "", rate_nine: "",
}, // }, //
all_data: "",
disabled: true, disabled: true,
}; };
}, },
@ -211,29 +221,28 @@ export default {
save_form() { save_form() {
// //
this.btn_loading = true; this.btn_loading = true;
const all_data = this.all_data = 0; //
Number(this.form.rate_one) + const num_arr = [
Number(this.form.rate_two) + this.form.rate_one,
Number(this.form.rate_three) + this.form.rate_two,
Number(this.form.rate_four) + this.form.rate_three,
Number(this.form.rate_five) + this.form.rate_four,
Number(this.form.rate_six) + this.form.rate_five,
Number(this.form.rate_seven) + this.form.rate_six,
Number(this.form.rate_eight) + this.form.rate_seven,
Number(this.form.rate_nine); this.form.rate_eight,
console.log("all_data", all_data); this.form.rate_nine,
if ( ];
Number(this.form.rate_one) > 0 && console.log("num_arr", num_arr);
Number(this.form.rate_two) > 0 && for (let i = 0; i < num_arr.length; i++) {
Number(this.form.rate_three) > 0 && if (String(num_arr[i]).indexOf(".") <= 1) {
Number(this.form.rate_four) > 0 && this.all_data += Number(num_arr[i]);
Number(this.form.rate_five) > 0 && }
Number(this.form.rate_six) > 0 && }
Number(this.form.rate_seven) > 0 && if (isNaN(this.all_data) || this.all_data.toFixed(2) != 1) {
Number(this.form.rate_eight) > 0 && this.$message.warning("保存失败,各指标占比应大于等于0且总和应等于1");
Number(this.form.rate_nine) > 0 && this.btn_loading = false;
all_data === 1 } else {
) {
const obj = { const obj = {
calculation: [ calculation: [
{ indexName: "内部治安管理", rate: this.form.rate_one, sort: "1" }, { indexName: "内部治安管理", rate: this.form.rate_one, sort: "1" },
@ -271,13 +280,14 @@ export default {
console.log(res); console.log(res);
this.btn_loading = false; this.btn_loading = false;
this.btn_flag = true; this.btn_flag = true;
this.$message.success("保存成功");
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);
this.btn_loading = false;
this.btn_flag = true;
this.$message.warning("保存失败");
}); });
} else {
this.$message.warning("保存失败,各指标占比应大于等于0且总和应等于1");
this.btn_loading = false;
} }
}, },
// text_form // text_form
@ -305,7 +315,7 @@ export default {
}); });
}, },
back(back) { back(back) {
this.level = back.level this.level = back.level;
}, },
}, },
}; };

Loading…
Cancel
Save