forked from xxhjsb/hbt-prevention-ui
feat:新增停用启用功能
parent
c1efb4549a
commit
564ce831e2
|
@ -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
|
||||
# 微前端地址
|
||||
|
|
|
@ -26,6 +26,11 @@ export default class UnitService extends BaseService<any>{
|
|||
return this.get(url,null)
|
||||
}
|
||||
|
||||
public updateStatus(params,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/risk/unit/repair';
|
||||
return this.post(url,params,{},showLoading)
|
||||
}
|
||||
|
||||
|
||||
// 新增或更新
|
||||
public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
|
||||
|
|
|
@ -20,14 +20,14 @@
|
|||
<el-table-column v-else :prop="item.key" :filters="item.filters" :label="item.name" :filter-method="item.filterMethod" :width="item.width" :key="item.key">
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column label="操作" width="200">
|
||||
<el-table-column label="操作" width="245">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="showUpdateModel(scope.row,true)">查看</el-button>
|
||||
<el-button type="text" @click="showUpdateModel(scope.row)">修改</el-button>
|
||||
<el-button type="text" @click="deleteData([scope.row.id])">删除</el-button>
|
||||
<el-button type="text" @click="getQrCode(scope.row)">二维码</el-button>
|
||||
<el-button type="text" v-if="!isArea && scope.row.status===2" @click="getQrCode(scope.row)">停用</el-button>
|
||||
<el-button type="text" v-if="!isArea && scope.row.status===1 " @click="getQrCode(scope.row)">恢复</el-button>
|
||||
<el-button type="text" v-if="!isArea && scope.row.status===1" @click="doTurnOff(scope.row,0)">停用</el-button>
|
||||
<el-button type="text" v-if="!isArea && scope.row.status===0 " @click="doTurnOff(scope.row,1)">恢复</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -57,7 +57,7 @@
|
|||
</el-dialog>
|
||||
<el-dialog :close-on-click-modal="false" v-if="!isArea" width="500px" :title="'停用/恢复登记'" :visible.sync="showTurnOff" >
|
||||
<FormComponent :options="turnOffForm" labelWidth="110px" labelAlign="right" :data.sync="turnOffParams"
|
||||
@actionCallback="doTurnOffAction" :actions="turnOffAction" @change="turnOffChange"
|
||||
@actionCallback="doTurnOffAction" :actions="turnOffAction"
|
||||
btn-position="center">
|
||||
</FormComponent>
|
||||
</el-dialog>
|
||||
|
|
|
@ -102,11 +102,7 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
|||
|
||||
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<any> {
|
|||
|
||||
created(){
|
||||
this.getAreaList();
|
||||
this.doTurnOff(1);
|
||||
}
|
||||
|
||||
public buildTurnOffForm(){
|
||||
|
@ -130,20 +125,21 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
|||
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<any> {
|
|||
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<any> {
|
|||
},{
|
||||
name:"登记时间",
|
||||
type:"text",
|
||||
key:"createTime",
|
||||
key:"registerTime",
|
||||
disable:true,
|
||||
width:"100%",
|
||||
require:true,
|
||||
|
@ -185,90 +181,112 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
|||
}]
|
||||
}
|
||||
|
||||
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<any> {
|
|||
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<any> {
|
|||
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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue