feat:完成作业活动清单增删改查

kongyeqing
吴延福 2023-06-13 16:40:59 +08:00
parent 8976191796
commit 4c8063c87e
15 changed files with 678 additions and 343 deletions

View File

@ -5,9 +5,9 @@ VUE_APP_TITLE = 汉邦唐全真数字服务平台
# 网关地址 # 网关地址
VUE_APP_GATEWAY_URL="/dev-api" 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.1.19:8081/"
# 服务前-- 请严格遵守格式 不允许换行 # 服务前-- 请严格遵守格式 不允许换行
VUE_APP_SERVICE_PREFIX= '{"system":"/system","file":"/file-zy","prevention":"/prevention-yx"}' VUE_APP_SERVICE_PREFIX= '{"system":"/system","file":"/file-zy","prevention":"/prevention-zy"}'
# 是否显示全部菜单 # 是否显示全部菜单
VUE_APP_ALL_MENU = false VUE_APP_ALL_MENU = false
# 微前端地址 # 微前端地址

View File

@ -21,6 +21,7 @@
"hbt-common": "0.0.7", "hbt-common": "0.0.7",
"mapbox-gl": "^2.15.0", "mapbox-gl": "^2.15.0",
"mockjs": "^1.1.0", "mockjs": "^1.1.0",
"moment": "^2.29.4",
"screenfull": "^6.0.2", "screenfull": "^6.0.2",
"vue": "^2.6.14", "vue": "^2.6.14",
"vue-class-component": "^7.2.3", "vue-class-component": "^7.2.3",

View File

@ -126,6 +126,10 @@ export default class DrawComponent extends Vue {
if(this.positions.length){ if(this.positions.length){
this.flyToCenter(16) this.flyToCenter(16)
} }
if(this.map){
this.addAllPolygon();
}
} }
} }
@ -297,11 +301,12 @@ export default class DrawComponent extends Vue {
public drawNode(data){ public drawNode(data){
this.params =Object.assign({bottomHeight:0,topHeight:0,geoJson:"[]"},data) as any; this.params =Object.assign({bottomHeight:0,topHeight:0,geoJson:"[]"},data) as any;
if(data.area_id){ if(data.areaId){
this.viewModel = "unit" this.viewModel = "unit"
}else{ }else{
this.viewModel = "area" this.viewModel = "area"
} }
} }
// //
public drawCallBack(){ public drawCallBack(){
@ -347,6 +352,7 @@ export default class DrawComponent extends Vue {
service.addOrUpdate(this.updateParams,false).then(res=>{ service.addOrUpdate(this.updateParams,false).then(res=>{
this.viewModel = "list"; this.viewModel = "list";
this.destoryDraw(); this.destoryDraw();
this.setTreeData()
}) })
this.onClose(false) this.onClose(false)
}else{ }else{

View File

@ -5,9 +5,9 @@ export default class UnitService extends BaseService<any>{
constructor(){ constructor(){
super() super()
} }
public selectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{ public selectByPage(params: any,showLoading?):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/risk/unit/list'; const url = this.prefix.prevention+'/risk/unit/list';
return this.get(url,params,true) return this.get(url,params,showLoading)
} }
public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{ public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/risk/unit'; const url = this.prefix.prevention+'/risk/unit';

View File

@ -6,11 +6,22 @@ export default class WorkService extends BaseService<any>{
super() super()
} }
public selectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{ public selectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.system+'/user/list'; const url = this.prefix.prevention+'/job/inventory/getList';
return this.get(url,params,true) return this.post(url,params,{},true)
} }
public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{ public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.system+'/user/list'; const url = this.prefix.prevention+'/job/inventory';
return this.deleteBatch(url,params,{},true) return this.deleteBatch(url,params,{},true)
} }
// 新增或更新
public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
const url = this.prefix.prevention+'/job/inventory';
if(add){
return this.post(url,params,{},showLoading)
}else{
return this.put(url,params,{},showLoading)
}
}
} }

View File

