forked from xxhjsb/hbt-prevention-ui
feat:完成区域固有风险开发
parent
385b163a0e
commit
f1f66ae87e
|
@ -10,6 +10,7 @@ export default new Vuex.Store({
|
|||
userList:[],
|
||||
common_yes_no:[],
|
||||
prevention_dangrous_level:[],
|
||||
prevention_risk_level:[],
|
||||
},
|
||||
getters: {
|
||||
common_yes_no_map:(state)=>{
|
||||
|
@ -21,7 +22,14 @@ export default new Vuex.Store({
|
|||
},
|
||||
prevention_dangrous_level_map:(state)=>{
|
||||
const map = {};
|
||||
state.common_yes_no.forEach((item:any)=>{
|
||||
state.prevention_dangrous_level.forEach((item:any)=>{
|
||||
map[item.value] = item.name
|
||||
})
|
||||
return map
|
||||
},
|
||||
prevention_risk_level_map:(state)=>{
|
||||
const map = {};
|
||||
state.prevention_risk_level.forEach((item:any)=>{
|
||||
map[item.value] = item.name
|
||||
})
|
||||
return map
|
||||
|
@ -43,6 +51,9 @@ export default new Vuex.Store({
|
|||
},
|
||||
set_prevention_dangrous_level(state,data){
|
||||
state.prevention_dangrous_level = data;
|
||||
},
|
||||
set_prevention_risk_level(state,data){
|
||||
state.prevention_risk_level = data;
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
|
|
@ -14,7 +14,8 @@ export default class BlankComponent extends Vue {
|
|||
this.systemService.getDeptList(),
|
||||
this.systemService.getUserList({pageSize:0}),
|
||||
this.systemService.getDictData("common_yes_no"),
|
||||
this.systemService.getDictData("prevention_dangrous_level")
|
||||
this.systemService.getDictData("prevention_dangrous_level"),
|
||||
this.systemService.getDictData("prevention_risk_level")
|
||||
]).then(((results:any)=>{
|
||||
this.$store.commit("setDeptTreeList",results[0].data);
|
||||
|
||||
|
@ -43,6 +44,12 @@ export default class BlankComponent extends Vue {
|
|||
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue
|
||||
}
|
||||
}))
|
||||
this.$store.commit("set_prevention_risk_level",results[5].data.map(item=>{
|
||||
return {
|
||||
name:item.dictLabel,
|
||||
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue
|
||||
}
|
||||
}))
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,10 @@
|
|||
&.active {
|
||||
&::before {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
content: "";
|
||||
background: #68C23A;
|
||||
z-index: 1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="common-box dis-flex " >
|
||||
<div class="common-box dis-flex ">
|
||||
<div class="common-content-box dis-flex flex-col flex-1">
|
||||
<div class="search-box">
|
||||
<FormComponent :options="formOptions" :data.sync="params" @actionCallback="callback" :actions="formActions"
|
||||
|
@ -6,22 +6,30 @@
|
|||
</div>
|
||||
<div class="table-box flex-1">
|
||||
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"
|
||||
@actionCallback="callback($event)" @pageNumberChange="callback($event)" @pageSizeChange="callback($event)"
|
||||
:footerActions="footerActions" :actions="tableActions">
|
||||
|
||||
@actionCallback="callback($event)" @pageNumberChange="callback($event)"
|
||||
@pageSizeChange="callback($event)" :actions="tableActions">
|
||||
|
||||
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked"
|
||||
@selection-change="handleSelectionChange" style="width: 100%">
|
||||
style="width: 100%">
|
||||
<el-table-column label="序号" width="60">
|
||||
<template slot-scope="scope">
|
||||
{{scope.$index+1}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template v-for="item in tableColumn">
|
||||
<el-table-column v-if="item.render" :label="item.name" :width="item.width" :key="item.key">
|
||||
<div slot-scope="scope" style="pointer-events: none;" @click="addVal($event,scope.row)" v-html="item.render(scope.row)"></div>
|
||||
<div slot-scope="scope" style="pointer-events: none;" @click="addVal($event,scope.row)"
|
||||
v-html="item.render(scope.row)"></div>
|
||||
</el-table-column>
|
||||
<el-table-column v-else :prop="item.key" :label="item.name" :width="item.width" :key="item.key">
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column label="操作" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" v-if="scope.row.analFlag && !scope.row.edit" @click="scope.row.edit = true">修改</el-button>
|
||||
<el-button type="text" v-if="!scope.row.analFlag || scope.row.edit" @click="saveVal(scope.row)">保存</el-button>
|
||||
<el-button type="text" v-if="scope.row.analFlag && !scope.row.edit"
|
||||
@click="scope.row.edit = true">修改</el-button>
|
||||
<el-button type="text" v-if="!scope.row.analFlag || scope.row.edit"
|
||||
@click="saveVal(scope.row)">保存</el-button>
|
||||
<el-button type="text" v-if="scope.row.edit" @click="scope.row.edit = false">取消</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -30,30 +38,35 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog :close-on-click-modal="false" :visible.sync="showUpdate" >
|
||||
<el-dialog :close-on-click-modal="false" :visible.sync="showUpdate">
|
||||
<img style="width:100%" src="../../../../assets/images/4.jpg" alt="">
|
||||
</el-dialog>
|
||||
<el-dialog :close-on-click-modal="false" :title="popTitle" :visible.sync="showPop" width="1000px">
|
||||
<el-table :data="riskDatas" border style="width: 100%; margin-bottom: 20px;" :span-method="colSpan">
|
||||
<el-dialog :close-on-click-modal="false" :title="popTitle" :visible.sync="showPop" width="1000px">
|
||||
<el-table :data="riskDatas" border style="width: 100%; margin-bottom: 20px;" :span-method="colSpan">
|
||||
<el-table-column prop="index" label="序号"></el-table-column>
|
||||
<el-table-column prop="name" label="项目"></el-table-column>
|
||||
<el-table-column label="取值标准">
|
||||
<el-table-column prop="noInvolved" label="是否涉及">
|
||||
<div slot-scope="scope" class="cursor td-content" :class="{active:scope.row.value===0}" @click="selectRow(scope.row,0)">
|
||||
<el-table-column label="取值标准">
|
||||
<el-table-column prop="noInvolved" label="是否涉及">
|
||||
<div slot-scope="scope" class="cursor td-content" :class="{active:scope.row.value===0}"
|
||||
@click="selectRow(scope.row,0)">
|
||||
<span>不涉及</span>
|
||||
</div>
|
||||
</el-table-column>
|
||||
<el-table-column prop="type1" label="1">
|
||||
<div slot-scope="scope" class="cursor td-content" :class="{active:scope.row.value===1}" @click="selectRow(scope.row,1)"><span>{{scope.row.type1}}</span></div>
|
||||
<div slot-scope="scope" class="cursor td-content" :class="{active:scope.row.value===1}"
|
||||
@click="selectRow(scope.row,1)"><span>{{scope.row.type1}}</span></div>
|
||||
</el-table-column>
|
||||
<el-table-column prop="type2" label="2">
|
||||
<div slot-scope="scope" class="cursor td-content" :class="{active:scope.row.value===2}" @click="selectRow(scope.row,2)"><span>{{scope.row.type2}}</span></div>
|
||||
<div slot-scope="scope" class="cursor td-content" :class="{active:scope.row.value===2}"
|
||||
@click="selectRow(scope.row,2)"><span>{{scope.row.type2}}</span></div>
|
||||
</el-table-column>
|
||||
<el-table-column prop="type3" label="3">
|
||||
<div slot-scope="scope" class="cursor td-content" :class="{active:scope.row.value===3}" @click="selectRow(scope.row,3)"><span>{{scope.row.type3}}</span></div>
|
||||
<div slot-scope="scope" class="cursor td-content" :class="{active:scope.row.value===3}"
|
||||
@click="selectRow(scope.row,3)"><span>{{scope.row.type3}}</span></div>
|
||||
</el-table-column>
|
||||
<el-table-column prop="type4" label="4">
|
||||
<div slot-scope="scope" class="cursor td-content" :class="{active:scope.row.value===4}" @click="selectRow(scope.row,4)"><span>{{scope.row.type4}}</span></div>
|
||||
<div slot-scope="scope" class="cursor td-content" :class="{active:scope.row.value===4}"
|
||||
@click="selectRow(scope.row,4)"><span>{{scope.row.type4}}</span></div>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
<el-table-column prop="value" :label="popTitle==='L值取值'?'Ln':'Sn'">
|
||||
|
@ -64,6 +77,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column prop="result" :label="popTitle==='L值取值'?'L':'S'"></el-table-column>
|
||||
</el-table>
|
||||
<ButtonListComponent :actions="popBtns" @callback="popCallback" btn-position="center" :full-btn="true"></ButtonListComponent>
|
||||
<ButtonListComponent :actions="popBtns" @callback="popCallback" btn-position="center" :full-btn="true">
|
||||
</ButtonListComponent>
|
||||
</el-dialog>
|
||||
</div>
|
|
@ -44,7 +44,7 @@ export default class AreaAnalComponent extends BaseRecordComponent<any> {
|
|||
}];
|
||||
public formOptions:FormOption<BtnOption>[] = [{
|
||||
name:"区域名称",
|
||||
key:"areaId",
|
||||
key:"name",
|
||||
type:"text",
|
||||
}];
|
||||
|
||||
|
@ -72,8 +72,7 @@ export default class AreaAnalComponent extends BaseRecordComponent<any> {
|
|||
}
|
||||
|
||||
public buildTable(){
|
||||
this.tableColumn.push({name:'序号',key:"areaName"});
|
||||
this.tableColumn.push({name:'区域名称',key:"areaName"});
|
||||
this.tableColumn.push({name:'区域名称',key:"name"});
|
||||
this.tableColumn.push({name:'区域内发生事故的可能性/L',width:"195",render:(data)=>{
|
||||
if(!data.analFlag|| data.edit){
|
||||
return "<span class='link l-value'>"+(data.analLikelihoodValue || "选取L值")+"</span>"
|
||||
|
@ -91,7 +90,7 @@ export default class AreaAnalComponent extends BaseRecordComponent<any> {
|
|||
|
||||
}});
|
||||
this.tableColumn.push({name:'区域固有风险',render:(data)=>{
|
||||
return "<span class='color_"+data.analRiskLevel+"'>"+data.analRiskLevel+"</span>"
|
||||
return "<span class='color_"+data.analRiskLevel+"'>"+(this.$store.getters.prevention_risk_level_map[data.analRiskLevel] || '')+"</span>"
|
||||
}});
|
||||
this.tableColumn.push({name:'评估完成情况',key:"status",render:(data)=>{
|
||||
if(data.edit){
|
||||
|
@ -162,10 +161,13 @@ export default class AreaAnalComponent extends BaseRecordComponent<any> {
|
|||
this.$message.error("请选取S值");
|
||||
return
|
||||
}
|
||||
row.edit = false;
|
||||
// 因为按索引取值 所以要-1
|
||||
row.analRiskLevel=riskLevel[row.analLikelihoodValue - 1][row.analSeverityValue - 1]
|
||||
row.analFlag = 1;
|
||||
row.analRiskLevel=riskLevel[row.analLikelihoodValue - 1][row.analSeverityValue - 1];
|
||||
row.analFlag = 1;
|
||||
this.tableService.addOrUpdate(row,false,true).then((res)=>{
|
||||
this.$message.success("保存成功")
|
||||
row.edit = false;
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue