feat:完成区域固有风险开发

kongyeqing
吴延福 2023-06-09 17:29:33 +08:00
parent 385b163a0e
commit f1f66ae87e
5 changed files with 66 additions and 29 deletions

View File

@ -10,6 +10,7 @@ export default new Vuex.Store({
userList:[], userList:[],
common_yes_no:[], common_yes_no:[],
prevention_dangrous_level:[], prevention_dangrous_level:[],
prevention_risk_level:[],
}, },
getters: { getters: {
common_yes_no_map:(state)=>{ common_yes_no_map:(state)=>{
@ -21,7 +22,14 @@ export default new Vuex.Store({
}, },
prevention_dangrous_level_map:(state)=>{ prevention_dangrous_level_map:(state)=>{
const map = {}; 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 map[item.value] = item.name
}) })
return map return map
@ -43,6 +51,9 @@ export default new Vuex.Store({
}, },
set_prevention_dangrous_level(state,data){ set_prevention_dangrous_level(state,data){
state.prevention_dangrous_level = data; state.prevention_dangrous_level = data;
},
set_prevention_risk_level(state,data){
state.prevention_risk_level = data;
} }
}, },
actions: { actions: {

View File

@ -14,7 +14,8 @@ export default class BlankComponent extends Vue {
this.systemService.getDeptList(), this.systemService.getDeptList(),
this.systemService.getUserList({pageSize:0}), this.systemService.getUserList({pageSize:0}),
this.systemService.getDictData("common_yes_no"), 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)=>{ ]).then(((results:any)=>{
this.$store.commit("setDeptTreeList",results[0].data); 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 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
}
}))
})) }))
} }
} }

View File

@ -51,7 +51,10 @@
&.active { &.active {
&::before { &::before {
position: absolute; position: absolute;
inset: 0; left: 0;
top: 0;
right: 0;
bottom: 0;
content: ""; content: "";
background: #68C23A; background: #68C23A;
z-index: 1; z-index: 1;

View File

@ -6,22 +6,30 @@
</div> </div>
<div class="table-box flex-1"> <div class="table-box flex-1">
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)" <TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"
@actionCallback="callback($event)" @pageNumberChange="callback($event)" @pageSizeChange="callback($event)" @actionCallback="callback($event)" @pageNumberChange="callback($event)"
:footerActions="footerActions" :actions="tableActions"> @pageSizeChange="callback($event)" :actions="tableActions">
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked" <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"> <template v-for="item in tableColumn">
<el-table-column v-if="item.render" :label="item.name" :width="item.width" :key="item.key"> <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>
<el-table-column v-else :prop="item.key" :label="item.name" :width="item.width" :key="item.key"> <el-table-column v-else :prop="item.key" :label="item.name" :width="item.width" :key="item.key">
</el-table-column> </el-table-column>
</template> </template>
<el-table-column label="操作" width="100"> <el-table-column label="操作" width="100">
<template slot-scope="scope"> <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"
<el-button type="text" v-if="!scope.row.analFlag || scope.row.edit" @click="saveVal(scope.row)">保存</el-button> @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> <el-button type="text" v-if="scope.row.edit" @click="scope.row.edit = false">取消</el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -39,21 +47,26 @@
<el-table-column prop="name" label="项目"></el-table-column> <el-table-column prop="name" label="项目"></el-table-column>
<el-table-column label="取值标准"> <el-table-column label="取值标准">
<el-table-column prop="noInvolved" 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)"> <div slot-scope="scope" class="cursor td-content" :class="{active:scope.row.value===0}"
@click="selectRow(scope.row,0)">
<span>不涉及</span> <span>不涉及</span>
</div> </div>
</el-table-column> </el-table-column>
<el-table-column prop="type1" label="1"> <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>
<el-table-column prop="type2" label="2"> <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>
<el-table-column prop="type3" label="3"> <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>
<el-table-column prop="type4" label="4"> <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> </el-table-column>
<el-table-column prop="value" :label="popTitle==='L值取值'?'Ln':'Sn'"> <el-table-column prop="value" :label="popTitle==='L值取值'?'Ln':'Sn'">
@ -64,6 +77,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="result" :label="popTitle==='L值取值'?'L':'S'"></el-table-column> <el-table-column prop="result" :label="popTitle==='L值取值'?'L':'S'"></el-table-column>
</el-table> </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> </el-dialog>
</div> </div>

View File

@ -44,7 +44,7 @@ export default class AreaAnalComponent extends BaseRecordComponent<any> {
}]; }];
public formOptions:FormOption<BtnOption>[] = [{ public formOptions:FormOption<BtnOption>[] = [{
name:"区域名称", name:"区域名称",
key:"areaId", key:"name",
type:"text", type:"text",
}]; }];
@ -72,8 +72,7 @@ export default class AreaAnalComponent extends BaseRecordComponent<any> {
} }
public buildTable(){ public buildTable(){
this.tableColumn.push({name:'序号',key:"areaName"}); this.tableColumn.push({name:'区域名称',key:"name"});
this.tableColumn.push({name:'区域名称',key:"areaName"});
this.tableColumn.push({name:'区域内发生事故的可能性/L',width:"195",render:(data)=>{ this.tableColumn.push({name:'区域内发生事故的可能性/L',width:"195",render:(data)=>{
if(!data.analFlag|| data.edit){ if(!data.analFlag|| data.edit){
return "<span class='link l-value'>"+(data.analLikelihoodValue || "选取L值")+"</span>" 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)=>{ 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)=>{ this.tableColumn.push({name:'评估完成情况',key:"status",render:(data)=>{
if(data.edit){ if(data.edit){
@ -162,10 +161,13 @@ export default class AreaAnalComponent extends BaseRecordComponent<any> {
this.$message.error("请选取S值"); this.$message.error("请选取S值");
return return
} }
row.edit = false;
// -1 // -1
row.analRiskLevel=riskLevel[row.analLikelihoodValue - 1][row.analSeverityValue - 1] row.analRiskLevel=riskLevel[row.analLikelihoodValue - 1][row.analSeverityValue - 1];
row.analFlag = 1; row.analFlag = 1;
this.tableService.addOrUpdate(row,false,true).then((res)=>{
this.$message.success("保存成功")
row.edit = false;
})
} }