forked from xxhjsb/hbt-prevention-ui
feat:完成作业活动清单增删改查
parent
8976191796
commit
4c8063c87e
|
@ -5,9 +5,9 @@ VUE_APP_TITLE = 汉邦唐全真数字服务平台
|
|||
# 网关地址
|
||||
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
|
||||
# 微前端地址
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
"hbt-common": "0.0.7",
|
||||
"mapbox-gl": "^2.15.0",
|
||||
"mockjs": "^1.1.0",
|
||||
"moment": "^2.29.4",
|
||||
"screenfull": "^6.0.2",
|
||||
"vue": "^2.6.14",
|
||||
"vue-class-component": "^7.2.3",
|
||||
|
|
|
@ -126,6 +126,10 @@ export default class DrawComponent extends Vue {
|
|||
if(this.positions.length){
|
||||
this.flyToCenter(16)
|
||||
}
|
||||
if(this.map){
|
||||
|
||||
this.addAllPolygon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,11 +301,12 @@ export default class DrawComponent extends Vue {
|
|||
|
||||
public drawNode(data){
|
||||
this.params =Object.assign({bottomHeight:0,topHeight:0,geoJson:"[]"},data) as any;
|
||||
if(data.area_id){
|
||||
if(data.areaId){
|
||||
this.viewModel = "unit"
|
||||
}else{
|
||||
this.viewModel = "area"
|
||||
}
|
||||
|
||||
}
|
||||
// 点击绘制
|
||||
public drawCallBack(){
|
||||
|
@ -347,6 +352,7 @@ export default class DrawComponent extends Vue {
|
|||
service.addOrUpdate(this.updateParams,false).then(res=>{
|
||||
this.viewModel = "list";
|
||||
this.destoryDraw();
|
||||
this.setTreeData()
|
||||
})
|
||||
this.onClose(false)
|
||||
}else{
|
||||
|
|
|
@ -5,9 +5,9 @@ export default class UnitService extends BaseService<any>{
|
|||
constructor(){
|
||||
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';
|
||||
return this.get(url,params,true)
|
||||
return this.get(url,params,showLoading)
|
||||
}
|
||||
public deleteByIds(params):Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.prevention+'/risk/unit';
|
||||
|
|
|
@ -6,11 +6,22 @@ export default class WorkService extends BaseService<any>{
|
|||
super()
|
||||
}
|
||||
public selectByPage(params: any):Promise<AxiosResponse<ActionResult<any>>>{
|
||||
const url = this.prefix.system+'/user/list';
|
||||
return this.get(url,params,true)
|
||||
const url = this.prefix.prevention+'/job/inventory/getList';
|
||||
return this.post(url,params,{},true)
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
// 新增或更新
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,11 +8,34 @@ export default new Vuex.Store({
|
|||
deptList:[],
|
||||
deptTreeList:[],
|
||||
userList:[],
|
||||
postList:[],
|
||||
common_yes_no:[],
|
||||
prevention_dangrous_level:[],
|
||||
prevention_risk_level:[],
|
||||
prevention_safe_reason:[],
|
||||
},
|
||||
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)=>{
|
||||
const map = {};
|
||||
state.common_yes_no.forEach((item:any)=>{
|
||||
|
@ -33,6 +56,13 @@ export default new Vuex.Store({
|
|||
map[item.value] = item.name
|
||||
})
|
||||
return map
|
||||
},
|
||||
prevention_safe_reason_map:(state)=>{
|
||||
const map = {};
|
||||
state.prevention_safe_reason.forEach((item:any)=>{
|
||||
map[item.value] = item.name
|
||||
})
|
||||
return map
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
|
@ -46,6 +76,10 @@ export default new Vuex.Store({
|
|||
setDeptTreeList(state,data){
|
||||
state.deptTreeList = data;
|
||||
},
|
||||
|
||||
setPostList(state,data){
|
||||
state.postList = data;
|
||||
},
|
||||
set_common_yes_no(state,data){
|
||||
state.common_yes_no = data;
|
||||
},
|
||||
|
@ -54,6 +88,9 @@ export default new Vuex.Store({
|
|||
},
|
||||
set_prevention_risk_level(state,data){
|
||||
state.prevention_risk_level = data;
|
||||
},
|
||||
set_prevention_safe_reason(state,data){
|
||||
state.prevention_safe_reason = data;
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
|
|
@ -2,22 +2,70 @@
|
|||
<router-view></router-view>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import AreaService from '@/service/area.service';
|
||||
import UnitService from '@/service/unit.service';
|
||||
import SystemService from 'hbt-common/service/system.service';
|
||||
import { Component,Vue } from 'vue-property-decorator';
|
||||
@Component
|
||||
export default class BlankComponent extends Vue {
|
||||
|
||||
public systemService = new SystemService()
|
||||
public systemService = new SystemService();
|
||||
public areaService = new AreaService();
|
||||
public unitService = new UnitService();
|
||||
created(){
|
||||
Promise.all([
|
||||
this.systemService.getDeptTree(),
|
||||
this.systemService.getDeptList(),
|
||||
this.systemService.getUserList({pageSize:0}),
|
||||
this.systemService.getPostList({pageSize:1000}),
|
||||
this.systemService.getDictData("common_yes_no"),
|
||||
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)=>{
|
||||
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)=>{
|
||||
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
|
||||
}
|
||||
}))
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,3 +139,12 @@
|
|||
justify-content: center;
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
.tips{
|
||||
color: #F56C6C;
|
||||
margin-left: -43px;
|
||||
margin-bottom: 20px;
|
||||
margin-top: -20px;
|
||||
font-size: 20px;
|
||||
scale:0.5;
|
||||
}
|
|
@ -37,7 +37,7 @@ export default class AreaManagerComponent extends BaseRecordComponent<any> {
|
|||
value:1
|
||||
}]
|
||||
|
||||
|
||||
public isArea = true;
|
||||
public showQrCode = false;
|
||||
public qrUrl = "";
|
||||
|
||||
|
@ -211,6 +211,13 @@ export default class AreaManagerComponent extends BaseRecordComponent<any> {
|
|||
icon:"el-icon-edit-outline",
|
||||
type:"primary"
|
||||
}]
|
||||
},{
|
||||
name:"分析对象编号",
|
||||
key:"analTargetNum",
|
||||
type:"text",
|
||||
showError:false,
|
||||
width:"calc(50% - 20px)",
|
||||
require:true,
|
||||
}];
|
||||
|
||||
this.updateActions = [{
|
||||
|
@ -317,11 +324,11 @@ export default class AreaManagerComponent extends BaseRecordComponent<any> {
|
|||
public callback(data,item?){
|
||||
// 新增编辑选择部门
|
||||
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"){
|
||||
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"){
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
<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>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -42,7 +44,9 @@
|
|||
:before-close="handleClose">
|
||||
<FormComponent :options="updateOptions" :isReadonly="isReadonly" labelWidth="110px" labelAlign="right" :data.sync="updateParams"
|
||||
@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>
|
||||
|
||||
|
@ -51,4 +55,10 @@
|
|||
|
||||
<img :src="qrUrl" style="width: 100%;" alt="">
|
||||
</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>
|
|
@ -1,33 +1,40 @@
|
|||
<div class="common-box dis-flex ">
|
||||
<div class="common-tree-box" v-if="treeData">
|
||||
<el-tree :data="treeData" :expand-on-click-node="false" default-expand-all highlight-current @node-click="handleNodeClick">
|
||||
</el-tree>
|
||||
<div class="common-tree-box">
|
||||
<UnitTreeComponent @callback="handleNodeClick"></UnitTreeComponent>
|
||||
</div>
|
||||
<div class="common-content-box dis-flex flex-col flex-1">
|
||||
<div class="search-box">
|
||||
<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 class="table-box flex-1">
|
||||
<TableComponent :tableData="tableData" :tableColumn="tableColumn" @tabCallback="callback($event)"
|
||||
@actionCallback="callback($event)" @pageNumberChange="callback($event)"
|
||||
@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%">
|
||||
<el-table-column type="selection" label="全选" width="40">
|
||||
</el-table-column>
|
||||
<template v-for="item in tableColumn">
|
||||
<el-table-column v-if="item.render" :label="item.name" :width="item.width" :key="item.key">
|
||||
<div slot-scope="scope" v-html="item.render(scope.row)"></div>
|
||||
<el-table-column label="序号" width="60">
|
||||
<template slot-scope="scope">
|
||||
{{scope.$index+1}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-else :prop="item.key" :label="item.name" :width="item.width" :key="item.key">
|
||||
<template v-for="item in tableColumn">
|
||||
<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" style="pointer-events: none;" @click="showSteps($event,scope.row)"
|
||||
v-html="item.render(scope.row)"></div>
|
||||
</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>
|
||||
</template>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="showUpdateModel(scope.row.userId)">查看</el-button>
|
||||
<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)">修改</el-button>
|
||||
<el-button type="text" @click="deleteData([scope.row])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -37,30 +44,34 @@
|
|||
</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">
|
||||
<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">
|
||||
<div class="sub-title">作业步骤</div>
|
||||
|
||||
<TableComponent :tableData="tableData" :tableColumn="subTableColumn" @actionCallback="callback($event)"
|
||||
:actions="subTableActions" actionPosition="flex-start" :showFooter="false" style="margin-bottom: 20px;">
|
||||
<TableComponent :tableData="currentStepTableData" :tableColumn="subTableColumn"
|
||||
@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%">
|
||||
<el-table-column type="selection" label="全选" width="40">
|
||||
<el-table-column type="selection" label="全选" width="40" v-if="!isReadonly">
|
||||
</el-table-column>
|
||||
<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>
|
||||
</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>
|
||||
</template>
|
||||
<el-table-column label="操作" width="100">
|
||||
<el-table-column label="操作" width="100" v-if="!isReadonly">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="showUpdateModel(scope.row.userId)">修改</el-button>
|
||||
<el-button type="text" @click="deleteData([scope.row])">删除</el-button>
|
||||
<el-button type="text" @click="showSubUpdateModel(scope.row)">修改</el-button>
|
||||
<el-button type="text" @click="doSubDelete(scope.$index)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -71,9 +82,26 @@
|
|||
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog :close-on-click-modal="false" :title="currentId>0?'详情':currentId===-1?'新增':'编辑'"
|
||||
:visible.sync="showSubUpdate" width="500" :before-close="handleClose">
|
||||
<FormComponent :options="subUpdateOptions" labelWidth="110px" labelAlign="right" :data.sync="updateParams"
|
||||
<el-dialog :close-on-click-modal="false" :title="!stepUpdateParams.id?'新增':'编辑'" :visible.sync="showSubUpdate"
|
||||
width="500" :before-close="handleClose">
|
||||
<FormComponent :options="subUpdateOptions" labelWidth="110px" @change="changes" labelAlign="right" :data.sync="stepUpdateParams"
|
||||
:full-btn="true" btnPosition="center" @actionCallback="callback" :actions="updateActions"></FormComponent>
|
||||
</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>
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { Component } from 'vue-property-decorator';
|
||||
import { Component, Watch } from 'vue-property-decorator';
|
||||
import template from "./work.component.html"
|
||||
import BaseRecordComponent from "hbt-common/components/common/baseRecord.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 BtnOption from "hbt-common/models/btnOptions"
|
||||
import DrawComponent from '@/components/draw.component.vue';
|
||||
import UnitTreeComponent from '@/components/tree.component.vue';
|
||||
import WorkService from '@/service/work.service';
|
||||
import UnitService from '@/service/unit.service';
|
||||
import AreaService from '@/service/area.service';
|
||||
@Component({
|
||||
template,
|
||||
components:{
|
||||
FormComponent,
|
||||
TableComponent,
|
||||
DrawComponent,
|
||||
UnitTreeComponent
|
||||
},
|
||||
})
|
||||
export default class WorkManagerComponent extends BaseRecordComponent<any> {
|
||||
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 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 currentStepRow:any;
|
||||
|
||||
public currentStepTableData = {
|
||||
datas:[]
|
||||
} as any;
|
||||
|
||||
public stepUpdateParams = {} as any;
|
||||
|
||||
public currentId = -1;
|
||||
|
||||
public treeData = [] as any;
|
||||
|
||||
public formActions = [{
|
||||
name:"查询",
|
||||
|
@ -82,18 +68,7 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
|
|||
icon:"el-icon-delete",
|
||||
type:"danger"
|
||||
}];
|
||||
public subTableActions = [{
|
||||
name:"添加",
|
||||
value:"subAdd",
|
||||
icon:"el-icon-plus",
|
||||
type:"primary"
|
||||
},{
|
||||
name:"批量删除",
|
||||
value:"subDelete",
|
||||
plain:true,
|
||||
icon:"el-icon-delete",
|
||||
type:"danger"
|
||||
}];
|
||||
public subTableActions:BtnOption[] = [];
|
||||
public footerActions = [{
|
||||
name:"选择全部",
|
||||
value:"selectAll",
|
||||
|
@ -104,15 +79,15 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
|
|||
}];
|
||||
public formOptions:FormOption<BtnOption>[] = [{
|
||||
name:"区域名称",
|
||||
key:"areaId",
|
||||
key:"areaName",
|
||||
type:"text",
|
||||
},{
|
||||
name:"单元名称",
|
||||
key:"unitId",
|
||||
key:"unitName",
|
||||
type:"text",
|
||||
},{
|
||||
name:"作业活动",
|
||||
key:"unitId",
|
||||
key:"name",
|
||||
type:"text",
|
||||
}];
|
||||
|
||||
|
@ -120,119 +95,13 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
|
|||
public updateParams = {} as any;
|
||||
public selectData = [];
|
||||
|
||||
public areaList = [];
|
||||
public unitList = [];
|
||||
|
||||
public updateOptions:FormOption<BtnOption>[] = [{
|
||||
name:"选择区域",
|
||||
key:"areaId",
|
||||
type:"select",
|
||||
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"
|
||||
}];
|
||||
public isReadonly = false;
|
||||
|
||||
|
||||
public updateOptions:FormOption<BtnOption>[] = [];
|
||||
|
||||
|
||||
|
||||
|
@ -251,104 +120,343 @@ export default class WorkManagerComponent extends BaseRecordComponent<any> {
|
|||
|
||||
public showSubUpdate = false;
|
||||
|
||||
public subUpdateOptions:FormOption<BtnOption>[] = [{
|
||||
public showSteptable = false;
|
||||
|
||||
public subUpdateOptions:FormOption<BtnOption>[] = [];
|
||||
@Watch("$store.state.deptList",{immediate:true,deep:true})
|
||||
onChanges(){
|
||||
this.loadAreaData()
|
||||
}
|
||||
|
||||
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:"stepName",
|
||||
key:"name",
|
||||
type:"text",
|
||||
width:"100%",
|
||||
require:true,
|
||||
showError:false,
|
||||
},{
|
||||
name:"作业步骤描述",
|
||||
key:"stepName",
|
||||
key:"description",
|
||||
type:"textarea",
|
||||
width:"100%",
|
||||
require:true,
|
||||
showError:false,
|
||||
},{
|
||||
name:"作业地点",
|
||||
key:"stepName",
|
||||
key:"location",
|
||||
type:"text",
|
||||
width:"100%",
|
||||
require:true,
|
||||
showError:false,
|
||||
},{
|
||||
name:"责任人",
|
||||
key:"person",
|
||||
key:"chargeUserId",
|
||||
type:"select",
|
||||
width:"100%",
|
||||
require:true,
|
||||
datas:[{
|
||||
name:"人员1",
|
||||
value:0
|
||||
},{
|
||||
name:"人员2",
|
||||
value:1
|
||||
}]
|
||||
showError:false,
|
||||
datas:this.$store.state.userList
|
||||
},{
|
||||
name:"作业人",
|
||||
key:"person",
|
||||
key:"workerId",
|
||||
type:"select",
|
||||
width:"100%",
|
||||
require:true,
|
||||
datas:[{
|
||||
name:"人员1",
|
||||
value:0
|
||||
},{
|
||||
name:"人员2",
|
||||
value:1
|
||||
}]
|
||||
showError:false,
|
||||
datas:this.$store.state.userList
|
||||
}]
|
||||
}
|
||||
|
||||
created(){
|
||||
|
||||
// 加载区域列表
|
||||
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){
|
||||
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(){
|
||||
this.tableColumn.push({name:'序号',key:"index"});
|
||||
this.tableColumn.push({name:'区域名称',key:"deptName",width:"200px"});
|
||||
this.tableColumn.push({name:'风险分析单元',key:"deptName",width:"200px"});
|
||||
this.tableColumn.push({name:'作业活动',key:"person"});
|
||||
this.tableColumn.push({name:'作业步骤',key:"person"});
|
||||
this.tableColumn.push({name:'责任部门',key:"person"});
|
||||
this.tableColumn.push({name:'责任人',key:"person"});
|
||||
this.tableColumn.push({name:'作业地点',key:"person"});
|
||||
this.tableColumn.push({name:'涉及岗位',key:"person"});
|
||||
this.tableColumn.push({name:'区域名称',key:"areaName",width:"200px"});
|
||||
this.tableColumn.push({name:'风险分析单元',key:"unitName",width:"200px"});
|
||||
this.tableColumn.push({name:'作业活动',key:"name",showTip:true});
|
||||
this.tableColumn.push({name:'作业步骤',key:"stepNum",render:(data)=>{
|
||||
return "<span class='link'>"+(data.stepNum?data.stepNum:0)+"</span>"
|
||||
}});
|
||||
this.tableColumn.push({name:'责任部门',key:"chargeDeptName"});
|
||||
this.tableColumn.push({name:'责任人',key:"chargeUserName"});
|
||||
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:"person"});
|
||||
this.subTableColumn.push({name:'作业步骤描述',key:"person",showTip:true,});
|
||||
this.subTableColumn.push({name:'作业地点',key:"person"});
|
||||
this.subTableColumn.push({name:'责任人',key:"person"});
|
||||
this.subTableColumn.push({name:'作业人',key:"person"});
|
||||
this.subTableColumn.push({name:'序号',key:"index",width:"60"});
|
||||
this.subTableColumn.push({name:'步骤名称',key:"name"});
|
||||
this.subTableColumn.push({name:'作业步骤描述',key:"description",showTip:true,});
|
||||
this.subTableColumn.push({name:'作业地点',key:"location",showTip:true});
|
||||
this.subTableColumn.push({name:'责任人',key:"chargeUserName"});
|
||||
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()
|
||||
// 重置
|
||||
}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"){
|
||||
this.showUpdate = true
|
||||
}else if(data.value === "delete"){
|
||||
}else if(data && data.value === "add"){
|
||||
this.showUpdateModel();
|
||||
}else if(data && data.value === "delete"){
|
||||
this.deleteData(this.selectData.map((item:any)=>item.id))
|
||||
}else if(data.value === "subAdd"){
|
||||
this.showSubUpdate = true
|
||||
}else if(data && data.value === "subAdd"){
|
||||
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(){
|
||||
this.params = {
|
||||
areaName:"",
|
||||
unitName:"",
|
||||
name:"",
|
||||
pageNum:1,
|
||||
pageSize:20,
|
||||
} 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
|
||||
}
|
||||
|
||||
public handleClose(){
|
||||
if(this.showSubUpdate){
|
||||
this.showSubUpdate = false;
|
||||
this.stepUpdateParams = {} as any;
|
||||
return
|
||||
}
|
||||
this.showSteptable = false;
|
||||
this.showUpdate = false;
|
||||
this.updateParams = {} as any;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<div class="common-box dis-flex ">
|
||||
<div class="common-tree-box" v-if="treeData">
|
||||
<el-tree :data="treeData" :expand-on-click-node="false" default-expand-all highlight-current
|
||||
@node-click="handleNodeClick">
|
||||
</el-tree>
|
||||
<div class="common-tree-box">
|
||||
<UnitTreeComponent @callback="handleNodeClick"></UnitTreeComponent>
|
||||
</div>
|
||||
<div class="common-content-box dis-flex flex-col flex-1">
|
||||
<div class="search-box">
|
||||
|
|
|
@ -8,6 +8,7 @@ import TableComponent from "hbt-common/components/common/table.component.vue"
|
|||
import FormOption from "hbt-common/models/formOptions"
|
||||
import BtnOption from "hbt-common/models/btnOptions"
|
||||
import DrawComponent from '@/components/draw.component.vue';
|
||||
import UnitTreeComponent from '@/components/tree.component.vue';
|
||||
import JobHazardService from '@/service/jobHazard.service';
|
||||
@Component({
|
||||
template,
|
||||
|
@ -15,6 +16,7 @@ import JobHazardService from '@/service/jobHazard.service';
|
|||
FormComponent,
|
||||
TableComponent,
|
||||
DrawComponent,
|
||||
UnitTreeComponent
|
||||
},
|
||||
})
|
||||
export default class WorkAnalManagerComponent extends BaseRecordComponent<any> {
|
||||
|
@ -24,42 +26,6 @@ export default class WorkAnalManagerComponent extends BaseRecordComponent<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 = [{
|
||||
name:"查询",
|
||||
value:"search",
|
||||
|
|
|
@ -10,6 +10,7 @@ import FormOption from "hbt-common/models/formOptions"
|
|||
import BtnOption from "hbt-common/models/btnOptions"
|
||||
import DrawComponent from '@/components/draw.component.vue';
|
||||
import AreaService from '@/service/area.service';
|
||||
import moment from "moment"
|
||||
@Component({
|
||||
template,
|
||||
components:{
|
||||
|
@ -25,6 +26,8 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
|||
|
||||
public params = {} as any;
|
||||
|
||||
public isArea = false;
|
||||
|
||||
|
||||
public filters = [{
|
||||
text:"未绘制",
|
||||
|
@ -94,8 +97,108 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
|||
|
||||
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(){
|
||||
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(){
|
||||
|
@ -276,11 +379,11 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
|||
public callback(data,item?){
|
||||
// 新增编辑选择部门
|
||||
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"){
|
||||
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"){
|
||||
|
@ -301,7 +404,7 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
|||
this.selectAll()
|
||||
}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 && (data.value === "draw" || data.value==="readDraw")){
|
||||
this.doDraw()
|
||||
|
|
Loading…
Reference in New Issue