bug修复 #43

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

@ -1,28 +1,69 @@
<template>
<div>
<el-table class="company_table">
<el-table-column prop="date" label="企业名称" width="300">
<el-table
: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 prop="date" label="平安指数" width="160">
<el-table-column prop="score" label="平安指数" width="160">
</el-table-column>
<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 prop="city" label="内部治安安全" width="140">
<el-table-column
prop="tbSafeCompanyStatisticsScoreDetails[1].score"
label="内部治安安全"
width="140"
>
</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 prop="zip" label="消防安全" width="140">
<el-table-column
prop="tbSafeCompanyStatisticsScoreDetails[3].score"
label="消防安全"
width="140"
>
</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 prop="zip" label="网络安全" width="140">
<el-table-column
prop="tbSafeCompanyStatisticsScoreDetails[5].score"
label="网络安全"
width="140"
>
</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 prop="zip" label="列管物品安全" width="140">
<el-table-column
prop="tbSafeCompanyStatisticsScoreDetails[7].score"
label="列管物品安全"
width="140"
>
</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 prop="zip" label="操作"> </el-table-column>
@ -31,13 +72,52 @@
</template>
<script>
export default {
props: {
table_data: {
type: Array,
default: () => [],
},
},
data() {
return {};
},
methods: {
//
table_header({ row, rowIndex }) {
console.log(row);
console.log(rowIndex);
return {
"text-align": "center", //
color: "#fff",
"border": "0.1px solid #425969",
};
},
},
};
</script>
<style lang="less" scoped>
.company_table {
/deep/.company_table.el-table {
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>

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

@ -141,10 +141,14 @@ export default {
//
for (let i = 0; i < rate_arr.length; i++) {
console.log(rate_arr[i]);
console.log("Number(rate_arr[i])", Number(rate_arr[i]));
this.all_data += Number(rate_arr[i]);
console.log("String(rate_arr[i])", String(rate_arr[i]).indexOf("."));
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");
} else {
console.log("this.all_data", this.all_data);
@ -171,9 +175,11 @@ export default {
console.log(res);
// this.btn_loading = false;
this.btn_flag = true;
this.$message.success('保存成功')
})
.catch((err) => {
console.log(err);
this.$message.warning('保存失败')
});
}
},

@ -124,9 +124,13 @@ export default {
for (let i = 0; i < rate_arr.length; i++) {
console.log(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");
} else {
console.log("this.all_data", this.all_data);
@ -153,9 +157,11 @@ export default {
console.log(res);
// this.btn_loading = false;
this.btn_flag = true;
this.$message.success('保存成功')
})
.catch((err) => {
console.log(err);
this.$message.warning('保存失败')
});
}
},

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

Loading…
Cancel
Save