企业赋名

pull/40/head
lukeyan 1 year ago
parent 2a4eabc676
commit e4e380cb91

@ -0,0 +1,10 @@
// 企业赋分模块接口
import request from '@/utils/request'
// 请求企业赋分表格主页
export function getSafeCompany(params) {
return request({
url: '/safety/system/tbSafeCompanyStatisticsScore/getSafeCompanyStatisticsScore',
method: 'post',
params
})
}

@ -0,0 +1,43 @@
<template>
<div>
<el-table class="company_table">
<el-table-column prop="date" label="企业名称" width="300">
</el-table-column>
<el-table-column prop="date" label="平安指数" width="160">
</el-table-column>
<el-table-column label="指标得分">
<el-table-column prop="province" label="防疫安全" width="140">
</el-table-column>
<el-table-column prop="city" label="内部治安安全" width="140">
</el-table-column>
<el-table-column prop="address" label="危化品运输安全" width="140">
</el-table-column>
<el-table-column prop="zip" label="消防安全" width="140">
</el-table-column>
<el-table-column prop="zip" label="人员安全" width="140">
</el-table-column>
<el-table-column prop="zip" label="网络安全" width="140">
</el-table-column>
<el-table-column prop="zip" label="道路安全" width="140">
</el-table-column>
<el-table-column prop="zip" label="列管物品安全" width="140">
</el-table-column>
<el-table-column prop="zip" label="防攻击安全" width="140">
</el-table-column>
</el-table-column>
<el-table-column prop="zip" label="操作"> </el-table-column>
</el-table>
</div>
</template>
<script>
export default {
data() {
return {};
},
};
</script>
<style lang="less" scoped>
.company_table {
width: 85.2vw;
}
</style>

