fetch:设备设施清单

kongyeqing
kongyeqing 2023-06-20 16:13:48 +08:00
parent b956f31151
commit 0608cdd7c0
6 changed files with 580 additions and 267 deletions

View File

@ -6,11 +6,28 @@ export default class DeviceService 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+'/device/inventory/getList';
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>>>{
const url = this.prefix.system+'/user/list';
const url = this.prefix.prevention +'/device/inventory/delete';
return this.deleteBatch(url,params,{},true)
}
}

View File

@ -14,6 +14,7 @@ export default new Vuex.Store({
prevention_risk_level:[],
prevention_safe_reason:[],
prevention_dangrous_type:[],
prevention_device_type:[]
},
getters: {
dept_map:(state)=>{
@ -71,7 +72,14 @@ export default new Vuex.Store({
map[item.value] = item.name
})
return map
}
},
prevention_device_type_map:(state)=>{
const map = {};
state.prevention_device_type.forEach((item:any)=>{
map[item.value] = item.name
})
return map
},
},
mutations: {
@ -102,6 +110,9 @@ export default new Vuex.Store({
},
set_prevention_dangrous_type(state,data){
state.prevention_dangrous_type = data;
},
set_prevention_device_type(state,data){
state.prevention_device_type = data;
}
},
actions: {

View File

@ -22,7 +22,8 @@ export default class BlankComponent extends Vue {
this.systemService.getDictData("prevention_dangrous_level"),
this.systemService.getDictData("prevention_risk_level"),
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) => {
this.$store.commit("setDeptTreeList", results[0].data);
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
}
}))
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) => {
return {

View File

@ -1,7 +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">
@ -17,17 +16,23 @@
@selection-change="handleSelectionChange" style="width: 100%">
<el-table-column type="selection" label="全选" width="40">
</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">
<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 v-else :prop="item.key" :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,9 +42,63 @@
</div>
</div>
<el-dialog :close-on-click-modal="false" :title="currentId>0?'详情':currentId===-1?'新增':'编辑'"
:visible.sync="showUpdate" width="952px" :before-close="handleClose">
<FormComponent :options="updateOptions" :isReadonly="true" labelWidth="110px" labelAlign="right"
:data.sync="updateParams"></FormComponent>
<el-dialog :close-on-click-modal="false" :title=" isReadonly?'详情':currentId>0?'编辑':'新增'" :visible.sync="showUpdate"
width="952px" :before-close="handleClose">
<FormComponent :options="updateOptions" :isReadonly="isReadonly" labelWidth="110px" labelAlign="right"
: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 :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>

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { Component } from 'vue-property-decorator';
import { Component, Watch } from 'vue-property-decorator';
import template from "./device.component.html"
import BaseRecordComponent from "hbt-common/components/common/baseRecord.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 BtnOption from "hbt-common/models/btnOptions"
import DrawComponent from '@/components/draw.component.vue';
import UnitTreeComponent from '@/components/tree.component.vue';
import DeviceService from '@/service/device.service';
import UnitService from '@/service/unit.service';
import AreaService from '@/service/area.service';
@Component({
template,
components: {
FormComponent,
TableComponent,
DrawComponent,
UnitTreeComponent,
},
})
export default class DeviceManagerComponent extends BaseRecordComponent<any> {
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 = [{
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 treeData = [] as any;
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 = [{
name: "查询",
value: "search",
@ -90,109 +81,252 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
}];
public formOptions: FormOption<BtnOption>[] = [{
name: "区域名称",
key: "areaId",
key: "areaName",
type: "text",
}, {
name: "单元名称",
key: "unitId",
key: "unitName",
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: "选择区域",
key: "areaId",
format: "areaName",
type: "select",
require: true,
width: "calc(50% - 20px)",
showError: false,
datas: this.areaList
}, {
name: "选择单元",
key: "unitId",
format: "unitName",
type: "select",
require: true,
width: "calc(50% - 20px)",
showError: false,
datas: this.unitList
}, {
name: "责任部门",
key: "deptId",
type: "select",
key: "chargeDeptId",
format: "chargeDeptName",
type: "treeSelect",
require: true,
width: "calc(50% - 20px)",
datas: [{
name: "部门1",
value: 0
}, {
name: "部门2",
value: 1
}]
expandLevel: Infinity,
showError: false,
datas: this.$store.state.deptTreeList,
}, {
name: "责任人",
key: "person",
key: "chargeUserId",
format: "chargeUserName",
type: "select",
require: true,
width: "calc(50% - 20px)",
datas: [{
name: "人员1",
value: 0
}, {
name: "人员2",
value: 1
}]
showError: false,
datas: this.$store.state.userList
}, {
name: "设备名称",
key: "devicename",
key: "name",
type: "text",
require: true,
width: "calc(50% - 20px)",
}, {
name: "设备类型",
key: "devicetype",
key: "type",
type: "select",
require: true,
width: "calc(50% - 20px)",
datas: this.$store.state.prevention_device_type
}, {
name: "涉及岗位",
key: "job",
key: "postCode",
format: "postName",
multiple: true,
require: true,
type: "select",
width: "calc(50% - 20px)",
datas: this.$store.state.postList
}, {
name: "安全因素",
key: "safeKey",
key: "safetyFactor",
format: 'safetyFactorName',
require: true,
type: "select",
multiple: true,
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 updateParams = {} as any;
public updateParams = {
items: [],
} as any;
public selectData = [];
@Watch("$store.state.deptList", { immediate: true, deep: true })
onChanges() {
this.loadAreaData()
}
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: "areaName", width: "200px" });
this.tableColumn.push({ name: '风险分析单元', key: "unitName", width: "200px" });
this.tableColumn.push({ name: '设备名称', key: "name" });
this.tableColumn.push({
name: '检查项目', key: "status", render: (data) => {
if (data.status == 0) {
return "<span class='noDraw'>未绘制</span>"
} else {
return "<span>已绘制</span>"
name: '设备类别', key: "type", render: (data) => {
if (data.type) {
return this.$store.getters.prevention_device_type_map[data.type];
}
}
});
this.tableColumn.push({ name: '责任人', key: "person" });
this.tableColumn.push({ name: '责任部门', key: "person" });
this.tableColumn.push({ name: '涉及岗位', key: "person" });
this.tableColumn.push({
name: '检查项目', key: "itemNum", render: (data) => {
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) {
@ -209,9 +343,16 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
} else if (data.value === "selectAll") {
this.selectAll()
} else if (data.value === "delete") {
this.deleteData(this.selectData.map((item: any) => item.id))
this.deleteData(this.selectData)
} else if (data.value === "add") {
this.isReadonly = false;
this.currentId = -1;
this.updateParams = { items: [], } as any;
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) {
this.showUpdate = true
public showUpdateModel(row, isReadonly) {
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() {
@ -252,6 +429,67 @@ export default class DeviceManagerComponent extends BaseRecordComponent<any> {
public handleSelectionChange(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>
<style lang="scss" scoped src="../../../common.component.scss"></style>

View File

@ -11,7 +11,7 @@ import DrawComponent from '@/components/draw.component.vue';
import DeviceService from '@/service/device.service';
@Component({
template,
components:{
components: {
FormComponent,
TableComponent,
DrawComponent,
@ -20,92 +20,61 @@ import DeviceService from '@/service/device.service';
export default class DeviceAnalManagerComponent extends BaseRecordComponent<any> {
public tableService = new DeviceService();
public params = {} as any;
public params = {
areaName: "",
unitName: "",
} 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 treeData = [] as any;
public formActions = [{
name:"查询",
value:"search",
icon:"el-icon-search",
type:"primary"
},{
name:"清空",
icon:"el-icon-tickets",
value:"reset"
name: "查询",
value: "search",
icon: "el-icon-search",
type: "primary"
}, {
name: "清空",
icon: "el-icon-tickets",
value: "reset"
}];
public tableActions = [{
name:"添加",
value:"add",
icon:"el-icon-plus",
type:"primary"
},{
name:"批量删除",
value:"delete",
plain:true,
icon:"el-icon-delete",
type:"danger"
name: "添加",
value: "add",
icon: "el-icon-plus",
type: "primary"
}, {
name: "批量删除",
value: "delete",
plain: true,
icon: "el-icon-delete",
type: "danger"
}];
public footerActions = [{
name:"选择全部",
value:"selectAll",
type:"primary"
},{
name:"反向选择",
value:"reverse"
name: "选择全部",
value: "selectAll",
type: "primary"
}, {
name: "反向选择",
value: "reverse"
}];
public formOptions:FormOption<BtnOption>[] = [{
name:"区域名称",
key:"areaId",
type:"text",
},{
name:"单元名称",
key:"unitId",
type:"text",
},{
name:"作业活动",
key:"unitId",
type:"select",
datas:[{
name:"单元1",
value:0
},{
name:"单元2",
value:1
public formOptions: FormOption<BtnOption>[] = [{
name: "区域名称",
key: "areaId",
type: "text",
}, {
name: "单元名称",
key: "unitId",
type: "text",
}, {
name: "作业活动",
key: "unitId",
type: "select",
datas: [{
name: "单元1",
value: 0
}, {
name: "单元2",
value: 1
}]
}];
@ -113,77 +82,91 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
public updateParams = {} as any;
public selectData = [];
created(){
created() {
}
//
public handleNodeClick(data){
console.log('data',data)
public handleNodeClick(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(){
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:"status",render:(data)=>{
if(data.status==0){
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: "status", render: (data) => {
if (data.status == 0) {
return "<span class='noDraw'>未绘制</span>"
}else{
} else {
return "<span>已绘制</span>"
}
}});
this.tableColumn.push({name:'责任人',key:"person"});
this.tableColumn.push({name:'责任部门',key:"person"});
this.tableColumn.push({name:'风险等级',key:"status",render:(data)=>{
if(data.status==0){
}
});
this.tableColumn.push({ name: '责任人', key: "person" });
this.tableColumn.push({ name: '责任部门', key: "person" });
this.tableColumn.push({
name: '风险等级', key: "status", render: (data) => {
if (data.status == 0) {
return "<span class='noDraw'>未绘制</span>"
}else{
} else {
return "<span>已绘制</span>"
}
}});
this.tableColumn.push({name:'残余风险等级',key:"status",render:(data)=>{
if(data.status==0){
}
});
this.tableColumn.push({
name: '残余风险等级', key: "status", render: (data) => {
if (data.status == 0) {
return "<span class='noDraw'>未绘制</span>"
}else{
} else {
return "<span>已绘制</span>"
}
}});
}
});
}
public callback(data){
public callback(data) {
//
if(data.value==="search"){
if (data.value === "search") {
this.getTableData()
//
}else if(data.value === "reset"){
} else if (data.value === "reset") {
this.reset()
//
}else if(data.value === "reverse"){
} else if (data.value === "reverse") {
this.toggleAll()
//
}else if(data.value === "selectAll"){
} else if (data.value === "selectAll") {
this.selectAll()
}else if(data.value === "delete"){
this.deleteData(this.selectData.map((item:any)=>item.id))
} else if (data.value === "delete") {
this.deleteData(this.selectData.map((item: any) => item.id))
}
}
//
public reset(){
public reset() {
this.params = {
pageNum:1,
pageSize:20,
pageNum: 1,
pageSize: 20,
} as any;
}
public showUpdateModel(id){
public showUpdateModel(id) {
this.showUpdate = true
}
public handleClose(){
public handleClose() {
this.showUpdate = false;
}
@ -191,20 +174,20 @@ export default class DeviceAnalManagerComponent extends BaseRecordComponent<any>
public toggleAll() {
(this.$refs.multipleTable as any).toggleAllSelection();
}
public selectAll(){
if(!this.selectData.length){
public selectAll() {
if (!this.selectData.length) {
this.toggleAll()
}else{
this.tableData.datas.forEach((item,index)=>{
const find = this.selectData.find((data:any)=>data.userId === item.userId);
if(!find){
} else {
this.tableData.datas.forEach((item, index) => {
const find = this.selectData.find((data: any) => data.userId === item.userId);
if (!find) {
(this.$refs.multipleTable as any).toggleRowSelection(item);
}
})
}
}
public handleSelectionChange(data){
public handleSelectionChange(data) {
this.selectData = data;
}
}