From 564ce831e2cb1d0912ae9b3e4642aedc6a70d2e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=BB=B6=E7=A6=8F?= <> Date: Tue, 13 Jun 2023 17:21:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=96=B0=E5=A2=9E=E5=81=9C=E7=94=A8?= =?UTF-8?q?=E5=90=AF=E7=94=A8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- src/service/unit.service.ts | 5 + src/views/risk/areaUnit.component.html | 8 +- src/views/risk/unit/unit.component.vue | 194 ++++++++++++++----------- 4 files changed, 116 insertions(+), 93 deletions(-) diff --git a/.env.development b/.env.development index 859950a..0759ac2 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.1.19:8081/" # 服务前-- 请严格遵守格式 不允许换行 -VUE_APP_SERVICE_PREFIX= '{"system":"/system","file":"/file-zy","prevention":"/prevention-zy"}' +VUE_APP_SERVICE_PREFIX= '{"system":"/system","file":"/file-zy","prevention":"/prevention-yx"}' # 是否显示全部菜单 VUE_APP_ALL_MENU = false # 微前端地址 diff --git a/src/service/unit.service.ts b/src/service/unit.service.ts index 302f484..a0b647d 100644 --- a/src/service/unit.service.ts +++ b/src/service/unit.service.ts @@ -26,6 +26,11 @@ export default class UnitService extends BaseService{ return this.get(url,null) } + public updateStatus(params,showLoading?:boolean): Promise>>{ + const url = this.prefix.prevention+'/risk/unit/repair'; + return this.post(url,params,{},showLoading) + } + // 新增或更新 public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise>>{ diff --git a/src/views/risk/areaUnit.component.html b/src/views/risk/areaUnit.component.html index 1137f7c..df329ff 100644 --- a/src/views/risk/areaUnit.component.html +++ b/src/views/risk/areaUnit.component.html @@ -20,14 +20,14 @@ - + @@ -57,7 +57,7 @@ diff --git a/src/views/risk/unit/unit.component.vue b/src/views/risk/unit/unit.component.vue index 675ca2b..7667f4b 100644 --- a/src/views/risk/unit/unit.component.vue +++ b/src/views/risk/unit/unit.component.vue @@ -102,11 +102,7 @@ export default class UnitManagerComponent extends BaseRecordComponent { public account = JSON.parse(localStorage.getItem("account") as any); - public turnOffParams = { - createTime:moment().format("YYYY-MM-DD HH:mm"), - account:this.account.nickName, - - } as any; + public turnOffParams = {} as any; public turnOffForm = [] as any; @@ -121,7 +117,6 @@ export default class UnitManagerComponent extends BaseRecordComponent { created(){ this.getAreaList(); - this.doTurnOff(1); } public buildTurnOffForm(){ @@ -130,20 +125,21 @@ export default class UnitManagerComponent extends BaseRecordComponent { type:"radio", key:"status", require:true, + disable:true, width:"100%", showError:false, datas:[{ name:"停用", - value:1 + value:0 },{ name:"恢复", - value:2 + value:1 }] },{ name:"停用开始时间", type:"date", subType:"datetime", - hide:this.turnOffParams.status===2, + hide:this.turnOffParams.status===1, format:"yyyy-MM-dd HH:mm", key:"startTime", width:"100%", @@ -154,7 +150,7 @@ export default class UnitManagerComponent extends BaseRecordComponent { type:"date", subType:"datetime", format:"yyyy-MM-dd HH:mm", - hide:this.turnOffParams.status===2, + hide:this.turnOffParams.status===1, key:"endTime", width:"100%", require:true, @@ -177,7 +173,7 @@ export default class UnitManagerComponent extends BaseRecordComponent { },{ name:"登记时间", type:"text", - key:"createTime", + key:"registerTime", disable:true, width:"100%", require:true, @@ -185,90 +181,112 @@ export default class UnitManagerComponent extends BaseRecordComponent { }] } - public doTurnOff(status){ - this.turnOffForm.status = status; + public doTurnOff(data,status){ + this.turnOffParams = { + status:status, + unitId:data.id, + startTime:"", + endTime:"", + riskUnitStatus:status, + registerUserId:this.account.userId, + registerTime:moment().format("YYYY-MM-DD HH:mm"), + account:this.account.nickName, + } this.showTurnOff = true; this.buildTurnOffForm(); } - public turnOffChange(data,item){ - if(item && item.key==="status"){ - this.buildTurnOffForm(); - } - } - public doTurnOffAction(data){ - console.log(data) + if(data && data.value==="saveStatus"){ + this.tableService.updateStatus(this.turnOffParams,true).then((res)=>{ + this.$message.success(this.turnOffParams.status?"启用成功":"停用成功"); + this.getTableData(); + this.showTurnOff = false; + }) + } } public buildFormOptions(){ this.updateOptions = [{ - name:"选择区域", - key:"areaId", - placeholder:"请选择区域名称", - width:"calc(50% - 20px)", - type:"select", - require:true, - datas:this.areaList - },{ - name:"区域编号", - key:"areaNo", - type:"text", - disable:true, - width:"calc(50% - 20px)", - },{ - name:"单元编号", - key:"number", - type:"text", - disable:true, - width:"calc(50% - 20px)", - require:true - },{ - name:"单元名称", - key:"name", - type:"text", - width:"calc(50% - 20px)", - require:true - },{ - name:"责任部门", - key:"chargeDeptId", - format:"chargeDeptName", - type:"treeSelect", - width:"calc(50% - 20px)", - require:true, - expandLevel:Infinity, - showError:false, - datas:this.$store.state.deptTreeList - },{ - name:"责任人", - key:"chargeUserId", - format:"chargeUserName", - type:"select", - width:"calc(50% - 20px)", - require:true, - datas:this.$store.state.userList - },{ - type:"btn", - name:"单元绘制", - width:"calc(50% - 20px)", - btn:[{ - name:"开始绘制", - value:"draw", - height:"36px", - hide:this.isReadonly, - size:"small", - icon:"el-icon-edit-outline", - type:"primary" + name:"选择区域", + key:"areaId", + placeholder:"请选择区域名称", + width:"calc(50% - 20px)", + type:"select", + require:true, + datas:this.areaList },{ - name:"查看绘制", - value:"readDraw", - hide:!this.isReadonly, - height:"36px", - size:"small", - icon:"el-icon-edit-outline", - type:"primary" - }] - }]; + name:"区域编号", + key:"areaNo", + type:"text", + disable:true, + width:"calc(50% - 20px)", + },{ + name:"单元编号", + key:"number", + type:"text", + disable:true, + width:"calc(50% - 20px)", + require:true + },{ + name:"单元名称", + key:"name", + type:"text", + width:"calc(50% - 20px)", + require:true + },{ + name:"责任部门", + key:"chargeDeptId", + format:"chargeDeptName", + type:"treeSelect", + width:"calc(50% - 20px)", + require:true, + expandLevel:Infinity, + showError:false, + datas:this.$store.state.deptTreeList + },{ + name:"责任人", + key:"chargeUserId", + format:"chargeUserName", + type:"select", + width:"calc(50% - 20px)", + require:true, + datas:this.$store.state.userList + },{ + type:"btn", + name:"单元绘制", + width:"calc(50% - 20px)", + btn:[{ + name:"开始绘制", + value:"draw", + height:"36px", + hide:this.isReadonly, + 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" + }] + },{ + name:"停用/检修状态", + key:"status", + width:"calc(50% - 20px)", + type:"select", + require:true, + datas:[{ + name:"启用", + value:1, + },{ + name:"停用", + value:0, + }] + }]; this.updateActions = [{ name:"取消", @@ -367,7 +385,7 @@ export default class UnitManagerComponent extends BaseRecordComponent { 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; + this.updateParams = {bottomHeight:0,topHeight:0,geoJson:"[]",status:1,number:null} as any; }else{ this.handleClose(); } @@ -436,11 +454,11 @@ export default class UnitManagerComponent extends BaseRecordComponent { public showUpdateModel(data?,isRead?){ if(!data){ this.currentId = -1; - this.updateParams = {bottomHeight:0,topHeight:0,geoJson:"[]",number:null} as any; + this.updateParams = {bottomHeight:0,topHeight:0,geoJson:"[]",status:1,number:null} as any; this.showUpdate = true }else{ this.currentId = data.id; - this.updateParams = Object.assign({bottomHeight:0,topHeight:0,geoJson:"[]",number:null},data); + this.updateParams = Object.assign({bottomHeight:0,topHeight:0,status:1,geoJson:"[]",number:null},data); this.isReadonly = !!isRead; this.buildFormOptions(); }