Explorar el Código

feat: 新增BOM设备关联功能并优化API接口

yusheng hace 2 meses
padre
commit
8700ae87db

+ 4 - 4
src/api/material/BOM.js

@@ -113,7 +113,7 @@ export async function getByTaskId(categoryId, taskId) {
 
 // 查询BOM树
 export async function getBomTreeList(params) {
-  const res = await request.get(`/eam/deviceBom/getList`, { params });
+  const res = await request.get(`/main/bomCategory/getList`, { params });
   if (res.data.code == 0) {
     return res.data;
   }
@@ -122,7 +122,7 @@ export async function getBomTreeList(params) {
 
 // 查询BOM树 详情
 export async function getBomGetById(id) {
-  const res = await request.get(`/eam/deviceBom/getById/${id}`);
+  const res = await request.get(`/main/bomCategory/getById/${id}`);
   if (res.data.code == 0) {
     return res.data;
   }
@@ -131,7 +131,7 @@ export async function getBomGetById(id) {
 
 // 查询BOM 版本
 export async function versionList(params) {
-  const res = await request.get(`/eam/deviceBom/versionList`, { params });
+  const res = await request.get(`/main/bomCategory/versionList`, { params });
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -176,7 +176,7 @@ export async function getBomPageList(params) {
 
 // 获取产品BOM列表
 export async function getBomPageCategoryId(params) {
-  const res = await request.get(`/eam/deviceBom/pageByCategoryId`, {
+  const res = await request.get(`/main/bomCategory/pageByCategoryId`, {
     params
   });
   if (res.data.code == 0) {

+ 6 - 3
src/api/system/file/index.js

@@ -7,9 +7,12 @@ import { download } from '@/utils/file';
  * @param file 文件
  */
 export async function uploadFile(data) {
-  const res = await request.post('/main/file/upload', data);
-  if (res.data.code === 0) {
-    return res.data.data;
+  const formData = new FormData();
+  formData.append('multiPartFile', data.multiPartFile);
+  formData.append('module', data.module);
+  const res = await request.post('/main/file/upload', formData);
+  if (res.data.code === '0') {
+    return res.data;
   }
   return Promise.reject(new Error(res.data.message));
 }

+ 1 - 0
src/components/upload/WithView.vue

@@ -57,6 +57,7 @@
       clearUploadFiles() {},
       //图片添加
       async handlSuccess(params) {
+        console.log(params,'params')
         let res = await uploadFile({
           multiPartFile: params.file,
           module: this.module

+ 185 - 0
src/views/ledgerAssets/components/MaterialAdd.vue

@@ -0,0 +1,185 @@
+<template>
+  <el-dialog
+    title="关联设备"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="70%"
+    :maxable="true"
+  >
+    <el-card shadow="never">
+      <ele-pro-table
+        :pageSizes="tablePageSizes"
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        :selection.sync="selection"
+        row-key="id"
+        :initLoad="false"
+        :needPage="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>
+        <template v-slot:action="{ row }">
+          <el-radio class="radio" v-model="radio" :label="row.id">
+            <i></i>
+          </el-radio>
+        </template>
+      </ele-pro-table>
+    </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 { getAssetList } from '@/api/ruleManagement/plan';
+  export default {
+    components: {},
+    data() {
+      return {
+        visible: false,
+        radio: '',
+        current: null,
+        // 表格列配置
+        columns: [
+          {
+            action: 'action',
+            slot: 'action',
+            align: 'center',
+            label: '选择',
+            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
+                : '';
+            }
+          }
+        ]
+      };
+    },
+    methods: {
+      /* 表格数据源 */
+      async datasource({}) {
+        return await getAssetList({
+          name: this.categoryName,
+          pageNum: 1,
+          size: 1000
+        });
+      },
+      open(row) {
+        this.categoryName = row.name;
+        this.visible = true;
+        this.$nextTick(() => {
+          this.$refs.table.reload();
+        });
+      },
+
+      handleClose() {
+        this.visible = false;
+        // this.$refs.table.setSelectedRows([]);
+        this.current = null;
+        this.radio = '';
+      },
+
+      // 单击获取id
+      cellClick(row) {
+        this.current = row;
+        this.radio = row.id;
+      },
+      selected() {
+        if (!this.current?.id) {
+          this.$message.error('请选择一条数据');
+          return;
+        }
+
+        this.$emit('chooseEquipment',this.current);
+        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>

+ 3 - 3
src/views/ledgerAssets/equipment/components/BOM-search.vue

@@ -29,7 +29,7 @@
           />
         </el-form-item>
       </el-col>
-      <el-col v-bind="styleResponsive ?   { md: 5 } : { span: 5 }">
+      <!-- <el-col v-bind="styleResponsive ?   { md: 5 } : { span: 5 }">
         <el-form-item label="状态">
           <el-select
             clearable
@@ -46,7 +46,7 @@
             ></el-option>
           </el-select>
         </el-form-item>
-      </el-col>
+      </el-col> -->
       <!-- <el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5}">
         <el-form-item label="组织机构:">
           <auth-selection size="mini" v-model.trim="where.deptIds" style="width: 100%"></auth-selection>
@@ -90,7 +90,7 @@
         code: '',
         categoryCode: this.categoryCode,
         categoryName: '',
-        status: '',
+        status: '1',
 
       };
       return {

+ 1 - 0
src/views/ledgerAssets/equipment/components/attribute.vue

@@ -5,6 +5,7 @@
       :rules="rules"
       ref="form"
       :model="attributeData"
+      :disabled="true"
     >
       <el-row>
         <el-col :span="8" label-width="100px">

+ 444 - 422
src/views/ledgerAssets/equipment/components/detailedList.vue

@@ -1,422 +1,444 @@
-<template>
-  <div class="ele-body">
-    <BOMSearch @search="reload" :statusOpt="statusOpt" />
-    <ele-pro-table
-      ref="table"
:pageSizes="tablePageSizes"
-      :columns="columns"
-      :datasource="datasource"
-      class="dict-table"
-      tool-class="ele-toolbar-actions"
-      @select="selectChange"
-      @select-all="changeSelectAll"
-    >
-      <template v-slot:toolbar>
-        <div class="toolbar_box">
-          <div class="toolbar_box_right"
-            ><span>基本数量</span>
-            <el-input
-              placeholder="请输入"
-              v-model.number="attributeData.baseCount"
-            >
-            </el-input>
-            <DictSelection dictName="计量单位" v-model="attributeData.unit"
-          /></div>
-
-          <el-button
-            size="small"
-            icon="el-icon-set-up"
-            class="ele-btn-icon"
-            style="margin-right: 12px"
-            @click="handlePrinting()"
-          >
-            打印条码
-          </el-button>
-        </div>
-      </template>
-
-      <template v-slot:dosage="{ row }">
-        <el-input
-          v-model="row.dosage"
-          placeholder="请输入"
-          size="mini"
-          style="width: 68px"
-        >
-        </el-input>
-      </template>
-
-      <template v-slot:versions="{ row }"> V{{ row.versions }}.0 </template>
-
-      <template v-slot:produceType="{ row }">
-        <el-select
-          v-model="row.produceType"
-          filterable
-          multiple
-          collapse-tags
-          class="ele-block"
-          size="mini"
-        >
-          <el-option
-            v-for="item in dictList"
-            :key="item.value"
-            :value="item.value"
-            :label="item.label"
-          ></el-option>
-        </el-select>
-      </template>
-
-      <template v-slot:materielDesignation="{ row }">
-        <el-input
-          v-model="row.materielDesignation"
-          placeholder="请输入物料代号"
-          size="mini"
-          style="width: 120px"
-        >
-        </el-input>
-      </template>
-
-      <template v-slot:supplierId="{ row }">
-        <el-select
-          v-model="row.supplierId"
-          size="mini"
-          clearable
-          class="ele-block"
-          filterable
-          placeholder="请选择供应商"
-        >
-          <el-option
-            v-for="(item, index) in gysList"
-            :key="item.id + index"
-            :value="item.id"
-            :label="item.name"
-          ></el-option>
-        </el-select>
-      </template>
-
-      <template v-slot:factories="{ row }">
-        <el-input
-          v-model="row.factories"
-          placeholder="请输入生产厂家"
-          size="mini"
-          style="width: 120px"
-        >
-        </el-input>
-      </template>
-    </ele-pro-table>
-    <print ref="printRef"></print>
-  </div>
-</template>
-
-<script>
-  import BOMSearch from './BOM-search.vue';
-  import {
-    getBomPageCategoryId,
-    contactList,
-    deleteBomTreeList,
-    updateBatchBOM
-  } from '@/api/material/BOM';
-  import { getByCode } from '@/api/system/dictionary-data';
-
-  import print from './print.vue';
-
-  export default {
-    name: 'SystemDictionary',
-    components: { BOMSearch, print },
-
-    data() {
-      return {
-        // 表格列配置
-        columns: [
-          {
-            width: 45,
-            type: 'selection',
-            columnKey: 'selection',
-            align: 'center'
-          },
-          {
-            label: '序号',
-            columnKey: 'index',
-            type: 'index',
-            width: 55,
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'code',
-            label: '编码',
-            showOverflowTooltip: true,
-            width: 240,
-            formatter: (row) => {
-              return row.code + '/' + this.codes;
-            }
-          },
-          /*  {
-            prop: 'deviceCode',
-            label: '部件编码',
-            width: 120
-          }, */
-          {
-            prop: 'name',
-            label: '名称',
-            width: 150
-          },
-
-          {
-            prop: 'level',
-            label: '层级'
-          },
-
-          {
-            prop: 'brandNum',
-            label: '牌号'
-          },
-
-          {
-            prop: 'modelType',
-            label: '型号',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'specification',
-            label: '规格',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-
-          {
-            prop: 'dosage',
-            slot: 'dosage',
-            label: '用量',
-            width: 100
-          },
-
-          {
-            prop: 'measuringUnit',
-            label: '计量单位',
-            showOverflowTooltip: true
-          },
-
-          {
-            prop: 'produceType',
-            slot: 'produceType',
-            label: '生产类型',
-            width: 160
-          },
-
-          {
-            prop: 'materielDesignation',
-            slot: 'materielDesignation',
-            label: '物料代号',
-            width: 150
-          },
-
-          {
-            prop: 'supplierId',
-            slot: 'supplierId',
-            label: '供应商',
-            width: 150
-          },
-
-          {
-            prop: 'factories',
-            slot: 'factories',
-            label: '生产厂家',
-            width: 180
-          },
-
-          {
-            prop: 'versions',
-            slot: 'versions',
-            label: '版本'
-          },
-
-          {
-            prop: 'status ',
-            label: '状态',
-            formatter: (row) => {
-              return this.statusOpt[+row.status];
-            }
-          },
-
-          {
-            prop: 'createName',
-            label: '创建人',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'createTime',
-            label: '创建日期',
-            width: 160
-          }
-        ],
-        statusOpt: {
-          '': '全部',
-          0: '草稿',
-          1: '已发布'
-        },
-
-        gysList: [],
-
-        newTreeId: null,
-
-        dictList: [],
-
-        checkRadioData: []
-      };
-    },
-
-    created() {
-      this.getDictList('productionType');
-
-      this.getContactList();
-    },
-    mounted() {},
-    props: {
-      attributeData: {
-        type: Object,
-        default: {}
-      },
-
-      treeId: {
-        type: String,
-        default: ''
-      },
-
-      isTemp: {
-        type: Number,
-        default: 0
-      },
-      codes: {
-        type: String,
-        default: ''
-      }
-    },
-
-    watch: {
-      treeId: {
-        handler(val) {
-          this.newTreeId = val;
-        },
-        deep: true,
-        immediate: true
-      },
-
-      attributeData: {
-        handler(val) {
-          this.$nextTick(() => {
-            this.reload();
-          });
-        },
-        deep: true,
-        immediate: true
-      }
-    },
-
-    methods: {
-      /* 表格数据源 */
-      datasource({ where, page, limit }) {
-        return getBomPageCategoryId({
-          ...where,
-          pageNum: page,
-          size: limit,
-          id: this.attributeData.id,
-          bomType: this.attributeData.bomType
-        });
-      },
-
-      /* 刷新表格 */
-      reload(where) {
-        this.$refs.table.reload({ where });
-      },
-
-      async getDictList(code) {
-        let { data: res } = await getByCode(code);
-        this.dictList = res.map((item) => {
-          let values = Object.keys(item);
-          return {
-            value: Number(values[0]),
-            label: item[values[0]]
-          };
-        });
-      },
-
-      getContactList() {
-        let param = {
-          pageNum: 1,
-          type: 2,
-          size: -1,
-          status: 1
-        };
-        contactList(param).then((res) => {
-          this.gysList = res.list;
-          console.log(this.gysList, '供应商列表');
-        });
-      },
-      handlePrinting() {
-        if (this.checkRadioData.length > 0) {
-          this.$refs.printRef.open(this.checkRadioData);
-        } else {
-          this.$message.warning('请选择数据!');
-        }
-      },
-      // 全选
-      changeSelectAll(arr) {
-        console.log(arr);
-        if (arr.length != 0) {
-          this.checkRadioData = arr;
-        } else {
-          this.checkRadioData = [];
-        }
-      },
-      selectChange(selection, row) {
-        if (selection.length != 0) {
-          this.checkRadioData = selection;
-        } else {
-          this.checkRadioData = [];
-        }
-      }
-    }
-  };
-</script>
-
-<style lang="scss" scoped>
-  .ele-body {
-    height: 100%;
-    ::v-deep .el-card {
-      height: 100%;
-      .el-card__body {
-        height: 100%;
-        display: flex;
-        flex-direction: column;
-        .dict-table {
-          flex: 1;
-          overflow: hidden;
-          display: flex;
-          flex-direction: column;
-          .el-table {
-            flex: 1;
-            overflow-y: auto;
-          }
-        }
-      }
-    }
-  }
-
-  .toolbar_box {
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-    .toolbar_box_right {
-      display: flex;
-      align-items: center;
-      justify-content: center;
-      margin-right: 10px;
-      > span {
-        width: 150px;
-      }
-      > div {
-        margin-left: 10px;
-      }
-    }
-  }
-</style>
+<template>
+  <div class="ele-body">
+    <BOMSearch @search="reload" :statusOpt="statusOpt" />
+    <ele-pro-table
+      ref="table"
+      :pageSizes="tablePageSizes"
+      :columns="columns"
+      :datasource="datasource"
+      class="dict-table"
+      tool-class="ele-toolbar-actions"
+      @select="selectChange"
+      @select-all="changeSelectAll"
+    >
+      <template v-slot:toolbar>
+        <div class="toolbar_box">
+          <!-- <div class="toolbar_box_right"
+            ><span>基本数量</span>
+            <el-input
+              placeholder="请输入"
+              v-model.number="attributeData.baseCount"
+            >
+            </el-input>
+            <DictSelection dictName="计量单位" v-model="attributeData.unit"
+          /></div> -->
+
+          <el-button
+            size="small"
+            icon="el-icon-set-up"
+            class="ele-btn-icon"
+            style="margin-right: 12px"
+            @click="handlePrinting()"
+          >
+            打印条码
+          </el-button>
+        </div>
+      </template>
+
+      <template v-slot:dosage="{ row }">
+        <el-input
+          v-model="row.dosage"
+          placeholder=" "
+          size="mini"
+          style="width: 68px"
+          :disabled="true"
+        >
+        </el-input>
+      </template>
+
+      <template v-slot:versions="{ row }"> V{{ row.versions }}.0 </template>
+
+      <template v-slot:produceType="{ row }">
+        <el-select
+          v-model="row.produceType"
+          filterable
+          multiple
+          collapse-tags
+          class="ele-block"
+          size="mini"
+          :disabled="true"
+        >
+          <el-option
+            v-for="item in dictList"
+            :key="item.value"
+            :value="item.value"
+            :label="item.label"
+          ></el-option>
+        </el-select>
+      </template>
+
+      <template v-slot:materielDesignation="{ row }">
+        <el-input
+          v-model="row.materielDesignation"
+          placeholder=" "
+          size="mini"
+          style="width: 120px"
+          :disabled="true"
+        >
+        </el-input>
+      </template>
+
+      <template v-slot:supplierId="{ row }">
+        <el-select
+          v-model="row.supplierId"
+          size="mini"
+          clearable
+          class="ele-block"
+          filterable
+          placeholder=" "
+          :disabled="true"
+        >
+          <el-option
+            v-for="(item, index) in gysList"
+            :key="item.id + index"
+            :value="item.id"
+            :label="item.name"
+          ></el-option>
+        </el-select>
+      </template>
+
+      <template v-slot:factories="{ row }">
+        <el-input
+          v-model="row.factories"
+          placeholder=" "
+          size="mini"
+          style="width: 120px"
+          :disabled="true"
+        >
+        </el-input>
+      </template>
+      <template v-slot:action="{ row }">
+        <el-link type="primary" :underline="false" @click="open(row)"
+          >关联设备实例</el-link
+        ></template
+      >
+    </ele-pro-table>
+    <print ref="printRef"></print>
+    <MaterialAdd
+      ref="MaterialAdd"
+      @chooseEquipment="chooseEquipment"
+    ></MaterialAdd>
+  </div>
+</template>
+
+<script>
+  import BOMSearch from './BOM-search.vue';
+  import { getBomPageCategoryId, contactList } from '@/api/material/BOM';
+  import { getByCode } from '@/api/system/dictionary-data';
+
+  import print from './print.vue';
+  import MaterialAdd from '@/views/ledgerAssets/components/MaterialAdd.vue';
+  export default {
+    name: 'SystemDictionary',
+    components: { BOMSearch, print, MaterialAdd },
+
+    data() {
+      return {
+        // 表格列配置
+        columns: [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
+          {
+            label: '序号',
+            columnKey: 'index',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'code',
+            label: '编码',
+            showOverflowTooltip: true,
+            width: 240,
+            formatter: (row) => {
+              return row.code + '/' + this.codes;
+            }
+          },
+          /*  {
+              prop: 'deviceCode',
+              label: '部件编码',
+              width: 120
+            }, */
+          {
+            prop: 'name',
+            label: '名称',
+            width: 150
+          },
+
+          {
+            prop: 'level',
+            label: '层级'
+          },
+
+          {
+            prop: 'brandNum',
+            label: '牌号'
+          },
+
+          {
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'dosage',
+            slot: 'dosage',
+            label: '用量',
+            width: 100
+          },
+
+          {
+            prop: 'measuringUnit',
+            label: '计量单位',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'produceType',
+            slot: 'produceType',
+            label: '生产类型',
+            width: 160
+          },
+
+          {
+            prop: 'materielDesignation',
+            slot: 'materielDesignation',
+            label: '物料代号',
+            width: 150
+          },
+
+          {
+            prop: 'supplierId',
+            slot: 'supplierId',
+            label: '供应商',
+            width: 150
+          },
+
+          {
+            prop: 'factories',
+            slot: 'factories',
+            label: '生产厂家',
+            width: 180
+          },
+
+          {
+            prop: 'versions',
+            slot: 'versions',
+            label: '版本'
+          },
+
+          {
+            prop: 'status ',
+            label: '状态',
+            formatter: (row) => {
+              return this.statusOpt[+row.status];
+            }
+          },
+
+          {
+            prop: 'createName',
+            label: '创建人',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'createTime',
+            label: '创建日期',
+            width: 160
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            align: 'center',
+            width: 150,
+            resizable: false,
+            slot: 'action',
+            fixed: 'right'
+          }
+        ],
+        statusOpt: {
+          '': '全部',
+          0: '草稿',
+          1: '已发布'
+        },
+
+        gysList: [],
+
+        newTreeId: null,
+
+        dictList: [],
+
+        checkRadioData: []
+      };
+    },
+
+    created() {
+      this.getDictList('productionType');
+
+      this.getContactList();
+    },
+    mounted() {},
+    props: {
+      attributeData: {
+        type: Object,
+        default: {}
+      },
+
+      treeId: {
+        type: String,
+        default: ''
+      },
+
+      isTemp: {
+        type: Number,
+        default: 0
+      },
+      codes: {
+        type: String,
+        default: ''
+      }
+    },
+
+    watch: {
+      treeId: {
+        handler(val) {
+          this.newTreeId = val;
+        },
+        deep: true,
+        immediate: true
+      },
+
+      attributeData: {
+        handler(val) {
+          this.$nextTick(() => {
+            this.reload();
+          });
+        },
+        deep: true,
+        immediate: true
+      }
+    },
+
+    methods: {
+      /* 表格数据源 */
+      datasource({ where, page, limit }) {
+        return getBomPageCategoryId({
+          ...where,
+          pageNum: page,
+          size: limit,
+          id: this.attributeData.id,
+          bomType: this.attributeData.bomType
+        });
+      },
+      open(row) {
+        this.$refs.MaterialAdd.open(row);
+      },
+      chooseEquipment(row) {},
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ where });
+      },
+
+      async getDictList(code) {
+        let { data: res } = await getByCode(code);
+        this.dictList = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: Number(values[0]),
+            label: item[values[0]]
+          };
+        });
+      },
+
+      getContactList() {
+        let param = {
+          pageNum: 1,
+          type: 2,
+          size: -1,
+          status: 1
+        };
+        contactList(param).then((res) => {
+          this.gysList = res.list;
+          console.log(this.gysList, '供应商列表');
+        });
+      },
+      handlePrinting() {
+        if (this.checkRadioData.length > 0) {
+          this.$refs.printRef.open(this.checkRadioData);
+        } else {
+          this.$message.warning('请选择数据!');
+        }
+      },
+      // 全选
+      changeSelectAll(arr) {
+        console.log(arr);
+        if (arr.length != 0) {
+          this.checkRadioData = arr;
+        } else {
+          this.checkRadioData = [];
+        }
+      },
+      selectChange(selection, row) {
+        if (selection.length != 0) {
+          this.checkRadioData = selection;
+        } else {
+          this.checkRadioData = [];
+        }
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .ele-body {
+    height: 100%;
+    ::v-deep .el-card {
+      height: 100%;
+      .el-card__body {
+        height: 100%;
+        display: flex;
+        flex-direction: column;
+        .dict-table {
+          flex: 1;
+          overflow: hidden;
+          display: flex;
+          flex-direction: column;
+          .el-table {
+            flex: 1;
+            overflow-y: auto;
+          }
+        }
+      }
+    }
+  }
+
+  .toolbar_box {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    .toolbar_box_right {
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      margin-right: 10px;
+      > span {
+        width: 150px;
+      }
+      > div {
+        margin-left: 10px;
+      }
+    }
+  }
+</style>

+ 8 - 9
src/views/ledgerAssets/equipment/detailsPop.vue

@@ -255,7 +255,7 @@
           this.currentNodeData.bomType = row.bomType;
         }
         this.drawer = true;
-        this.getTreeData();
+        // this.getTreeData();
         this.getVersion();
       },
 
@@ -344,16 +344,15 @@
         };
         versionList(param).then((res) => {
           this.versList = res || [];
-          if (type == 'del' || type == 'add') {
-            if (this.versList.length >= 1) {
-              this.searchObj.versions =
-                this.versList[this.versList.length - 1].versions;
-            } else {
-              this.searchObj.versions = '';
-            }
 
-            this.getTreeData();
+          if (this.versList.length >= 1) {
+            this.searchObj.versions =
+              this.versList[this.versList.length - 1].versions;
+          } else {
+            this.searchObj.versions = '';
           }
+
+          this.getTreeData();
         });
       },
 

+ 22 - 1
src/views/ledgerAssets/equipment/edit.vue

@@ -51,9 +51,24 @@
                 </el-switch>
               </el-form-item>
             </el-col>
+          </el-row>
+
+          <el-row>
             <el-col>
               <el-form-item label="物联ID">{{ iotId }}</el-form-item>
             </el-col>
+            <el-col :span="6">
+              <el-form-item label="物联产品key">
+                <el-input class="input" v-model="form.iotProductKey"></el-input
+              ></el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="物联编号">
+                <el-input
+                  class="input"
+                  v-model="form.iotSubstanceCode"
+                ></el-input></el-form-item
+            ></el-col>
           </el-row>
           <!-- <div class="basic-details-title border-none">
             <span class="border-span">扩展信息</span>
@@ -189,11 +204,14 @@
         id: '',
         form: {
           extInfoSelf: [],
+          iotSubstanceCode: '',
+          iotProductKey: '',
           // 基本信息
           code: '',
           name: '',
           productTime: '',
-          workstation: '',fixCode:'',
+          workstation: '',
+          fixCode: '',
           equipmentLabelJson
         },
         rules: {
@@ -318,6 +336,7 @@
         this.form.categoryId = this.basicInfo.id;
         this.form.name = this.basicInfo.name;
         this.form.code = data.code; //Date.now(); //res.data[0].onlyCode;
+        this.form.iotProductKey = res.category.iotProductKey;
         this.initOtherMsg();
       },
       // 计算过保时间
@@ -495,6 +514,8 @@
         // 物联参数
         this.isIotEnable = data.isIotEnable;
         this.iotId = data.iotId;
+        this.form.iotProductKey =
+          this.form.iotProductKey || data.category.category.iotProductKey;
       },
       async initOtherMsg() {
         // 基本信息

+ 287 - 286
src/views/maintenance/components/MaterialAdd.vue

@@ -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>