|
|
@@ -10,36 +10,45 @@
|
|
|
:maxable="true"
|
|
|
>
|
|
|
<el-card shadow="never">
|
|
|
- <seekPage :seekList="seekList" @search="reload" />
|
|
|
- <header-title title="设备台账"> </header-title>
|
|
|
-
|
|
|
- <ele-pro-table
|
|
|
- height="300px"
|
|
|
- ref="table"
|
|
|
- :columns="columns"
|
|
|
- :datasource="datasource"
|
|
|
- row-key="id"
|
|
|
- :initLoad="false"
|
|
|
- @cell-click="cellClick"
|
|
|
+ <ele-split-layout
|
|
|
+ width="266px"
|
|
|
+ allow-collapse
|
|
|
+ :right-style="{ overflow: 'hidden' }"
|
|
|
>
|
|
|
- <template #radio="{ row }">
|
|
|
- <el-radio v-model="currentId" :label="row.id" class="radio">
|
|
|
- <i></i>
|
|
|
- </el-radio>
|
|
|
+ <div>
|
|
|
+ <div class="ele-border-lighter sys-organization-list">
|
|
|
+ <el-tree
|
|
|
+ :data="treeList"
|
|
|
+ :props="{
|
|
|
+ children: 'children',
|
|
|
+ value: 'id',
|
|
|
+ label: 'name'
|
|
|
+ }"
|
|
|
+ node-key="id"
|
|
|
+ ref="tree"
|
|
|
+ :highlight-current="true"
|
|
|
+ :expand-on-click-node="false"
|
|
|
+ @node-click="handleNodeClick"
|
|
|
+ v-bind="$attrs"
|
|
|
+ :default-expand-all="true"
|
|
|
+ >
|
|
|
+ </el-tree>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <template v-slot:content>
|
|
|
+ <ele-pro-table
|
|
|
+ max-height="500px"
|
|
|
+ ref="table"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="physicalList"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ row-key="id"
|
|
|
+ :initLoad="false"
|
|
|
+ :needPage="false"
|
|
|
+ >
|
|
|
+ </ele-pro-table>
|
|
|
</template>
|
|
|
- </ele-pro-table>
|
|
|
- <header-title title="物联点位"> </header-title>
|
|
|
- <ele-pro-table
|
|
|
- height="300px"
|
|
|
- ref="table1"
|
|
|
- :columns="columns1"
|
|
|
- :datasource="physicalList"
|
|
|
- :selection.sync="selection"
|
|
|
- row-key="id"
|
|
|
- :initLoad="false"
|
|
|
- :needPage="false"
|
|
|
- >
|
|
|
- </ele-pro-table>
|
|
|
+ </ele-split-layout>
|
|
|
</el-card>
|
|
|
|
|
|
<div class="rx-sc">
|
|
|
@@ -77,148 +86,6 @@
|
|
|
// 表格列配置
|
|
|
columns() {
|
|
|
const list = [
|
|
|
- {
|
|
|
- prop: 'radio',
|
|
|
- slot: 'radio',
|
|
|
- width: 50,
|
|
|
- align: 'center',
|
|
|
- fixed: 'left'
|
|
|
- },
|
|
|
- {
|
|
|
- columnKey: 'index',
|
|
|
- type: 'index',
|
|
|
- label: '序号',
|
|
|
- width: 55,
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- fixed: 'left'
|
|
|
- },
|
|
|
- {
|
|
|
- columnKey: 'code',
|
|
|
- prop: 'code',
|
|
|
- slot: 'code',
|
|
|
- label: '编码',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 180
|
|
|
- },
|
|
|
- // {
|
|
|
- // columnKey: 'code',
|
|
|
- // prop: 'code',
|
|
|
- // label: '设备编码',
|
|
|
- // showOverflowTooltip: true,
|
|
|
- // minWidth: 110,
|
|
|
- // slot: 'code'
|
|
|
- // },
|
|
|
- {
|
|
|
- prop: 'name',
|
|
|
- label: '名称',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'fixCode',
|
|
|
- label: '固资编码',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
-
|
|
|
- {
|
|
|
- prop: 'codeNumber',
|
|
|
- label: '编号',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- // {
|
|
|
- // prop: 'codeNumber',
|
|
|
- // label: '编号',
|
|
|
- // showOverflowTooltip: true,
|
|
|
- // minWidth: 110
|
|
|
- // },
|
|
|
-
|
|
|
- {
|
|
|
- prop: 'category.modelType',
|
|
|
- label: '型号',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'category.specification',
|
|
|
- label: '规格',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'workstationInfo.name',
|
|
|
- label: '工位名称',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'postName',
|
|
|
- label: '使用单位',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'usePerson',
|
|
|
- label: '使用人',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 80
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'ownershipGroupName',
|
|
|
- label: '权属部门',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'areaPersonInChargeUserName',
|
|
|
- label: '片区负责人',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 150
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'repairUserName',
|
|
|
- label: '维修人',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 150
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'endTime',
|
|
|
- label: '有效期结束时间',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 150
|
|
|
- },
|
|
|
-
|
|
|
- {
|
|
|
- prop: 'pathName',
|
|
|
- label: '位置',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110,
|
|
|
- formatter: (_row) => {
|
|
|
- const positionDetail =
|
|
|
- _row.position &&
|
|
|
- _row.position.length != 0 &&
|
|
|
- _row.position[0].detailPosition
|
|
|
- ? _row.position[0].detailPosition
|
|
|
- : '-';
|
|
|
- return _row.deviceLocationName
|
|
|
- ? _row.deviceLocationName + '-' + positionDetail
|
|
|
- : '';
|
|
|
- }
|
|
|
- }
|
|
|
- ];
|
|
|
-
|
|
|
- return list;
|
|
|
- }
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- visible: false,
|
|
|
- title: '选择',
|
|
|
-
|
|
|
- type: null,
|
|
|
- columns1: [
|
|
|
{
|
|
|
columnKey: 'selection',
|
|
|
type: 'selection',
|
|
|
@@ -267,12 +134,22 @@
|
|
|
showOverflowTooltip: true,
|
|
|
minWidth: 180
|
|
|
}
|
|
|
- ],
|
|
|
+ ];
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ visible: false,
|
|
|
+ title: '选择',
|
|
|
+
|
|
|
+ type: null,
|
|
|
// 表格选中数据
|
|
|
selection: [],
|
|
|
physicalList: [],
|
|
|
- id: '',
|
|
|
- currentId: '',
|
|
|
+ cachingData: {},
|
|
|
+ treeList: [],
|
|
|
current: null
|
|
|
};
|
|
|
},
|
|
|
@@ -280,75 +157,86 @@
|
|
|
watch: {},
|
|
|
methods: {
|
|
|
/* 表格数据源 */
|
|
|
- async datasource({ page, limit, where }) {
|
|
|
- if (this.id) {
|
|
|
- where['id'] = this.id;
|
|
|
- }
|
|
|
- return await queryBindSubstanceList({
|
|
|
- ...where,
|
|
|
- pageNum: page,
|
|
|
- size: limit
|
|
|
+ async queryBindSubstanceList(id) {
|
|
|
+ let data = await queryBindSubstanceList({
|
|
|
+ id,
|
|
|
+ pageNum: 1,
|
|
|
+ size: 1000
|
|
|
});
|
|
|
+ this.treeList[0].children = data.list;
|
|
|
},
|
|
|
getPhysicalModel(id) {
|
|
|
getPhysicalModel(id).then((res) => {
|
|
|
this.physicalList = res.properties;
|
|
|
+ if (this.cachingData[id]) {
|
|
|
+ this.$refs.table.setSelectedRows(this.cachingData[id].list);
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- cellClick(data) {
|
|
|
+ handleNodeClick(data) {
|
|
|
+ if (data.id == this.treeList[0].id) {
|
|
|
+ this.physicalList = [];
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.current = data;
|
|
|
- this.currentId = data.id;
|
|
|
+ this.$refs.table.clearSelection();
|
|
|
this.getPhysicalModel(data.id);
|
|
|
},
|
|
|
- open(id) {
|
|
|
+ open(id, name) {
|
|
|
this.visible = true;
|
|
|
- this.id = id;
|
|
|
- this.$nextTick(() => {
|
|
|
- this.reload();
|
|
|
- });
|
|
|
+ if (id) {
|
|
|
+ this.treeList.push({
|
|
|
+ id,
|
|
|
+ name,
|
|
|
+ children: []
|
|
|
+ });
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.queryBindSubstanceList(id);
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
- /* 刷新表格 */
|
|
|
- reload(where) {
|
|
|
- this.$refs.table.reload({ page: 1, where: where });
|
|
|
+ handleSelectionChange(data) {
|
|
|
+ this.cachingData[this.current.id] = {
|
|
|
+ substanceCode: this.current.code,
|
|
|
+ substanceId: this.current.id,
|
|
|
+ substanceName: this.current.name,
|
|
|
+ list: data
|
|
|
+ };
|
|
|
},
|
|
|
-
|
|
|
handleClose() {
|
|
|
- this.$refs.table.setSelectedRows([]);
|
|
|
- this.selection = [];
|
|
|
- this.physicalList=[]
|
|
|
- this.current = null;
|
|
|
- this.currentId = '';
|
|
|
+ this.physicalList = [];
|
|
|
+ this.cachingData = [];
|
|
|
+ this.treeList = [];
|
|
|
this.visible = false;
|
|
|
},
|
|
|
selected() {
|
|
|
- let list =[];
|
|
|
- if (!this.current) {
|
|
|
- this.$message.warning('请选择设备!');
|
|
|
- return;
|
|
|
- }
|
|
|
- if (this.selection.length) {
|
|
|
- list = this.selection;
|
|
|
- }else{
|
|
|
- list=[{}]
|
|
|
+ let cachingData = [];
|
|
|
+ let list = [];
|
|
|
+ for (let key in this.cachingData) {
|
|
|
+ cachingData.push(this.cachingData[key]);
|
|
|
}
|
|
|
|
|
|
- this.$emit(
|
|
|
- 'bindSubstanceSuccess',
|
|
|
- list.map((item) => {
|
|
|
- return {
|
|
|
- substanceCode: this.current.code,
|
|
|
- substanceId: this.current.id,
|
|
|
- substanceName: this.current.name,
|
|
|
- paramCode: item.identifier,
|
|
|
- paramValue: item.name,
|
|
|
- maxValue: item.dataType?.specs.max,
|
|
|
- minValue: item.dataType?.specs.min,
|
|
|
- unitName: item.dataType?.specs.unitName
|
|
|
- };
|
|
|
- })
|
|
|
- );
|
|
|
+ if (!cachingData.length) {
|
|
|
+ this.$message.warning('请选择设备点位!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ cachingData.forEach((item) => {
|
|
|
+ item.list.forEach((listItem) => {
|
|
|
+ list.push({
|
|
|
+ substanceCode: item.substanceCode,
|
|
|
+ substanceId: item.substanceId,
|
|
|
+ substanceName: item.substanceName,
|
|
|
+ paramCode: listItem.identifier,
|
|
|
+ paramValue: listItem.name,
|
|
|
+ maxValue: listItem.dataType?.specs.max,
|
|
|
+ minValue: listItem.dataType?.specs.min,
|
|
|
+ unitName: listItem.dataType?.specs.unitName
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ this.$emit('bindSubstanceSuccess', list);
|
|
|
this.handleClose();
|
|
|
}
|
|
|
}
|