From 9db238dfe3d3fd54b5eb74d642e405a97c6cf1d8 Mon Sep 17 00:00:00 2001 From: kongyeqing <2697454777@qq.com> Date: Fri, 28 Jul 2023 14:51:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E7=A7=AF=E5=88=86=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E4=B8=8D=E6=98=BE=E7=A4=BA=EF=BC=8C=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/index.ts | 33 ++ src/views/blank.component.vue | 25 ++ src/views/common.component.scss | 8 +- src/views/hiddenDanger/common.component.html | 20 +- src/views/hiddenDanger/manager.component.vue | 7 + .../hiddenDanger/safe/action.component.vue | 2 +- .../hiddenDanger/safe/plan.component.vue | 4 +- .../exchangeFlow/exchange.component.vue | 43 ++- .../exchangeRecord.component.vue | 8 - src/views/risk/area/area.component.vue | 26 +- .../areaAnal/areaAnal.component.vue | 4 +- .../assessment/device/device.component.vue | 6 +- .../device/deviceAnal.component.html | 4 +- .../device/deviceAnal.component.vue | 363 +++++++++--------- .../risk/assessment/work/work.component.vue | 4 +- .../assessment/work/workAnal.component.vue | 332 ++++++++-------- src/views/risk/duty/duty.component.vue | 19 +- .../risk/identify/identify.component.vue | 106 ++--- 18 files changed, 566 insertions(+), 448 deletions(-) diff --git a/src/store/index.ts b/src/store/index.ts index 7efc72c..57713f9 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -36,6 +36,9 @@ export default new Vuex.Store({ prevention_training_level:[], prevention_integral_eventtype:[], prevention_integral_type:[], + prevention_risk_source:[], + prevention_risk_craft:[], + prevention_risk_chemical:[], }, getters: { dept_map:(state)=>{ @@ -248,6 +251,27 @@ export default new Vuex.Store({ }) return map }, + prevention_risk_source_map:(state)=>{ + const map = {}; + state.prevention_risk_source.forEach((item:any)=>{ + map[item.value] = item.name + }) + return map + }, + prevention_risk_craft_map:(state)=>{ + const map = {}; + state.prevention_risk_craft.forEach((item:any)=>{ + map[item.value] = item.name + }) + return map + }, + prevention_risk_chemical_map:(state)=>{ + const map = {}; + state.prevention_risk_chemical.forEach((item:any)=>{ + map[item.value] = item.name + }) + return map + }, }, mutations: { setAnalCntrol(state,data){ @@ -344,6 +368,15 @@ export default new Vuex.Store({ set_prevention_integral_type(state,data){ state.prevention_integral_type = data }, + set_prevention_risk_source(state,data){ + state.prevention_risk_source = data + }, + set_prevention_risk_craft(state,data){ + state.prevention_risk_craft = data + }, + set_prevention_risk_chemical(state,data){ + state.prevention_risk_chemical = data + }, }, actions: { }, diff --git a/src/views/blank.component.vue b/src/views/blank.component.vue index 548e323..1e51734 100644 --- a/src/views/blank.component.vue +++ b/src/views/blank.component.vue @@ -45,6 +45,9 @@ export default class BlankComponent extends Vue { this.systemService.getDictData("prevention_integral_eventtype"), this.systemService.getDictData("prevention_integral_type"), + this.systemService.getDictData("prevention_risk_source"), + this.systemService.getDictData("prevention_risk_craft"), + this.systemService.getDictData("prevention_risk_chemical"), ]).then(((results: any) => { this.$store.commit("setDeptTreeList", results[0].data); @@ -239,6 +242,28 @@ export default class BlankComponent extends Vue { } })) + + this.$store.commit("set_prevention_risk_source", results[31].data.map(item => { + return { + name: item.dictLabel, + value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue, + } + })) + + this.$store.commit("set_prevention_risk_craft", results[32].data.map(item => { + return { + name: item.dictLabel, + value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue, + } + })) + + this.$store.commit("set_prevention_risk_chemical", results[33].data.map(item => { + return { + name: item.dictLabel, + value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue, + } + })) + this.$store.commit("setDeptList", results[1].data.map((item) => { return { name: item.deptName, diff --git a/src/views/common.component.scss b/src/views/common.component.scss index bdaec9a..0d1e05d 100644 --- a/src/views/common.component.scss +++ b/src/views/common.component.scss @@ -24,7 +24,7 @@ .color_level_1{ color: #fff; - background-color:#3E70EB; + background-color:#116FF5; padding: 5px 21px; font-size: 12px; border-radius: 4px; @@ -32,7 +32,7 @@ .color_level_2{ color: #fff; - background-color:#E0AF46; + background-color:#FFC019; padding: 5px 15px; font-size: 12px; border-radius: 4px; @@ -40,7 +40,7 @@ .color_level_3{ color: #fff; - background-color:#EC7B45; + background-color:#FF7802; padding: 5px 15px; font-size: 12px; border-radius: 4px; @@ -48,7 +48,7 @@ .color_level_4{ color: #fff; - background-color:#E13030; + background-color:#E31C21; padding: 5px 15px; font-size: 12px; border-radius: 4px; diff --git a/src/views/hiddenDanger/common.component.html b/src/views/hiddenDanger/common.component.html index dd8723c..de94500 100644 --- a/src/views/hiddenDanger/common.component.html +++ b/src/views/hiddenDanger/common.component.html @@ -39,8 +39,11 @@ 查看 修改 - 删除 + 删除 下发 @@ -70,7 +73,7 @@ + :visible.sync="showRecord" width="980px" :before-close="handleClose" destroy-on-close>
{{scope.row.description}} + +
+ + +
@@ -170,7 +180,7 @@ + :visible.sync="showUpdate" width="980px" :before-close="handleClose" destroy-on-close>
隐患信息
+ :before-close="handleClose" destroy-on-close>
@@ -271,7 +281,7 @@ + width="980px" :before-close="handleClose" destroy-on-close>
取消 diff --git a/src/views/hiddenDanger/manager.component.vue b/src/views/hiddenDanger/manager.component.vue index 4bc970b..74c0866 100644 --- a/src/views/hiddenDanger/manager.component.vue +++ b/src/views/hiddenDanger/manager.component.vue @@ -752,6 +752,13 @@ export default class HiddenDangerManagerComponent extends BaseRecordComponent reform) { + this.$message.error("治理时限不能超过整改时限") + this.updateParams.executeDeadline = null; + return + } } if (item && item.key === "realConfirmTime") { const now = this.updateParams.createTime; diff --git a/src/views/hiddenDanger/safe/action.component.vue b/src/views/hiddenDanger/safe/action.component.vue index a9929ed..cf059aa 100644 --- a/src/views/hiddenDanger/safe/action.component.vue +++ b/src/views/hiddenDanger/safe/action.component.vue @@ -112,7 +112,7 @@ export default class RulesManagerComponent extends BaseRecordComponent { } }); this.tableColumn.push({ name: '检查对象', key: "analControlNames" }); - this.tableColumn.push({ name: '检查时间', key: "checkTime" }); + this.tableColumn.push({ name: '检查执行时间', key: "checkTime" }); this.tableColumn.push({ name: '检查负责人', key: "chargeUserName" }); this.tableColumn.push({ name: '检查表', key: "tableNum", render: (data) => { diff --git a/src/views/hiddenDanger/safe/plan.component.vue b/src/views/hiddenDanger/safe/plan.component.vue index ff3dd4f..417a432 100644 --- a/src/views/hiddenDanger/safe/plan.component.vue +++ b/src/views/hiddenDanger/safe/plan.component.vue @@ -263,7 +263,7 @@ export default class PlanComponent extends BaseRecordComponent { require: true, showError: false, }, { - name: "检查时间", + name: "计划检查时间", key: "time", type: "date", subType: "datetimerange", @@ -359,7 +359,7 @@ export default class PlanComponent extends BaseRecordComponent { } }); this.tableColumn.push({ - name: '检查时间', width: "270px", render: (data) => { + name: '计划检查时间', width: "270px", render: (data) => { return data.startTime + (data.endTime ? '~' + data.endTime : "") } }); diff --git a/src/views/integral/exchange/exchangeFlow/exchange.component.vue b/src/views/integral/exchange/exchangeFlow/exchange.component.vue index b2c7013..b6cf426 100644 --- a/src/views/integral/exchange/exchangeFlow/exchange.component.vue +++ b/src/views/integral/exchange/exchangeFlow/exchange.component.vue @@ -130,19 +130,23 @@ export default class IntegralExchange extends BaseRecordComponent { value: "save", type: "primary" }] + public subUpdateActions = [] as any; + public buildSubForm() { + this.subUpdateActions = [{ + name: "取消", + value: "cancel" + }, { + name: "保存并继续添加", + value: "saveAndContinue", + type: "primary", + hide: this.subUpdateParams.index + }, { + name: "保存", + value: "save", + type: "primary" + }]; + } - public subUpdateActions = [{ - name: "取消", - value: "cancel" - }, { - name: "保存并继续添加", - value: "saveAndContinue", - type: "primary", - }, { - name: "保存", - value: "save", - type: "primary" - }]; public tabs = [{ name: "待办", @@ -298,6 +302,7 @@ export default class IntegralExchange extends BaseRecordComponent { width: "calc(50% - 20px)", disable: true, showError: false, + hide:this.subIsReadonly, }, { name: "单价/积分", type: "number", @@ -395,7 +400,7 @@ export default class IntegralExchange extends BaseRecordComponent { this.subTableColumn.push({ name: '序号', key: "index", }); this.subTableColumn.push({ name: '商品名称', key: "name", }); - this.subTableColumn.push({ name: '库存', key: "stockNumber", }); + // this.subTableColumn.push({ name: '库存', key: "stockNumber", }); this.subTableColumn.push({ name: '单位', key: "goodsUnit", }); this.subTableColumn.push({ name: '单价', key: "goodsPrice", }); this.subTableColumn.push({ name: '兑换数量', key: "exchangeNumber", }); @@ -541,6 +546,7 @@ export default class IntegralExchange extends BaseRecordComponent { this.buildSubUpdateForm() this.subShowUpdate = true this.subIsReadonly = false + this.buildSubForm() } else if (data.value === "save") { if (this.updateParams.pointExchangeDetails.length === 0) { this.$message.error("请您添加兑换清单"); @@ -678,6 +684,7 @@ export default class IntegralExchange extends BaseRecordComponent { } public doSubSave(goOn) { + // 如果是新增步骤 if (this.subShowUpdate) { if (!this.subUpdateParams.exchangeNumber) { @@ -695,6 +702,13 @@ export default class IntegralExchange extends BaseRecordComponent { this.countIntegral() this.subUpdateParams = {} as any; this.subShowUpdate = !!goOn; + if (goOn) { + this.goodsList = JSON.parse(JSON.stringify(this.totalGoodsList)) + this.updateParams.pointExchangeDetails.forEach((item) => { + this.goodsList.splice(this.goodsList.findIndex(goodsItem => goodsItem.value === item.goodsId), 1) + }) + this.buildSubUpdateForm() + } return } } @@ -713,6 +727,7 @@ export default class IntegralExchange extends BaseRecordComponent { }) this.subIsReadonly = false this.subUpdateParams = JSON.parse(JSON.stringify(row)) + this.buildSubForm() } this.subShowUpdate = true this.buildSubUpdateForm() @@ -748,6 +763,7 @@ export default class IntegralExchange extends BaseRecordComponent { let residuePoints = this.updateParams.originalPoints - consumePoint; this.updateParams.consumePoints = consumePoint; this.updateParams.residuePoints = residuePoints; + this.buildUpdateForm() } //处理任务 @@ -796,6 +812,7 @@ export default class IntegralExchange extends BaseRecordComponent { }) this.showProtable = true } + this.getIntegralGoods({}) } //操作 diff --git a/src/views/integral/exchange/exchangeRecord/exchangeRecord.component.vue b/src/views/integral/exchange/exchangeRecord/exchangeRecord.component.vue index d84ecb8..9c63fa6 100644 --- a/src/views/integral/exchange/exchangeRecord/exchangeRecord.component.vue +++ b/src/views/integral/exchange/exchangeRecord/exchangeRecord.component.vue @@ -227,13 +227,6 @@ export default class IntegralExchangeRecord extends BaseRecordComponent { width: "calc(50% - 20px)", }, { - name: "库存", - type: "number", - key: "stockNumber", - require: true, - width: "calc(50% - 20px)", - disable: true, - }, { name: "单价/积分", type: "number", key: "goodsPrice", @@ -285,7 +278,6 @@ export default class IntegralExchangeRecord extends BaseRecordComponent { this.subTableColumn.push({ name: '序号', key: "index", }); this.subTableColumn.push({ name: '商品名称', key: "name", }); - this.subTableColumn.push({ name: '库存', key: "stockNumber", }); this.subTableColumn.push({ name: '单位', key: "goodsUnit", }); this.subTableColumn.push({ name: '单价', key: "goodsPrice", }); this.subTableColumn.push({ name: '兑换数量', key: "exchangeNumber", }); diff --git a/src/views/risk/area/area.component.vue b/src/views/risk/area/area.component.vue index 0b6a020..9b87721 100644 --- a/src/views/risk/area/area.component.vue +++ b/src/views/risk/area/area.component.vue @@ -407,16 +407,17 @@ export default class AreaManagerComponent extends BaseRecordComponent { } public levelName(type) { - if (type === 1) { - return "一级" - } else if (type === 2) { - return "二级" - } else if (type === 3) { - return "三级" - } else if (type === 4) { - return "四级" - } else if (type === 5) { - return "不涉及级" + switch (type) { + case 1: + return "一级" + case 2: + return "二级" + case 3: + return "三级" + case 4: + return "四级" + case 5: + return "不涉及级" } } @@ -428,11 +429,11 @@ export default class AreaManagerComponent extends BaseRecordComponent { public toggleAll() { - this.tableData.datas.forEach((item, index) => { (this.$refs.multipleTable as any).toggleRowSelection(item); }) } + public selectAll() { if (!this.selectData.length) { this.toggleAll() @@ -450,9 +451,6 @@ export default class AreaManagerComponent extends BaseRecordComponent { this.selectData = data; } - - mounted() { - } } diff --git a/src/views/risk/assessment/areaAnal/areaAnal.component.vue b/src/views/risk/assessment/areaAnal/areaAnal.component.vue index 06f0006..ed5bc9c 100644 --- a/src/views/risk/assessment/areaAnal/areaAnal.component.vue +++ b/src/views/risk/assessment/areaAnal/areaAnal.component.vue @@ -132,8 +132,8 @@ export default class AreaAnalComponent extends BaseRecordComponent { public showUpdateModel(id){ - if(id!==-1){ - } + // if(id!==-1){ + // } this.showUpdate = true } diff --git a/src/views/risk/assessment/device/device.component.vue b/src/views/risk/assessment/device/device.component.vue index 28842a3..efad215 100644 --- a/src/views/risk/assessment/device/device.component.vue +++ b/src/views/risk/assessment/device/device.component.vue @@ -291,7 +291,7 @@ export default class DeviceManagerComponent extends BaseRecordComponent { public buildTable() { this.tableColumn.push({ name: '区域名称', key: "areaName", width: "200px" }); this.tableColumn.push({ name: '风险分析单元', key: "unitName", width: "200px" }); - this.tableColumn.push({ name: '设备名称', key: "name",width:"250px",showTip: true, }); + this.tableColumn.push({ name: '设备名称', key: "name", width: "250px", showTip: true, }); this.tableColumn.push({ name: '设备类别', key: "type", render: (data) => { if (data.type) { @@ -458,8 +458,8 @@ export default class DeviceManagerComponent extends BaseRecordComponent { public toggleAll() { - - this.tableData.datas.forEach((item,index)=>{ + + this.tableData.datas.forEach((item, index) => { (this.$refs.multipleTable as any).toggleRowSelection(item); }) } diff --git a/src/views/risk/assessment/device/deviceAnal.component.html b/src/views/risk/assessment/device/deviceAnal.component.html index cd3c70d..3e899db 100644 --- a/src/views/risk/assessment/device/deviceAnal.component.html +++ b/src/views/risk/assessment/device/deviceAnal.component.html @@ -46,7 +46,7 @@
+ :visible.sync="showUpdate" width="1080px" :before-close="handleClose">
安全检查表分析法
@@ -89,7 +89,7 @@
+ :before-close="handleAnalyClose" > diff --git a/src/views/risk/assessment/device/deviceAnal.component.vue b/src/views/risk/assessment/device/deviceAnal.component.vue index 21dbc23..261857b 100644 --- a/src/views/risk/assessment/device/deviceAnal.component.vue +++ b/src/views/risk/assessment/device/deviceAnal.component.vue @@ -71,21 +71,6 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent }]; public labelWidth = '140px'; - - //数据字典 - public dictData = { - source: [], - craft: [], - chemical: [], - mainPerson: [], - craftPerson: [], - operatePerson: [], - measuresSort: [], - riskControlLevel: [], - seriousResult: [], - identifier: [], - majorsign: [], - } as any; //评估矩阵 public showMatrixModal = false; //评价 @@ -293,7 +278,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent format: "majorHazardName", width: "calc(50% - 20px)", require: true, - datas: this.dictData.source + datas: this.$store.state.prevention_risk_source }, { name: "重点监管工艺", @@ -303,7 +288,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent type: "select", width: "calc(50% - 20px)", require: true, - datas: this.dictData.craft, + datas: this.$store.state.prevention_risk_craft, }, { name: "重点监管化学品", key: "regulatoryChemical", @@ -313,7 +298,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent width: "calc(50% - 20px)", require: true, labelWidth: "130px", - datas: this.dictData.chemical, + datas: this.$store.state.prevention_risk_chemical }]; this.subTableActions = [{ @@ -381,36 +366,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent } 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() - })); + // } // 加载区域列表 @@ -530,7 +486,7 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent } } }); - this.subTableColumn.push({ name: '检查项目', key: "itemName" }); + this.subTableColumn.push({ name: '检查项目', key: "itemName" ,showTip: true,}); this.subTableColumn.push({ name: '检查标准', key: "itemStandard", showTip: true, width: "100px" }); this.subTableColumn.push({ name: '风险源', key: "riskSource" }); this.subTableColumn.push({ name: '危害分析', key: "hazardAnalysis" }); @@ -584,13 +540,13 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent }); this.proTableColumn.push({ name: '风险等级', key: "riskLevel", render: (data) => { - return "" + (data.riskLevel ? (this.$store.getters.prevention_risk_level_map[data.riskLevel]) : '') + "" + return "" + (data.riskLevel ? (this.$store.getters.prevention_risk_level_map[data.riskLevel]) : '') + "" }, }); this.proTableColumn.push({ name: '残余风险等级', key: "remainLevel", width: "150px", render: (data) => { if (data.remainLevel) { - return "" + (data.remainLevel ? (this.$store.getters.prevention_risk_level_map[data.remainLevel]) : '') + "" + return "" + (data.remainLevel ? (this.$store.getters.prevention_risk_level_map[data.remainLevel]) : '') + "" } } @@ -643,7 +599,6 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent this.isReadonly = false; } else if (data && data.value === "subDelete") { if (this.subSelectData.length > 0) { - this.$confirm('确认删除所选数据', '确认数据', { confirmButtonText: '确定', cancelButtonText: '取消', @@ -656,10 +611,8 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent 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.addCheckTableIndex() this.updateParams.itemNum = this.updateParams.items.length }).catch(() => { // @@ -691,59 +644,31 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent this.updateParams.unitId = null; } const areaData = this.areaList.find((itm: any) => itm.value === data) as any; - this.updateParams.analRiskLevel = areaData.analRiskLevel - - this.updateParams.chargeDeptName = null; - this.updateParams.chargeUserId = null; - this.updateParams.chargeUserName = null; - this.updateParams.chargeDeptId = null; - - 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.initAreaParamMethod(areaData); + //区域关联数据初始化 + this.initParamMethod(); 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.initUnitParamMethod(unitData); + //单元关联数据初始化 + this.initParamMethod(); + //加载设备设施清单列表 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.initDeviceParamMethod(diviceData); } //是否为两大一重 + //多选 选中不涉及时,其他三项不可选中 if (item && item.key === 'majorSign') { if (!data) { data = [] @@ -755,6 +680,54 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent } this.buildUpdateForm() } + + + //区域数据 + public initAreaParamMethod(areaData: any) { + this.updateParams.analRiskLevel = areaData.analRiskLevel; + this.updateParams.chargeDeptName = null; + this.updateParams.chargeUserId = null; + this.updateParams.chargeUserName = null; + this.updateParams.chargeDeptId = null; + } + + //单元数据 + public initUnitParamMethod(unitData: any) { + this.updateParams.chargeDeptName = unitData.deptName; + this.updateParams.chargeUserId = unitData.userId; + this.updateParams.chargeUserName = unitData.userName; + this.updateParams.chargeDeptId = unitData.deptId; + } + + //区域单元切换,数据初始化 + public initParamMethod() { + 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; + } + + + //设备数据 + public initDeviceParamMethod(diviceData: 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; + } + //加载设备设施清单列表 public loadJobData(unitId) { this.tableService.selectDeviceByUnit({ unitId: unitId, id: this.updateParams.id ? this.updateParams.id : null }).then((res: any) => { @@ -809,45 +782,23 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent this.currentId = row.id; this.tableService.selectById(this.currentId).then((res: any) => { if (isReadonly) { - const areaAnalRiskLevel = this.areaList.filter((item) => item.value === res.data.areaId)[0]['analRiskLevel'] - const majorHazard = res.data.majorHazard ? parseInt(res.data.majorHazard) : null - const regulatoryProcess = res.data.regulatoryProcess ? parseInt(res.data.regulatoryProcess) : null - const regulatoryChemical = res.data.regulatoryChemical ? parseInt(res.data.regulatoryChemical) : null - - this.updateParams = Object.assign({ - majorHazardName: majorHazard || majorHazard === 0 ? this.sourceMap[majorHazard] : null, - regulatoryProcessName: regulatoryProcess || regulatoryProcess === 0 ? this.craftMap[regulatoryProcess] : null, - regulatoryChemicalName: regulatoryChemical || regulatoryChemical === 0 ? this.chemicaltMap[regulatoryChemical] : null, - 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], - analRiskLevelName: this.$store.getters.prevention_risk_level_map[areaAnalRiskLevel] - }, res.data) - this.updateParams.majorSign = res.data.majorSign ? this.stringChangeArray(res.data.majorSign) : null - 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 - }) + //select项翻译 + this.readonlyParamTransform(res); + //添加序号 + this.addCheckTableIndex() this.isReadonly = true } else { this.isReadonly = false this.isModifyonly = true this.updateParams = res.data; - this.updateParams.majorSign = res.data.majorSign ? this.stringChangeArray(res.data.majorSign) : [] - this.updateParams.majorHazard = res.data.majorHazard ? parseInt(res.data.majorHazard) : null - this.updateParams.regulatoryProcess = res.data.regulatoryProcess ? parseInt(res.data.regulatoryProcess) : null - this.updateParams.regulatoryChemical = res.data.regulatoryChemical ? parseInt(res.data.regulatoryChemical) : null - const areaAnalRiskLevel = this.areaList.filter((item) => item.value === res.data.areaId)[0]['analRiskLevel'] - this.updateParams.analRiskLevel = areaAnalRiskLevel + //对select进行转换 + this.updateParamTransform(res); + //获取区域固有风险等级 + this.getAreaRiskLevel(res); this.loadUnitData(res.data.areaId) this.loadJobData(res.data.unitId) - this.updateParams.items.forEach((item, i) => { - item.index = i + 1 - }) + //添加序号 + this.addCheckTableIndex() } this.buildUpdateForm() @@ -857,6 +808,38 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent } } + //查看,select项翻译 + public readonlyParamTransform(res: any) { + const areaAnalRiskLevel = this.areaList.filter((item) => item.value === res.data.areaId)[0]['analRiskLevel']; + const majorHazard = res.data.majorHazard ? parseInt(res.data.majorHazard) : null; + const regulatoryProcess = res.data.regulatoryProcess ? parseInt(res.data.regulatoryProcess) : null; + const regulatoryChemical = res.data.regulatoryChemical ? parseInt(res.data.regulatoryChemical) : null; + + this.updateParams = Object.assign({ + majorHazardName: majorHazard || majorHazard === 0 ? this.$store.getters.prevention_risk_source_map[majorHazard] : null, + regulatoryProcessName: regulatoryProcess || regulatoryProcess === 0 ? this.$store.getters.prevention_risk_craft_map[regulatoryProcess] : null, + regulatoryChemicalName: regulatoryChemical || regulatoryChemical === 0 ? this.$store.getters.prevention_risk_chemical_map[regulatoryChemical] : null, + 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], + analRiskLevelName: this.$store.getters.prevention_risk_level_map[areaAnalRiskLevel] + }, res.data); + } + + //编辑对select进行转换 + public updateParamTransform(res: any) { + this.updateParams.majorSign = res.data.majorSign ? this.stringChangeArray(res.data.majorSign) : []; + this.updateParams.majorHazard = res.data.majorHazard ? parseInt(res.data.majorHazard) : null; + this.updateParams.regulatoryProcess = res.data.regulatoryProcess ? parseInt(res.data.regulatoryProcess) : null; + this.updateParams.regulatoryChemical = res.data.regulatoryChemical ? parseInt(res.data.regulatoryChemical) : null; + } + //获取区域固有风险等级 + public getAreaRiskLevel(res: any) { + const areaAnalRiskLevel = this.areaList.filter((item) => item.value === res.data.areaId)[0]['analRiskLevel']; + this.updateParams.analRiskLevel = areaAnalRiskLevel; + } + public handleClose() { this.showUpdate = false; } @@ -864,45 +847,44 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent //保存 更新 public doSave(goOn?) { // 如果是新增工作危害分析清单 - this.updateParams.majorSign = this.arrayChangeString(this.updateParams.majorSign) - this.updateParams.regulatoryProcess = this.numberChangeString(this.updateParams.regulatoryProcess) - this.updateParams.regulatoryChemical = this.numberChangeString(this.updateParams.regulatoryChemical) - this.updateParams.majorHazard = this.numberChangeString(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.saveTransformData(); this.tableService.addOrUpdate(this.updateParams, !this.updateParams.id || this.updateParams.status === 1 ? 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.numberChangeString(this.updateParams.regulatoryProcess) - this.updateParams.regulatoryChemical = this.numberChangeString(this.updateParams.regulatoryChemical) - this.updateParams.majorHazard = this.numberChangeString(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.saveTransformData(); this.tableService.addOrDraft(this.updateParams, !this.updateParams.id).then((res) => { this.$message.success(!this.updateParams.id ? "新增成功!" : "编辑成功!"); this.showUpdate = false; this.getTableData(); }) } + + //保存 存草稿 对数据进行处理 + public saveTransformData() { + this.updateParams.majorSign = this.arrayChangeString(this.updateParams.majorSign); + this.updateParams.regulatoryProcess = this.numberChangeString(this.updateParams.regulatoryProcess); + this.updateParams.regulatoryChemical = this.numberChangeString(this.updateParams.regulatoryChemical); + this.updateParams.majorHazard = this.numberChangeString(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; + } + } + } public toggleAll() { this.tableData.datas.forEach((item, index) => { @@ -940,43 +922,61 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent if (row) { if (isReadonly) { this.analyIsReadonly = true; - this.analysisUpdateParams = Object.assign({ - seriousResultName: !row.seriousResult ? null : row.seriousResult.split(",").map(item => this.$store.getters.prevention_serious_result_map[item]).join(","), - safetySignName: !row.safetySign ? null : 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) + //select 翻译 + this.analysisTransformParam(row); this.analysisUpdateParams = { ...this.analysisUpdateParams, ...JSON.parse(JSON.stringify(row)) }; - this.analysisUpdateParams.measures.forEach((item, index) => { - item.index = index + 1 - return item - }) + //管控措施 + this.initAnalysisMeasure(); } 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.checkRiskType.risk = this.analysisUpdateParams.riskChoose - this.checkRiskType.remain = this.analysisUpdateParams.remainChoose - - this.analysisUpdateParams.measures.forEach((item, index) => { - item.index = index + 1 - return item - }) + //编辑 参数处理 + this.updateAnalysisParam(row); + //管控措施 + this.initAnalysisMeasure(); } } this.showSubUpdate = true } + //安全检查分析法 查看翻译 + public analysisTransformParam(row: any) { + this.analysisUpdateParams = Object.assign({ + seriousResultName: !row.seriousResult ? null : row.seriousResult.split(",").map(item => this.$store.getters.prevention_serious_result_map[item]).join(","), + safetySignName: !row.safetySign ? null : 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); + } + + //安全检查 编辑 数据处理 + public updateAnalysisParam(row: any) { + 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.checkRiskType.risk = this.analysisUpdateParams.riskChoose; + this.checkRiskType.remain = this.analysisUpdateParams.remainChoose; + } + + //管控措施初始化 + public initAnalysisMeasure() { + if (!this.analysisUpdateParams.measures) { + this.analysisUpdateParams.measures = []; + } + this.analysisUpdateParams.measures.forEach((item, index) => { + item.index = index + 1; + return item; + }); + } + //数组转字符串 public arrayChangeString(data) { if (data && data.length > 0) { @@ -1005,6 +1005,13 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent return null } } + //安全检查法 add 序号 + public addCheckTableIndex() { + this.updateParams.items.forEach((item, index) => { + item.index = index + 1; + return item + }) + } } diff --git a/src/views/risk/assessment/work/work.component.vue b/src/views/risk/assessment/work/work.component.vue index 576e41f..6c80a83 100644 --- a/src/views/risk/assessment/work/work.component.vue +++ b/src/views/risk/assessment/work/work.component.vue @@ -348,6 +348,7 @@ export default class WorkManagerComponent extends BaseRecordComponent { this.subTableColumn.push({ name: '作业人', key: "workerName" }); } + //作业步骤 public showSteps(el, data) { const isTarget = el.target.classList.contains("link"); if (isTarget) { @@ -514,7 +515,8 @@ export default class WorkManagerComponent extends BaseRecordComponent { this.isReadonly = !!isRead; if (!row) { this.updateParams = { - steps: [], identifyTime: moment().format('YYYY-MM-DD'), + steps: [], + identifyTime: moment().format('YYYY-MM-DD'), identifyUserId: this.account.userId, } as any; } else { diff --git a/src/views/risk/assessment/work/workAnal.component.vue b/src/views/risk/assessment/work/workAnal.component.vue index b94a602..470ce90 100644 --- a/src/views/risk/assessment/work/workAnal.component.vue +++ b/src/views/risk/assessment/work/workAnal.component.vue @@ -52,7 +52,6 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent { public subTableColumn = [] as any; public currentId = -1; - public sourceMap = {} as any; public craftMap = {} as any; public chemicaltMap = {} as any public majorsignMap = {} as any; @@ -71,20 +70,6 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent { value: "cancel" }]; - //数据字典 - public dictData = { - source: [], - craft: [], - chemical: [], - mainPerson: [], - craftPerson: [], - operatePerson: [], - measuresSort: [], - riskControlLevel: [], - seriousResult: [], - identifier: [], - majorsign: [], - } as any; //评估矩阵 public showMatrixModal = false; //评价 @@ -292,7 +277,7 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent { width: "calc(50% - 20px)", require: true, // multiple: true, - datas: this.dictData.source, + datas: this.$store.state.prevention_risk_source, showError: false, }, { @@ -304,7 +289,7 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent { width: "calc(50% - 20px)", require: true, // multiple: true, - datas: this.dictData.craft, + datas: this.$store.state.prevention_risk_craft, showError: false, }, { name: "重点监管化学品", @@ -315,7 +300,7 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent { width: "calc(50% - 20px)", require: true, // multiple: true, - datas: this.dictData.chemical, + datas: this.$store.state.prevention_risk_chemical, showError: false, }]; @@ -386,36 +371,7 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent { } 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() - })); + // } // 加载区域列表 @@ -635,14 +591,18 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent { this.buildActionsForm() } 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) { this.$confirm('确认删除所选数据', '确认数据', { @@ -657,10 +617,8 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent { this.updateParams.deleteIds.push(itemData.id) this.updateParams.steps.splice(this.updateParams.steps.findIndex(item => item.index === itemData.index), 1) }) - this.updateParams.steps.forEach((item, index) => { - item.index = index + 1 - return item - }) + //分析步骤添加序号 + this.addStepsIndex() this.updateParams.stepNum = this.updateParams.steps.length }).catch(() => { // @@ -692,57 +650,32 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent { 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; - - this.updateParams.type = null; - this.updateParams.postName = null; - this.updateParams.postCode = null; - this.updateParams.jobInventoryName = null; - this.updateParams.jobInventoryId = null; - this.updateParams.name = null; - this.updateParams.steps = []; - this.updateParams.stepNum = 0; + //区域数据 + this.initAreaParamMethod(areaData); + //区域关联数据初始化 + this.initParamMethod(); + //关联单元 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.jobInventoryName = null; - this.updateParams.jobInventoryId = null; - this.updateParams.name = null; - this.updateParams.steps = []; - this.updateParams.stepNum = 0; + //单元数据 + this.initUnitParamMethod(unitData); + //单元关联数据初始化 + this.initParamMethod(); + //关联作业活动 this.loadJobData(data) } //作业清单 if (item && item.key === 'jobInventoryId') { const jobData = this.jobList.find((itm: any) => itm.value === data) as any; - this.updateParams.location = jobData.location; - this.updateParams.postCode = jobData.postCode; - this.updateParams.postName = jobData.postName; - this.updateParams.steps = jobData.steps; - this.updateParams.jobInventoryName = jobData.name; - this.updateParams.stepNum = jobData.steps.length; - this.updateParams.steps.forEach((item, i) => { - item.index = i + 1 - }) + //作业活动 + this.initJobParamMethod(jobData) } //是否为两大一重 + //多选 选中不涉及时,其他三项不可选中 if (item && item.key === 'majorSign') { if (!data) { data = [] @@ -772,6 +705,47 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent { this.buildUpdateForm() }) } + //区域数据 + public initAreaParamMethod(areaData: any) { + this.updateParams.analRiskLevel = areaData.analRiskLevel; + this.updateParams.chargeDeptName = null; + this.updateParams.chargeUserId = null; + this.updateParams.chargeUserName = null; + this.updateParams.chargeDeptId = null; + } + + //单元数据 + public initUnitParamMethod(unitData: any) { + this.updateParams.chargeDeptName = unitData.deptName; + this.updateParams.chargeUserId = unitData.userId; + this.updateParams.chargeUserName = unitData.userName; + this.updateParams.chargeDeptId = unitData.deptId; + } + + //作业活动数据 + public initJobParamMethod(jobData: any) { + this.updateParams.location = jobData.location; + this.updateParams.postCode = jobData.postCode; + this.updateParams.postName = jobData.postName; + this.updateParams.steps = jobData.steps; + this.updateParams.jobInventoryName = jobData.name; + this.updateParams.stepNum = jobData.steps.length; + this.updateParams.steps.forEach((item, i) => { + item.index = i + 1 + }) + } + //区域单元切换,数据初始化 + public initParamMethod() { + this.updateParams.type = null; + this.updateParams.postName = null; + this.updateParams.postCode = null; + this.updateParams.jobInventoryName = null; + this.updateParams.jobInventoryId = null; + this.updateParams.name = null; + this.updateParams.location = null; + this.updateParams.steps = []; + this.updateParams.stepNum = 0; + } //作业步骤 public showPros(el, data) { const isTarget = el.target.classList.contains("link"); @@ -798,45 +772,26 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent { this.currentId = row.id; this.tableService.selectById(this.currentId).then((res: any) => { if (isReadonly) { - const areaAnalRiskLevel = this.areaList.filter((item) => item.value === res.data.areaId)[0]['analRiskLevel'] - const majorHazard = res.data.majorHazard ? parseInt(res.data.majorHazard) : null - const regulatoryProcess = res.data.regulatoryProcess ? parseInt(res.data.regulatoryProcess) : null - const regulatoryChemical = res.data.regulatoryChemical ? parseInt(res.data.regulatoryChemical) : null - this.updateParams = Object.assign({ - majorHazardName: majorHazard || majorHazard === 0 ? this.sourceMap[majorHazard] : null, - regulatoryProcessName: regulatoryProcess || regulatoryProcess === 0 ? this.craftMap[regulatoryProcess] : null, - regulatoryChemicalName: regulatoryChemical || regulatoryChemical === 0 ? this.chemicaltMap[regulatoryChemical] : null, - 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], - analRiskLevelName: this.$store.getters.prevention_risk_level_map[areaAnalRiskLevel] - }, 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.steps = this.updateParams.steps.map((item, index) => { - item.index = index + 1; - return item - }) + //select项翻译 + this.readonlyParamTransform(res); + //分析步骤添加序号 + this.addStepsIndex() this.isReadonly = true; this.isModifyonly = false } else { this.isReadonly = false this.isModifyonly = true this.updateParams = res.data; - this.updateParams.majorSign = res.data.majorSign ? this.stringChangeArray(res.data.majorSign) : [] - this.updateParams.majorHazard = res.data.majorHazard ? parseInt(res.data.majorHazard) : null - this.updateParams.regulatoryProcess = res.data.regulatoryProcess ? parseInt(res.data.regulatoryProcess) : null - this.updateParams.regulatoryChemical = res.data.regulatoryChemical ? parseInt(res.data.regulatoryChemical) : null - const areaAnalRiskLevel = this.areaList.filter((item) => item.value === res.data.areaId)[0]['analRiskLevel'] - this.updateParams.analRiskLevel = areaAnalRiskLevel + //对select进行转换 + this.updateParamTransform(res); + //获取区域固有风险等级 + this.getAreaRiskLevel(res); + //加载区域 this.loadUnitData(res.data.areaId) + //加载单元 this.loadJobData(res.data.unitId) - this.updateParams.steps.forEach((item, i) => { - item.index = i + 1 - }) + //分析步骤添加序号 + this.addStepsIndex() } this.buildUpdateForm(); @@ -846,6 +801,40 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent { } } + + + //查看,select项翻译 + public readonlyParamTransform(res: any) { + const areaAnalRiskLevel = this.areaList.filter((item) => item.value === res.data.areaId)[0]['analRiskLevel']; + const majorHazard = res.data.majorHazard ? parseInt(res.data.majorHazard) : null; + const regulatoryProcess = res.data.regulatoryProcess ? parseInt(res.data.regulatoryProcess) : null; + const regulatoryChemical = res.data.regulatoryChemical ? parseInt(res.data.regulatoryChemical) : null; + this.updateParams = Object.assign({ + majorHazardName: majorHazard || majorHazard === 0 ? this.$store.getters.prevention_risk_source_map[majorHazard] : null, + regulatoryProcessName: regulatoryProcess || regulatoryProcess === 0 ? this.$store.getters.prevention_risk_craft_map[regulatoryProcess] : null, + regulatoryChemicalName: regulatoryChemical || regulatoryChemical === 0 ? this.$store.getters.prevention_risk_chemical_map[regulatoryChemical] : null, + 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], + analRiskLevelName: this.$store.getters.prevention_risk_level_map[areaAnalRiskLevel] + }, res.data); + } + + //编辑对select进行转换 + public updateParamTransform(res: any) { + this.updateParams.majorSign = res.data.majorSign ? this.stringChangeArray(res.data.majorSign) : []; + this.updateParams.majorHazard = res.data.majorHazard ? parseInt(res.data.majorHazard) : null; + this.updateParams.regulatoryProcess = res.data.regulatoryProcess ? parseInt(res.data.regulatoryProcess) : null; + this.updateParams.regulatoryChemical = res.data.regulatoryChemical ? parseInt(res.data.regulatoryChemical) : null; + } + + //获取区域固有风险等级 + public getAreaRiskLevel(res: any) { + const areaAnalRiskLevel = this.areaList.filter((item) => item.value === res.data.areaId)[0]['analRiskLevel']; + this.updateParams.analRiskLevel = areaAnalRiskLevel; + } + public handleClose() { this.showUpdate = false; } @@ -857,33 +846,37 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent { //保存 更新 public doSave(goOn?) { // 如果是新增工作危害分析清单 - this.updateParams.majorSign = this.arrayChangeString(this.updateParams.majorSign) - this.updateParams.regulatoryProcess = this.numberChangeString(this.updateParams.regulatoryProcess) - this.updateParams.regulatoryChemical = this.numberChangeString(this.updateParams.regulatoryChemical) - this.updateParams.majorHazard = this.numberChangeString(this.updateParams.majorHazard) - this.updateParams.safetyFactor = this.arrayChangeString(this.updateParams.safetyFactor) + //对数据进行处理 + this.saveTransformData(); this.tableService.addOrUpdate(this.updateParams, !this.updateParams.id || this.updateParams.status === 1 ? 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.numberChangeString(this.updateParams.regulatoryProcess) - this.updateParams.regulatoryChemical = this.numberChangeString(this.updateParams.regulatoryChemical) - this.updateParams.majorHazard = this.numberChangeString(this.updateParams.majorHazard) - this.updateParams.safetyFactor = this.arrayChangeString(this.updateParams.safetyFactor) + //对数据进行处理 + this.saveTransformData(); this.tableService.addOrDraft(this.updateParams, !this.updateParams.id).then((res) => { this.$message.success(!this.updateParams.id ? "新增成功!" : "编辑成功!"); this.showUpdate = false; this.getTableData(); }) } - public toggleAll() { + //保存处理数据 + public saveTransformData() { + this.updateParams.majorSign = this.arrayChangeString(this.updateParams.majorSign); + this.updateParams.regulatoryProcess = this.numberChangeString(this.updateParams.regulatoryProcess); + this.updateParams.regulatoryChemical = this.numberChangeString(this.updateParams.regulatoryChemical); + this.updateParams.majorHazard = this.numberChangeString(this.updateParams.majorHazard); + this.updateParams.safetyFactor = this.arrayChangeString(this.updateParams.safetyFactor); + } + public toggleAll() { this.tableData.datas.forEach((item, index) => { (this.$refs.multipleTable as any).toggleRowSelection(item); }) @@ -917,45 +910,56 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent { 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], - }, row) + //select 翻译 + this.analysisTransformParam(row); this.analysisUpdateParams = { ...this.analysisUpdateParams, ...JSON.parse(JSON.stringify(row)) }; - if (!this.analysisUpdateParams.measures) { - this.analysisUpdateParams.measures = [] - } - this.analysisUpdateParams.measures.forEach((item, index) => { - item.index = index + 1 - return item - }) + //管控措施 + this.initAnalysisMeasure(); } 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.checkRiskType.risk = this.analysisUpdateParams.riskChoose - this.checkRiskType.remain = this.analysisUpdateParams.remainChoose - if (!this.analysisUpdateParams.measures) { - this.analysisUpdateParams.measures = [] - } - this.analysisUpdateParams.measures.forEach((item, index) => { - item.index = index + 1 - return item - }) + //编辑 参数处理 + this.updateAnalysisParam(row); + //管控措施 + this.initAnalysisMeasure(); } } this.showSubUpdate = true } + //工作危害分析法 查看翻译 + public analysisTransformParam(row: any) { + 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], + }, row); + } + //分析法编辑 数据处理 + public updateAnalysisParam(row: any) { + 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.checkRiskType.risk = this.analysisUpdateParams.riskChoose; + this.checkRiskType.remain = this.analysisUpdateParams.remainChoose; + } + //管控措施初始化 + public initAnalysisMeasure() { + if (!this.analysisUpdateParams.measures) { + this.analysisUpdateParams.measures = []; + } + this.analysisUpdateParams.measures.forEach((item, index) => { + item.index = index + 1; + return item; + }); + } + //数组转字符串 public arrayChangeString(data) { if (data && data.length > 0) { @@ -985,6 +989,14 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent { } } + //工作危害分析步骤 add 序号 + public addStepsIndex() { + this.updateParams.steps.forEach((item, i) => { + item.index = i + 1 + return item + }) + } + } diff --git a/src/views/risk/duty/duty.component.vue b/src/views/risk/duty/duty.component.vue index 2c66b5a..c47e604 100644 --- a/src/views/risk/duty/duty.component.vue +++ b/src/views/risk/duty/duty.component.vue @@ -68,7 +68,7 @@ export default class DutyManagerComponent extends BaseRecordComponent { public showUpdate = false; public updateParams = { - result:1 + result: 1 } as any; public selectData = []; @@ -94,7 +94,7 @@ export default class DutyManagerComponent extends BaseRecordComponent { labelWidth: 'auto', require: true, disable: true, - + datas: [ { name: "否", @@ -161,7 +161,7 @@ export default class DutyManagerComponent extends BaseRecordComponent { width: "100%", require: true, hide: this.updateParams.result === 1 || this.updateParams.dangerFlag == 0, - datas: this.$store.state.prevention_hazard_category, + datas: this.$store.state.prevention_danger_type, }, { name: "隐患归属人", key: "ownerId", @@ -310,7 +310,7 @@ export default class DutyManagerComponent extends BaseRecordComponent { if (data.value === "cancel") { this.showUpdate = false this.updateParams = { - result:1 + result: 1 } as any; } else if (data.value === "save") { this.doSave() @@ -329,7 +329,6 @@ export default class DutyManagerComponent extends BaseRecordComponent { this.userListName[item.value] = item.name }) - this.updateParams.taskChargeUserName = this.userListName[this.account.userId] this.updateParams.ownerName = this.userListName[this.updateParams.ownerId] this.tableService.addOrUpdate(this.updateParams, this.updateParams.id).then((res) => { @@ -343,13 +342,13 @@ export default class DutyManagerComponent extends BaseRecordComponent { if (item && item.key === "result") { if (data === 1) { this.updateParams.dangerFlag = null - // this.updateParams.taskName = null this.updateParams.taskType = null this.updateParams.ownerId = null + } else if (data === 2) { + this.updateParams.dangerFlag = 0 } this.subUpdateForm() } - if (item && item.key === "dangerFlag") { if (data === 0) { this.updateParams.taskType = null @@ -358,7 +357,6 @@ export default class DutyManagerComponent extends BaseRecordComponent { this.subUpdateForm() } this.subUpdateForm() - } // 重置数据 @@ -380,7 +378,6 @@ export default class DutyManagerComponent extends BaseRecordComponent { this.showUpdate = false; } - public toggleAll() { this.tableData.datas.forEach((item, index) => { @@ -451,10 +448,10 @@ export default class DutyManagerComponent extends BaseRecordComponent { // checkUserId: this.account.userId, checkTime: moment().format('YYYY-MM-DD HH:mm'), imeiCode: moment().format('DDHHmm') + mathData, - result:1 + result: 1 }, row) this.updateParams.checkUserId = this.account.userId, - this.updateParams.status = 1 + this.updateParams.status = 1 this.updateParams.endTime = moment().format('YYYY-MM-DD HH:mm:ss') this.subUpdateForm() this.showUpdate = true diff --git a/src/views/risk/identify/identify.component.vue b/src/views/risk/identify/identify.component.vue index 9be940a..5a4b5ef 100644 --- a/src/views/risk/identify/identify.component.vue +++ b/src/views/risk/identify/identify.component.vue @@ -323,8 +323,8 @@ export default class IdentifyManagerComponent extends BaseRecordComponent { } public buildTable() { - this.tableColumn.push({ name: '管控对象', key: "controlName",}); - this.tableColumn.push({ name: '分析对象', key: "analName",}); + this.tableColumn.push({ name: '管控对象', key: "controlName", }); + this.tableColumn.push({ name: '分析对象', key: "analName", }); this.tableColumn.push({ name: '风险源', key: "riskSource", }); this.tableColumn.push({ name: '事故后果', key: "seriousResult", render: (data) => { @@ -352,7 +352,7 @@ export default class IdentifyManagerComponent extends BaseRecordComponent { } }); this.tableColumn.push({ name: '评估人', key: "appraiser" }); - this.tableColumn.push({ name: '评估时间', key: "appraiseTime",}); + this.tableColumn.push({ name: '评估时间', key: "appraiseTime", }); } @@ -392,76 +392,94 @@ export default class IdentifyManagerComponent extends BaseRecordComponent { this.tableData = res.data as any; }) } - + //查看 public showUpdateModel(row) { this.showUpdate = true const tmprow = JSON.parse(JSON.stringify(row)) this.subUpdateParams = tmprow - this.subUpdateParams.safetySignName =tmprow.safetySign? tmprow.safetySign.split(',').map(item => this.$store.getters.prevention_security_identifier_map[item]).join(","):null + this.subUpdateParams.safetySignName = tmprow.safetySign ? tmprow.safetySign.split(',').map(item => this.$store.getters.prevention_security_identifier_map[item]).join(",") : null this.subUpdateParams.seriousResultName = tmprow.seriousResult.split(',').map(item => this.$store.getters.prevention_serious_result_map[item]).join(",") //风险评估 this.riskUpdateParams.riskLevelName = this.$store.getters.prevention_risk_level_map[tmprow.riskLevel] this.riskUpdateParams.riskControlLevelName = this.$store.getters.prevention_control_level_map[tmprow.riskControlLevel] if (tmprow.riskLsValue) { - const riskLsValue = JSON.parse(tmprow.riskLsValue) - const tmpRiskLsValue = {} - for (let key in riskLsValue) { - if (key.indexOf('ls') !== -1) { - tmpRiskLsValue[key] = riskLsValue[key]; - } - } - this.riskUpdateParams = { ...this.riskUpdateParams, ...tmpRiskLsValue } - this.riskUpdateParams.lsgradeName = this.$store.getters.prevention_risk_level_map[this.riskUpdateParams.lsgrade] + this.handleRiskLs(tmprow); } if (tmprow.riskLecValue) { - const riskLecValue = JSON.parse(tmprow.riskLecValue) - const tmpRiskLecValue = {} - for (let key in riskLecValue) { - if (key.indexOf('lec') !== -1) { - tmpRiskLecValue[key] = riskLecValue[key]; - } - } - this.riskUpdateParams = { ...this.riskUpdateParams, ...tmpRiskLecValue } - this.riskUpdateParams.lecgradeName = this.$store.getters.prevention_risk_level_map[this.riskUpdateParams.lsgrade] + this.handleRiskLec(tmprow); } - //残余风险评估 this.remainUpdateParams.remainLevelName = this.$store.getters.prevention_risk_level_map[tmprow.remainLevel] if (tmprow.remainLsValue) { - const remainLsValue = JSON.parse(tmprow.remainLsValue) - const tmpRemainLsValue = {} - for (let key in remainLsValue) { - if (key.indexOf('ls') !== -1) { - tmpRemainLsValue[key] = remainLsValue[key]; - } - } - this.remainUpdateParams = { ...this.remainUpdateParams, ...tmpRemainLsValue } - this.remainUpdateParams.lsgradeName = this.$store.getters.prevention_risk_level_map[this.remainUpdateParams.lsgrade] + this.handelRemainRiskLs(tmprow); } if (tmprow.remainLecValue) { - const remainLecValue = JSON.parse(tmprow.remainLecValue) - const tmpRemainLecValue = {} - for (let key in remainLecValue) { - if (key.indexOf('lec') !== -1) { - tmpRemainLecValue[key] = remainLecValue[key]; - } - } - this.remainUpdateParams = { ...this.remainUpdateParams, ...tmpRemainLecValue } - this.remainUpdateParams.lecgradeName = this.$store.getters.prevention_risk_level_map[this.remainUpdateParams.lecgrade] + this.handleRemainRiskLec(tmprow); } this.buildUpdateForm() } + //处理 风险评估LS + public handleRiskLs(tmprow: any) { + const riskLsValue = JSON.parse(tmprow.riskLsValue); + const tmpRiskLsValue = {}; + for (let key in riskLsValue) { + if (key.indexOf('ls') !== -1) { + tmpRiskLsValue[key] = riskLsValue[key]; + } + } + this.riskUpdateParams = { ...this.riskUpdateParams, ...tmpRiskLsValue }; + this.riskUpdateParams.lsgradeName = this.$store.getters.prevention_risk_level_map[this.riskUpdateParams.lsgrade]; + } + + //处理 风险评估 lec + public handleRiskLec(tmprow: any) { + const riskLecValue = JSON.parse(tmprow.riskLecValue); + const tmpRiskLecValue = {}; + for (let key in riskLecValue) { + if (key.indexOf('lec') !== -1) { + tmpRiskLecValue[key] = riskLecValue[key]; + } + } + this.riskUpdateParams = { ...this.riskUpdateParams, ...tmpRiskLecValue }; + this.riskUpdateParams.lecgradeName = this.$store.getters.prevention_risk_level_map[this.riskUpdateParams.lsgrade]; + } + + //处理 残余风险评估LS + public handelRemainRiskLs(tmprow: any) { + const remainLsValue = JSON.parse(tmprow.remainLsValue); + const tmpRemainLsValue = {}; + for (let key in remainLsValue) { + if (key.indexOf('ls') !== -1) { + tmpRemainLsValue[key] = remainLsValue[key]; + } + } + this.remainUpdateParams = { ...this.remainUpdateParams, ...tmpRemainLsValue }; + this.remainUpdateParams.lsgradeName = this.$store.getters.prevention_risk_level_map[this.remainUpdateParams.lsgrade]; + } + //处理 残余风险评估Lec + public handleRemainRiskLec(tmprow: any) { + const remainLecValue = JSON.parse(tmprow.remainLecValue); + const tmpRemainLecValue = {}; + for (let key in remainLecValue) { + if (key.indexOf('lec') !== -1) { + tmpRemainLecValue[key] = remainLecValue[key]; + } + } + this.remainUpdateParams = { ...this.remainUpdateParams, ...tmpRemainLecValue }; + this.remainUpdateParams.lecgradeName = this.$store.getters.prevention_risk_level_map[this.remainUpdateParams.lecgrade]; + } + public handleClose() { this.showUpdate = false; } public toggleAll() { - - this.tableData.datas.forEach((item,index)=>{ + + this.tableData.datas.forEach((item, index) => { (this.$refs.multipleTable as any).toggleRowSelection(item); }) }