@ -8,11 +8,34 @@ export default new Vuex.Store({
deptList:[], deptList:[],
deptTreeList:[], deptTreeList:[],
userList:[], userList:[],
postList:[],
common_yes_no:[], common_yes_no:[],
prevention_dangrous_level:[], prevention_dangrous_level:[],
prevention_risk_level:[], prevention_risk_level:[],
prevention_safe_reason:[],
}, },
getters: { getters: {
dept_map:(state)=>{
const map = {};
state.deptList.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
user_map:(state)=>{
const map = {};
state.userList.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
post_map:(state)=>{
const map = {};
state.postList.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
common_yes_no_map:(state)=>{ common_yes_no_map:(state)=>{
const map = {}; const map = {};
state.common_yes_no.forEach((item:any)=>{ state.common_yes_no.forEach((item:any)=>{
@ -33,6 +56,13 @@ export default new Vuex.Store({
map[item.value] = item.name map[item.value] = item.name
}) })
return map return map
},
prevention_safe_reason_map:(state)=>{
const map = {};
state.prevention_safe_reason.forEach((item:any)=>{
map[item.value] = item.name
})
return map
} }
}, },
mutations: { mutations: {
@ -46,6 +76,10 @@ export default new Vuex.Store({
setDeptTreeList(state,data){ setDeptTreeList(state,data){
state.deptTreeList = data; state.deptTreeList = data;
}, },
setPostList(state,data){
state.postList = data;
},
set_common_yes_no(state,data){ set_common_yes_no(state,data){
state.common_yes_no = data; state.common_yes_no = data;
}, },
@ -54,6 +88,9 @@ export default new Vuex.Store({
}, },
set_prevention_risk_level(state,data){ set_prevention_risk_level(state,data){
state.prevention_risk_level = data; state.prevention_risk_level = data;
},
set_prevention_safe_reason(state,data){
state.prevention_safe_reason = data;
} }
}, },
actions: { actions: {

View File

@ -2,22 +2,70 @@
<router-view></router-view> <router-view></router-view>
</template> </template>
<script lang="ts"> <script lang="ts">
import AreaService from '@/service/area.service';
import UnitService from '@/service/unit.service';
import SystemService from 'hbt-common/service/system.service'; import SystemService from 'hbt-common/service/system.service';
import { Component,Vue } from 'vue-property-decorator'; import { Component,Vue } from 'vue-property-decorator';
@Component @Component
export default class BlankComponent extends Vue { export default class BlankComponent extends Vue {
public systemService = new SystemService() public systemService = new SystemService();
public areaService = new AreaService();
public unitService = new UnitService();
created(){ created(){
Promise.all([ Promise.all([
this.systemService.getDeptTree(), this.systemService.getDeptTree(),
this.systemService.getDeptList(), this.systemService.getDeptList(),
this.systemService.getUserList({pageSize:0}), this.systemService.getUserList({pageSize:0}),
this.systemService.getPostList({pageSize:1000}),
this.systemService.getDictData("common_yes_no"), this.systemService.getDictData("common_yes_no"),
this.systemService.getDictData("prevention_dangrous_level"), this.systemService.getDictData("prevention_dangrous_level"),
this.systemService.getDictData("prevention_risk_level") this.systemService.getDictData("prevention_risk_level"),
this.systemService.getDictData("prevention_safe_reason")
]).then(((results:any)=>{ ]).then(((results:any)=>{
this.$store.commit("setDeptTreeList",results[0].data); this.$store.commit("setDeptTreeList",results[0].data);
this.$store.commit("setUserList",results[2].data.datas.map((item)=>{
return {
name:item.nickName,
value:item.userId
}
}))
this.$store.commit("setPostList",results[3].rows.map((item)=>{
return {
name:item.postName,
value:item.postId
}
}))
this.$store.commit("set_common_yes_no",results[4].data.map(item=>{
return {
name:item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue
}
}))
this.$store.commit("set_prevention_dangrous_level",results[5].data.map(item=>{
return {
name:item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue
}
}))
this.$store.commit("set_prevention_risk_level",results[6].data.map(item=>{
return {
name:item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue
}
}))
this.$store.commit("set_prevention_safe_reason",results[7].data.map(item=>{
return {
name:item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue
}
}))
this.$store.commit("setDeptList",results[1].data.map((item)=>{ this.$store.commit("setDeptList",results[1].data.map((item)=>{
return { return {
@ -26,30 +74,6 @@ export default class BlankComponent extends Vue {
} }
})) }))
this.$store.commit("setUserList",results[2].data.datas.map((item)=>{
return {
name:item.nickName,
value:item.userId
}
}))
this.$store.commit("set_common_yes_no",results[3].data.map(item=>{
return {
name:item.dictLabel,
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
}
}))
this.$store.commit("set_prevention_risk_level",results[5].data.map(item=>{
return {
name:item.dictLabel,
value:isNaN(+item.dictValue)?item.dictValue:+item.dictValue
}
}))
})) }))
} }
} }

View File

@ -138,4 +138,13 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
padding: 20px 0; padding: 20px 0;
}
.tips{
color: #F56C6C;
margin-left: -43px;
margin-bottom: 20px;
margin-top: -20px;
font-size: 20px;
scale:0.5;
} }

View File

@ -37,7 +37,7 @@ export default class AreaManagerComponent extends BaseRecordComponent<any> {
value:1 value:1
}] }]
public isArea = true;
public showQrCode = false; public showQrCode = false;
public qrUrl = ""; public qrUrl = "";
@ -211,6 +211,13 @@ export default class AreaManagerComponent extends BaseRecordComponent<any> {
icon:"el-icon-edit-outline", icon:"el-icon-edit-outline",
type:"primary" type:"primary"
}] }]
},{
name:"分析对象编号",
key:"analTargetNum",
type:"text",
showError:false,
width:"calc(50% - 20px)",
require:true,
}]; }];
this.updateActions = [{ this.updateActions = [{
@ -317,11 +324,11 @@ export default class AreaManagerComponent extends BaseRecordComponent<any> {
public callback(data,item?){ public callback(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.getters.dept_map[data];
} }
// //
if(item && item.key === "chargeUserId"){ if(item && item.key === "chargeUserId"){
this.updateParams.chargeUserName = this.$store.state.userList.find(item=>item.value === data)?.name; this.updateParams.chargeUserName = this.$store.getters.user_map[data];
} }
// //
if(item && item.key === "majorHazardFlag"){ if(item && item.key === "majorHazardFlag"){

View File

@ -26,6 +26,8 @@
<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" @click="getQrCode(scope.row)">二维码</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>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -42,7 +44,9 @@
:before-close="handleClose"> :before-close="handleClose">
<FormComponent :options="updateOptions" :isReadonly="isReadonly" labelWidth="110px" labelAlign="right" :data.sync="updateParams" <FormComponent :options="updateOptions" :isReadonly="isReadonly" labelWidth="110px" labelAlign="right" :data.sync="updateParams"
@actionCallback="callback" :actions="updateActions" :full-btn="true" @change="callback" @actionCallback="callback" :actions="updateActions" :full-btn="true" @change="callback"
btn-position="center"></FormComponent> btn-position="center">
<span class="tips" v-if="currentId===-1 && isArea">*注:安全风险分析对象编码即危险化学品登记综合服务系统中的危险源编码</span>
</FormComponent>
</el-dialog> </el-dialog>
@ -51,4 +55,10 @@
<img :src="qrUrl" style="width: 100%;" alt=""> <img :src="qrUrl" style="width: 100%;" alt="">
</el-dialog> </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"
btn-position="center">
</FormComponent>
</el-dialog>
</div> </div>

View File

@ -1,33 +1,40 @@
<div class="common-box dis-flex "> <div class="common-box dis-flex ">
<div class="common-tree-box" v-if="treeData"> <div class="common-tree-box">
<el-tree :data="treeData" :expand-on-click-node="false" default-expand-all highlight-current @node-click="handleNodeClick"> <UnitTreeComponent @callback="handleNodeClick"></UnitTreeComponent>
</el-tree>
</div> </div>
<div class="common-content-box dis-flex flex-col flex-1"> <div class="common-content-box dis-flex flex-col flex-1">
<div class="search-box"> <div class="search-box">
<FormComponent :options="formOptions" :data.sync="params" @actionCallback="callback" :actions="formActions" <FormComponent :options="formOptions" :data.sync="params" @actionCallback="callback" :actions="formActions"
:full-btn="false" @change="callback" btn-position="end"></FormComponent> :full-btn="false" @change="changes" btn-position="end"></FormComponent>
</div> </div>
<div class="table-box flex-1"> <div class="table-box flex-1">
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)" <TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"
@actionCallback="callback($event)" @pageNumberChange="callback($event)" @actionCallback="callback($event)" @pageNumberChange="callback($event)"
@pageSizeChange="callback($event)" :footerActions="footerActions" :actions="tableActions"> @pageSizeChange="callback($event)" :footerActions="footerActions" :actions="tableActions">
<el-table ref="multipleTable" :data="tableData.datas" height="100%" border row-key="checked" <el-table ref="multipleTable" :data="tableData.datas" height="100%" border tooltip-effect="dark"
@selection-change="handleSelectionChange" style="width: 100%"> @selection-change="handleSelectionChange" style="width: 100%">
<el-table-column type="selection" label="全选" width="40"> <el-table-column type="selection" label="全选" width="40">
</el-table-column> </el-table-column>
<el-table-column label="序号" width="60">
<template slot-scope="scope">
{{scope.$index+1}}
</template>
</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" :show-overflow-tooltip="item.showTip" :label="item.name"
<div slot-scope="scope" v-html="item.render(scope.row)"></div> :width="item.width" :key="item.key">
<div slot-scope="scope" style="pointer-events: none;" @click="showSteps($event,scope.row)"
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" :show-overflow-tooltip="item.showTip"
:label="item.name" :width="item.width" :key="item.key">
</el-table-column> </el-table-column>
</template> </template>
<el-table-column label="操作" width="150"> <el-table-column label="操作" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showUpdateModel(scope.row.userId)">查看</el-button> <el-button type="text" @click="showUpdateModel(scope.row,true)">查看</el-button>
<el-button type="text" @click="showUpdateModel(scope.row.userId)">修改</el-button> <el-button type="text" @click="showUpdateModel(scope.row)">修改</el-button>
<el-button type="text" @click="deleteData([scope.row])">删除</el-button> <el-button type="text" @click="deleteData([scope.row])">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -37,30 +44,34 @@
</div> </div>
</div> </div>
<el-dialog :close-on-click-modal="false" :title="currentId>0?'详情':currentId===-1?'新增':'编辑'" <el-dialog :close-on-click-modal="false" :title="currentId===-1?'新增':isReadonly?'详情':'编辑'"
:visible.sync="showUpdate" width="952px" :before-close="handleClose"> :visible.sync="showUpdate" width="952px" :before-close="handleClose">
<FormComponent :options="updateOptions" labelWidth="110px" labelAlign="right" :data.sync="updateParams" @actionCallback="callback" :actions="updateActions" <FormComponent :options="updateOptions" :isReadonly="isReadonly" @change="changes" labelWidth="110px"
labelAlign="right" :data.sync="updateParams" @actionCallback="callback" :actions="updateActions"
:full-btn="true" btnPosition="center"> :full-btn="true" btnPosition="center">
<div class="sub-title">作业步骤</div> <div class="sub-title">作业步骤</div>
<TableComponent :tableData="tableData" :tableColumn="subTableColumn" @actionCallback="callback($event)" <TableComponent :tableData="currentStepTableData" :tableColumn="subTableColumn"
:actions="subTableActions" actionPosition="flex-start" :showFooter="false" style="margin-bottom: 20px;"> @actionCallback="callback($event)" :actions="subTableActions" actionPosition="flex-start"
:showFooter="false" style="margin-bottom: 20px;">
<el-table ref="multipleTable" :data="tableData.datas" tooltip-effect="dark" height="250" border row-key="checked" <el-table ref="multipleTable" :data="currentStepTableData.datas" tooltip-effect="dark" height="250" border
@selection-change="handleSelectionChange" style="width: 100%"> @selection-change="handleSelectionChange" style="width: 100%">
<el-table-column type="selection" label="全选" width="40"> <el-table-column type="selection" label="全选" width="40" v-if="!isReadonly">
</el-table-column> </el-table-column>
<template v-for="item in subTableColumn"> <template v-for="item in subTableColumn">
<el-table-column v-if="item.render" :show-overflow-tooltip="item.showTip" :label="item.name" :width="item.width" :key="item.key"> <el-table-column v-if="item.render" :show-overflow-tooltip="item.showTip" :label="item.name"
: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" :show-overflow-tooltip="item.showTip" :label="item.name" :width="item.width" :key="item.key"> <el-table-column v-else :prop="item.key" :show-overflow-tooltip="item.showTip"
:label="item.name" :width="item.width" :key="item.key">
</el-table-column> </el-table-column>
</template> </template>
<el-table-column label="操作" width="100"> <el-table-column label="操作" width="100" v-if="!isReadonly">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="showUpdateModel(scope.row.userId)">修改</el-button> <el-button type="text" @click="showSubUpdateModel(scope.row)">修改</el-button>
<el-button type="text" @click="deleteData([scope.row])">删除</el-button> <el-button type="text" @click="doSubDelete(scope.$index)">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -68,12 +79,29 @@
</TableComponent> </TableComponent>
</FormComponent> </FormComponent>
</el-dialog> </el-dialog>
<el-dialog :close-on-click-modal="false" :title="currentId>0?'详情':currentId===-1?'新增':'编辑'" <el-dialog :close-on-click-modal="false" :title="!stepUpdateParams.id?'新增':'编辑'" :visible.sync="showSubUpdate"
:visible.sync="showSubUpdate" width="500" :before-close="handleClose"> width="500" :before-close="handleClose">
<FormComponent :options="subUpdateOptions" labelWidth="110px" labelAlign="right" :data.sync="updateParams" <FormComponent :options="subUpdateOptions" labelWidth="110px" @change="changes" labelAlign="right" :data.sync="stepUpdateParams"
:full-btn="true" btnPosition="center" @actionCallback="callback" :actions="updateActions"></FormComponent> :full-btn="true" btnPosition="center" @actionCallback="callback" :actions="updateActions"></FormComponent>
</el-dialog> </el-dialog>
<el-dialog :close-on-click-modal="false" title="作业步骤" :visible.sync="showSteptable" width="800"
:before-close="handleClose">
<TableComponent :tableData="currentStepTableData" :tableColumn="subTableColumn" :showFooter="false"
style="margin-bottom: 20px;">
<el-table ref="multipleTable" :data="currentStepTableData.datas" tooltip-effect="dark" height="250" border style="width: 100%">
<template v-for="item in subTableColumn">
<el-table-column :prop="item.key" :show-overflow-tooltip="item.showTip"
:label="item.name" :width="item.width" :key="item.key">
</el-table-column>
</template>
</el-table>
</TableComponent>
</el-dialog>
</div> </div>

View File

@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Component } from 'vue-property-decorator'; import { Component, Watch } from 'vue-property-decorator';
import template from "./work.component.html" import template from "./work.component.html"
import BaseRecordComponent from "hbt-common/components/common/baseRecord.component.vue" import BaseRecordComponent from "hbt-common/components/common/baseRecord.component.vue"
import FormComponent from "hbt-common/components/common/form.component.vue" import FormComponent from "hbt-common/components/common/form.component.vue"
@ -8,57 +8,43 @@ import TableComponent from "hbt-common/components/common/table.component.vue"
import FormOption from "hbt-common/models/formOptions" import FormOption from "hbt-common/models/formOptions"
import BtnOption from "hbt-common/models/btnOptions" import BtnOption from "hbt-common/models/btnOptions"
import DrawComponent from '@/components/draw.component.vue'; import DrawComponent from '@/components/draw.component.vue';
import UnitTreeComponent from '@/components/tree.component.vue';
import WorkService from '@/service/work.service'; import WorkService from '@/service/work.service';
import UnitService from '@/service/unit.service';
import AreaService from '@/service/area.service';
@Component({ @Component({
template, template,
components:{ components:{
FormComponent, FormComponent,
TableComponent, TableComponent,
DrawComponent, DrawComponent,
UnitTreeComponent
}, },
}) })
export default class WorkManagerComponent extends BaseRecordComponent<any> { export default class WorkManagerComponent extends BaseRecordComponent<any> {
public tableService = new WorkService(); public tableService = new WorkService();
public unitService = new UnitService()
public areaService = new AreaService()
public params = {} as any; public params = {
areaName:"",
unitName:"",
name:""
} as any;
public subTableColumn = [] as any; public subTableColumn = [] as any;
public treeData = [{ public currentStepRow:any;
label: '一级 1',
children: [{ public currentStepTableData = {
label: '二级 1-1', datas:[]
children: [{ } as any;
label: '三级 1-1-1'
}] public stepUpdateParams = {} as any;
}]
}, { public currentId = -1;
label: '一级 2',
children: [{ public treeData = [] as any;
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 formActions = [{ public formActions = [{
name:"查询", name:"查询",
@ -82,18 +68,7 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
icon:"el-icon-delete", icon:"el-icon-delete",
type:"danger" type:"danger"
}]; }];
public subTableActions = [{ public subTableActions:BtnOption[] = [];
name:"添加",
value:"subAdd",
icon:"el-icon-plus",
type:"primary"
},{
name:"批量删除",
value:"subDelete",
plain:true,
icon:"el-icon-delete",
type:"danger"
}];
public footerActions = [{ public footerActions = [{
name:"选择全部", name:"选择全部",
value:"selectAll", value:"selectAll",
@ -104,15 +79,15 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
}]; }];
public formOptions:FormOption<BtnOption>[] = [{ public formOptions:FormOption<BtnOption>[] = [{
name:"区域名称", name:"区域名称",
key:"areaId", key:"areaName",
type:"text", type:"text",
},{ },{
name:"单元名称", name:"单元名称",
key:"unitId", key:"unitName",
type:"text", type:"text",
},{ },{
name:"作业活动", name:"作业活动",
key:"unitId", key:"name",
type:"text", type:"text",
}]; }];
@ -120,119 +95,13 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
public updateParams = {} as any; public updateParams = {} as any;
public selectData = []; public selectData = [];
public areaList = [];
public unitList = [];
public updateOptions:FormOption<BtnOption>[] = [{ public isReadonly = false;
name:"选择区域",
key:"areaId",
type:"select", public updateOptions:FormOption<BtnOption>[] = [];
width:"calc(50% - 20px)",
require:true,
datas:[{
name:"区域1",
value:0
},{
name:"区域2",
value:1
}]
},{
name:"选择单元",
key:"unitId",
type:"select",
width:"calc(50% - 20px)",
require:true,
datas:[{
name:"单元1",
value:0
},{
name:"单元2",
value:1
}]
},{
name:"责任部门",
key:"deptId",
type:"select",
width:"calc(50% - 20px)",
require:true,
datas:[{
name:"部门1",
value:0
},{
name:"部门2",
value:1
}]
},{
name:"责任人",
key:"person",
type:"select",
width:"calc(50% - 20px)",
require:true,
datas:[{
name:"人员1",
value:0
},{
name:"人员2",
value:1
}]
},{
name:"作业名称",
key:"workName",
type:"text",
width:"calc(50% - 20px)",
require:true,
},{
name:"作业地点",
key:"position",
type:"text",
width:"calc(50% - 20px)",
require:true,
},{
name:"涉及岗位",
key:"job",
type:"select",
width:"calc(50% - 20px)",
require:true,
datas:[{
name:"岗位1",
value:0
},{
name:"岗位2",
value:1
}]
},{
name:"安全因素",
key:"safeKey",
type:"select",
width:"calc(50% - 20px)",
require:true,
datas:[{
name:"因素1",
value:0
},{
name:"因素2",
value:1
}]
},{
name:"辨识人",
key:"person",
type:"select",
width:"calc(50% - 20px)",
require:true,
datas:[{
name:"人员1",
value:0
},{
name:"人员2",
value:1
}]
},{
name:"辨识时间",
key:"time",
type:"date",
subType:"date",
width:"calc(50% - 20px)",
require:true,
format:"yyyy-MM-dd"
}];
@ -251,104 +120,343 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
public showSubUpdate = false; public showSubUpdate = false;
public subUpdateOptions:FormOption<BtnOption>[] = [{ public showSteptable = false;
name:"步骤名称",
key:"stepName", public subUpdateOptions:FormOption<BtnOption>[] = [];
type:"text", @Watch("$store.state.deptList",{immediate:true,deep:true})
width:"100%", onChanges(){
require:true, this.loadAreaData()
},{ }
name:"作业步骤描述",
key:"stepName",
type:"textarea",
width:"100%",
require:true,
},{
name:"作业地点",
key:"stepName",
type:"text",
width:"100%",
require:true,
},{
name:"责任人",
key:"person",
type:"select",
width:"100%",
require:true,
datas:[{
name:"人员1",
value:0
},{
name:"人员2",
value:1
}]
},{
name:"作业人",
key:"person",
type:"select",
width:"100%",
require:true,
datas:[{
name:"人员1",
value:0
},{
name:"人员2",
value:1
}]
}]
created(){ created(){
}
public buildUpdateForm(){
this.updateOptions=[{
name:"选择区域",
key:"areaId",
type:"select",
width:"calc(50% - 20px)",
require:true,
format:"areaName",
showError:false,
datas:this.areaList
},{
name:"选择单元",
key:"unitId",
type:"select",
format:"unitName",
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:this.unitList
},{
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,
showError:false,
datas:this.$store.state.userList
},{
name:"作业名称",
key:"name",
type:"text",
width:"calc(50% - 20px)",
require:true,
showError:false,
},{
name:"作业地点",
key:"location",
type:"text",
width:"calc(50% - 20px)",
require:true,
showError:false,
},{
showError:false,
name:"涉及岗位",
key:"postCode",
format:"postName",
type:"select",
multiple:true,
width:"calc(50% - 20px)",
require:true,
datas:this.$store.state.postList
},{
name:"安全因素",
key:"safetyFactor",
format:"safetyFactorName",
type:"select",
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:this.$store.state.prevention_safe_reason
},{
name:"辨识人",
key:"identifyUserId",
format:"identifyUserName",
type:"select",
width:"calc(50% - 20px)",
require:true,
showError:false,
datas:this.$store.state.userList
},{
name:"辨识时间",
key:"identifyTime",
type:"date",
subType:"date",
width:"calc(50% - 20px)",
require:true,
showError:false,
format:"yyyy-MM-dd"
}];
this.subTableActions = [{
name:"添加",
value:"subAdd",
icon:"el-icon-plus",
hide:this.isReadonly,
type:"primary"
},{
name:"批量删除",
value:"subDelete",
plain:true,
hide:this.isReadonly,
icon:"el-icon-delete",
type:"danger"
}];
this.subUpdateOptions=[{
name:"步骤名称",
key:"name",
type:"text",
width:"100%",
require:true,
showError:false,
},{
name:"作业步骤描述",
key:"description",
type:"textarea",
width:"100%",
require:true,
showError:false,
},{
name:"作业地点",
key:"location",
type:"text",
width:"100%",
require:true,
showError:false,
},{
name:"责任人",
key:"chargeUserId",
type:"select",
width:"100%",
require:true,
showError:false,
datas:this.$store.state.userList
},{
name:"作业人",
key:"workerId",
type:"select",
width:"100%",
require:true,
showError:false,
datas:this.$store.state.userList
}]
}
//
public loadAreaData(){
this.areaService.selectByPage({pageSize:1000}).then((res:any)=>{
this.areaList = res.data.datas.map(item=>{
return {
name:item.name,
value:item.id
}
});
this.buildUpdateForm()
})
}
//
public loadUnitData(id?){
this.unitService.selectByPage({pageSize:1000,areaId:id},false).then((res:any)=>{
this.unitList = res.data.datas.map(item=>{
return {
name:item.name,
value:item.id
}
});
this.buildUpdateForm()
})
} }
// //
public handleNodeClick(data){ public handleNodeClick(data){
console.log(data) this.params.unitName="";
this.params.areaName="";
if(data.areaId){
this.params.unitName = data.name
}else{
this.params.areaName = data.name
}
this.getTableData()
} }
public buildTable(){ public buildTable(){
this.tableColumn.push({name:'序号',key:"index"}); this.tableColumn.push({name:'区域名称',key:"areaName",width:"200px"});
this.tableColumn.push({name:'区域名称',key:"deptName",width:"200px"}); this.tableColumn.push({name:'风险分析单元',key:"unitName",width:"200px"});
this.tableColumn.push({name:'风险分析单元',key:"deptName",width:"200px"}); this.tableColumn.push({name:'作业活动',key:"name",showTip:true});
this.tableColumn.push({name:'作业活动',key:"person"}); this.tableColumn.push({name:'作业步骤',key:"stepNum",render:(data)=>{
this.tableColumn.push({name:'作业步骤',key:"person"}); return "<span class='link'>"+(data.stepNum?data.stepNum:0)+"</span>"
this.tableColumn.push({name:'责任部门',key:"person"}); }});
this.tableColumn.push({name:'责任人',key:"person"}); this.tableColumn.push({name:'责任部门',key:"chargeDeptName"});
this.tableColumn.push({name:'作业地点',key:"person"}); this.tableColumn.push({name:'责任人',key:"chargeUserName"});
this.tableColumn.push({name:'涉及岗位',key:"person"}); this.tableColumn.push({name:'作业地点',key:"location",showTip:true});
this.tableColumn.push({name:'涉及岗位',key:"postName",width:"200px",showTip:true});
this.subTableColumn.push({name:'序号',key:"person"}); this.subTableColumn.push({name:'序号',key:"index",width:"60"});
this.subTableColumn.push({name:'步骤名称',key:"person"}); this.subTableColumn.push({name:'步骤名称',key:"name"});
this.subTableColumn.push({name:'作业步骤描述',key:"person",showTip:true,}); this.subTableColumn.push({name:'作业步骤描述',key:"description",showTip:true,});
this.subTableColumn.push({name:'作业地点',key:"person"}); this.subTableColumn.push({name:'作业地点',key:"location",showTip:true});
this.subTableColumn.push({name:'责任人',key:"person"}); this.subTableColumn.push({name:'责任人',key:"chargeUserName"});
this.subTableColumn.push({name:'作业人',key:"person"}); this.subTableColumn.push({name:'作业人',key:"workerName"});
} }
public callback(data){ public showSteps(el,data){
const isTarget = el.target.classList.contains("link");
if(isTarget){
this.showSteptable = true;
this.currentStepTableData.datas = data.steps.map((item,index)=>{
item.index=index+1;
return item
})
}
}
public changes(data,item){
//
if(item && item.key === "chargeDeptId"){
this.updateParams.chargeDeptName = this.$store.getters.dept_map[data];
}
//
if(item && item.key === "chargeUserId"){
if(this.showSubUpdate){
this.stepUpdateParams.chargeUserName = this.$store.getters.user_map[data];
return
}
this.updateParams.chargeUserName = this.$store.getters.user_map[data];
}
//
if(item && item.key === "workerId"){
this.stepUpdateParams.workerName = this.$store.getters.user_map[data];
}
//
if(item && item.key === "identifyUserId"){
this.updateParams.identifyUserName = this.$store.getters.user_map[data];
}
//
if(item && item.key==="areaId"){
if(this.updateParams.unitId){
this.updateParams.unitId = null;
}
this.loadUnitData(data)
}
//
if(item && item.key==="postCode"){
this.updateParams.postName = data.map(itm=>this.$store.getters.post_map[itm]).join(";");
}
}
public callback(data,item?){
// //
if(data.value==="search"){ if(data && data.value==="search"){
this.getTableData() this.getTableData()
// //
}else if(data.value === "reset"){ }else if(data && data.value === "reset"){
this.reset() this.reset()
// //
}else if(data.value === "reverse"){ }else if(data && data.value === "reverse"){
this.toggleAll() this.toggleAll()
// //
}else if(data.value === "selectAll"){ }else if(data && data.value === "selectAll"){
this.selectAll() this.selectAll()
}else if(data.value === "add"){ }else if(data && data.value === "add"){
this.showUpdate = true this.showUpdateModel();
}else if(data.value === "delete"){ }else if(data && data.value === "delete"){
this.deleteData(this.selectData.map((item:any)=>item.id)) this.deleteData(this.selectData.map((item:any)=>item.id))
}else if(data.value === "subAdd"){ }else if(data && data.value === "subAdd"){
this.showSubUpdate = true this.showSubUpdateModel()
}else if(data && data.value === "subDelete"){
//
this.selectData.forEach((item,index)=>{
this.doSubDelete(index)
})
}else if(data && data.value.indexOf("save")>=0){
this.doSave(data.value!=="save")
}else if(data && data.value === "cancel"){
this.handleClose()
} }
} }
public showSubUpdateModel(row?){
this.stepUpdateParams = {} as any;
if(row){
//
this.currentStepRow = row;
this.stepUpdateParams = JSON.parse(JSON.stringify(row));
}
this.showSubUpdate = true;
}
public doSubDelete(index){
this.updateParams.steps.splice(index,1)
}
public doSave(goOn?){
//
if(this.showSubUpdate){
//
if(!this.stepUpdateParams.id){
this.stepUpdateParams.index = this.updateParams.steps.length+1;
this.updateParams.steps.push(this.stepUpdateParams);
}else{
Object.assign(this.currentStepRow,this.stepUpdateParams)
}
this.stepUpdateParams = {} as any;
this.showSubUpdate=!!goOn;
return
}
//
this.updateParams.stepNum = this.updateParams.steps.length;
this.updateParams.postCode = this.updateParams.postCode.join(";")
this.tableService.addOrUpdate(this.updateParams,this.currentId===-1).then((res)=>{
this.$message.success(this.currentId===-1?"新增成功!":"编辑成功!");
this.updateParams = {
postCode:[]
} as any
this.showUpdate = !!goOn;
this.getTableData();
})
}
// //
public reset(){ public reset(){
this.params = { this.params = {
areaName:"",
unitName:"",
name:"",
pageNum:1, pageNum:1,
pageSize:20, pageSize:20,
} as any; } as any;
@ -356,16 +464,43 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
public showUpdateModel(id){ public showUpdateModel(row?,isRead?){
this.isReadonly = !!isRead;
if(!row){
this.currentId = -1;
this.updateParams = {steps:[]} as any;
}else{
this.currentId = row.id;
this.updateParams = JSON.parse(JSON.stringify(row));
if(!this.updateParams.steps){
this.updateParams.steps = [];
}
this.currentStepTableData.datas = this.updateParams.steps.map((item,index)=>{
item.index = index+1;
return item
});
if(!isRead){
this.updateParams.postCode = this.updateParams.postCode.split(";").map(item=>+item);
}else{
this.updateParams.safetyFactorName = this.$store.getters.prevention_safe_reason_map[this.updateParams.safetyFactor];
this.buildUpdateForm()
}
}
//
this.selectData = [];
this.showUpdate = true this.showUpdate = true
} }
public handleClose(){ public handleClose(){
if(this.showSubUpdate){ if(this.showSubUpdate){
this.showSubUpdate = false; this.showSubUpdate = false;
this.stepUpdateParams = {} as any;
return return
} }
this.showSteptable = false;
this.showUpdate = false; this.showUpdate = false;
this.updateParams = {} as any;
} }

View File

@ -1,8 +1,6 @@
<div class="common-box dis-flex "> <div class="common-box dis-flex ">
<div class="common-tree-box" v-if="treeData"> <div class="common-tree-box">
<el-tree :data="treeData" :expand-on-click-node="false" default-expand-all highlight-current <UnitTreeComponent @callback="handleNodeClick"></UnitTreeComponent>
@node-click="handleNodeClick">
</el-tree>
</div> </div>
<div class="common-content-box dis-flex flex-col flex-1"> <div class="common-content-box dis-flex flex-col flex-1">
<div class="search-box"> <div class="search-box">

View File

@ -8,6 +8,7 @@ import TableComponent from "hbt-common/components/common/table.component.vue"
import FormOption from "hbt-common/models/formOptions" import FormOption from "hbt-common/models/formOptions"
import BtnOption from "hbt-common/models/btnOptions" import BtnOption from "hbt-common/models/btnOptions"
import DrawComponent from '@/components/draw.component.vue'; import DrawComponent from '@/components/draw.component.vue';
import UnitTreeComponent from '@/components/tree.component.vue';
import JobHazardService from '@/service/jobHazard.service'; import JobHazardService from '@/service/jobHazard.service';
@Component({ @Component({
template, template,
@ -15,6 +16,7 @@ import JobHazardService from '@/service/jobHazard.service';
FormComponent, FormComponent,
TableComponent, TableComponent,
DrawComponent, DrawComponent,
UnitTreeComponent
}, },
}) })
export default class WorkAnalManagerComponent extends BaseRecordComponent<any> { export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
@ -24,42 +26,6 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
public subTableColumn = [] as any; public subTableColumn = [] as any;
public treeData = [{
label: '一级 1',
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 formActions = [{ public formActions = [{
name:"查询", name:"查询",
value:"search", value:"search",

View File

@ -10,6 +10,7 @@ import FormOption from "hbt-common/models/formOptions"
import BtnOption from "hbt-common/models/btnOptions" import BtnOption from "hbt-common/models/btnOptions"
import DrawComponent from '@/components/draw.component.vue'; import DrawComponent from '@/components/draw.component.vue';
import AreaService from '@/service/area.service'; import AreaService from '@/service/area.service';
import moment from "moment"
@Component({ @Component({
template, template,
components:{ components:{
@ -25,6 +26,8 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
public params = {} as any; public params = {} as any;
public isArea = false;
public filters = [{ public filters = [{
text:"未绘制", text:"未绘制",
@ -89,13 +92,113 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
public areaList = [] as any; public areaList = [] as any;
public areaNoMap = {} as any; public areaNoMap = {} as any;
public updateActions:BtnOption[] = []; public updateActions:BtnOption[] = [];
public selectData = []; public selectData = [];
public showTurnOff = false;
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 turnOffForm = [] as any;
public turnOffAction = [{
name:"取消",
value:"cancelStatus"
},{
name:"保存",
value:"saveStatus",
type:"primary"
}]
created(){ created(){
this.getAreaList(); this.getAreaList();
this.doTurnOff(1);
}
public buildTurnOffForm(){
this.turnOffForm = [{
name:"停用/恢复",
type:"radio",
key:"status",
require:true,
width:"100%",
showError:false,
datas:[{
name:"停用",
value:1
},{
name:"恢复",
value:2
}]
},{
name:"停用开始时间",
type:"date",
subType:"datetime",
hide:this.turnOffParams.status===2,
format:"yyyy-MM-dd HH:mm",
key:"startTime",
width:"100%",
require:true,
showError:false,
},{
name:"停用结束时间",
type:"date",
subType:"datetime",
format:"yyyy-MM-dd HH:mm",
hide:this.turnOffParams.status===2,
key:"endTime",
width:"100%",
require:true,
showError:false,
},{
name:"原因",
type:"textarea",
key:"reason",
width:"100%",
require:true,
showError:false,
},{
name:"登记人",
type:"text",
key:"account",
disable:true,
require:true,
width:"100%",
showError:false,
},{
name:"登记时间",
type:"text",
key:"createTime",
disable:true,
width:"100%",
require:true,
showError:false,
}]
}
public doTurnOff(status){
this.turnOffForm.status = status;
this.showTurnOff = true;
this.buildTurnOffForm();
}
public turnOffChange(data,item){
if(item && item.key==="status"){
this.buildTurnOffForm();
}
}
public doTurnOffAction(data){
console.log(data)
} }
public buildFormOptions(){ public buildFormOptions(){
@ -276,11 +379,11 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
public callback(data,item?){ public callback(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.getters.dept_map[data];
} }
// //
if(item && item.key === "chargeUserId"){ if(item && item.key === "chargeUserId"){
this.updateParams.chargeUserName = this.$store.state.userList.find(item=>item.value === data)?.name; this.updateParams.chargeUserName = this.$store.getters.user_map[data];
} }
// //
if(item && item.key === "areaId"){ if(item && item.key === "areaId"){
@ -301,7 +404,7 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
this.selectAll() this.selectAll()
}else if(data && data.value === "add"){ }else if(data && data.value === "add"){
this.showUpdateModel() this.showUpdateModel()
}else if(data.value === "delete"){ }else if(data && data.value === "delete"){
this.deleteData(this.selectData.map((item:any)=>item.id)) this.deleteData(this.selectData.map((item:any)=>item.id))
}else if(data && (data.value === "draw" || data.value==="readDraw")){ }else if(data && (data.value === "draw" || data.value==="readDraw")){
this.doDraw() this.doDraw()