@ -0,0 +1,209 @@
<template>
<div>
<!--背景-点击可关闭卡片-->
<mark
class="bgCard"
v-if="showSeason"
@click.stop="showSeason = false"
></mark>
<el-input
placeholder="请选择季度"
v-model="showValue"
@focus="showSeason = true"
>
<i slot="prefix" class="el-input__icon el-icon-date"></i>
</el-input>
<el-card
class="box-card"
style="
width: 322px;
padding: 0 3px 20px;
margin-top: 10px;
position: fixed;
z-index: 9999;
"
v-if="showSeason"
>
<div
slot="header"
class="clearfix"
style="text-align: center; padding: 0"
>
<button
type="button"
aria-label="前一年"
class="el-picker-panel__icon-btn el-date-picker__prev-btn el-icon-d-arrow-left"
@click="prev"
></button>
<span role="button" class="el-date-picker__header-label"
>{{ year }}</span
>
<button
type="button"
aria-label="后一年"
@click="next"
class="el-picker-panel__icon-btn el-date-picker__next-btn el-icon-d-arrow-right"
></button>
</div>
<div class="text item" style="text-align: center">
<el-button
type="text"
size="medium"
style="width: 40%; color: #606266; float: left"
@click="selectSeason(1)"
>第一季度</el-button
>
<el-button
type="text"
size="medium"
style="float: right; width: 40%; color: #606266"
@click="selectSeason(2)"
>第二季度</el-button
>
</div>
<div class="text item" style="text-align: center">
<el-button
type="text"
size="medium"
style="width: 40%; color: #606266; float: left"
@click="selectSeason(3)"
>第三季度</el-button
>
<el-button
type="text"
size="medium"
style="float: right; width: 40%; color: #606266"
@click="selectSeason(4)"
>第四季度</el-button
>
</div>
</el-card>
</div>
</template>
<script>
/**
* @file: View 组件 季节选择控件
* @date: 2021-03-22
* @description: UI组件 可选择季节
*/
export default {
props: {
/**
* @默认赋值
* date类型默认值传的是时间 2021-03-22
* quarter 类型是季度 2021-01
* */
defaultValue: {
type: String,
default: "",
},
/**
* @默认赋值类型
* date类型默认值传的是时间 2021-03-22
* quarter 类型是季度 2021-01
* */
defaultType: {
type: String,
default: "date",
},
},
data() {
return {
showSeason: false,
year: new Date().getFullYear(), //
month: new Date().getMonth() + 1, //
showValue: "", //input
season_num:'',
};
},
created() {
//
if (this.defaultValue) {
this.changeDefaultVal();
} else {
this.defaultValue = this.year + "-" + this.month;
this.changeDefaultVal();
}
},
watch: {
defaultValue(value) {
console.log("value", value);
this.changeDefaultVal();
},
},
methods: {
/**
* 处理默认值
* @params value == 默认值
* @return 页面input内容回填默认值
* */
changeDefaultVal() {
let arr = this.defaultValue.split("-");
this.year = arr[0];
let quarter = ""; //
if (this.defaultType === "quarter") {
quarter = arr[1];
this.showValue = `${this.year}${quarter}季度`;
} else if (this.defaultType === "date") {
let month = +arr[1];
if (month >= 1 && month <= 3) {
this.showValue = `${this.year}年1季度`;
} else if (month >= 4 && month <= 6) {
this.showValue = `${this.year}年2季度`;
} else if (month >= 7 && month <= 9) {
this.showValue = `${this.year}年3季度`;
} else if (month >= 10 && month <= 12) {
this.showValue = `${this.year}年4季度`;
}
}
},
prev() {
this.year = +this.year - 1;
},
next() {
this.year = +this.year + 1;
},
selectSeason(quarter) {
if(quarter === 1) {
this.season_num = '03'
} else if(quarter === 2) {
this.season_num = '06'
} else if(quarter === 3) {
this.season_num = '09'
} else if(quarter === 4) {
this.season_num = '12'
}
let result = {
date: `${this.year}-${this.season_num}`,
year: this.year,
quarter: quarter,
};
//
this.$emit("getValue", result);
this.showSeason = false;
this.showValue = `${this.year}${quarter}季度`;
},
},
};
</script>
<style lang="less" scoped>
.bgCard {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0);
z-index: 999;
}
/deep/.el-input__inner {
background: rgba(0, 0, 0, 0);
border-radius: 0px;
color: #fff;
width: 10vw;
height: 4vh;
}
.el-date-picker__header-label {
color: black !important;
}
</style>

