feat:新增风险区域单元逻辑

kongyeqing
吴延福 2023-06-09 16:58:40 +08:00
parent cdef5d6121
commit 385b163a0e
5 changed files with 98 additions and 9 deletions

View File

@ -7,7 +7,7 @@ VUE_APP_GATEWAY_URL="/dev-api"
# 服务地址 # 服务地址
VUE_APP_BASE_API_URL="http://192.168.2.3:8081/" 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 VUE_APP_ALL_MENU = false
# 微前端地址 # 微前端地址

View File

@ -21,6 +21,11 @@ export default class AreaService extends BaseService<any>{
return this.get(url,null) 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<AxiosResponse<ActionResult<any>>>{ public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/risk/area'; const url = this.prefix.prevention+'/risk/area';

View File

@ -29,6 +29,20 @@ export default class AreaManagerComponent extends BaseRecordComponent<any> {
majorHazardFlag:null majorHazardFlag:null
} as any; } as any;
public filters = [{
text:"未绘制",
value:0
},{
text:"已绘制",
value:1
}]
public showQrCode = false;
public qrUrl = "";
// //
public formActions = [{ public formActions = [{
@ -138,7 +152,7 @@ export default class AreaManagerComponent extends BaseRecordComponent<any> {
},{ },{
name:"属于重大危险源", name:"属于重大危险源",
key:"majorHazardFlag", key:"majorHazardFlag",
format:"majorHazardName", format:"majorHazardFlagName",
type:"radio", type:"radio",
width:"calc(50% - 20px)", width:"calc(50% - 20px)",
require:true, require:true,
@ -229,6 +243,26 @@ export default class AreaManagerComponent extends BaseRecordComponent<any> {
}] }]
} }
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(){ public buildTable(){
this.tableColumn.push({name:'区域名称',key:"name"}); this.tableColumn.push({name:'区域名称',key:"name"});
this.tableColumn.push({name:'责任部门',key:"chargeDeptName"}); this.tableColumn.push({name:'责任部门',key:"chargeDeptName"});
@ -236,7 +270,13 @@ export default class AreaManagerComponent extends BaseRecordComponent<any> {
this.tableColumn.push({name:'是否属于重大危险源',key:"majorHazardFlag",render:(data)=>{ this.tableColumn.push({name:'是否属于重大危险源',key:"majorHazardFlag",render:(data)=>{
return this.$store.getters.common_yes_no_map[data.majorHazardFlag] 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){ if(data.geoJson==='[]' || !data.geoJson){
return "<span class='noDraw'>未绘制</span>" return "<span class='noDraw'>未绘制</span>"
}else{ }else{
@ -337,7 +377,7 @@ export default class AreaManagerComponent extends BaseRecordComponent<any> {
this.getCreateNumber(); this.getCreateNumber();
}else{ }else{
this.currentId = data.id; 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.isReadonly = !!isRead;
this.buildFormOptions(); this.buildFormOptions();

View File

@ -14,10 +14,10 @@
<el-table-column type="selection" label="全选"> <el-table-column type="selection" label="全选">
</el-table-column> </el-table-column>
<template v-for="item in tableColumn"> <template v-for="item in tableColumn">
<el-table-column v-if="item.render" :label="item.name" :width="item.width" :key="item.key"> <el-table-column v-if="item.render" :label="item.name" :filters="item.filters" :filter-method="item.filterMethod" :width="item.width" :key="item.key">
<div slot-scope="scope" v-html="item.render(scope.row)"></div> <div slot-scope="scope" v-html="item.render(scope.row)"></div>
</el-table-column> </el-table-column>
<el-table-column v-else :prop="item.key" :label="item.name" :width="item.width" :key="item.key"> <el-table-column v-else :prop="item.key" :filters="item.filters" :label="item.name" :filter-method="item.filterMethod" :width="item.width" :key="item.key">
</el-table-column> </el-table-column>
</template> </template>
<el-table-column label="操作" width="200"> <el-table-column label="操作" width="200">
@ -25,7 +25,7 @@
<el-button type="text" @click="showUpdateModel(scope.row,true)">查看</el-button> <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="showUpdateModel(scope.row)">修改</el-button>
<el-button type="text" @click="deleteData([scope.row.id])">删除</el-button> <el-button type="text" @click="deleteData([scope.row.id])">删除</el-button>
<el-button type="text">二维码</el-button> <el-button type="text" @click="getQrCode(scope.row)">二维码</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -45,4 +45,10 @@
btn-position="center"></FormComponent> btn-position="center"></FormComponent>
</el-dialog> </el-dialog>
<el-dialog :close-on-click-modal="false" :title="'查看二维码'" :visible.sync="showQrCode" >
<img :src="qrUrl" style="width: 100%;" alt="">
</el-dialog>
</div> </div>

View File

@ -25,6 +25,18 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
public params = {} as any; public params = {} as any;
public filters = [{
text:"未绘制",
value:0
},{
text:"已绘制",
value:1
}]
public showQrCode = false;
public qrUrl = "";
public isReadonly = false; public isReadonly = false;
public formActions = [{ public formActions = [{
@ -180,11 +192,38 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
}] }]
} }
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(){ public buildTable(){
this.tableColumn.push({name:'风险分析单元',key:"name"}); this.tableColumn.push({name:'风险分析单元',key:"name"});
this.tableColumn.push({name:'责任部门',key:"chargeDeptName"}); this.tableColumn.push({name:'责任部门',key:"chargeDeptName"});
this.tableColumn.push({name:'责任人',key:"chargeUserName"}); 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){ if(data.geoJson==='[]' || !data.geoJson){
return "<span class='noDraw'>未绘制</span>" return "<span class='noDraw'>未绘制</span>"
}else{ }else{
@ -235,7 +274,6 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
public callback(data,item?){ public callback(data,item?){
console.log(data,item)
// //
if(item && item.key === "chargeDeptId"){ if(item && item.key === "chargeDeptId"){
this.updateParams.chargeDeptName = this.$store.state.deptList.find(item=>item.value === data)?.name; this.updateParams.chargeDeptName = this.$store.state.deptList.find(item=>item.value === data)?.name;