feat:新增设备设施清单 安全检查表分析评价

kongyeqing
kongyeqing 2023-06-27 17:11:05 +08:00
parent c15160e682
commit 748be50781
7 changed files with 997 additions and 101 deletions

View File

@ -0,0 +1,39 @@
import BaseService from "hbt-common/service/base.service"
import type { AxiosResponse } from 'axios'
import { ActionResult } from "hbt-common/models/actionResult";
export default class DeviceService extends BaseService<any>{
constructor(){
super()
}
public selectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/device/anal/getList';
return this.get(url,params)
}
public selectById(id):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/device/anal/detail?id='+id;
return this.get(url,null,true)
}
// 新增或更新
public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
if(add){
const url = this.prefix.prevention+'/device/anal/add';
return this.post(url,params,{},showLoading)
}else{
const url = this.prefix.prevention+'/device/anal/update';
return this.put(url,params,{},showLoading)
}
}
public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention +'/device/anal/delete';
return this.deleteBatch(url,params,{},true)
}
// 存草稿
public addOrDraft(params: any, add: boolean,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/device/anal/addDraft';
return this.post(url,params,{},showLoading)
}
}

View File

@ -20,7 +20,15 @@ export default new Vuex.Store({
prevention_danger_type:[], prevention_danger_type:[],
prevention_occur_step:[], prevention_occur_step:[],
prevention_major_type:[], prevention_major_type:[],
prevention_device_type:[] prevention_device_type:[],
prevention_serious_result:[],
prevention_security_identifier:[],
prevention_majorsign:[],
prevention_control_level:[],
prevention_measure_type:[],
prevention_measures_sort:[],
prevention_task_type:[],
prevention_evaluate_status:[]
}, },
getters: { getters: {
dept_map:(state)=>{ dept_map:(state)=>{
@ -127,7 +135,63 @@ export default new Vuex.Store({
map[item.value] = item.name map[item.value] = item.name
}) })
return map return map
} },
prevention_serious_result_map:(state)=>{
const map = {};
state.prevention_serious_result.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
prevention_security_identifier_map:(state)=>{
const map = {};
state.prevention_security_identifier.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
prevention_majorsign_map:(state)=>{
const map = {};
state.prevention_majorsign.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
prevention_control_level_map:(state)=>{
const map = {};
state.prevention_control_level.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
prevention_measure_type_map:(state)=>{
const map = {};
state.prevention_measure_type.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
prevention_measures_sort_map:(state)=>{
const map = {};
state.prevention_measures_sort.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
prevention_task_type_map:(state)=>{
const map = {};
state.prevention_task_type.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
prevention_evaluate_status_map:(state)=>{
const map = {};
state.prevention_evaluate_status.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
}, },
mutations: { mutations: {
@ -179,7 +243,31 @@ export default new Vuex.Store({
}, },
set_prevention_device_type(state,data){ set_prevention_device_type(state,data){
state.prevention_device_type = data; state.prevention_device_type = data;
} },
set_prevention_serious_result(state,data){
state.prevention_serious_result = data;
},
set_prevention_security_identifier(state,data){
state.prevention_security_identifier = data;
},
set_prevention_majorsign(state,data){
state.prevention_majorsign = data;
},
set_prevention_control_level(state,data){
state.prevention_control_level = data;
},
set_prevention_measure_type(state,data){
state.prevention_measure_type = data;
},
set_prevention_measures_sort(state,data){
state.prevention_measures_sort = data;
},
set_prevention_task_type(state,data){
state.prevention_task_type = data
},
set_prevention_evaluate_status(state,data){
state.prevention_evaluate_status = data
},
}, },
actions: { actions: {
}, },

View File

@ -29,9 +29,19 @@ export default class BlankComponent extends Vue {
this.systemService.getDictData("prevention_danger_type"), this.systemService.getDictData("prevention_danger_type"),
this.systemService.getDictData("prevention_major_type"), this.systemService.getDictData("prevention_major_type"),
this.systemService.getDictData("prevention_occur_step"), this.systemService.getDictData("prevention_occur_step"),
]).then(((results:any)=>{ this.systemService.getDictData("prevention_device_type"),
this.$store.commit("setDeptTreeList",results[0].data);
this.$store.commit("setUserList",results[2].data.datas.map((item)=>{ this.systemService.getDictData("prevention_serious_result"),
this.systemService.getDictData("prevention_security_identifier"),
this.systemService.getDictData("prevention_majorsign"),
this.systemService.getDictData("prevention_control_level"),
this.systemService.getDictData("prevention_measure_type"),
this.systemService.getDictData("prevention_measures_sort"),
this.systemService.getDictData("prevention_task_type"),
this.systemService.getDictData("prevention_evaluate_status"),
]).then(((results: any) => {
this.$store.commit("setDeptTreeList", results[0].data);
this.$store.commit("setUserList", results[2].data.datas.map((item) => {
return { return {
name: item.nickName, name: item.nickName,
value: item.userId value: item.userId
@ -83,40 +93,97 @@ 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_cycle_unit",results[9].data.map(item=>{ this.$store.commit("set_prevention_cycle_unit", results[9].data.map(item => {
return { return {
name:item.dictLabel, name: item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
} }
})) }))
this.$store.commit("set_prevention_danger_check_type",results[10].data.map(item=>{ this.$store.commit("set_prevention_danger_check_type", results[10].data.map(item => {
return { return {
name:item.dictLabel, name: item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
} }
})) }))
this.$store.commit("set_prevention_danger_resource",results[11].data.map(item=>{ this.$store.commit("set_prevention_danger_resource", results[11].data.map(item => {
return { return {
name:item.dictLabel, name: item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
} }
})) }))
this.$store.commit("set_prevention_danger_type",results[12].data.map(item=>{ this.$store.commit("set_prevention_danger_type", results[12].data.map(item => {
return { return {
name:item.dictLabel, name: item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
} }
})) }))
this.$store.commit("set_prevention_major_type",results[13].data.map(item=>{ this.$store.commit("set_prevention_major_type", results[13].data.map(item => {
return { return {
name:item.dictLabel, name: item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
} }
})) }))
this.$store.commit("set_prevention_occur_step",results[14].data.map(item=>{ this.$store.commit("set_prevention_occur_step", results[14].data.map(item => {
return { return {
name:item.dictLabel, name: item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
}
}))
this.$store.commit("set_prevention_device_type", results[15].data.map(item => {
return {
name: item.dictLabel,
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
}
}))
this.$store.commit("set_prevention_serious_result", results[16].data.map(item => {
return {
name: item.dictLabel,
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
}
}))
this.$store.commit("set_prevention_security_identifier", results[17].data.map(item => {
return {
name: item.dictLabel,
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
}
}))
this.$store.commit("set_prevention_majorsign", results[18].data.map(item => {
return {
name: item.dictLabel,
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
}
}))
this.$store.commit("set_prevention_control_level", results[19].data.map(item => {
return {
name: item.dictLabel,
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
}
}))
this.$store.commit("set_prevention_measure_type", results[20].data.map(item => {
return {
name: item.dictLabel,
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
}
}))
this.$store.commit("set_prevention_measures_sort", results[21].data.map(item => {
return {
name: item.dictLabel,
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue,
children: item.children
}
}))
this.$store.commit("set_prevention_task_type", results[22].data.map(item => {
return {
name: item.dictLabel,
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue,
children: item.children
}
}))
this.$store.commit("set_prevention_evaluate_status", results[23].data.map(item => {
return {
name: item.dictLabel,
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue,
} }
})) }))

View File

@ -72,7 +72,6 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</TableComponent> </TableComponent>
</FormComponent> </FormComponent>
</el-dialog> </el-dialog>
@ -97,8 +96,8 @@
</el-table-column> </el-table-column>
</template> </template>
</el-table> </el-table>
</TableComponent> </TableComponent>
</el-dialog> </el-dialog>
</div> </div>

View File

@ -149,6 +149,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
}, { }, {
name: "设备类型", name: "设备类型",
key: "type", key: "type",
format: "typeName",
type: "select", type: "select",
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
@ -374,6 +375,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
this.updateParams = Object.assign({ this.updateParams = Object.assign({
safetyFactorName: res.data.safetyFactor.split(";").map(item => this.$store.getters.prevention_safe_reason_map[item]).join(";"), safetyFactorName: res.data.safetyFactor.split(";").map(item => this.$store.getters.prevention_safe_reason_map[item]).join(";"),
identifyUserName: this.$store.getters.user_map[res.data.identifyUserId], identifyUserName: this.$store.getters.user_map[res.data.identifyUserId],
typeName: this.$store.getters.prevention_device_type_map[res.data.type],
}, res.data) }, res.data)
} else { } else {
this.isReadonly = false this.isReadonly = false

View File

@ -1,7 +1,6 @@
<div class="common-box dis-flex "> <div class="common-box dis-flex ">
<div class="common-tree-box" v-if="treeData"> <div class="common-tree-box">
<el-tree :data="treeData" :expand-on-click-node="false" default-expand-all highlight-current @node-click="handleNodeClick"> <UnitTreeComponent @callback="handleNodeClick"></UnitTreeComponent>
</el-tree>
</div> </div>
<div class="common-content-box dis-flex flex-col flex-1"> <div class="common-content-box dis-flex flex-col flex-1">
<div class="search-box"> <div class="search-box">
@ -17,37 +16,41 @@
@selection-change="handleSelectionChange" style="width: 100%"> @selection-change="handleSelectionChange" style="width: 100%">
<el-table-column type="selection" label="全选" width="40"> <el-table-column type="selection" label="全选" width="40">
</el-table-column> </el-table-column>
<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" v-html="item.render(scope.row)"></div> <div slot-scope="scope" v-html="item.render(scope.row)" @click="showPros($event,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="150"> <el-table-column label="操作" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showUpdateModel(scope.row.userId)">查看</el-button> <el-button type="text" @click="showUpdateModel(scope.row,true)">查看</el-button>
<el-button type="text" @click="showUpdateModel(scope.row.userId)">修改</el-button> <el-button type="text" @click="showUpdateModel(scope.row,null,true)">修改</el-button>
<el-button type="text" @click="deleteData([scope.row])">删除</el-button> <el-button type="text" @click="deleteData([scope.row.id])">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</TableComponent> </TableComponent>
</div> </div>
</div> </div>
<el-dialog :close-on-click-modal="false" :title="currentId>0?'详情':currentId===-1?'新增':'编辑'" <el-dialog :close-on-click-modal="false" :title="!updateParams.id?'新增':isReadonly?'详情':'编辑'"
:visible.sync="showUpdate" width="952px" :before-close="handleClose"> :visible.sync="showUpdate" width="952px" :before-close="handleClose">
<FormComponent :options="updateOptions" labelWidth="110px" labelAlign="right" :data.sync="updateParams" <FormComponent :options="updateOptions" labelWidth="110px" labelAlign="right" :data.sync="updateParams"
@actionCallback="callback" :actions="updateActions" :full-btn="true" btnPosition="center"> :isReadonly="isReadonly" @actionCallback="callback" @change="changes">
<div class="sub-title">作业步骤</div> <div class="sub-title">安全检查表分析法</div>
<TableComponent :tableData="currentStepTableData" :tableColumn="subTableColumn"
<TableComponent :tableData="tableData" :tableColumn="subTableColumn" @actionCallback="callback($event)" @actionCallback="callback($event)" :actions="isReadonly? []:subTableActions" actionPosition="flex-start"
:actions="subTableActions" actionPosition="flex-start" :showFooter="false" style="margin-bottom: 20px;"> :showFooter="false" style="margin-bottom: 20px;">
<el-table ref="multipleTable" :data="updateParams.items" tooltip-effect="dark" height="250" border
<el-table ref="multipleTable" :data="tableData.datas" tooltip-effect="dark" height="250" border row-key="checked" @selection-change="handleSubSelectionChange" style="width: 100%">
row-key="checked" @selection-change="handleSelectionChange" style="width: 100%">
<el-table-column type="selection" label="全选" width="40"> <el-table-column type="selection" label="全选" width="40">
</el-table-column> </el-table-column>
<template v-for="item in subTableColumn"> <template v-for="item in subTableColumn">
@ -59,23 +62,54 @@
:label="item.name" :width="item.width" :key="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="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showUpdateModel(scope.row.userId)">修改</el-button> <el-button v-if="isReadonly || isModifyonly" type="text"
<el-button type="text" @click="deleteData([scope.row])">删除</el-button> @click="showSubModel(scope.row,true)">查看</el-button>
<el-button v-if="isModifyonly" type="text" @click="showSubModel(scope.row)">修改</el-button>
<el-button v-if="!isReadonly && !isModifyonly" type="text"
@click="showSubModel(scope.row)">评价</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</TableComponent>
</FormComponent>
<FormComponent :options="subBasicRiskOptions" labelWidth="110px" labelAlign="right" :data.sync="updateParams"
:isReadonly="isReadonly" @actionCallback="callback" @change="changes" @action="updateActions"
:actions="isReadonly? []:updateActions" :full-btn="true" btnPosition="center">
</FormComponent>
</el-dialog>
<!-- 评估矩阵 -->
<el-dialog :close-on-click-modal="false" :visible.sync="showMatrixModal" :title="'区域风险等级判定准则'">
<img style="width:100%" src="../../../../assets/images/5.png" alt="">
</el-dialog>
<!-- 评价 -->
<el-dialog :close-on-click-modal="false" :visible.sync="showSubUpdate" width="880px"
:before-close="handleAnalyClose">
<AnalEvaluationComponent :isReadonly="analyIsReadonly" :data.sync="analysisUpdateParams"
:show.sync="showSubUpdate" @actionCallback="analyCallback" :tabledata.sync="updateParams"
:areaList="areaList" :type="'device'"></AnalEvaluationComponent>
</el-dialog>
<!-- 检查项目 -->
<el-dialog :close-on-click-modal="false" title="检查项目" :show-close="false" :visible.sync="showProtable"
width="880px">
<FormComponent labelWidth="110px" labelAlign="right" :actions="proActions" @actionCallback="proCallback"
:full-btn="true" btnPosition="center">
<TableComponent :tableData="currentProTableData" :tableColumn="proTableColumn" :showFooter="false"
style="margin-bottom: 20px;">
<el-table ref="multipleTable" :data="currentProTableData.datas" tooltip-effect="dark" height="250"
border style="width: 100%">
<template v-for="item in proTableColumn">
<el-table-column v-if="item.render" :label="item.name" :width="item.width" :key="item.key">
<div slot-scope="scope" v-html="item.render(scope.row)" @click="showPros($event,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>
</TableComponent> </TableComponent>
</FormComponent> </FormComponent>
</el-dialog>
<el-dialog :close-on-click-modal="false" :title="currentId>0?'详情':currentId===-1?'新增':'编辑'"
:visible.sync="showUpdate" width="952px" :before-close="handleClose">
<FormComponent :options="updateOptions" :isReadonly="true" labelWidth="110px" labelAlign="right"
:data.sync="updateParams"></FormComponent>
</el-dialog> </el-dialog>
</div> </div>

View File

@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Component } from 'vue-property-decorator'; import { Component, Watch } from 'vue-property-decorator';
import template from "./deviceAnal.component.html" import template from "./deviceAnal.component.html"
import BaseRecordComponent from "hbt-common/components/common/baseRecord.component.vue" import BaseRecordComponent from "hbt-common/components/common/baseRecord.component.vue"
import FormComponent from "hbt-common/components/common/form.component.vue" import FormComponent from "hbt-common/components/common/form.component.vue"
@ -8,17 +8,33 @@ import TableComponent from "hbt-common/components/common/table.component.vue"
import FormOption from "hbt-common/models/formOptions" import FormOption from "hbt-common/models/formOptions"
import BtnOption from "hbt-common/models/btnOptions" import BtnOption from "hbt-common/models/btnOptions"
import DrawComponent from '@/components/draw.component.vue'; import DrawComponent from '@/components/draw.component.vue';
import DeviceService from '@/service/device.service'; import AnalEvaluationComponent from '@/components/analEvaluation.component.vue';
import UnitTreeComponent from '@/components/tree.component.vue';
import ButtonListComponent from "hbt-common/components/common/buttonList.component.vue";
import DeviceService from '@/service/deviceAnal.service';
import UnitService from '@/service/unit.service';
import AreaService from '@/service/area.service';
import DiviceService from '@/service/device.service';
import SystemService from "hbt-common/service/system.service";
import moment from "moment"
@Component({ @Component({
template, template,
components: { components: {
FormComponent, FormComponent,
TableComponent, TableComponent,
DrawComponent, DrawComponent,
AnalEvaluationComponent,
UnitTreeComponent,
ButtonListComponent
}, },
}) })
export default class DeviceAnalManagerComponent extends BaseRecordComponent<any> { export default class DeviceAnalManagerComponent extends BaseRecordComponent<any> {
public tableService = new DeviceService(); public tableService = new DeviceService();
public unitService = new UnitService();
public areaService = new AreaService();
public systemService = new SystemService();
public diviceService = new DiviceService();
public params = { public params = {
areaName: "", areaName: "",
@ -27,6 +43,62 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
public treeData = [] as any; public treeData = [] as any;
public areaList = [];
public unitList = [];
public diviceList = [];
public isReadonly = false;
public isModifyonly = false;
public subTableColumn = [] as any;
public currentId = -1;
public sourceMap = {} as any;
public craftMap = {} as any;
public chemicaltMap = {} as any
public majorsignMap = {} as any;
//
public showProtable = false;
public proTableColumn = [] as any;
public currentProTableData = {
datas: []
} as any;
public proActions = [{
name: "取消",
value: "cancel"
}];
//
public dictData = {
source: [],
craft: [],
chemical: [],
mainPerson: [],
craftPerson: [],
operatePerson: [],
measuresSort: [],
riskControlLevel: [],
seriousResult: [],
identifier: [],
majorsign: [],
} as any;
//
public showMatrixModal = false;
//
public showSubUpdate = false;
public analyIsReadonly = false;
//
public analysisUpdateParams = {
riskChoose: [],
remainChoose: [],
remainLevel: null,
riskLevel: null,
datas: []
} as any;
public formActions = [{ public formActions = [{
name: "查询", name: "查询",
value: "search", value: "search",
@ -57,37 +129,279 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
name: "反向选择", name: "反向选择",
value: "reverse" value: "reverse"
}]; }];
public updateActions = [{
name: "取消",
value: "cancel"
}, {
name: '存草稿',
value: 'addDraft',
type: "primay"
}, {
name: "保存并继续添加",
value: "saveAndContinue",
type: "primary"
}, {
name: "保存",
value: "save",
type: "primary"
}];
public formOptions: FormOption<BtnOption>[] = [{ public formOptions: FormOption<BtnOption>[] = [{
name: "区域名称", name: "区域名称",
key: "areaId", key: "areaName",
type: "text", type: "text",
}, { }, {
name: "单元名称", name: "单元名称",
key: "unitId", key: "unitName",
type: "text", type: "text",
}, { },];
name: "作业活动",
key: "unitId",
type: "select",
datas: [{
name: "单元1",
value: 0
}, {
name: "单元2",
value: 1
}]
}];
public showUpdate = false; public showUpdate = false;
public updateParams = {} as any;
public account = JSON.parse(localStorage.getItem("account") as any);
public updateParams = {
majorSign: [],
items: [],
evaluateTime: moment().format('YYYY-MM-DD'),
evaluateUserId: this.account.userId,
evaluateUserName: this.account.nickName,
} as any;
public selectData = []; public selectData = [];
created() { public subSelectData = []
public updateOptions: FormOption<BtnOption>[] = [];
public subBasicRiskOptions: FormOption<BtnOption>[] = [];
public subTableActions: BtnOption[] = [];
public buildUpdateForm() {
this.updateOptions = [{
name: "区域名称",
key: "areaId",
format: "areaName",
type: "select",
require: true,
width: "calc(50% - 20px)",
showError: false,
datas: this.areaList
}, {
name: "单元名称",
key: "unitId",
format: "unitName",
type: "select",
require: true,
width: "calc(50% - 20px)",
showError: false,
datas: this.unitList
}, {
name: "责任部门",
key: "chargeDeptName",
type: "text",
require: true,
width: "calc(50% - 20px)",
disable: true,
}, {
name: "责任人",
key: "chargeUserName",
type: "text",
require: true,
width: "calc(50% - 20px)",
showError: false,
disable: true,
}, {
name: "设备名称",
key: "deviceInventoryId",
format: 'name',
type: "select",
require: true,
width: "calc(50% - 20px)",
showError: false,
datas: this.diviceList,
}, {
name: "设备类型",
key: "type",
format: "typeName",
type: "select",
require: true,
width: "calc(50% - 20px)",
disable: true,
datas: this.$store.state.prevention_device_type
}, {
name: "涉及岗位",
key: "postName",
type: "text",
width: "calc(100% - 20px)",
require: true,
disable: true,
}, {
name: "评价人",
key: "evaluateUserId",
format: "evaluateUserName",
require: true,
width: "calc(50% - 20px)",
type: "select",
showError: false,
datas: this.$store.state.userList
}, {
name: "评价时间",
key: "evaluateTime",
type: "date",
subType: "date",
width: "calc(50% - 20px)",
require: true,
showError: false,
format: "yyyy-MM-dd"
}, {
name: "是否为两大一重",
key: "majorSign",
format: "majorSignName",
type: "checkbox",
width: "calc(100% - 20px)",
require: true,
datas: this.$store.state.prevention_majorsign,
}, {
name: "重大危险源",
key: "majorHazard",
hide: !this.updateParams.majorSign.includes(1) || this.updateParams.majorSign.includes(0),
type: "select",
format: "majorHazardName",
width: "calc(50% - 20px)",
require: true,
multiple: true,
datas: this.dictData.source
}, {
name: "重点监管工艺",
key: "regulatoryProcess",
format: "regulatoryProcessName",
hide: !this.updateParams.majorSign.includes(2) || this.updateParams.majorSign.includes(0),
type: "select",
width: "calc(50% - 20px)",
require: true,
multiple: true,
datas: this.dictData.craft,
}, {
name: "重点监管化学品",
key: "regulatoryChemical",
format: "regulatoryChemicalName",
hide: !this.updateParams.majorSign.includes(3) || this.updateParams.majorSign.includes(0),
type: "select",
width: "calc(50% - 20px)",
require: true,
multiple: true,
datas: this.dictData.chemical,
}];
this.subTableActions = [{
name: "批量删除",
value: "subDelete",
plain: true,
icon: "el-icon-delete",
type: "danger"
}, {
name: "评估矩阵",
value: "estimateMatrix",
type: "primary"
}];
this.subBasicRiskOptions = [{
name: "风险等级",
key: "riskLevel",
format: 'riskLevelName',
type: "select",
require: true,
width: "calc(50% - 20px)",
disable: true,
datas: this.$store.state.prevention_risk_level
}, {
name: "残余风险等级",
key: "remainRiskLevel",
format: "remainRiskLevelName",
type: "select",
require: true,
width: "calc(50% - 20px)",
disable: true,
datas: this.$store.state.prevention_risk_level
}]
}
@Watch("$store.state.deptList", { immediate: true, deep: true })
onChanges() {
this.loadAreaData()
}
@Watch("updateParams", { immediate: true, deep: true })
onCountValueChange() {
this.buildUpdateForm()
}
created() {
Promise.all([
this.systemService.getDictData("prevention_risk_source"),
this.systemService.getDictData("prevention_risk_craft"),
this.systemService.getDictData("prevention_risk_chemical"),
]).then(((results: any) => {
this.dictData.source = results[0].data.map((item) => {
this.sourceMap[item.dictValue] = item.dictLabel;
return {
name: item.dictLabel,
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
}
})
this.dictData.craft = results[1].data.map((item) => {
this.craftMap[item.dictValue] = item.dictLabel;
return {
name: item.dictLabel,
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
}
})
this.dictData.chemical = results[2].data.map((item) => {
this.chemicaltMap[item.dictValue] = item.dictLabel;
return {
name: item.dictLabel,
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
}
})
this.buildUpdateForm()
}));
}
//
public loadAreaData() {
this.unitList = [];
this.diviceList = [];
this.areaService.selectByPage({ pageSize: 1000 }).then((res: any) => {
this.areaList = res.data.datas.map(item => {
return {
name: item.name,
value: item.id,
analRiskLevel: item.analRiskLevel ? item.analRiskLevel : 0,
}
});
this.buildUpdateForm()
})
}
//
public loadUnitData(id?) {
this.unitService.selectByPage({ pageSize: 1000, areaId: id }, false).then((res: any) => {
this.unitList = res.data.datas.map(item => {
return {
name: item.name,
value: item.id,
deptId: item.chargeDeptId,
userId: item.chargeUserId,
deptName: item.chargeDeptName,
userName: item.chargeUserName,
}
});
this.buildUpdateForm()
})
} }
// //
public handleNodeClick(data) { public handleNodeClick(data) {
console.log('data', data)
this.params.unitName = ""; this.params.unitName = "";
this.params.areaName = ""; this.params.areaName = "";
if (data.areaId) { if (data.areaId) {
@ -96,40 +410,111 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
this.params.areaName = data.name this.params.areaName = data.name
} }
this.getTableData() this.getTableData()
} }
public buildTable() { public buildTable() {
this.tableColumn.push({ name: '序号', key: "index" }); this.tableColumn.push({ name: '区域名称', key: "areaName", width: "150px" });
this.tableColumn.push({ name: '区域名称', key: "deptName", width: "200px" }); this.tableColumn.push({ name: '风险分析单元', key: "unitName", width: "150px" });
this.tableColumn.push({ name: '风险分析单元', key: "deptName", width: "200px" }); this.tableColumn.push({ name: '设备名称', key: "name", });
this.tableColumn.push({ name: '设备名称', key: "person" });
this.tableColumn.push({ name: '设备类别', key: "person" });
this.tableColumn.push({ this.tableColumn.push({
name: '检查项目', key: "status", render: (data) => { name: '设备类别', key: "type", render: (data) => {
if (data.status == 0) { if (data.riskLevel) {
return "<span class='noDraw'>未绘制</span>" return this.$store.getters.prevention_risk_level_map[data.riskLevel]
} else {
return "<span>已绘制</span>"
}
}
});
this.tableColumn.push({ name: '责任人', key: "person" });
this.tableColumn.push({ name: '责任部门', key: "person" });
this.tableColumn.push({
name: '风险等级', key: "status", render: (data) => {
if (data.status == 0) {
return "<span class='noDraw'>未绘制</span>"
} else {
return "<span>已绘制</span>"
} }
} }
}); });
this.tableColumn.push({ this.tableColumn.push({
name: '残余风险等级', key: "status", render: (data) => { name: '检查项目', key: "itemNum", render: (data) => {
if (data.status == 0) { return "<span class='link'>" + (data.itemNum ? data.itemNum : 0) + "</span>"
return "<span class='noDraw'>未绘制</span>" }
});
this.tableColumn.push({ name: '责任部门', key: "chargeDeptName" });
this.tableColumn.push({ name: '责任人', key: "chargeUserName" });
this.tableColumn.push({
name: '风险等级', key: "riskLevel", render: (data) => {
return "<span class='color_" + data.riskLevel + "'>" + (data.riskLevel ? (this.$store.getters.prevention_risk_level_map[data.riskLevel]) : '') + "</span>"
}
});
this.tableColumn.push({
name: '残余风险等级', key: "remainRiskLevel", width: "150px", render: (data) => {
return "<span class='color_" + data.remainRiskLevel + "'>" + (data.remainRiskLevel ? (this.$store.getters.prevention_risk_level_map[data.remainRiskLevel]) : '') + "</span>"
}
});
this.tableColumn.push({
name: '状态', key: "status", render: (data) => {
if (data.status) {
return "<span class='color_" + data.status + "'>" + (data.status ? (this.$store.getters.prevention_evaluate_status_map[data.status]) : '') + "</span>"
}
}
});
//
this.subTableColumn.push({ name: '序号', key: "index" });
this.subTableColumn.push({ name: '检查项目', key: "itemName" });
this.subTableColumn.push({ name: '检查标准', key: "itemStandard", showTip: true, width: "200px" });
this.subTableColumn.push({ name: '风险源', key: "riskSource" });
this.subTableColumn.push({ name: '危害分析', key: "hazardAnalysis" });
this.subTableColumn.push({
name: '最严重后果', key: "seriousResult", width: "200px", render: (data) => {
if (data.seriousResult) {
return data.seriousResult.split(";").map(item => this.$store.getters.prevention_serious_result_map[item]).join(";")
}
}
});
this.subTableColumn.push({
name: '风险等级', key: "riskLevel", render: (data) => {
if (data.riskLevel) {
return this.$store.getters.prevention_risk_level_map[data.riskLevel]
}
}
});
this.subTableColumn.push({ name: '评估方法', key: "riskChoose", });
this.subTableColumn.push({
name: '残余风险等级', key: "remainLevel", width: "200px", render: (data) => {
if (data.remainLevel) {
return this.$store.getters.prevention_risk_level_map[data.remainLevel]
}
}
});
this.subTableColumn.push({ name: '评估方法', key: "remainChoose", });
this.subTableColumn.push({
name: '管控措施', key: "measuresNum", render: (data) => {
if (data.measuresNum) {
return data.measuresNum
} else { } else {
return "<span>已绘制</span>" if (data.measures && data.measures.length) {
return data.measures.length
}
}
}
});
//
this.proTableColumn.push({ name: '序号', key: "index" });
this.proTableColumn.push({ name: '检查项目', key: "itemName" });
this.proTableColumn.push({ name: '检查标准', key: "itemStandard", showTip: true, width: "200px" });
this.proTableColumn.push({ name: '风险源', key: "riskSource" });
this.proTableColumn.push({
name: '可能发生事故', key: "seriousResult", width: "150px", render: (data) => {
if (data.seriousResult) {
return data.seriousResult.split(";").map(item => this.$store.getters.prevention_serious_result_map[item]).join(";")
}
}
});
this.proTableColumn.push({
name: '风险等级', key: "riskLevel", render: (data) => {
if (data.riskLevel) {
return this.$store.getters.prevention_risk_level_map[data.riskLevel]
}
}
});
this.proTableColumn.push({
name: '残余风险等级', key: "remainLevel", width: "150px", render: (data) => {
if (data.remainLevel) {
return this.$store.getters.prevention_risk_level_map[data.remainLevel]
} }
} }
}); });
@ -150,6 +535,41 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
this.selectAll() this.selectAll()
} else if (data.value === "delete") { } else if (data.value === "delete") {
this.deleteData(this.selectData.map((item: any) => item.id)) this.deleteData(this.selectData.map((item: any) => item.id))
} else if (data.value === "add") {
this.isReadonly = false;
this.showUpdate = true
this.updateParams = {
majorSign: [],
items: [],
evaluateTime: moment().format('YYYY-MM-DD'),
evaluateUserId: this.account.userId,
evaluateUserName: this.account.nickName,
} as any
} else if (data.value === "cancel") {
this.handleClose()
} else if (data.value === "estimateMatrix") {
this.showMatrixModal = true
} else if (data && data.value.indexOf("save") >= 0) {
this.doSave(data.value !== "save")
this.isReadonly = false;
} else if (data && data.value === 'addDraft') {
this.doSaveDraft()
this.isReadonly = false;
} else if (data && data.value === "subDelete") {
if (this.subSelectData.length > 0) {
if (!this.updateParams.deleteIds) {
this.updateParams.deleteIds = []
}
this.subSelectData.map((itemData: any) => {
this.updateParams.deleteIds.push(itemData.id)
this.updateParams.items.splice(this.updateParams.items.findIndex(item => item.index === itemData.index), 1)
})
this.updateParams.items.forEach((item, index) => {
item.index = index + 1
return item
})
this.updateParams.itemNum = this.updateParams.items.length
}
} }
} }
// //
@ -160,17 +580,205 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
} as any; } as any;
} }
public changes(data, item) {
//
if (item && item.key === "areaId") {
this.diviceList = [];
if (this.updateParams.unitId) {
this.updateParams.unitId = null;
}
const areaData = this.areaList.find((itm: any) => itm.value === data) as any;
this.updateParams.analRiskLevel = areaData.analRiskLevel
this.updateParams.analRiskLevel = areaData.analRiskLevel
this.updateParams.chargeDeptName = null;
this.updateParams.chargeUserId = null;
this.updateParams.chargeUserName = null;
this.updateParams.chargeDeptId = null;
public showUpdateModel(id) { this.updateParams.type = null;
this.showUpdate = true this.updateParams.postName = null;
this.updateParams.postCode = null;
this.updateParams.deviceName = null;
this.updateParams.deviceInventoryId = null;
this.updateParams.name = null;
this.updateParams.steps = [];
this.updateParams.stepNum = 0;
this.loadUnitData(data)
}
//
if (item && item.key === 'unitId') {
const unitData = this.unitList.find((itm: any) => itm.value === data) as any;
this.updateParams.chargeDeptName = unitData.deptName;
this.updateParams.chargeUserId = unitData.userId;
this.updateParams.chargeUserName = unitData.userName;
this.updateParams.chargeDeptId = unitData.deptId;
this.updateParams.type = null;
this.updateParams.postName = null;
this.updateParams.postCode = null;
this.updateParams.deviceName = null;
this.updateParams.deviceInventoryId = null;
this.updateParams.name = null;
this.updateParams.steps = [];
this.updateParams.stepNum = 0;
this.loadJobData(data)
}
//
if (item && item.key === 'deviceInventoryId') {
const diviceData = this.diviceList.find((itm: any) => itm.value === data) as any;
this.updateParams.type = diviceData.type;
this.updateParams.postName = diviceData.postName;
this.updateParams.postCode = diviceData.postCode;
this.updateParams.deviceName = diviceData.name;
this.updateParams.name = diviceData.name;
this.updateParams.items = diviceData.items.map((item, index) => {
item.index = index + 1;
item.itemName = item.name;
item.itemStandard = item.standard;
return item
})
this.updateParams.itemNum = diviceData.items.length;
this.buildUpdateForm()
}
//
if (item && item.key === 'majorSign') {
if (data.includes(0)) {
data.splice(0, data.length)
data.push(0)
}
this.buildUpdateForm()
}
}
//
public loadJobData(id?) {
this.diviceService.selectByPage({ pageSize: 1000, unitId: id }).then((res: any) => {
this.diviceList = res.data.datas.map(item => {
return {
name: item.name,
value: item.id,
type: item.type,
postCode: item.postCode,
postName: item.postName,
items: item.items,
itemNum: item.itemNum
}
});
this.buildUpdateForm()
})
}
//
public showPros(el, data) {
const isTarget = el.target.classList.contains("link");
if (isTarget) {
this.showProtable = true;
this.currentProTableData.datas = data.items.map((item, index) => {
item.index = index + 1;
return item
})
}
}
//--
public proCallback() {
this.showProtable = false;
}
//
public showUpdateModel(row, isReadonly, isModifyonly) {
this.updateParams = { number: null, tableItems: [] } as any;
if (!row) {
this.currentId = -1;
this.showUpdate = true;
} else {
this.currentId = row.id;
this.tableService.selectById(this.currentId).then((res: any) => {
if (isReadonly) {
this.updateParams = Object.assign({
majorHazardName: !res.data.majorHazard ? null : res.data.majorHazard.split(";").map(item => this.sourceMap[item]).join(";"),
regulatoryProcessName: !res.data.regulatoryProcess ? null : res.data.regulatoryProcess.split(";").map(item => this.craftMap[item]).join(";"),
regulatoryChemicalName: !res.data.regulatoryChemical ? null : res.data.regulatoryChemical.split(";").map(item => this.chemicaltMap[item]).join(";"),
majorSignName: !res.data.majorSign ? null : res.data.majorSign.split(";").map(item => this.$store.getters.prevention_majorsign_map[item]).join(";"),
riskLevelName: this.$store.getters.prevention_risk_level_map[res.data.riskLevel],
remainRiskLevelName: this.$store.getters.prevention_risk_level_map[res.data.remainRiskLevel],
typeName: this.$store.getters.prevention_device_type_map[res.data.type]
}, res.data)
this.updateParams.majorSign = this.stringChangeArray(res.data.majorSign)
this.updateParams.majorHazard = this.stringChangeArray(res.data.majorHazard)
this.updateParams.regulatoryProcess = this.stringChangeArray(res.data.regulatoryProcess)
this.updateParams.regulatoryChemical = this.stringChangeArray(res.data.regulatoryChemical)
this.updateParams.items = this.updateParams.items.map((item, index) => {
item.index = index + 1;
return item
})
this.isReadonly = true
} else {
this.isReadonly = false
this.isModifyonly = true
this.updateParams = res.data;
this.updateParams.majorSign = this.stringChangeArray(res.data.majorSign)
this.updateParams.majorHazard = this.stringChangeArray(res.data.majorHazard)
this.updateParams.regulatoryProcess = this.stringChangeArray(res.data.regulatoryProcess)
this.updateParams.regulatoryChemical = this.stringChangeArray(res.data.regulatoryChemical)
this.loadUnitData(res.data.areas)
this.loadJobData(res.data.unitId)
this.updateParams.items.forEach((item, i) => {
item.index = i + 1
})
}
this.buildUpdateForm()
this.showUpdate = true;
})
}
} }
public handleClose() { public handleClose() {
this.showUpdate = false; this.showUpdate = false;
} }
//
public doSave(goOn?) {
//
this.updateParams.majorSign = this.arrayChangeString(this.updateParams.majorSign)
this.updateParams.regulatoryProcess = this.arrayChangeString(this.updateParams.regulatoryProcess)
this.updateParams.regulatoryChemical = this.arrayChangeString(this.updateParams.regulatoryChemical)
this.updateParams.majorHazard = this.arrayChangeString(this.updateParams.majorHazard)
this.updateParams.safetyFactor = this.arrayChangeString(this.updateParams.safetyFactor)
if (!this.updateParams.id) {
if (this.updateParams.steps && this.updateParams.steps.length > 0) {
this.updateParams.items = this.updateParams.steps
this.updateParams.itemNum = this.updateParams.steps.length
} else {
this.updateParams.itemNum = this.updateParams.items.length
}
}
this.tableService.addOrUpdate(this.updateParams, !this.updateParams.id ? true : false).then((res) => {
this.$message.success(!this.updateParams.id ? "新增成功!" : "编辑成功!");
this.showUpdate = !!goOn;
this.getTableData();
})
}
//稿
public doSaveDraft() {
//
this.updateParams.majorSign = this.arrayChangeString(this.updateParams.majorSign)
this.updateParams.regulatoryProcess = this.arrayChangeString(this.updateParams.regulatoryProcess)
this.updateParams.regulatoryChemical = this.arrayChangeString(this.updateParams.regulatoryChemical)
this.updateParams.majorHazard = this.arrayChangeString(this.updateParams.majorHazard)
this.updateParams.safetyFactor = this.arrayChangeString(this.updateParams.safetyFactor)
if (this.updateParams.steps && this.updateParams.steps.length > 0) {
this.updateParams.items = this.updateParams.steps
this.updateParams.itemNum = this.updateParams.steps.length
} else {
this.updateParams.itemNum = this.updateParams.items.length
}
this.tableService.addOrDraft(this.updateParams, !this.updateParams.id).then((res) => {
this.$message.success(!this.updateParams.id ? "新增成功!" : "编辑成功!");
this.showUpdate = false;
this.getTableData();
})
}
public toggleAll() { public toggleAll() {
(this.$refs.multipleTable as any).toggleAllSelection(); (this.$refs.multipleTable as any).toggleAllSelection();
} }
@ -190,6 +798,65 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
public handleSelectionChange(data) { public handleSelectionChange(data) {
this.selectData = data; this.selectData = data;
} }
public handleSubSelectionChange(data) {
this.subSelectData = data
}
//
public showSubModel(row, isReadonly) {
this.updateParams.steps = this.updateParams.items
this.analysisUpdateParams = {
riskChoose: [],
remainChoose: [],
} as any;
if (row) {
if (isReadonly) {
this.analyIsReadonly = true;
this.analysisUpdateParams = Object.assign({
seriousResultName: row.seriousResult.split(";").map(item => this.$store.getters.prevention_serious_result_map[item]).join(";"),
safetySignName: row.safetySign.split(";").map(item => this.$store.getters.prevention_security_identifier_map[item]).join(";"),
riskLevelName: this.$store.getters.prevention_risk_level_map[row.riskLevel],
remainLevelName: this.$store.getters.prevention_risk_level_map[row.remainLevel],
riskControlLevelName: this.$store.getters.prevention_control_level_map[row.riskControlLevel],
typeName: this.$store.getters.prevention_device_type_map[row.deviceType]
}, row)
this.analysisUpdateParams = { ...this.analysisUpdateParams, ...JSON.parse(JSON.stringify(row)) };
} else {
this.analyIsReadonly = false
//
this.analysisUpdateParams = { ...this.analysisUpdateParams, ...JSON.parse(JSON.stringify(row)) };
this.analysisUpdateParams.seriousResult = this.stringChangeArray(row.seriousResult)
this.analysisUpdateParams.safetySign = this.stringChangeArray(row.safetySign)
this.analysisUpdateParams.riskChoose = row.riskChoose ? row.riskChoose.split(";") : []
this.analysisUpdateParams.remainChoose = row.remainChoose ? row.remainChoose.split(";") : []
this.analysisUpdateParams.chargeUserName = this.updateParams.chargeUserName
this.analysisUpdateParams.deviceName = this.updateParams.name
this.analysisUpdateParams.deviceType = this.updateParams.type
}
}
this.showSubUpdate = true
}
//
public arrayChangeString(data) {
if (data && data.length > 0) {
if (data instanceof Array) {
return data.join(";")
} else {
return data
}
} else {
return null
}
}
//
public stringChangeArray(data) {
if (data) {
return data.split(";").map((item) => parseInt(item))
}
}
} }
</script> </script>
<style lang="scss" scoped src="../../../common.component.scss"></style> <style lang="scss" scoped src="../../../common.component.scss"></style>