@ -0,0 +1,218 @@
<template>
<!-- 企业赋分 -->
<el-card class="box-card">
<div class="topZS"></div>
<div class="bottomZS"></div>
<div slot="header" class="clearfix">
<span>企业赋分</span>
</div>
<div class="cardBody">
<!-- 顶部下拉和搜索 -->
<div class="search_top">
<!-- 顶部下拉和日历 -->
<div class="select_left">
<el-select v-model="search_select" @change="date_select">
<el-option
v-for="item in day_list"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<el-date-picker
v-if="this.search_date === '1'"
v-model="month_date"
type="month"
@change="month_change"
value-format="yyyy-MM"
placeholder="选择月"
>
</el-date-picker>
<Season
v-if="this.search_date === '2'"
ref="season"
@getValue="getValue"
></Season>
<el-date-picker
v-if="this.search_date === '3'"
v-model="year_date"
type="year"
@change="year_change"
value-format="yyyy"
placeholder="选择年"
>
</el-date-picker>
</div>
<!-- 顶部搜索 -->
<div class="search_right">
<el-input
class="search_right_input"
placeholder="输入企业名称"
v-model="search_company"
>
</el-input>
<el-button @click="search" icon="el-icon-search"></el-button>
</div>
</div>
<div class="table_body">
<CompanyTable ref="companyTable"></CompanyTable>
</div>
</div>
</el-card>
</template>
<script>
import Season from "./components/season";
import CompanyTable from "./components/companyTable"
import { getSafeCompany } from "@/api/systemManagement/companyScore";
export default {
name: "CompanyScore",
components: {
Season,
CompanyTable
},
data() {
return {
search_select: "月度", //
search_date: "1", //
date_state: "",
month_date: "",
season_date: "", //
statistics_date: "", //
year_date: "",
search_company: "",
day_list: [
{
value: "month",
label: "月度",
},
{
value: "season",
label: "季度",
},
{
value: "year",
label: "年度",
},
],
};
},
created() {},
methods: {
date_select(val) {
console.log("val", val);
this.date_state = val;
if (val === "month") {
this.search_date = "1";
} else if (val === "season") {
this.search_date = "2";
} else if (val === "year") {
this.search_date = "3";
}
},
month_change(val) {
//
console.log("month", val);
this.statistics_date = val; // statisticsDate
},
getValue(val) {
//
console.log("val123", val);
this.statistics_date = val.date; // statisticsDate
},
year_change(val) {
//
console.log("year", val);
this.statistics_date = val; // statisticsDate
},
search() {
const params = {
scoreType: this.date_state,
statisticsDate: this.statistics_date,
companyParamName: this.search_company,
levelIndex:'1'
};
getSafeCompany(params).then((res) => {
console.log("res", res);
this.$message.success('企业查询成功')
}).catch(err=>{
console.log(err);
this.$message.warning('企业查询失败')
})
},
},
};
</script>
<style lang="less" scoped>
/* card统一样式 */
.el-card.box-card.is-always-shadow {
border: 0px;
height: 89vh; /* 控制card布局高度,用于适配 */
position: relative;
background: url("~@/assets/companyFile/22136.png") no-repeat !important;
background-size: 100% 100% !important;
}
/* card统一样式 */
/deep/.el-card__header {
border-bottom: 1px solid #a1a1a1 !important;
.clearfix {
span {
font-size: 17px;
font-weight: 400;
color: #fff;
text-shadow: 0 0 9px rgba(21, 255, 198, 0.64);
}
}
}
.cardBody {
.search_top {
width: 85.2vw;
height: 4.3vh;
border: 0.1px solid #4d8f89;
display: flex;
justify-content: space-between;
.select_left {
display: flex;
justify-content: space-between;
width: 22vw;
}
.search_right {
display: flex;
.el-button {
font-size: 18px;
border-radius: 0px;
color: #fff;
background: rgba(0, 0, 0, 0);
}
.el-button:hover {
background: #4d8f89;
}
}
}
.table_body {
width: 85.2vw;
height: 71vh;
margin-top: 3vh;
border: 0.1px solid #4d8f89;
}
/deep/.el-input--suffix .el-input__inner {
color: #fff;
border: 0.1px solid #fff;
border-radius: 0px;
background: rgba(0, 0, 0, 0);
width: 10vw;
height: 4vh;
}
/deep/ .search_right_input.el-input {
.el-input__inner {
color: #fff;
border: 0.1px solid #fff;
border-radius: 0px;
background: rgba(0, 0, 0, 0);
width: 10vw;
height: 4vh;
}
}
}
</style>

