From 4e1028b914726093c128d79d1290efb3c128c738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=BB=B6=E7=A6=8F?= <> Date: Fri, 9 Jun 2023 16:00:43 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=E5=AE=8C=E6=88=90=E9=A3=8E=E9=99=A9?= =?UTF-8?q?=E5=92=8C=E5=8C=BA=E5=9F=9F=E5=A2=9E=E5=88=A0=E6=94=B9=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/draw.component.vue | 141 ++++++++++++++----------- src/service/area.service.ts | 7 +- src/service/unit.service.ts | 14 ++- src/store/index.ts | 22 +++- src/views/blank.component.vue | 9 +- src/views/risk/area/area.component.vue | 98 +++++++++++------ src/views/risk/areaUnit.component.html | 5 +- src/views/risk/unit/unit.component.vue | 86 ++++++++++----- 8 files changed, 251 insertions(+), 131 deletions(-) diff --git a/src/components/draw.component.vue b/src/components/draw.component.vue index 7f7fe52..04927fc 100644 --- a/src/components/draw.component.vue +++ b/src/components/draw.component.vue @@ -4,29 +4,30 @@ {{modelMap[viewModel]}}
全屏
- +
- +
- {{ node.label }} 绘制 - + 已绘制 @@ -46,6 +47,8 @@ import screenfull from "screenfull" import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css'; import MapboxDraw from '@mapbox/mapbox-gl-draw'; import * as turf from '@turf/turf' +import UnitService from '@/service/unit.service'; +import AreaService from '@/service/area.service'; @Component({ components:{ MapComponent, @@ -54,42 +57,10 @@ import * as turf from '@turf/turf' }) export default class DrawComponent extends Vue { - public treeData = [{ - label: '一级 1', - value: '123', - children: [{ - label: '二级 1-1', - children: [{ - label: '三级 1-1-1' - }] - }] - }, { - label: '一级 2', - children: [{ - label: '二级 2-1', - children: [{ - label: '三级 2-1-1' - }] - }, { - label: '二级 2-2', - children: [{ - label: '三级 2-2-1' - }] - }] - }, { - label: '一级 3', - children: [{ - label: '二级 3-1', - children: [{ - label: '三级 3-1-1' - }] - }, { - label: '二级 3-2', - children: [{ - label: '三级 3-2-1' - }] - }] - }]; + public unitService = new UnitService() + public areaService = new AreaService() + + public treeData = [] as any; public modelMap = { list:"批量绘制", @@ -132,6 +103,8 @@ export default class DrawComponent extends Vue { }) @PropSync("model") public viewModel:string; + @Prop() + public isReadonly:boolean; @PropSync("show",{ required:true, default:true @@ -160,23 +133,28 @@ export default class DrawComponent extends Vue { onModelChanges(newVal){ if(newVal==="list"){ this.fromList = true; - this.positions = this.getAllFeatures(this.treeData); - if(this.positions.length){ - this.addAllPolygon(); - } + this.setTreeData(); } this.buildUpdate() } + @Watch("visible",{immediate:true,deep:true}) + onVisibleChanges(newVal){ + // console.log("close") + // if(!newVal){ + // } + } + + @Emit("onClose") + onClose(data){ + //Emit false + } created(){ // this.positions = [] as any; } - public flyToCenter(zoom){ + public flyToCenter(zoom,timer?){ if(!this.map ){ - setTimeout(()=>{ - this.flyToCenter(zoom) - }) return } const center = turf.centerOfMass(turf.featureCollection(this.positions)); @@ -184,12 +162,24 @@ export default class DrawComponent extends Vue { this.addAllPolygon(); } + public setTreeData(){ + this.unitService.getUnitTree().then(res=>{ + this.treeData = res.data; + this.positions = this.getAllFeatures(this.treeData); + if(this.positions.length && this.map){ + this.addAllPolygon(); + } + }) + } + public getMap(map){ this.map = map; - if(this.viewModel!=="list"){ - this.map.on('draw.create', this.drawCallback); - this.map.on('draw.delete', this.drawCallback); - this.map.on('draw.update', this.drawCallback); + this.map.on('draw.create', this.drawCallback); + this.map.on('draw.delete', this.drawCallback); + this.map.on('draw.update', this.drawCallback); + if(this.positions.length){ + this.addAllPolygon(); + this.flyToCenter(this.fromList?14:16) } } @@ -260,9 +250,11 @@ export default class DrawComponent extends Vue { if(!this.map){ return } - this.map.removeLayer("allDataLayer") - this.map.removeLayer("textLayer") - this.map.removeSource("allDataSource") + if(this.map.getSource("allDataSource")){ + this.map.removeLayer("allDataLayer") + this.map.removeLayer("textLayer") + this.map.removeSource("allDataSource") + } } public drawCallback(e){ @@ -273,6 +265,7 @@ export default class DrawComponent extends Vue { }else{ this.positions.splice(this.positions.findIndex((item:any)=>item.id===e.features[0].id),1) } + console.log(this.positions) } public drawScreenFull(){ @@ -284,7 +277,7 @@ export default class DrawComponent extends Vue { // 树节点过滤 public filterNode(value, data) { if (!value) return true; - return data.label.indexOf(value) !== -1; + return data.name.indexOf(value) !== -1; } public change(data,meta){ @@ -294,10 +287,16 @@ export default class DrawComponent extends Vue { } public handleNodeClick(node){ - this.positions = JSON.parse(node.geoJson); + const geoJson = JSON.parse(node.geoJson); + if(!geoJson.length){ + return + } + const center = turf.centerOfMass(turf.featureCollection(geoJson)); + this.map.flyTo({center: center.geometry.coordinates, zoom: 18}); } public drawNode(data){ + this.params =Object.assign({bottomHeight:0,topHeight:0,geoJson:"[]"},data) as any; if(data.area_id){ this.viewModel = "unit" }else{ @@ -343,12 +342,15 @@ export default class DrawComponent extends Vue { feature.properties = this.updateParams }) this.updateParams.geoJson = JSON.stringify(this.positions); - this.params = this.updateParams; if(this.fromList){ - this.viewModel = "list"; - this.destoryDraw(); - + const service = this.viewModel==='unit'?this.unitService:this.areaService; + service.addOrUpdate(this.updateParams,false).then(res=>{ + this.viewModel = "list"; + this.destoryDraw(); + }) + this.onClose(false) }else{ + this.params = this.updateParams; this.visible = false; } } @@ -359,10 +361,13 @@ export default class DrawComponent extends Vue { if(action.value==="draw"){ this.drawCallBack(); }else if(action.value==="save"){ + this.doSave() }else { if(this.fromList){ this.viewModel = "list"; - this.draw.deleteAll() + if(this.hasInitDraw){ + this.draw.deleteAll() + } }else{ this.visible = false; } @@ -423,10 +428,19 @@ export default class DrawComponent extends Vue { mounted(){ } + + public closePop(){ + this.removeMap(); + this.updateParams = {} as any; + this.onClose(false) + this.visible = false; + } + public removeMap(){ this.map.off('draw.create', this.drawCallback); this.map.off('draw.delete', this.drawCallback); this.map.off('draw.update', this.drawCallback); + this.removeLayer(); this.map.remove(); this.map = null; } @@ -445,6 +459,9 @@ export default class DrawComponent extends Vue { .el-tree-node__content{ height: auto; } +.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content .el-button--text{ + color: #FFF; +} } .draw-box{ diff --git a/src/service/area.service.ts b/src/service/area.service.ts index 1e39c50..015a509 100644 --- a/src/service/area.service.ts +++ b/src/service/area.service.ts @@ -12,10 +12,15 @@ export default class AreaService extends BaseService{ } // 批量删除 public deleteByIds(params):Promise>>{ - const url = this.prefix.prevention+'/user/list'; + const url = this.prefix.prevention+'/risk/area'; return this.deleteBatch(url,params,{},true) } + public getAreaNumber():Promise>>{ + const url = this.prefix.prevention+'/risk/area/number'; + return this.get(url,null) + } + // 新增或更新 public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise>>{ const url = this.prefix.prevention+'/risk/area'; diff --git a/src/service/unit.service.ts b/src/service/unit.service.ts index 329e2e1..4daca3a 100644 --- a/src/service/unit.service.ts +++ b/src/service/unit.service.ts @@ -10,11 +10,23 @@ export default class UnitService extends BaseService{ return this.get(url,params,true) } public deleteByIds(params):Promise>>{ - const url = this.prefix.system+'/user/list'; + const url = this.prefix.prevention+'/risk/unit'; return this.deleteBatch(url,params,{},true) } + public getUnitNumber(params):Promise>>{ + const url = this.prefix.prevention+'/risk/unit/number'; + return this.get(url,params) + } + + + public getUnitTree():Promise>>{ + const url = this.prefix.prevention+'/risk/unit/tree'; + return this.get(url,null) + } + + // 新增或更新 public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise>>{ const url = this.prefix.prevention+'/risk/unit'; diff --git a/src/store/index.ts b/src/store/index.ts index 1d01fc5..1c41a99 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -9,12 +9,23 @@ export default new Vuex.Store({ deptTreeList:[], userList:[], common_yes_no:[], - yesNoMap:{ - 0:"否", - 1:"是" - } + prevention_dangrous_level:[], }, getters: { + common_yes_no_map:(state)=>{ + const map = {}; + state.common_yes_no.forEach((item:any)=>{ + map[item.value] = item.name + }) + return map + }, + prevention_dangrous_level_map:(state)=>{ + const map = {}; + state.common_yes_no.forEach((item:any)=>{ + map[item.value] = item.name + }) + return map + } }, mutations: { @@ -29,6 +40,9 @@ export default new Vuex.Store({ }, set_common_yes_no(state,data){ state.common_yes_no = data; + }, + set_prevention_dangrous_level(state,data){ + state.prevention_dangrous_level = data; } }, actions: { diff --git a/src/views/blank.component.vue b/src/views/blank.component.vue index c30781f..7492686 100644 --- a/src/views/blank.component.vue +++ b/src/views/blank.component.vue @@ -13,7 +13,8 @@ export default class BlankComponent extends Vue { this.systemService.getDeptTree(), this.systemService.getDeptList(), this.systemService.getUserList({pageSize:0}), - this.systemService.getDictData("common_yes_no") + this.systemService.getDictData("common_yes_no"), + this.systemService.getDictData("prevention_dangrous_level") ]).then(((results:any)=>{ this.$store.commit("setDeptTreeList",results[0].data); @@ -36,6 +37,12 @@ export default class BlankComponent extends Vue { value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue } })) + this.$store.commit("set_prevention_dangrous_level",results[4].data.map(item=>{ + return { + name:item.dictLabel, + value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue + } + })) })) } } diff --git a/src/views/risk/area/area.component.vue b/src/views/risk/area/area.component.vue index 9749967..fab0820 100644 --- a/src/views/risk/area/area.component.vue +++ b/src/views/risk/area/area.component.vue @@ -105,6 +105,7 @@ export default class AreaManagerComponent extends BaseRecordComponent { name:"区域编号", key:"number", type:"text", + disable:true, showError:false, width:"calc(50% - 20px)", require:true @@ -137,6 +138,7 @@ export default class AreaManagerComponent extends BaseRecordComponent { },{ name:"属于重大危险源", key:"majorHazardFlag", + format:"majorHazardName", type:"radio", width:"calc(50% - 20px)", require:true, @@ -186,6 +188,14 @@ export default class AreaManagerComponent extends BaseRecordComponent { size:"small", icon:"el-icon-edit-outline", type:"primary" + },{ + name:"查看绘制", + value:"readDraw", + hide:!this.isReadonly, + height:"36px", + size:"small", + icon:"el-icon-edit-outline", + type:"primary" }] }]; @@ -224,7 +234,7 @@ export default class AreaManagerComponent extends BaseRecordComponent { this.tableColumn.push({name:'责任部门',key:"chargeDeptName"}); this.tableColumn.push({name:'责任人',key:"chargeUserName"}); this.tableColumn.push({name:'是否属于重大危险源',key:"majorHazardFlag",render:(data)=>{ - return this.$store.state.yesNoMap[data.majorHazardFlag] + return this.$store.getters.common_yes_no_map[data.majorHazardFlag] }}); this.tableColumn.push({name:'绘制情况',render:(data)=>{ if(data.geoJson==='[]' || !data.geoJson){ @@ -235,50 +245,75 @@ export default class AreaManagerComponent extends BaseRecordComponent { }}); } + public doDraw(){ + if(!this.updateParams.name){ + this.$message.error("请先输入区域名称"); + return + } + this.drawModel = "area"; + this.showDraw = true; + } + + public getCreateNumber(){ + this.tableService.getAreaNumber().then((res)=>{ + this.updateParams = {bottomHeight:0,topHeight:0,geoJson:"[]",number:res.data} as any; + this.buildFormOptions(); + this.showUpdate = true + }) + } + + public doSave(goOn?){ + this.tableService.addOrUpdate(this.updateParams,this.currentId===-1).then((res)=>{ + this.$message.success(this.currentId===-1?"新增成功!":"修改成功!"); + if(goOn){ + this.getCreateNumber(); + }else{ + this.handleClose(); + } + this.getTableData(); + }) + } + public callback(data,item?){ + // 新增编辑选择部门 + if(item && item.key === "chargeDeptId"){ + this.updateParams.chargeDeptName = this.$store.state.deptList.find(item=>item.value === data)?.name; + } + // 新增编辑选择人员 + if(item && item.key === "chargeUserId"){ + this.updateParams.chargeUserName = this.$store.state.userList.find(item=>item.value === data)?.name; + } // 新增编辑选择是否重大危险源 if(item && item.key === "majorHazardFlag"){ this.updateOptions[5].hide = !data; this.updateOptions[6].hide = !data; } // 查询 - if(data.value==="search"){ + if(data && data.value==="search"){ this.getTableData() // 重置 - }else if(data.value === "reset"){ + }else if(data && data.value === "reset"){ this.reset() // 反选 - }else if(data.value === "reverse"){ + }else if(data && data.value === "reverse"){ this.toggleAll() // 全选 - }else if(data.value === "selectAll"){ + }else if(data && data.value === "selectAll"){ this.selectAll() - }else if(data.value === "add"){ + }else if(data && data.value === "add"){ this.showUpdateModel() - }else if(data.value === "delete"){ + }else if(data && data.value === "delete"){ this.deleteData(this.selectData.map((item:any)=>item.id)) - }else if(data.value === "draw"){ - if(!this.updateParams.name){ - this.$message.error("请先输入区域名称"); - return - } - this.drawModel = "area"; - this.showDraw = true; - }else if(data.value === "drawList"){ + }else if(data && (data.value === "draw" || data.value==="readDraw")){ + this.doDraw() + }else if(data && data.value === "drawList"){ this.drawModel = "list"; this.showDraw = true; - }else if(data.value === "submit"){ - this.tableService.addOrUpdate(this.updateParams,this.currentId===-1).then((res)=>{ - this.$message.success(this.currentId===-1?"新增成功!":"修改成功!"); - this.handleClose(); - this.getTableData(); - }) - }else if(data.value === "saveAndContinue"){ - this.tableService.addOrUpdate(this.updateParams,this.currentId===-1).then((res)=>{ - this.$message.success("新增成功!"); - this.updateParams = {bottomHeight:0,topHeight:0,geoJson:"[]"} as any - }) - }else if(data.value === "cancel"){ + }else if(data && data.value === "submit"){ + this.doSave() + }else if(data && data.value === "saveAndContinue"){ + this.doSave(true) + }else if(data && data.value === "cancel"){ this.updateParams = {} as any; this.handleClose(); } @@ -299,14 +334,15 @@ export default class AreaManagerComponent extends BaseRecordComponent { public showUpdateModel(data?,isRead?){ if(!data){ this.currentId = -1; - this.updateParams = {bottomHeight:0,topHeight:0,geoJson:"[]"} as any + this.getCreateNumber(); }else{ this.currentId = data.id; - this.updateParams = Object.assign({bottomHeight:0,topHeight:0,geoJson:"[]"},data); + this.updateParams = Object.assign({bottomHeight:0,topHeight:0,geoJson:"[]",majorHazardName:this.$store.getters.common_yes_no_map[data.majorHazardFlag]},data); + + this.isReadonly = !!isRead; this.buildFormOptions(); - this.isReadonly = !!isRead + this.showUpdate = true } - this.showUpdate = true } public handleClose(){ diff --git a/src/views/risk/areaUnit.component.html b/src/views/risk/areaUnit.component.html index a2e0d53..d59ff6e 100644 --- a/src/views/risk/areaUnit.component.html +++ b/src/views/risk/areaUnit.component.html @@ -24,7 +24,7 @@ @@ -35,7 +35,7 @@
- +
+
\ No newline at end of file diff --git a/src/views/risk/unit/unit.component.vue b/src/views/risk/unit/unit.component.vue index 766d5b1..22ab07e 100644 --- a/src/views/risk/unit/unit.component.vue +++ b/src/views/risk/unit/unit.component.vue @@ -105,6 +105,7 @@ export default class UnitManagerComponent extends BaseRecordComponent { name:"单元编号", key:"number", type:"text", + disable:true, width:"calc(50% - 20px)", require:true },{ @@ -126,6 +127,7 @@ export default class UnitManagerComponent extends BaseRecordComponent { },{ name:"责任人", key:"chargeUserId", + format:"chargeUserName", type:"select", width:"calc(50% - 20px)", require:true, @@ -142,6 +144,14 @@ export default class UnitManagerComponent extends BaseRecordComponent { size:"small", icon:"el-icon-edit-outline", type:"primary" + },{ + name:"查看绘制", + value:"readDraw", + hide:!this.isReadonly, + height:"36px", + size:"small", + icon:"el-icon-edit-outline", + type:"primary" }] }]; @@ -196,7 +206,36 @@ export default class UnitManagerComponent extends BaseRecordComponent { }) } + + public doDraw(){ + console.log("openDraw") + if(!this.updateParams.name){ + this.$message.error("请先输入单元名称"); + return + } + this.drawModel = "unit"; + this.showDraw = true; + } + public getCreateNumber(params){ + this.tableService.getUnitNumber(params).then((res)=>{ + this.updateParams.number = res.data; + }) + } + public doSave(goOn?){ + this.tableService.addOrUpdate(this.updateParams,this.currentId===-1).then((res)=>{ + this.$message.success(this.currentId===-1?"新增成功!":"修改成功!"); + if(goOn){ + this.updateParams = {bottomHeight:0,topHeight:0,geoJson:"[]",number:null} as any; + }else{ + this.handleClose(); + } + this.getTableData(); + }) + } + + public callback(data,item?){ + console.log(data,item) // 新增编辑选择部门 if(item && item.key === "chargeDeptId"){ this.updateParams.chargeDeptName = this.$store.state.deptList.find(item=>item.value === data)?.name; @@ -207,48 +246,35 @@ export default class UnitManagerComponent extends BaseRecordComponent { } // 新增编辑选择区域 if(item && item.key === "areaId"){ - console.log(item) this.updateParams.areaNo = this.areaNoMap[data]; - console.log(this.updateParams) + this.getCreateNumber({areaNo:this.updateParams.areaNo}) } // 查询 - if(data.value==="search"){ + if(data && data.value==="search"){ this.getTableData() // 重置 - }else if(data.value === "reset"){ + }else if(data && data.value === "reset"){ this.reset() // 反选 - }else if(data.value === "reverse"){ + }else if(data && data.value === "reverse"){ this.toggleAll() // 全选 - }else if(data.value === "selectAll"){ + }else if(data && data.value === "selectAll"){ this.selectAll() - }else if(data.value === "add"){ + }else if(data && data.value === "add"){ this.showUpdateModel() }else if(data.value === "delete"){ this.deleteData(this.selectData.map((item:any)=>item.id)) - }else if(data.value === "draw"){ - if(!this.updateParams.name){ - this.$message.error("请先输入单元名称"); - return - } - this.drawModel = "unit"; - this.showDraw = true; - }else if(data.value === "drawList"){ + }else if(data && (data.value === "draw" || data.value==="readDraw")){ + this.doDraw() + }else if(data && data.value === "drawList"){ this.drawModel = "list"; this.showDraw = true; - }else if(data.value === "submit"){ - this.tableService.addOrUpdate(this.updateParams,this.currentId===-1).then((res)=>{ - this.$message.success(this.currentId===-1?"新增成功!":"修改成功!"); - this.handleClose(); - this.getTableData(); - }) - }else if(data.value === "saveAndContinue"){ - this.tableService.addOrUpdate(this.updateParams,this.currentId===-1).then((res)=>{ - this.$message.success("新增成功!"); - this.updateParams = {bottomHeight:0,topHeight:0,geoJson:"[]"} as any - }) - }else if(data.value === "cancel"){ + }else if(data && data.value === "submit"){ + this.doSave() + }else if(data && data.value === "saveAndContinue"){ + this.doSave(true) + }else if(data && data.value === "cancel"){ this.updateParams = {} as any; this.handleClose(); } @@ -269,10 +295,11 @@ export default class UnitManagerComponent extends BaseRecordComponent { public showUpdateModel(data?,isRead?){ if(!data){ this.currentId = -1; - this.updateParams = {bottomHeight:0,topHeight:0,geoJson:"[]"} as any + this.updateParams = {bottomHeight:0,topHeight:0,geoJson:"[]",number:null} as any; + this.showUpdate = true }else{ this.currentId = data.id; - this.updateParams = Object.assign({bottomHeight:0,topHeight:0,geoJson:"[]"},data); + this.updateParams = Object.assign({bottomHeight:0,topHeight:0,geoJson:"[]",number:null},data); this.isReadonly = !!isRead; this.buildFormOptions(); } @@ -280,6 +307,7 @@ export default class UnitManagerComponent extends BaseRecordComponent { } public handleClose(){ + this.updateParams = {} as any; this.showUpdate = false; this.currentId = -1; this.isReadonly = false; From 385b163a0ec3d78f51dfa96e556150285ab07e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=BB=B6=E7=A6=8F?= <> Date: Fri, 9 Jun 2023 16:58:40 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=E6=96=B0=E5=A2=9E=E9=A3=8E=E9=99=A9?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E5=8D=95=E5=85=83=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- src/service/area.service.ts | 5 +++ src/views/risk/area/area.component.vue | 46 ++++++++++++++++++++++++-- src/views/risk/areaUnit.component.html | 12 +++++-- src/views/risk/unit/unit.component.vue | 42 +++++++++++++++++++++-- 5 files changed, 98 insertions(+), 9 deletions(-) diff --git a/.env.development b/.env.development index 9b8d3d9..88bce41 100644 --- a/.env.development +++ b/.env.development @@ -7,7 +7,7 @@ VUE_APP_GATEWAY_URL="/dev-api" # 服务地址 VUE_APP_BASE_API_URL="http://192.168.2.3:8081/" # 服务前-- 请严格遵守格式 不允许换行 -VUE_APP_SERVICE_PREFIX= '{"system":"/system","prevention":"/prevention-yx"}' +VUE_APP_SERVICE_PREFIX= '{"system":"/system","file":"/file-zy","prevention":"/prevention-yx"}' # 是否显示全部菜单 VUE_APP_ALL_MENU = false # 微前端地址 diff --git a/src/service/area.service.ts b/src/service/area.service.ts index 015a509..3d1bdfa 100644 --- a/src/service/area.service.ts +++ b/src/service/area.service.ts @@ -21,6 +21,11 @@ export default class AreaService extends BaseService{ return this.get(url,null) } + public getQrCode(params){ + const url = this.prefix.file+'/qrCode/createQrCode'; + return this.post(url,params) + } + // 新增或更新 public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise>>{ const url = this.prefix.prevention+'/risk/area'; diff --git a/src/views/risk/area/area.component.vue b/src/views/risk/area/area.component.vue index fab0820..4422ce3 100644 --- a/src/views/risk/area/area.component.vue +++ b/src/views/risk/area/area.component.vue @@ -29,6 +29,20 @@ export default class AreaManagerComponent extends BaseRecordComponent { majorHazardFlag:null } as any; + public filters = [{ + text:"未绘制", + value:0 + },{ + text:"已绘制", + value:1 + }] + + + public showQrCode = false; + public qrUrl = ""; + + + // 列表搜索条件按钮 public formActions = [{ @@ -138,7 +152,7 @@ export default class AreaManagerComponent extends BaseRecordComponent { },{ name:"属于重大危险源", key:"majorHazardFlag", - format:"majorHazardName", + format:"majorHazardFlagName", type:"radio", width:"calc(50% - 20px)", require:true, @@ -229,6 +243,26 @@ export default class AreaManagerComponent extends BaseRecordComponent { }] } + public getQrCode(row){ + this.tableService.getQrCode({ + url:"/", + id:row.id, + system:"prevention", + type:0, + data:"", + params:{ + "区域名称" : row.name, + "区域编号" : row.number, + "责任人" : row.chargeUserName, + "责任部门" : row.chargeDeptName, + "重大危险源名称" : row.majorHazardName + } + }).then((res:any)=>{ + this.showQrCode = true; + this.qrUrl = res.data.url; + }) + } + public buildTable(){ this.tableColumn.push({name:'区域名称',key:"name"}); this.tableColumn.push({name:'责任部门',key:"chargeDeptName"}); @@ -236,7 +270,13 @@ export default class AreaManagerComponent extends BaseRecordComponent { this.tableColumn.push({name:'是否属于重大危险源',key:"majorHazardFlag",render:(data)=>{ return this.$store.getters.common_yes_no_map[data.majorHazardFlag] }}); - this.tableColumn.push({name:'绘制情况',render:(data)=>{ + this.tableColumn.push({name:'绘制情况',filters:this.filters,filterMethod:(data,row)=>{ + if(data){ + return row.geoJson && row.geoJson!=="[]" + }else{ + return !row.geoJson || row.geoJson === "[]" + } + }, render:(data)=>{ if(data.geoJson==='[]' || !data.geoJson){ return "未绘制" }else{ @@ -337,7 +377,7 @@ export default class AreaManagerComponent extends BaseRecordComponent { this.getCreateNumber(); }else{ this.currentId = data.id; - this.updateParams = Object.assign({bottomHeight:0,topHeight:0,geoJson:"[]",majorHazardName:this.$store.getters.common_yes_no_map[data.majorHazardFlag]},data); + this.updateParams = Object.assign({bottomHeight:0,topHeight:0,geoJson:"[]",majorHazardFlagName:this.$store.getters.common_yes_no_map[data.majorHazardFlag]},data); this.isReadonly = !!isRead; this.buildFormOptions(); diff --git a/src/views/risk/areaUnit.component.html b/src/views/risk/areaUnit.component.html index d59ff6e..555ec29 100644 --- a/src/views/risk/areaUnit.component.html +++ b/src/views/risk/areaUnit.component.html @@ -14,10 +14,10 @@ @@ -25,7 +25,7 @@ 查看 修改 删除 - 二维码 + 二维码 @@ -45,4 +45,10 @@ btn-position="center"> + + + + + +
\ No newline at end of file diff --git a/src/views/risk/unit/unit.component.vue b/src/views/risk/unit/unit.component.vue index 22ab07e..002091d 100644 --- a/src/views/risk/unit/unit.component.vue +++ b/src/views/risk/unit/unit.component.vue @@ -25,6 +25,18 @@ export default class UnitManagerComponent extends BaseRecordComponent { public params = {} as any; + + public filters = [{ + text:"未绘制", + value:0 + },{ + text:"已绘制", + value:1 + }] + public showQrCode = false; + + public qrUrl = ""; + public isReadonly = false; public formActions = [{ @@ -180,11 +192,38 @@ export default class UnitManagerComponent extends BaseRecordComponent { }] } + public getQrCode(row){ + this.areaService.getQrCode({ + url:"/", + id:row.id, + system:"prevention", + type:0, + data:"", + params:{ + "区域编号" : row.areaNo, + "单元名称" : row.name, + "单元编号" : row.number, + "责任人" : row.chargeUserName, + "责任部门" : row.chargeDeptName, + } + }).then((res:any)=>{ + this.showQrCode = true; + this.qrUrl = res.data.url; + }) + } + + public buildTable(){ this.tableColumn.push({name:'风险分析单元',key:"name"}); this.tableColumn.push({name:'责任部门',key:"chargeDeptName"}); this.tableColumn.push({name:'责任人',key:"chargeUserName"}); - this.tableColumn.push({name:'绘制情况',render:(data)=>{ + this.tableColumn.push({name:'绘制情况',filters:this.filters,filterMethod:(data,row)=>{ + if(data){ + return row.geoJson && row.geoJson!=="[]" + }else{ + return !row.geoJson || row.geoJson === "[]" + } + },render:(data)=>{ if(data.geoJson==='[]' || !data.geoJson){ return "未绘制" }else{ @@ -235,7 +274,6 @@ export default class UnitManagerComponent extends BaseRecordComponent { public callback(data,item?){ - console.log(data,item) // 新增编辑选择部门 if(item && item.key === "chargeDeptId"){ this.updateParams.chargeDeptName = this.$store.state.deptList.find(item=>item.value === data)?.name; From f1f66ae87e5cdca83da0e06a0f518f6961370331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=BB=B6=E7=A6=8F?= <> Date: Fri, 9 Jun 2023 17:29:33 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=E5=AE=8C=E6=88=90=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E5=9B=BA=E6=9C=89=E9=A3=8E=E9=99=A9=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/index.ts | 13 ++++- src/views/blank.component.vue | 9 +++- src/views/common.component.scss | 5 +- .../areaAnal/areaAnal.component.html | 52 ++++++++++++------- .../areaAnal/areaAnal.component.vue | 16 +++--- 5 files changed, 66 insertions(+), 29 deletions(-) diff --git a/src/store/index.ts b/src/store/index.ts index 1c41a99..c4fe200 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -10,6 +10,7 @@ export default new Vuex.Store({ userList:[], common_yes_no:[], prevention_dangrous_level:[], + prevention_risk_level:[], }, getters: { common_yes_no_map:(state)=>{ @@ -21,7 +22,14 @@ export default new Vuex.Store({ }, prevention_dangrous_level_map:(state)=>{ const map = {}; - state.common_yes_no.forEach((item:any)=>{ + state.prevention_dangrous_level.forEach((item:any)=>{ + map[item.value] = item.name + }) + return map + }, + prevention_risk_level_map:(state)=>{ + const map = {}; + state.prevention_risk_level.forEach((item:any)=>{ map[item.value] = item.name }) return map @@ -43,6 +51,9 @@ export default new Vuex.Store({ }, set_prevention_dangrous_level(state,data){ state.prevention_dangrous_level = data; + }, + set_prevention_risk_level(state,data){ + state.prevention_risk_level = data; } }, actions: { diff --git a/src/views/blank.component.vue b/src/views/blank.component.vue index 7492686..97c8423 100644 --- a/src/views/blank.component.vue +++ b/src/views/blank.component.vue @@ -14,7 +14,8 @@ export default class BlankComponent extends Vue { this.systemService.getDeptList(), this.systemService.getUserList({pageSize:0}), this.systemService.getDictData("common_yes_no"), - this.systemService.getDictData("prevention_dangrous_level") + this.systemService.getDictData("prevention_dangrous_level"), + this.systemService.getDictData("prevention_risk_level") ]).then(((results:any)=>{ this.$store.commit("setDeptTreeList",results[0].data); @@ -43,6 +44,12 @@ export default class BlankComponent extends Vue { value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue } })) + this.$store.commit("set_prevention_risk_level",results[5].data.map(item=>{ + return { + name:item.dictLabel, + value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue + } + })) })) } } diff --git a/src/views/common.component.scss b/src/views/common.component.scss index dbdd477..8a46f8e 100644 --- a/src/views/common.component.scss +++ b/src/views/common.component.scss @@ -51,7 +51,10 @@ &.active { &::before { position: absolute; - inset: 0; + left: 0; + top: 0; + right: 0; + bottom: 0; content: ""; background: #68C23A; z-index: 1; diff --git a/src/views/risk/assessment/areaAnal/areaAnal.component.html b/src/views/risk/assessment/areaAnal/areaAnal.component.html index 7badb41..1cd165f 100644 --- a/src/views/risk/assessment/areaAnal/areaAnal.component.html +++ b/src/views/risk/assessment/areaAnal/areaAnal.component.html @@ -1,4 +1,4 @@ -
+
- + - - + + - - -
+ + +
不涉及
-
{{scope.row.type1}}
+
{{scope.row.type1}}
-
{{scope.row.type2}}
+
{{scope.row.type2}}
-
{{scope.row.type3}}
+
{{scope.row.type3}}
-
{{scope.row.type4}}
+
{{scope.row.type4}}
@@ -64,6 +77,7 @@ - + +
\ No newline at end of file diff --git a/src/views/risk/assessment/areaAnal/areaAnal.component.vue b/src/views/risk/assessment/areaAnal/areaAnal.component.vue index 631862e..efc3084 100644 --- a/src/views/risk/assessment/areaAnal/areaAnal.component.vue +++ b/src/views/risk/assessment/areaAnal/areaAnal.component.vue @@ -44,7 +44,7 @@ export default class AreaAnalComponent extends BaseRecordComponent { }]; public formOptions:FormOption[] = [{ name:"区域名称", - key:"areaId", + key:"name", type:"text", }]; @@ -72,8 +72,7 @@ export default class AreaAnalComponent extends BaseRecordComponent { } public buildTable(){ - this.tableColumn.push({name:'序号',key:"areaName"}); - this.tableColumn.push({name:'区域名称',key:"areaName"}); + this.tableColumn.push({name:'区域名称',key:"name"}); this.tableColumn.push({name:'区域内发生事故的可能性/L',width:"195",render:(data)=>{ if(!data.analFlag|| data.edit){ return ""+(data.analLikelihoodValue || "选取L值")+"" @@ -91,7 +90,7 @@ export default class AreaAnalComponent extends BaseRecordComponent { }}); this.tableColumn.push({name:'区域固有风险',render:(data)=>{ - return ""+data.analRiskLevel+"" + return ""+(this.$store.getters.prevention_risk_level_map[data.analRiskLevel] || '')+"" }}); this.tableColumn.push({name:'评估完成情况',key:"status",render:(data)=>{ if(data.edit){ @@ -162,10 +161,13 @@ export default class AreaAnalComponent extends BaseRecordComponent { this.$message.error("请选取S值"); return } - row.edit = false; // 因为按索引取值 所以要-1 - row.analRiskLevel=riskLevel[row.analLikelihoodValue - 1][row.analSeverityValue - 1] - row.analFlag = 1; + row.analRiskLevel=riskLevel[row.analLikelihoodValue - 1][row.analSeverityValue - 1]; + row.analFlag = 1; + this.tableService.addOrUpdate(row,false,true).then((res)=>{ + this.$message.success("保存成功") + row.edit = false; + }) }