|
|
@@ -1,286 +1,287 @@
|
|
|
-<template>
|
|
|
- <el-dialog
|
|
|
- title="新增"
|
|
|
- :visible.sync="visible"
|
|
|
- :before-close="handleClose"
|
|
|
- class="fullscreen"
|
|
|
- :close-on-click-modal="false"
|
|
|
- :close-on-press-escape="false"
|
|
|
- append-to-body
|
|
|
- width="90%"
|
|
|
- :fullscreen="fullscreen"
|
|
|
- >
|
|
|
- <template slot="title">
|
|
|
- <modalTitle
|
|
|
- title="新增"
|
|
|
- @setFullscreen="fullscreen = !fullscreen"
|
|
|
- ></modalTitle>
|
|
|
- </template>
|
|
|
- <el-card shadow="never">
|
|
|
- <ele-split-layout
|
|
|
- width="244px"
|
|
|
- allow-collapse
|
|
|
- :right-style="{ overflow: 'hidden' }"
|
|
|
- >
|
|
|
- <div class="ele-border-lighter split-layout-right-content">
|
|
|
- <el-tree
|
|
|
- :data="treeList"
|
|
|
- :props="defaultProps"
|
|
|
- ref="treeRef"
|
|
|
- :expand-on-click-node="false"
|
|
|
- :default-expanded-keys="categoryId ? [categoryId] : []"
|
|
|
- :highlight-current="true"
|
|
|
- node-key="id"
|
|
|
- @node-click="handleNodeClick"
|
|
|
- ></el-tree>
|
|
|
- </div>
|
|
|
-
|
|
|
- <!-- 数据表格 -->
|
|
|
- <template v-slot:content>
|
|
|
- <ProductSearch @search="reload" ref="searchRef" />
|
|
|
- <ele-pro-table
|
|
|
- height="400"
:pageSizes="tablePageSizes"
|
|
|
- ref="table"
|
|
|
- :columns="columns"
|
|
|
- :datasource="datasource"
|
|
|
- :selection.sync="selection"
|
|
|
- row-key="id"
|
|
|
- :initLoad="false"
|
|
|
- >
|
|
|
- <template v-slot:modelType="{ row }">
|
|
|
- <span>{{ row.category.modelType }}</span>
|
|
|
- </template>
|
|
|
- <template v-slot:specification="{ row }">
|
|
|
- <span>{{ row.category.specification }}</span>
|
|
|
- </template>
|
|
|
- <template v-slot:pathName="{ row }">
|
|
|
- <span>{{ row.position[0] && row.position[0].pathName }}</span>
|
|
|
- </template>
|
|
|
- </ele-pro-table>
|
|
|
- </template>
|
|
|
- </ele-split-layout>
|
|
|
- </el-card>
|
|
|
-
|
|
|
- <div class="rx-sc">
|
|
|
- <el-button type="primary" size="small" @click="selected">选择</el-button>
|
|
|
- <el-button size="small" @click="handleClose">关闭</el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
- import modalTitle from '@/components/modalTitle.vue';
|
|
|
- import ProductSearch from './product-search.vue';
|
|
|
- import { getAssetList } from '@/api/ruleManagement/plan';
|
|
|
- import { getTreeByPid, getTreeByGroup } from '@/api/classifyManage';
|
|
|
- export default {
|
|
|
- components: {
|
|
|
- ProductSearch,
|
|
|
- modalTitle
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- fullscreen: false,
|
|
|
- ruleIdListIndex: 0,
|
|
|
- visible: false,
|
|
|
- title: '选择设备',
|
|
|
- categoryLevelId: null,
|
|
|
- categoryId: 1,
|
|
|
- treeList: [],
|
|
|
- treeLoading: false,
|
|
|
- defaultProps: {
|
|
|
- children: 'children',
|
|
|
- label: 'name'
|
|
|
- },
|
|
|
- type: null,
|
|
|
- disposalType: '',
|
|
|
- // 表格列配置
|
|
|
- columns: [
|
|
|
- {
|
|
|
- columnKey: 'selection',
|
|
|
- type: 'selection',
|
|
|
- width: 45,
|
|
|
- align: 'center',
|
|
|
- selectable: (row, index) => {
|
|
|
- return !this.processData.some((id) => id == row.id);
|
|
|
- },
|
|
|
- reserveSelection: true,
|
|
|
- fixed: 'left'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '设备名称',
|
|
|
- prop: 'name'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '编码',
|
|
|
- prop: 'code'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '固资编码',
|
|
|
- prop: 'fixCode'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '使用人',
|
|
|
- prop: 'usePerson'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '使用岗位',
|
|
|
- prop: 'postName'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '片区负责人负责人',
|
|
|
- prop: 'areaPersonInChargeUserName'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '有效开始时间',
|
|
|
- prop: 'startTime'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '有效结束时间',
|
|
|
- prop: 'endTime'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'category.modelType',
|
|
|
- label: '型号',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'category.specification',
|
|
|
- label: '规格',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
- {
|
|
|
- label: '设备位置',
|
|
|
- prop: 'pathName',
|
|
|
- formatter: (_row) => {
|
|
|
- const positionDetail =
|
|
|
- _row.position &&
|
|
|
- _row.position.length != 0 &&
|
|
|
- _row.position[0].detailPosition
|
|
|
- ? _row.position[0].detailPosition
|
|
|
- : '-';
|
|
|
- return _row.deviceLocationName
|
|
|
- ? _row.deviceLocationName + '-' + positionDetail
|
|
|
- : '';
|
|
|
- }
|
|
|
- }
|
|
|
- ],
|
|
|
-
|
|
|
- // 表格选中数据
|
|
|
- selection: [],
|
|
|
- processData: []
|
|
|
- };
|
|
|
- },
|
|
|
- methods: {
|
|
|
- /* 表格数据源 */
|
|
|
- async datasource({ page, limit, where }) {
|
|
|
- const res = await getAssetList({
|
|
|
- ...where,
|
|
|
- pageNum: page,
|
|
|
- size: limit,
|
|
|
- categoryLevelId: this.categoryLevelId,
|
|
|
- rootCategoryLevelId: this.rootId,
|
|
|
- disposalType: this.disposalType
|
|
|
- });
|
|
|
- console.log('res---------', res);
|
|
|
- this.categoryId = res.list[0]?.categoryId;
|
|
|
- return res;
|
|
|
- },
|
|
|
- open(ruleIdList, ruleIdListIndex, isAlone, data, disposalType) {
|
|
|
- this.disposalType = disposalType;
|
|
|
- console.log(ruleIdList);
|
|
|
- console.log(ruleIdListIndex);
|
|
|
- let list = [];
|
|
|
- if (isAlone) {
|
|
|
- list = data;
|
|
|
- } else {
|
|
|
- list = ruleIdList
|
|
|
- .map((item) => {
|
|
|
- return item.equipmentList;
|
|
|
- })
|
|
|
- .flat();
|
|
|
- this.ruleIdListIndex = ruleIdListIndex;
|
|
|
- }
|
|
|
- console.log(list);
|
|
|
- if (list.length > 0) {
|
|
|
- this.processData = list.map((item) => item.id);
|
|
|
- } else {
|
|
|
- this.processData = [];
|
|
|
- }
|
|
|
- this.visible = true;
|
|
|
- this.getTreeData();
|
|
|
- },
|
|
|
-
|
|
|
- async getTreeData() {
|
|
|
- try {
|
|
|
- this.treeLoading = true;
|
|
|
- const res = await getTreeByGroup({ type: 4 });
|
|
|
- console.log('res---treeList----------', res);
|
|
|
- this.treeLoading = false;
|
|
|
- if (res?.code === '0') {
|
|
|
- this.treeList = res.data;
|
|
|
- return this.treeList;
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.log(error);
|
|
|
- }
|
|
|
- this.treeLoading = false;
|
|
|
- },
|
|
|
-
|
|
|
- handleNodeClick(data) {
|
|
|
- this.rootId = data.rootCategoryLevelId;
|
|
|
- this.categoryLevelId = data.id;
|
|
|
- this.$refs.table.reload({ pageNum: 1, where: {} });
|
|
|
- },
|
|
|
-
|
|
|
- /* 刷新表格 */
|
|
|
- reload(where) {
|
|
|
- if (this.rootId && this.categoryLevelId) {
|
|
|
- this.$refs.table.reload({ page: 1, where: where });
|
|
|
- } else {
|
|
|
- this.$message.error('请选择设备类别');
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- handleClose() {
|
|
|
- this.visible = false;
|
|
|
- this.$refs.table.setSelectedRows([]);
|
|
|
- this.selection = [];
|
|
|
- },
|
|
|
- selected() {
|
|
|
- if (!this.selection.length) {
|
|
|
- this.$message.error('请至少选择一条数据');
|
|
|
- return;
|
|
|
- }
|
|
|
- const selectList = this.$refs.treeRef.getCheckedNodes();
|
|
|
- console.log('selectList-----------', selectList);
|
|
|
- this.$emit(
|
|
|
- 'chooseEquipment',
|
|
|
- this.selection,
|
|
|
- this.ruleIdListIndex,
|
|
|
- this.categoryId
|
|
|
- );
|
|
|
- this.handleClose();
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
-</script>
|
|
|
-
|
|
|
-<style lang="scss" scoped>
|
|
|
- ::v-deep {
|
|
|
- .el-checkbox__input.is-disabled .el-checkbox__inner {
|
|
|
- background-color: #c1c1c1 !important;
|
|
|
- }
|
|
|
- }
|
|
|
- .ml60 {
|
|
|
- margin-left: 60px;
|
|
|
- }
|
|
|
- .rx-sc {
|
|
|
- flex: 0 0 50px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- }
|
|
|
-</style>
|
|
|
+<template>
|
|
|
+ <el-dialog
|
|
|
+ title="新增"
|
|
|
+ :visible.sync="visible"
|
|
|
+ :before-close="handleClose"
|
|
|
+ class="fullscreen"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ append-to-body
|
|
|
+ width="90%"
|
|
|
+ :fullscreen="fullscreen"
|
|
|
+ >
|
|
|
+ <template slot="title">
|
|
|
+ <modalTitle
|
|
|
+ title="新增"
|
|
|
+ @setFullscreen="fullscreen = !fullscreen"
|
|
|
+ ></modalTitle>
|
|
|
+ </template>
|
|
|
+ <el-card shadow="never">
|
|
|
+ <ele-split-layout
|
|
|
+ width="244px"
|
|
|
+ allow-collapse
|
|
|
+ :right-style="{ overflow: 'hidden' }"
|
|
|
+ >
|
|
|
+ <div class="ele-border-lighter split-layout-right-content">
|
|
|
+ <el-tree
|
|
|
+ :data="treeList"
|
|
|
+ :props="defaultProps"
|
|
|
+ ref="treeRef"
|
|
|
+ :expand-on-click-node="false"
|
|
|
+ :default-expanded-keys="categoryId ? [categoryId] : []"
|
|
|
+ :highlight-current="true"
|
|
|
+ node-key="id"
|
|
|
+ @node-click="handleNodeClick"
|
|
|
+ ></el-tree>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 数据表格 -->
|
|
|
+ <template v-slot:content>
|
|
|
+ <ProductSearch @search="reload" ref="searchRef" />
|
|
|
+ <ele-pro-table
|
|
|
+ height="400"
|
|
|
+ :pageSizes="tablePageSizes"
|
|
|
+ ref="table"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="datasource"
|
|
|
+ :selection.sync="selection"
|
|
|
+ row-key="id"
|
|
|
+ :initLoad="false"
|
|
|
+ >
|
|
|
+ <template v-slot:modelType="{ row }">
|
|
|
+ <span>{{ row.category.modelType }}</span>
|
|
|
+ </template>
|
|
|
+ <template v-slot:specification="{ row }">
|
|
|
+ <span>{{ row.category.specification }}</span>
|
|
|
+ </template>
|
|
|
+ <template v-slot:pathName="{ row }">
|
|
|
+ <span>{{ row.position[0] && row.position[0].pathName }}</span>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+ </template>
|
|
|
+ </ele-split-layout>
|
|
|
+ </el-card>
|
|
|
+
|
|
|
+ <div class="rx-sc">
|
|
|
+ <el-button type="primary" size="small" @click="selected">选择</el-button>
|
|
|
+ <el-button size="small" @click="handleClose">关闭</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import modalTitle from '@/components/modalTitle.vue';
|
|
|
+ import ProductSearch from './product-search.vue';
|
|
|
+ import { getAssetList } from '@/api/ruleManagement/plan';
|
|
|
+ import { getTreeByPid, getTreeByGroup } from '@/api/classifyManage';
|
|
|
+ export default {
|
|
|
+ components: {
|
|
|
+ ProductSearch,
|
|
|
+ modalTitle
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ fullscreen: false,
|
|
|
+ ruleIdListIndex: 0,
|
|
|
+ visible: false,
|
|
|
+ title: '选择设备',
|
|
|
+ categoryLevelId: null,
|
|
|
+ categoryId: 1,
|
|
|
+ treeList: [],
|
|
|
+ treeLoading: false,
|
|
|
+ defaultProps: {
|
|
|
+ children: 'children',
|
|
|
+ label: 'name'
|
|
|
+ },
|
|
|
+ type: null,
|
|
|
+ disposalType: '',
|
|
|
+ // 表格列配置
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ columnKey: 'selection',
|
|
|
+ type: 'selection',
|
|
|
+ width: 45,
|
|
|
+ align: 'center',
|
|
|
+ selectable: (row, index) => {
|
|
|
+ return !this.processData.some((id) => id == row.id);
|
|
|
+ },
|
|
|
+ reserveSelection: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '设备名称',
|
|
|
+ prop: 'name'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '编码',
|
|
|
+ prop: 'code'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '固资编码',
|
|
|
+ prop: 'fixCode'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '使用人',
|
|
|
+ prop: 'usePerson'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '使用岗位',
|
|
|
+ prop: 'postName'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '片区负责人负责人',
|
|
|
+ prop: 'areaPersonInChargeUserName'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '有效开始时间',
|
|
|
+ prop: 'startTime'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '有效结束时间',
|
|
|
+ prop: 'endTime'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'category.modelType',
|
|
|
+ label: '型号',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'category.specification',
|
|
|
+ label: '规格',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '设备位置',
|
|
|
+ prop: 'pathName',
|
|
|
+ formatter: (_row) => {
|
|
|
+ const positionDetail =
|
|
|
+ _row.position &&
|
|
|
+ _row.position.length != 0 &&
|
|
|
+ _row.position[0].detailPosition
|
|
|
+ ? _row.position[0].detailPosition
|
|
|
+ : '-';
|
|
|
+ return _row.deviceLocationName
|
|
|
+ ? _row.deviceLocationName + '-' + positionDetail
|
|
|
+ : '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+
|
|
|
+ // 表格选中数据
|
|
|
+ selection: [],
|
|
|
+ processData: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /* 表格数据源 */
|
|
|
+ async datasource({ page, limit, where }) {
|
|
|
+ const res = await getAssetList({
|
|
|
+ ...where,
|
|
|
+ pageNum: page,
|
|
|
+ size: limit,
|
|
|
+ categoryLevelId: this.categoryLevelId,
|
|
|
+ rootCategoryLevelId: this.rootId,
|
|
|
+ disposalType: this.disposalType
|
|
|
+ });
|
|
|
+ console.log('res---------', res);
|
|
|
+ this.categoryId = res.list[0]?.categoryId;
|
|
|
+ return res;
|
|
|
+ },
|
|
|
+ open(ruleIdList, ruleIdListIndex, isAlone, data, disposalType) {
|
|
|
+ this.disposalType = disposalType;
|
|
|
+ console.log(ruleIdList);
|
|
|
+ console.log(ruleIdListIndex);
|
|
|
+ let list = [];
|
|
|
+ if (isAlone) {
|
|
|
+ list = data;
|
|
|
+ } else {
|
|
|
+ list = ruleIdList
|
|
|
+ .map((item) => {
|
|
|
+ return item.equipmentList;
|
|
|
+ })
|
|
|
+ .flat();
|
|
|
+ this.ruleIdListIndex = ruleIdListIndex;
|
|
|
+ }
|
|
|
+ console.log(list);
|
|
|
+ if (list.length > 0) {
|
|
|
+ this.processData = list.map((item) => item.id);
|
|
|
+ } else {
|
|
|
+ this.processData = [];
|
|
|
+ }
|
|
|
+ this.visible = true;
|
|
|
+ this.getTreeData();
|
|
|
+ },
|
|
|
+
|
|
|
+ async getTreeData() {
|
|
|
+ try {
|
|
|
+ this.treeLoading = true;
|
|
|
+ const res = await getTreeByGroup({ type: 4 });
|
|
|
+ console.log('res---treeList----------', res);
|
|
|
+ this.treeLoading = false;
|
|
|
+ if (res?.code === '0') {
|
|
|
+ this.treeList = res.data;
|
|
|
+ return this.treeList;
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
+ this.treeLoading = false;
|
|
|
+ },
|
|
|
+
|
|
|
+ handleNodeClick(data) {
|
|
|
+ this.rootId = data.rootCategoryLevelId;
|
|
|
+ this.categoryLevelId = data.id;
|
|
|
+ this.$refs.table.reload({ pageNum: 1, where: {} });
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 刷新表格 */
|
|
|
+ reload(where) {
|
|
|
+ if (this.rootId && this.categoryLevelId) {
|
|
|
+ this.$refs.table.reload({ page: 1, where: where });
|
|
|
+ } else {
|
|
|
+ this.$message.error('请选择设备类别');
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ handleClose() {
|
|
|
+ this.visible = false;
|
|
|
+ this.$refs.table.setSelectedRows([]);
|
|
|
+ this.selection = [];
|
|
|
+ },
|
|
|
+ selected() {
|
|
|
+ if (!this.selection.length) {
|
|
|
+ this.$message.error('请至少选择一条数据');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const selectList = this.$refs.treeRef.getCheckedNodes();
|
|
|
+ console.log('selectList-----------', selectList);
|
|
|
+ this.$emit(
|
|
|
+ 'chooseEquipment',
|
|
|
+ this.selection,
|
|
|
+ this.ruleIdListIndex,
|
|
|
+ this.categoryId
|
|
|
+ );
|
|
|
+ this.handleClose();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+ ::v-deep {
|
|
|
+ .el-checkbox__input.is-disabled .el-checkbox__inner {
|
|
|
+ background-color: #c1c1c1 !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .ml60 {
|
|
|
+ margin-left: 60px;
|
|
|
+ }
|
|
|
+ .rx-sc {
|
|
|
+ flex: 0 0 50px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ }
|
|
|
+</style>
|