@ -74,13 +74,12 @@
</el-table-column> </el-table-column>
<el-table-column prop="score" label="分值设置"> <el-table-column prop="score" label="分值设置">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input <el-input
class="table_input" class="table_input"
type="number" type="number"
v-model="scope.row.score" v-model="scope.row.score"
></el-input> ></el-input>
</template> </template> </el-table-column
</el-table-column
></el-table> ></el-table>
<!-- 预警 --> <!-- 预警 -->
<div class="title_btn"> <div class="title_btn">
@ -114,6 +113,7 @@
placeholder="请填入预警等级" placeholder="请填入预警等级"
class="table_input_warn_level" class="table_input_warn_level"
v-model="scope.row.alarmLevel" v-model="scope.row.alarmLevel"
@blur="input_warn_blur($event)"
></el-input> ></el-input>
</div> </div>
</template> </template>
@ -180,6 +180,7 @@ export default {
color: "", // color: "", //
sortValue: "", sortValue: "",
add_warn_disabled: false, // add_warn_disabled: false, //
input_warnning: "1", //
}; };
}, },
created() { created() {
@ -189,6 +190,7 @@ export default {
bus.$on("send_three", (data) => { bus.$on("send_three", (data) => {
console.log("data", data); console.log("data", data);
this.three_level_id = data.safeRuleId; // id this.three_level_id = data.safeRuleId; // id
this.safeRuleId = data.safeRuleId;
this.table_num = data.table_num; // 12 this.table_num = data.table_num; // 12
const new_arr = this.three_level_arr.filter( const new_arr = this.three_level_arr.filter(
(item) => item.id == this.three_level_id (item) => item.id == this.three_level_id
@ -207,7 +209,7 @@ export default {
this.is_flag = false; this.is_flag = false;
} }
this.tableData_all = []; // this.tableData_all = []; //
this.tableData_warn = [] this.tableData_warn = [];
this.tableData_all = JSON.parse(res.data.calculationRule).calculation; this.tableData_all = JSON.parse(res.data.calculationRule).calculation;
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
@ -253,6 +255,14 @@ export default {
color: "#fff", color: "#fff",
}; };
}, },
input_warn_blur(e) {
if (e.target.value === "") {
this.$message.warning("预警等级不能为空");
this.input_warnning = "1";
} else {
this.input_warnning = "0";
}
},
// //
add_data() { add_data() {
this.tableData_all.push({ this.tableData_all.push({
@ -280,6 +290,8 @@ export default {
this.$message.warning("至多四条预警数据"); this.$message.warning("至多四条预警数据");
} }
this.tableData_warn.push({ this.tableData_warn.push({
id: "",
safeRuleId: this.safeRuleId,
alarmLevel: "", alarmLevel: "",
scoreLowerLimit: "0", scoreLowerLimit: "0",
scoreUpperLimit: "0", scoreUpperLimit: "0",
@ -331,33 +343,41 @@ export default {
}) })
.catch((err) => { .catch((err) => {
console.log("errsave", err); console.log("errsave", err);
this.$message.warning('保存失败') this.$message.warning("保存失败");
}); });
}, },
// //
save_data_warn() { save_data_warn() {
const obj = { if (this.input_warnning === "1") {
calculation: [], this.$message.warning("请填入预警等级");
}; } else {
obj.calculation = this.tableData_warn.map((item) => ({ const obj = {
id: item.id, calculation: [],
safeRuleId: item.safeRuleId, };
alarmLevel: item.alarmLevel, obj.calculation = this.tableData_warn.map((item) => ({
scoreUpperLimit: item.scoreUpperLimit, id: item.id,
scoreLowerLimit: item.scoreLowerLimit, safeRuleId: item.safeRuleId,
color: item.color, alarmLevel: item.alarmLevel,
sortValue: item.sortValue, scoreUpperLimit: item.scoreUpperLimit,
})); scoreLowerLimit: item.scoreLowerLimit,
const params = { color: item.color,
alarmRule: JSON.stringify(obj), sortValue: item.sortValue,
}; }));
saveWarnTable(params).then((res) => { const params = {
console.log(res); alarmRule: JSON.stringify(obj),
this.$message.success('保存成功') };
}).catch(err=>{ console.log("params_warn", params);
console.log(err); saveWarnTable(params)
this.$message.warning('保存失败') .then((res) => {
}) console.log(res);
this.$message.success("保存成功");
this.input_warnning = "1";
})
.catch((err) => {
console.log(err);
this.$message.warning("保存失败");
});
}
}, },
// //
styleChange(color) { styleChange(color) {

@ -277,6 +277,7 @@ export default {
}); });
} else { } else {
this.$message.warning("保存失败,各指标占比应大于等于0且总和应等于1"); this.$message.warning("保存失败,各指标占比应大于等于0且总和应等于1");
this.btn_loading = false;
} }
}, },
// text_form // text_form

Loading…
Cancel
Save