forked from xxhjsb/hbt-prevention-ui
fetch:设备设施清单
parent
b956f31151
commit
0608cdd7c0
|
@ -6,11 +6,28 @@ export default class DeviceService 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+'/device/inventory/getList';
|
||||||
return this.get(url,params,true)
|
return this.post(url,params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public selectById(id):Promise<AxiosResponse<ActionResult<any>>>{
|
||||||
|
const url = this.prefix.prevention+'/device/inventory/detail?id='+id;
|
||||||
|
return this.get(url,null,true)
|
||||||
|
}
|
||||||
|
// 新增或更新
|
||||||
|
public addOrUpdate(params: any, add: boolean,showLoading?:boolean): Promise<AxiosResponse<ActionResult<any>>>{
|
||||||
|
|
||||||
|
if(add){
|
||||||
|
const url = this.prefix.prevention+'/device/inventory/add';
|
||||||
|
return this.post(url,params,{},showLoading)
|
||||||
|
}else{
|
||||||
|
const url = this.prefix.prevention+'/device/inventory/update';
|
||||||
|
return this.put(url,params,{},showLoading)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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 +'/device/inventory/delete';
|
||||||
return this.deleteBatch(url,params,{},true)
|
return this.deleteBatch(url,params,{},true)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,6 +14,7 @@ export default new Vuex.Store({
|
||||||
prevention_risk_level:[],
|
prevention_risk_level:[],
|
||||||
prevention_safe_reason:[],
|
prevention_safe_reason:[],
|
||||||
prevention_dangrous_type:[],
|
prevention_dangrous_type:[],
|
||||||
|
prevention_device_type:[]
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
dept_map:(state)=>{
|
dept_map:(state)=>{
|
||||||
|
@ -71,7 +72,14 @@ export default new Vuex.Store({
|
||||||
map[item.value] = item.name
|
map[item.value] = item.name
|
||||||
})
|
})
|
||||||
return map
|
return map
|
||||||
}
|
},
|
||||||
|
prevention_device_type_map:(state)=>{
|
||||||
|
const map = {};
|
||||||
|
state.prevention_device_type.forEach((item:any)=>{
|
||||||
|
map[item.value] = item.name
|
||||||
|
})
|
||||||
|
return map
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
|
|
||||||
|
@ -102,6 +110,9 @@ export default new Vuex.Store({
|
||||||
},
|
},
|
||||||
set_prevention_dangrous_type(state,data){
|
set_prevention_dangrous_type(state,data){
|
||||||
state.prevention_dangrous_type = data;
|
state.prevention_dangrous_type = data;
|
||||||
|
},
|
||||||
|
set_prevention_device_type(state,data){
|
||||||
|
state.prevention_device_type = data;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -22,7 +22,8 @@ export default class BlankComponent extends Vue {
|
||||||
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"),
|
this.systemService.getDictData("prevention_safe_reason"),
|
||||||
this.systemService.getDictData("prevention_dangrous_type")
|
this.systemService.getDictData("prevention_dangrous_type"),
|
||||||
|
this.systemService.getDictData("prevention_device_type"),
|
||||||
]).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) => {
|
this.$store.commit("setUserList", results[2].data.datas.map((item) => {
|
||||||
|
@ -71,8 +72,12 @@ export default class BlankComponent extends Vue {
|
||||||
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
|
value: isNaN(+item.dictValue) ? item.dictValue : +item.dictValue
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
this.$store.commit("set_prevention_device_type", results[9].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 {
|
||||||
|
|
|
@ -1,7 +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 @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">
|
||||||
|
@ -17,17 +16,23 @@
|
||||||
@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" :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)" @click="showPros($event,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" :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,9 +42,63 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-dialog :close-on-click-modal="false" :title="currentId>0?'详情':currentId===-1?'新增':'编辑'"
|
<el-dialog :close-on-click-modal="false" :title=" isReadonly?'详情':currentId>0?'编辑':'新增'" :visible.sync="showUpdate"
|
||||||
:visible.sync="showUpdate" width="952px" :before-close="handleClose">
|
width="952px" :before-close="handleClose">
|
||||||
<FormComponent :options="updateOptions" :isReadonly="true" labelWidth="110px" labelAlign="right"
|
<FormComponent :options="updateOptions" :isReadonly="isReadonly" labelWidth="110px" labelAlign="right"
|
||||||
:data.sync="updateParams"></FormComponent>
|
:data.sync="updateParams" @change="changes" :actions="updateActions" @actionCallback="callback"
|
||||||
|
:full-btn="true" btnPosition="center">
|
||||||
|
<div class="sub-title">检查项目</div>
|
||||||
|
<TableComponent :tableData="tableData" :tableColumn="subTableColumn"
|
||||||
|
@actionCallback="projectCallback($event)" :actions="!isReadonly?tableActions:[]"
|
||||||
|
actionPosition="flex-start" :showFooter="false" style="margin-bottom: 20px;">
|
||||||
|
<el-table ref="multipleTable" :data="updateParams.items" tooltip-effect="dark" height="250" border
|
||||||
|
@selection-change="handleSelectionChange" style="width: 100%">
|
||||||
|
<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">
|
||||||
|
<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>
|
||||||
|
</template>
|
||||||
|
<el-table-column label="操作" width="100" v-if="!isReadonly">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button type="text" @click="showSubmodal(scope.row,true)">查看</el-button>
|
||||||
|
<el-button type="text" @click="showSubmodal(scope.row)">修改</el-button>
|
||||||
|
<el-button type="text" @click="deleteProData([scope.row.index - 1])">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
</TableComponent>
|
||||||
|
</FormComponent>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog :close-on-click-modal="false" :title="proIsReadonly?'详情':updateProParams.index ?'编辑' :'新增'"
|
||||||
|
:visible.sync="showProject" width="700px" :before-close="handleProClose">
|
||||||
|
<FormComponent :options="projectOptions" :isReadonly="proIsReadonly" labelWidth="110px" labelAlign="right"
|
||||||
|
:data.sync="updateProParams" :actions="proIsReadonly ? [] :updateActions" @actionCallback="subCallback"
|
||||||
|
:full-btn="true" btnPosition="center">
|
||||||
|
</FormComponent>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog :close-on-click-modal="false" title="检查项目" :visible.sync="showProtable" width="800"
|
||||||
|
:before-close="handleClosePro">
|
||||||
|
<TableComponent :tableData="currentProTableData" :tableColumn="subTableColumn" :showFooter="false"
|
||||||
|
style="margin-bottom: 20px;">
|
||||||
|
<el-table ref="multipleTable" :data="currentProTableData.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>
|
|
@ -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 "./device.component.html"
|
import template from "./device.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,56 +8,47 @@ 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 DeviceService from '@/service/device.service';
|
import DeviceService from '@/service/device.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 DeviceManagerComponent extends BaseRecordComponent<any> {
|
export default class DeviceManagerComponent extends BaseRecordComponent<any> {
|
||||||
public tableService = new DeviceService();
|
public tableService = new DeviceService();
|
||||||
|
public unitService = new UnitService();
|
||||||
|
public areaService = new AreaService();
|
||||||
|
|
||||||
public params = {} as any;
|
public params = {
|
||||||
|
areaName: "",
|
||||||
|
unitName: "",
|
||||||
|
} as any;
|
||||||
|
public isReadonly = false;
|
||||||
|
public currentId = -1;
|
||||||
|
|
||||||
public treeData = [{
|
public treeData = [] as any;
|
||||||
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 areaList = [];
|
||||||
|
public unitList = [];
|
||||||
|
|
||||||
|
public subTableColumn = [] as any;
|
||||||
|
//检查项目
|
||||||
|
public showProject = false;
|
||||||
|
public updateProParams = {} as any;
|
||||||
|
public proIsReadonly = false;
|
||||||
|
public showProtable = false;
|
||||||
|
public currentProTableData = {
|
||||||
|
datas: []
|
||||||
|
} as any;
|
||||||
public formActions = [{
|
public formActions = [{
|
||||||
name: "查询",
|
name: "查询",
|
||||||
value: "search",
|
value: "search",
|
||||||
|
@ -90,109 +81,252 @@ export default class DeviceManagerComponent 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",
|
||||||
}];
|
}];
|
||||||
|
public updateActions = [{
|
||||||
|
name: "取消",
|
||||||
|
value: "cancel"
|
||||||
|
}, {
|
||||||
|
name: "保存并继续添加",
|
||||||
|
value: "saveAndContinue",
|
||||||
|
type: "primary"
|
||||||
|
}, {
|
||||||
|
name: "保存",
|
||||||
|
value: "save",
|
||||||
|
type: "primary"
|
||||||
|
}];
|
||||||
|
|
||||||
public updateOptions: FormOption<BtnOption>[] = [{
|
public updateOptions: FormOption<BtnOption>[] = [] as any;
|
||||||
|
public buildUpdateForm() {
|
||||||
|
this.updateOptions = [{
|
||||||
name: "选择区域",
|
name: "选择区域",
|
||||||
key: "areaId",
|
key: "areaId",
|
||||||
|
format: "areaName",
|
||||||
type: "select",
|
type: "select",
|
||||||
require: true,
|
require: true,
|
||||||
width: "calc(50% - 20px)",
|
width: "calc(50% - 20px)",
|
||||||
|
showError: false,
|
||||||
|
datas: this.areaList
|
||||||
}, {
|
}, {
|
||||||
name: "选择单元",
|
name: "选择单元",
|
||||||
key: "unitId",
|
key: "unitId",
|
||||||
|
format: "unitName",
|
||||||
type: "select",
|
type: "select",
|
||||||
require: true,
|
require: true,
|
||||||
width: "calc(50% - 20px)",
|
width: "calc(50% - 20px)",
|
||||||
|
showError: false,
|
||||||
|
datas: this.unitList
|
||||||
}, {
|
}, {
|
||||||
name: "责任部门",
|
name: "责任部门",
|
||||||
key: "deptId",
|
key: "chargeDeptId",
|
||||||
type: "select",
|
format: "chargeDeptName",
|
||||||
|
type: "treeSelect",
|
||||||
require: true,
|
require: true,
|
||||||
width: "calc(50% - 20px)",
|
width: "calc(50% - 20px)",
|
||||||
datas: [{
|
expandLevel: Infinity,
|
||||||
name: "部门1",
|
showError: false,
|
||||||
value: 0
|
datas: this.$store.state.deptTreeList,
|
||||||
}, {
|
|
||||||
name: "部门2",
|
|
||||||
value: 1
|
|
||||||
}]
|
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
name: "责任人",
|
name: "责任人",
|
||||||
key: "person",
|
key: "chargeUserId",
|
||||||
|
format: "chargeUserName",
|
||||||
type: "select",
|
type: "select",
|
||||||
require: true,
|
require: true,
|
||||||
width: "calc(50% - 20px)",
|
width: "calc(50% - 20px)",
|
||||||
datas: [{
|
showError: false,
|
||||||
name: "人员1",
|
datas: this.$store.state.userList
|
||||||
value: 0
|
|
||||||
}, {
|
|
||||||
name: "人员2",
|
|
||||||
value: 1
|
|
||||||
}]
|
|
||||||
}, {
|
}, {
|
||||||
name: "设备名称",
|
name: "设备名称",
|
||||||
key: "devicename",
|
key: "name",
|
||||||
type: "text",
|
type: "text",
|
||||||
require: true,
|
require: true,
|
||||||
width: "calc(50% - 20px)",
|
width: "calc(50% - 20px)",
|
||||||
}, {
|
}, {
|
||||||
name: "设备类型",
|
name: "设备类型",
|
||||||
key: "devicetype",
|
key: "type",
|
||||||
type: "select",
|
type: "select",
|
||||||
require: true,
|
require: true,
|
||||||
width: "calc(50% - 20px)",
|
width: "calc(50% - 20px)",
|
||||||
|
datas: this.$store.state.prevention_device_type
|
||||||
}, {
|
}, {
|
||||||
name: "涉及岗位",
|
name: "涉及岗位",
|
||||||
key: "job",
|
key: "postCode",
|
||||||
|
format: "postName",
|
||||||
|
multiple: true,
|
||||||
require: true,
|
require: true,
|
||||||
type: "select",
|
type: "select",
|
||||||
width: "calc(50% - 20px)",
|
width: "calc(50% - 20px)",
|
||||||
|
datas: this.$store.state.postList
|
||||||
}, {
|
}, {
|
||||||
name: "安全因素",
|
name: "安全因素",
|
||||||
key: "safeKey",
|
key: "safetyFactor",
|
||||||
|
format: 'safetyFactorName',
|
||||||
require: true,
|
require: true,
|
||||||
type: "select",
|
type: "select",
|
||||||
|
multiple: true,
|
||||||
width: "calc(50% - 20px)",
|
width: "calc(50% - 20px)",
|
||||||
}];
|
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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
public projectOptions: FormOption<BtnOption>[] = [
|
||||||
|
{
|
||||||
|
name: "检查项目",
|
||||||
|
key: "name",
|
||||||
|
type: "textarea",
|
||||||
|
require: true,
|
||||||
|
width: "100%",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "检查标准",
|
||||||
|
key: "standard",
|
||||||
|
type: "textarea",
|
||||||
|
require: true,
|
||||||
|
width: "100%",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
public showUpdate = false;
|
public showUpdate = false;
|
||||||
public updateParams = {} as any;
|
public updateParams = {
|
||||||
|
items: [],
|
||||||
|
} as any;
|
||||||
public selectData = [];
|
public selectData = [];
|
||||||
|
|
||||||
|
@Watch("$store.state.deptList", { immediate: true, deep: true })
|
||||||
|
onChanges() {
|
||||||
|
this.loadAreaData()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
created() {
|
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) {
|
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" });
|
||||||
this.tableColumn.push({ name: '设备名称', key: "person" });
|
|
||||||
this.tableColumn.push({ name: '设备类别', key: "person" });
|
|
||||||
this.tableColumn.push({
|
this.tableColumn.push({
|
||||||
name: '检查项目', key: "status", render: (data) => {
|
name: '设备类别', key: "type", render: (data) => {
|
||||||
if (data.status == 0) {
|
if (data.type) {
|
||||||
return "<span class='noDraw'>未绘制</span>"
|
return this.$store.getters.prevention_device_type_map[data.type];
|
||||||
} else {
|
|
||||||
return "<span>已绘制</span>"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.tableColumn.push({ name: '责任人', key: "person" });
|
this.tableColumn.push({
|
||||||
this.tableColumn.push({ name: '责任部门', key: "person" });
|
name: '检查项目', key: "itemNum", render: (data) => {
|
||||||
this.tableColumn.push({ name: '涉及岗位', key: "person" });
|
return "<span class='link'>" + (data.itemNum ? data.itemNum : 0) + "</span>"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.tableColumn.push({ name: '责任人', key: "chargeUserName" });
|
||||||
|
this.tableColumn.push({ name: '责任部门', key: "chargeDeptName" });
|
||||||
|
this.tableColumn.push({ name: '涉及岗位', key: "postName" });
|
||||||
|
|
||||||
|
this.subTableColumn.push({ name: '序号', key: "index", width: "60" });
|
||||||
|
this.subTableColumn.push({ name: '检查项目', key: "name" });
|
||||||
|
this.subTableColumn.push({ name: '检查标准', key: "standard" });
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public showPros(el, data) {
|
||||||
|
const isTarget = el.target.classList.contains("link");
|
||||||
|
if (isTarget) {
|
||||||
|
this.showProtable = true;
|
||||||
|
this.currentProTableData.datas = data.items.map((item, index) => {
|
||||||
|
item.index = index + 1;
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public handleClosePro() {
|
||||||
|
this.showProtable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public changes(data, item) {
|
||||||
|
// 部门
|
||||||
|
if (item && item.key === "chargeDeptId") {
|
||||||
|
this.updateParams.chargeDeptName = this.$store.getters.dept_map[data];
|
||||||
|
}
|
||||||
|
//责任人
|
||||||
|
if (item && item.key === 'chargeUserId') {
|
||||||
|
this.updateParams.chargeUserName = 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) {
|
public callback(data) {
|
||||||
|
@ -209,9 +343,16 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
|
||||||
} else if (data.value === "selectAll") {
|
} else if (data.value === "selectAll") {
|
||||||
this.selectAll()
|
this.selectAll()
|
||||||
} else if (data.value === "delete") {
|
} else if (data.value === "delete") {
|
||||||
this.deleteData(this.selectData.map((item: any) => item.id))
|
this.deleteData(this.selectData)
|
||||||
} else if (data.value === "add") {
|
} else if (data.value === "add") {
|
||||||
|
this.isReadonly = false;
|
||||||
|
this.currentId = -1;
|
||||||
|
this.updateParams = { items: [], } as any;
|
||||||
this.showUpdate = true
|
this.showUpdate = true
|
||||||
|
} else if (data && data.value.indexOf("save") >= 0) {
|
||||||
|
this.doSave(data.value !== "save")
|
||||||
|
} else if (data && data.value === "cancel") {
|
||||||
|
this.handleClose()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 重置数据
|
// 重置数据
|
||||||
|
@ -224,8 +365,44 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public showUpdateModel(id) {
|
public showUpdateModel(row, isReadonly) {
|
||||||
this.showUpdate = true
|
this.updateParams = { items: [], } as any;
|
||||||
|
this.currentId = row.id;
|
||||||
|
this.tableService.selectById(this.currentId).then((res: any) => {
|
||||||
|
if (isReadonly) {
|
||||||
|
this.isReadonly = true;
|
||||||
|
this.updateParams = Object.assign({
|
||||||
|
safetyFactorName: res.data.safetyFactor.split(";").map(item => this.$store.getters.prevention_safe_reason_map[item]).join(";"),
|
||||||
|
identifyUserName: this.$store.getters.user_map[res.data.identifyUserId],
|
||||||
|
}, res.data)
|
||||||
|
} else {
|
||||||
|
this.isReadonly = false
|
||||||
|
this.updateParams = res.data;
|
||||||
|
this.updateParams.safetyFactor = res.data.safetyFactor.split(";").map(item => parseInt(item))
|
||||||
|
this.updateParams.postCode = res.data.postCode.split(";").map(item => parseInt(item))
|
||||||
|
this.loadUnitData(res.data.areas)
|
||||||
|
}
|
||||||
|
this.updateParams.items.forEach((item, i) => {
|
||||||
|
item.index = i + 1
|
||||||
|
})
|
||||||
|
this.buildUpdateForm()
|
||||||
|
this.showUpdate = true;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
public doSave(goOn?) {
|
||||||
|
// 新增
|
||||||
|
this.updateParams.itemNum = this.updateParams.items.length;
|
||||||
|
this.updateParams.postCode = this.updateParams.postCode.join(";")
|
||||||
|
this.updateParams.safetyFactor = this.updateParams.safetyFactor.join(";")
|
||||||
|
this.tableService.addOrUpdate(this.updateParams, this.updateParams.id ? false : true).then((res) => {
|
||||||
|
this.$message.success(!this.updateParams.id ? "新增成功!" : "编辑成功!");
|
||||||
|
this.updateParams = {
|
||||||
|
items: [],
|
||||||
|
} as any
|
||||||
|
this.showUpdate = !!goOn;
|
||||||
|
this.getTableData();
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public handleClose() {
|
public handleClose() {
|
||||||
|
@ -252,6 +429,67 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
|
||||||
public handleSelectionChange(data) {
|
public handleSelectionChange(data) {
|
||||||
this.selectData = data;
|
this.selectData = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//检查项目
|
||||||
|
public projectCallback(data) {
|
||||||
|
if (data && data.value === 'add') {
|
||||||
|
this.showProject = true
|
||||||
|
} else if (data && data.value === 'delete') {
|
||||||
|
// 批量删除步骤
|
||||||
|
this.deleteProData(this.selectData.map((itm: any) => itm.index - 1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//查看 编辑
|
||||||
|
public showSubmodal(row, isReadonly) {
|
||||||
|
this.proIsReadonly = false;
|
||||||
|
this.showProject = true
|
||||||
|
if (isReadonly) {
|
||||||
|
this.proIsReadonly = true
|
||||||
|
this.updateProParams = JSON.parse(JSON.stringify(row));
|
||||||
|
} else {
|
||||||
|
this.updateProParams = JSON.parse(JSON.stringify(row));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//删除
|
||||||
|
public deleteProData(indexs) {
|
||||||
|
for (let i = this.updateParams.items.length - 1; i >= 0; i--) {
|
||||||
|
if (indexs.includes(i)) {
|
||||||
|
this.updateParams.items.splice(i, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.updateParams.items.forEach((item, index) => {
|
||||||
|
item.index = index + 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
public subCallback(data) {
|
||||||
|
if (data && data.value.indexOf("save") >= 0) {
|
||||||
|
this.doSaveProject(data.value !== "save")
|
||||||
|
} else if (data && data.value === "cancel") {
|
||||||
|
this.handleProClose()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public doSaveProject(goOn) {
|
||||||
|
// 如果是新增步骤
|
||||||
|
if (this.updateProParams) {
|
||||||
|
// 新增
|
||||||
|
if (!this.updateProParams.index) {
|
||||||
|
this.updateProParams.index = this.updateParams.items.length + 1;
|
||||||
|
this.updateParams.items.push(this.updateProParams);
|
||||||
|
} else {
|
||||||
|
this.updateParams.items.splice(this.updateParams.items.findIndex(item => item.index === this.updateProParams.index), 1, this.updateProParams)
|
||||||
|
}
|
||||||
|
this.updateProParams = {} as any;
|
||||||
|
this.showProject = !!goOn;
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public handleProClose() {
|
||||||
|
this.showProject = false;
|
||||||
|
this.updateProParams = {} as any;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped src="../../../common.component.scss"></style>
|
<style lang="scss" scoped src="../../../common.component.scss"></style>
|
||||||
|
|
|
@ -20,43 +20,12 @@ import DeviceService from '@/service/device.service';
|
||||||
export default class DeviceAnalManagerComponent extends BaseRecordComponent<any> {
|
export default class DeviceAnalManagerComponent extends BaseRecordComponent<any> {
|
||||||
public tableService = new DeviceService();
|
public tableService = new DeviceService();
|
||||||
|
|
||||||
public params = {} as any;
|
public params = {
|
||||||
|
areaName: "",
|
||||||
|
unitName: "",
|
||||||
|
} as any;
|
||||||
|
|
||||||
public treeData = [{
|
public treeData = [] as any;
|
||||||
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: "查询",
|
||||||
|
@ -119,6 +88,14 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
|
||||||
// 树点击
|
// 树点击
|
||||||
public handleNodeClick(data) {
|
public handleNodeClick(data) {
|
||||||
console.log('data', data)
|
console.log('data', 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() {
|
||||||
|
@ -127,29 +104,35 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
|
||||||
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:"status",render:(data)=>{
|
this.tableColumn.push({
|
||||||
|
name: '检查项目', key: "status", render: (data) => {
|
||||||
if (data.status == 0) {
|
if (data.status == 0) {
|
||||||
return "<span class='noDraw'>未绘制</span>"
|
return "<span class='noDraw'>未绘制</span>"
|
||||||
} else {
|
} else {
|
||||||
return "<span>已绘制</span>"
|
return "<span>已绘制</span>"
|
||||||
}
|
}
|
||||||
}});
|
}
|
||||||
|
});
|
||||||
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:"status",render:(data)=>{
|
this.tableColumn.push({
|
||||||
|
name: '风险等级', key: "status", render: (data) => {
|
||||||
if (data.status == 0) {
|
if (data.status == 0) {
|
||||||
return "<span class='noDraw'>未绘制</span>"
|
return "<span class='noDraw'>未绘制</span>"
|
||||||
} else {
|
} else {
|
||||||
return "<span>已绘制</span>"
|
return "<span>已绘制</span>"
|
||||||
}
|
}
|
||||||
}});
|
}
|
||||||
this.tableColumn.push({name:'残余风险等级',key:"status",render:(data)=>{
|
});
|
||||||
|
this.tableColumn.push({
|
||||||
|
name: '残余风险等级', key: "status", render: (data) => {
|
||||||
if (data.status == 0) {
|
if (data.status == 0) {
|
||||||
return "<span class='noDraw'>未绘制</span>"
|
return "<span class='noDraw'>未绘制</span>"
|
||||||
} else {
|
} else {
|
||||||
return "<span>已绘制</span>"
|
return "<span>已绘制</span>"
|
||||||
}
|
}
|
||||||
}});
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public callback(data) {
|
public callback(data) {
|
||||||
|
|
Loading…
Reference in New Issue