Forráskód Böngészése

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend into dev

LAPTOP-16IUEB3P\Lenovo 3 éve
szülő
commit
15fe2c10bb

+ 32 - 16
src/api/classifyManage/itemInformation.js

@@ -7,20 +7,32 @@ export async function getList (data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
-// // 物品信息保存
-// export const informationAdd = (data) => {
-//   return http.asyncCall('/information/add', data, 'post', 'json');
-// };
+// 物品信息保存
+export async function informationAdd (data) {
+  const res = await request.post('/main/category/add', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 
-// // 物品信息编辑
-// export const informationEdit = (data) => {
-//   return http.asyncCall('/information/edit', data, 'post', 'json');
-// };
+// 物品信息编辑
+export async function informationEdit (data) {
+  const res = await request.post('/main/category/edit', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 
-// // 物品信息详情
-// export const getDetails = (data) => {
-//   return http.asyncCall(`/information/info/${data.id}`, {}, 'get');
-// };
+// 物品信息详情
+export async function getDetails (id) {
+  const res = await request.get(`/category/info/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 
 // 物品信息删除
 export async function removeItem (id) {
@@ -31,7 +43,11 @@ export async function removeItem (id) {
   return Promise.reject(new Error(res.data.message));
 }
 
-// // 物品信息获取编码
-// export const getOrderNo = (data) => {
-//   return http.asyncCall(`/information/createOrderNo/${data.prefix}`, {}, 'get');
-// };
+// 物品信息获取编码
+export async function getOrderNo (prefix) {
+  const res = await request.get(`/main/category/createOrderNo/${prefix}`, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 1 - 0
src/enum/dict.js

@@ -1,5 +1,6 @@
 export default {
   类型用途: 'type_use',
+  分类编号: 'classify_no',
   分隔符: 'separate',
   任务类型: 'taskCategory',
   流程分类: 'processCategory'

+ 2 - 2
src/router/routes.js

@@ -24,8 +24,8 @@ export const routes = [
     component: () => import('@/views/exception/404/index.vue')
   }
   // {
-  //   path: '/codeManagement/details',
-  //   component: () => import('@/views/codeManagement/details.vue'),
+  //   path: '/system/role',
+  //   component: () => import('@/views/system/role/index.vue'),
   //   meta: { title: '编码信息' }
   // }
 ];

+ 38 - 497
src/views/classifyManage/itemInformation/add.vue

@@ -46,293 +46,7 @@
             defaultNum != 'w08' && defaultNum != 'w02' && defaultNum != 'w03'
           "
         >
-          <el-tabs v-model="activeName" type="card">
-            <el-tab-pane
-              label="匹配产品"
-              name="product"
-              v-if="defaultNum == 'w06' || defaultNum == 'w04'"
-            >
-              <el-button type="primary" @click="clickAdd([4], '选择产品')"
-                >添加</el-button
-              >
-              <el-table
-                :data="productData"
-                class="table-box"
-                :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
-              >
-                <el-table-column type="index" label="序号" width="50">
-                </el-table-column>
-                <el-table-column prop="informationCode" label="物品编码">
-                </el-table-column>
-                <el-table-column
-                  prop="informationName"
-                  label="物品名称"
-                  show-overflow-tooltip
-                >
-                </el-table-column>
-                <el-table-column prop="brandNum" label="牌号">
-                </el-table-column>
-                <el-table-column prop="modelType" label="型号">
-                </el-table-column>
-                <el-table-column
-                  label="物品类型"
-                  prop="classificationCode"
-                  :formatter="classificationCodeFormatter"
-                >
-                </el-table-column>
-                <el-table-column
-                  prop="classificationUrl"
-                  show-overflow-tooltip
-                  label="分类"
-                >
-                </el-table-column>
-                <el-table-column label="操作">
-                  <template slot-scope="scope">
-                    <el-button
-                      type="text"
-                      @click="handleDelete(scope.$index, scope.row)"
-                      >删除</el-button
-                    >
-                  </template>
-                </el-table-column>
-              </el-table>
-            </el-tab-pane>
-            <el-tab-pane
-              label="匹配模具"
-              name="mould"
-              v-if="defaultNum == 'w01' || defaultNum == 'w07'"
-            >
-              <el-button type="primary" @click="clickAdd([6], '选择模具')"
-                >添加</el-button
-              >
-              <el-table
-                :data="mouldData"
-                class="table-box"
-                :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
-              >
-                <el-table-column type="index" label="序号" width="50">
-                </el-table-column>
-                <el-table-column
-                  prop="informationCode"
-                  label="物品编码"
-                  width="120"
-                >
-                </el-table-column>
-                <el-table-column
-                  prop="informationName"
-                  label="物品名称"
-                  show-overflow-tooltip
-                >
-                </el-table-column>
-                <el-table-column prop="brandNum" label="牌号">
-                </el-table-column>
-                <el-table-column prop="modelType" label="型号">
-                </el-table-column>
-                <el-table-column
-                  prop="shrinkageCoefficient"
-                  label="收缩系数"
-                  :formatter="shrinkFormatter"
-                >
-                </el-table-column>
-                <el-table-column
-                  prop="dieBodyModel"
-                  width="120"
-                  label="大模体型号"
-                  :formatter="modleFormatter"
-                >
-                </el-table-column>
-                <el-table-column
-                  label="物品类型"
-                  prop="classificationCode"
-                  :formatter="classificationCodeFormatter"
-                >
-                </el-table-column>
-                <el-table-column
-                  prop="classificationUrl"
-                  show-overflow-tooltip
-                  label="分类"
-                >
-                </el-table-column>
-                <el-table-column label="操作">
-                  <template slot-scope="scope">
-                    <el-button
-                      type="text"
-                      @click="handleDelete(scope.$index, scope.row)"
-                      >删除</el-button
-                    >
-                  </template>
-                </el-table-column>
-              </el-table>
-            </el-tab-pane>
-            <el-tab-pane
-              label="匹配备品备件"
-              name="part"
-              v-if="defaultNum == 'w01'"
-            >
-              <el-button type="primary" @click="clickAdd([7], '选择备品备件')"
-                >添加</el-button
-              >
-              <el-table
-                :data="partData"
-                class="table-box"
-                :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
-              >
-                <el-table-column type="index" label="序号" width="50">
-                </el-table-column>
-                <el-table-column prop="informationCode" label="物品编码">
-                </el-table-column>
-                <el-table-column
-                  prop="informationName"
-                  label="物品名称"
-                  show-overflow-tooltip
-                >
-                </el-table-column>
-                <el-table-column prop="modelType" label="型号">
-                </el-table-column>
-                <el-table-column
-                  label="物品类型"
-                  prop="classificationCode"
-                  :formatter="classificationCodeFormatter"
-                >
-                </el-table-column>
-                <el-table-column
-                  prop="classificationUrl"
-                  show-overflow-tooltip
-                  label="分类"
-                >
-                </el-table-column>
-                <el-table-column label="操作">
-                  <template slot-scope="scope">
-                    <el-button
-                      type="text"
-                      @click="handleDelete(scope.$index, scope.row)"
-                      >删除</el-button
-                    >
-                  </template>
-                </el-table-column>
-              </el-table>
-            </el-tab-pane>
-            <el-tab-pane label="BOM表" name="bom" v-if="defaultNum == 'w07'">
-              <div class="bom-top">
-                <el-button type="primary" @click="clickAdd([3], '选择物料')"
-                  >添加</el-button
-                >
-                <div class="top-input">
-                  <span>基本数量</span>
-                  <el-input
-                    class="input-box"
-                    @input="handleEdit"
-                    v-model="itemForm.basicNum"
-                    placeholder="请输入"
-                  ></el-input>
-                  <span>{{ itemForm.measuringUnit }}</span>
-                </div>
-              </div>
-              <el-table
-                :data="bomData"
-                class="table-box"
-                :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
-              >
-                <el-table-column type="index" label="序号" width="50">
-                </el-table-column>
-                <el-table-column
-                  prop="informationCode"
-                  label="物品编码"
-                  width="120"
-                >
-                </el-table-column>
-                <el-table-column
-                  prop="informationName"
-                  label="物品名称"
-                  show-overflow-tooltip
-                >
-                </el-table-column>
-                <el-table-column prop="brandNum" label="牌号">
-                </el-table-column>
-                <el-table-column
-                  label="物品类型"
-                  prop="classificationCode"
-                  :formatter="classificationCodeFormatter"
-                >
-                </el-table-column>
-                <el-table-column
-                  prop="classificationUrl"
-                  label="分类"
-                  show-overflow-tooltip
-                >
-                </el-table-column>
-                <el-table-column prop="num" label="数量" width="120">
-                  <template slot-scope="scope">
-                    <el-input
-                      type="number"
-                      v-model="scope.row.num"
-                      placeholder="请输入"
-                      oninput="value=value.replace(/[^0-9.]/g,'')"
-                    ></el-input>
-                  </template>
-                </el-table-column>
-                <el-table-column label="计量单位" prop="measuringUnit">
-                </el-table-column>
-                <el-table-column label="操作">
-                  <template slot-scope="scope">
-                    <el-button
-                      type="text"
-                      @click="handleDelete(scope.$index, scope.row)"
-                      >删除</el-button
-                    >
-                  </template>
-                </el-table-column>
-              </el-table>
-            </el-tab-pane>
-            <el-tab-pane
-              label="匹配设备"
-              name="facility"
-              v-if="defaultNum == 'w04' || defaultNum == 'w05'"
-            >
-              <el-button type="primary" @click="clickAdd([1], '选择设备')"
-                >添加</el-button
-              >
-              <el-table
-                :data="facilityData"
-                class="table-box"
-                :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
-              >
-                <el-table-column type="index" label="序号" width="50">
-                </el-table-column>
-                <el-table-column prop="informationCode" label="物品编码">
-                </el-table-column>
-                <el-table-column
-                  prop="informationName"
-                  label="物品名称"
-                  show-overflow-tooltip
-                >
-                </el-table-column>
-                <el-table-column prop="modelType" label="型号">
-                </el-table-column>
-                <el-table-column
-                  label="物品类型"
-                  prop="classificationCode"
-                  :formatter="classificationCodeFormatter"
-                >
-                </el-table-column>
-                <el-table-column
-                  prop="classificationUrl"
-                  label="分类"
-                  show-overflow-tooltip
-                >
-                </el-table-column>
-                <el-table-column label="操作">
-                  <template slot-scope="scope">
-                    <el-button
-                      type="text"
-                      @click="handleDelete(scope.$index, scope.row)"
-                      >删除</el-button
-                    >
-                  </template>
-                </el-table-column>
-              </el-table>
-            </el-tab-pane>
-          </el-tabs>
+          <ItemMatch ref="itemMatchRef" :defaultNum="defaultNum"></ItemMatch>
         </div>
         <div class="page-footer-btn mt20">
           <el-button @click="goBack">取消</el-button>
@@ -340,22 +54,13 @@
         </div>
       </div>
     </div>
-
-    <!-- 选择添加 -->
-    <AddDialog
-      ref="addDialogRef"
-      @submit="selectedEquipment"
-      :typeValue="typeValue"
-      :dialogTitle="dialogTitle"
-      :mapList="mapList"
-    />
   </div>
 </template>
 
 <script>
   import ItemForm from './components/ItemForm';
   import RowForm from './components/RowForm';
-  import AddDialog from './components/AddDialog.vue';
+  import ItemMatch from './components/item-match';
   import {
     informationAdd,
     getDetails,
@@ -363,8 +68,8 @@
     getOrderNo
   } from '@/api/classifyManage/itemInformation';
   export default {
-    components: { ItemForm, RowForm, AddDialog },
-    data() {
+    components: { ItemForm, RowForm, ItemMatch },
+    data () {
       return {
         pageTitle: '',
         typeList: [
@@ -406,28 +111,18 @@
           expirationDateUnit: 'minute',
           takeStockPattern: 1
         },
-        activeName: 'mould',
-        productData: [],
-        mouldData: [],
-        partData: [],
-        bomData: [],
-        facilityData: [],
-        bomNumber: null,
         defaultNum: 'w01',
         selectNode: null,
         classList: [],
         changeData: [],
         urlIdList: [],
         requestData: {},
-        typeValue: [],
-        mapList: [],
         uneditable: false,
-        currentItem: null,
         dialogTitle: '',
         newCode: ''
       };
     },
-    created() {
+    created () {
       this.pageTitle = this.$route.query.pageTitle;
       if (this.pageTitle == '新建物品') {
         this.selectNode = JSON.parse(this.$route.query.selectNode);
@@ -439,18 +134,10 @@
             code = this.selectNode.type;
             this.typeList.map((item) => {
               if (item.code == code) {
-                this.currentItem = item;
                 this.defaultNum = item.prefix;
                 this.setDefault(this.defaultNum);
               }
             });
-          } else {
-            this.currentItem = {
-              id: 1,
-              value: 'w01  生产设备',
-              prefix: 'w01',
-              code: 1
-            };
           }
           this.getTreeData(code);
         }
@@ -465,8 +152,8 @@
       }
     },
     methods: {
-      async getOrderCode() {
-        const res = await getOrderNo({ prefix: this.defaultNum });
+      async getOrderCode () {
+        const res = await getOrderNo(this.defaultNum);
         if (res.success) {
           this.newCode = res.data;
           this.$set(this.itemForm, 'itemCode', res.data.substring(3));
@@ -474,7 +161,7 @@
         }
       },
 
-      getCode(code) {
+      getCode (code) {
         this.typeList.map((item) => {
           if (item.code == code) {
             this.defaultNum = item.prefix;
@@ -484,17 +171,17 @@
       },
 
       // 在 Input 值改变时触发
-      handleEdit(e) {
+      handleEdit (e) {
         let value = e.replace(/^(0+)|[^\d]+/g, ''); // 以0开头或者输入非数字,会被替换成空
         value = value.replace(/(\d{15})\d*/, '$1'); // 最多保留15位整数
       },
-      goBack() {
+      goBack () {
         this.$router.go(-1);
       },
 
       // 获取详情
-      async getDetilInfo(id) {
-        const res = await getDetails({ id: id });
+      async getDetilInfo (id) {
+        const res = await getDetails(id);
         if (res.success) {
           this.defaultNum = res.data.classificationCode;
           this.chooseItem(res.data.classificationCode);
@@ -533,31 +220,31 @@
             : 'false';
           this.itemForm.isUnpack = res.data.isUnpack ? 'true' : 'false';
           for (const key in this.itemForm.informationRelationMap) {
-            this.matchList(key, this.itemForm.informationRelationMap);
+            this.$refs.itemMatchRef &&
+              this.$refs.itemMatchRef.matchList(
+                key,
+                this.itemForm.informationRelationMap
+              );
           }
         }
       },
 
       // 改变物品类型
-      chooseItem(val) {
-        if (this.currentItem && this.currentItem.prefix != val) {
-          this.initItemForm();
-          this.$refs.itemFormRef.$refs.formName.resetFields();
-          this.getOrderCode();
-        }
+      chooseItem (val) {
+        this.initItemForm();
+        this.$refs.itemFormRef.$refs.formName.resetFields();
+        this.getOrderCode();
         this.typeList.map((item) => {
           if (item.prefix == val) {
-            this.currentItem = item;
-            this.defaultNum = item.prefix;
-            this.itemForm.classificationCode = this.defaultNum;
+            this.itemForm.classificationCode = item.prefix;
             this.selectNode = null;
             this.getTreeData(item.code);
+            this.setDefault(item.prefix);
           }
         });
-        this.setDefault(this.defaultNum);
       },
 
-      submit() {
+      submit () {
         const a1 = new Promise((resolve, reject) => {
           this.$refs.itemFormRef.validateForm((valid) => {
             if (valid) resolve();
@@ -569,7 +256,8 @@
           });
         });
         Promise.all([a1, a2]).then(() => {
-          this.mapAddList();
+          this.$refs.itemMatchRef && this.$refs.itemMatchRef.mapAddList();
+
           this.requestData = this.itemForm;
           const { pathName, pathId } = this.$refs.itemFormRef.getText();
           this.requestData.classificationUrl = pathName;
@@ -594,11 +282,10 @@
           this.requestData.univalence = this.itemForm.univalence
             ? this.itemForm.univalence
             : null;
-          this.mapList.map((item) => {
-            item.informationId = item.id;
-            delete item.id;
-          });
-          this.requestData.informationRelation = this.mapList;
+          this.requestData.informationRelation =
+            (this.$refs.itemMatchRef && this.$refs.itemMatchRef.getMapList()) ||
+            [];
+
           if (this.pageTitle == '编辑物品') {
             this.requestData.mainInformationId = this.$route.query.id;
             delete this.requestData.informationRelationMap;
@@ -636,77 +323,7 @@
         });
       },
 
-      handleDelete(index, row) {
-        this.$confirm(`确认删除[${row.informationName}]吗?`)
-          .then(async () => {
-            switch (this.activeName) {
-              case 'product': {
-                this.productData.splice(index, 1);
-                break;
-              }
-              case 'mould': {
-                this.mouldData.splice(index, 1);
-                break;
-              }
-              case 'part': {
-                this.partData.splice(index, 1);
-                break;
-              }
-              case 'bom': {
-                this.bomData.splice(index, 1);
-                break;
-              }
-              case 'facility': {
-                this.facilityData.splice(index, 1);
-                break;
-              }
-              default:
-                break;
-            }
-            this.mapAddList();
-          })
-          .catch(() => {});
-      },
-
-      //点击添加打开弹窗
-      clickAdd(val, name) {
-        this.$refs.addDialogRef.equipmentdialog = true;
-        if (val) {
-          this.typeValue = val;
-          this.dialogTitle = name;
-          this.mapAddList();
-        }
-      },
-
-      // 选择的设备
-      selectedEquipment(val) {
-        switch (this.activeName) {
-          case 'product': {
-            this.productData = val;
-            break;
-          }
-          case 'mould': {
-            this.mouldData = val;
-            break;
-          }
-          case 'part': {
-            this.partData = val;
-            break;
-          }
-          case 'bom': {
-            this.bomData = val;
-            break;
-          }
-          case 'facility': {
-            this.facilityData = val;
-            break;
-          }
-          default:
-            break;
-        }
-      },
-
-      async getTreeData(code) {
+      async getTreeData (code) {
         // try {
         //   const res = await common.getClassify({
         //     type: code,
@@ -730,7 +347,7 @@
         // } catch (error) {}
       },
 
-      convertTreeData(data) {
+      convertTreeData (data) {
         this.changeData = data;
         for (let i = 0; i < this.changeData.length; i++) {
           if (this.changeData[i].children != undefined) {
@@ -742,7 +359,7 @@
       },
 
       // 子节点处理
-      deepEach(parentId) {
+      deepEach (parentId) {
         this.changeData.map((item, index) => {
           if (item.id == parentId) {
             this.urlIdList.push(item.id);
@@ -751,46 +368,12 @@
         });
       },
 
-      setDefault(val) {
-        switch (val) {
-          case 'w06': {
-            this.activeName = 'product';
-            break;
-          }
-          case 'w01': {
-            this.activeName = 'mould';
-            break;
-          }
-          case 'w07': {
-            this.activeName = 'mould';
-            break;
-          }
-          case 'w04': {
-            this.activeName = 'product';
-            break;
-          }
-          case 'w05': {
-            this.activeName = 'facility';
-            break;
-          }
-          default:
-            break;
-        }
-      },
-
-      // 物品类型格式化
-      classificationCodeFormatter(row) {
-        let itemName = '';
-        this.typeList.map((item) => {
-          if (item.prefix == row.classificationCode) {
-            itemName = item.name;
-          }
-        });
-        return itemName;
+      setDefault (val) {
+        this.$refs.itemMatchRef && this.$refs.itemMatchRef.setDefault(val);
       },
 
       // 收缩系数格式化
-      shrinkFormatter(row) {
+      shrinkFormatter (row) {
         let shrink = '';
         let extendField = JSON.parse(row.extendField);
         if (extendField.hasOwnProperty('shrinkageCoefficient')) {
@@ -799,7 +382,7 @@
         return shrink;
       },
 
-      modleFormatter(row) {
+      modleFormatter (row) {
         let modle = '';
         let extendField = JSON.parse(row.extendField);
         if (extendField.hasOwnProperty('dieBodyModel')) {
@@ -808,49 +391,7 @@
         return modle;
       },
 
-      mapAddList() {
-        this.mapList = [];
-        if (this.defaultNum == 'w01') {
-          this.mapList = this.partData.concat(this.mouldData);
-        } else if (this.defaultNum == 'w04') {
-          this.mapList = this.facilityData.concat(this.productData);
-        } else if (this.defaultNum == 'w05') {
-          this.mapList = this.facilityData;
-        } else if (this.defaultNum == 'w06') {
-          this.mapList = this.productData;
-        } else if (this.defaultNum == 'w07') {
-          this.mapList = this.mouldData.concat(this.bomData);
-        }
-      },
-
-      matchList(key, data) {
-        switch (key) {
-          case 'w01': {
-            this.facilityData = data[key];
-            break;
-          }
-          case 'w04': {
-            this.mouldData = data[key];
-            break;
-          }
-          case 'w05': {
-            this.partData = data[key];
-            break;
-          }
-          case 'w07': {
-            this.productData = data[key];
-            break;
-          }
-          case 'w06': {
-            this.bomData = data[key];
-            break;
-          }
-          default:
-            break;
-        }
-      },
-
-      initItemForm() {
+      initItemForm () {
         this.itemForm = {
           classificationUrlId: [],
           addList: [],

+ 15 - 29
src/views/classifyManage/itemInformation/components/AddDialog.vue

@@ -149,7 +149,7 @@
         default: ''
       }
     },
-    data() {
+    data () {
       return {
         treeLoading: false,
         equipmentdialog: false,
@@ -172,7 +172,7 @@
       };
     },
     watch: {
-      equipmentdialog(val) {
+      equipmentdialog (val) {
         if (val) {
           if (this.tableData.length) this.$refs.tableRef.clearSelection();
           this.$nextTick(() => {
@@ -186,72 +186,58 @@
           // if(this.tableData.length)  this.$refs.tableRef.clearSelection()
         }
       },
-      typeValue(val) {
+      typeValue (val) {
         if (val) {
           this.currentKey = null;
         }
-      },
-      mapList(val) {
-        if (val) {
-          // if(this.tableData.length)  this.$refs.tableRef.clearSelection()
-          // this.$nextTick(() => {
-          //     this.mapList.forEach(item => {
-          //       const row = this.tableData.find(i => i.id === item.id)
-          //       console.log('row',row)
-          //       if (row) {
-          //         this.$refs.tableRef.toggleRowSelection(row, true)
-          //       }
-          //     })
-          // })
-        }
       }
     },
     methods: {
-      handleClose() {
+      handleClose () {
         this.equipmentdialog = false;
         this.tableSelectionList = [];
       },
 
-      handleCurrent(page) {
+      handleCurrent (page) {
         this.pagination.page = page;
         this.handleList();
       },
-      handleSize(size) {
+      handleSize (size) {
         this.pagination.page = 1;
         this.pagination.size = size;
         this.handleList();
       },
 
-      handleSelectionChange(val) {
+      handleSelectionChange (val) {
         this.tableSelectionList = val;
       },
       // handleCurSelectionChange (selection, row) {
 
       // },
 
-      toDelete(val) {
+      toDelete (val) {
         console.log('触发删除', val);
       },
 
-      getRowKeys(row) {
+      getRowKeys (row) {
         return row.id;
       },
 
       // 确定
-      selected() {
+      selected () {
         this.$emit('submit', this.tableSelectionList);
         this.handleClose();
       },
 
       // 树点击事件
-      handleNodeClick(data, node) {
+      handleNodeClick (data, node) {
         if (data.id === this.currentTreeData.id) return;
         this.currentTreeData = data;
         this.searchForm.classificationId = data.id;
         this.handleList();
       },
 
-      async handleList() {
+      async handleList () {
         const params = {
           ...this.searchForm,
           ...this.pagination
@@ -273,7 +259,7 @@
       },
 
       // 弹窗 - 按关键字搜索
-      searchByKeyWords() {
+      searchByKeyWords () {
         if (!this.currentTreeData) {
           this.$message.warning('请先选择设备!');
           return;
@@ -282,14 +268,14 @@
         this.handleList();
       },
       // 重置
-      reset() {
+      reset () {
         this.pagination.page = 1;
         this.searchForm.searchKey = '';
         this.handleList();
       },
 
       // 设置默认高亮行
-      setCurrentKey(id) {
+      setCurrentKey (id) {
         this.currentKey = id;
         this.$refs.tree.setCurrentKey(this.currentKey);
       }

+ 5 - 35
src/views/classifyManage/itemInformation/components/ItemForm.vue

@@ -15,7 +15,6 @@
         :props="defaultProps"
         separator="-"
         filterable
-        @change="chooseClassify"
         ref="cascader"
       >
       </el-cascader>
@@ -148,7 +147,7 @@
       }
     },
     components: {},
-    data() {
+    data () {
       let validateCode = (rule, value, callback) => {
         let reg = /[\u4e00-\u9fa5]/;
         // console.log('reg.test(value)',reg.test(value))
@@ -218,51 +217,22 @@
       };
     },
     watch: {
-      defaultNum(val) {
-        if (val) {
-        }
-      },
-
-      itemForm(val) {},
-
-      classList(val) {
+      classList (val) {
         this.keyValue++;
       }
     },
-    created() {},
+    created () {},
     methods: {
-      // // 在 Input 值改变时触发
-      handleEdit(e) {
-        // let value = e.replace(/^(0+)|[^\d]+/g,''); // 以0开头或者输入非数字,会被替换成空
-        // value = value.replace(/(\d{15})\d*/, '$1') // 最多保留15位整数
-        // this.itemForm.expirationDate = value
-      },
-
       //子组件接收callback为父组件传过来的next()方法
-      validateForm(callback) {
+      validateForm (callback) {
         // let flag = true;
         //开始表单校验
         this.$refs.formName.validate((valid) => {
           callback(valid);
-          // if (valid) {
-          //   this.itemForm.informationCode = this.defaultNum + this.itemForm.informationCode
-          //   console.log('itemForm',this.itemForm)
-          //   flag = true
-          // } else {
-          //   console.log('error submit!!');
-          //   return false;
-          // }
         });
-        // 如果flag为true,则执行callback()
-        // if (flag) {
-        // callback();
-        // }
       },
 
-      // 选择分类
-      chooseClassify(val) {},
-
-      getText() {
+      getText () {
         // 获取节点下的汉字
         let pathName = this.$refs.cascader
           .getCheckedNodes()[0]

+ 6 - 12
src/views/classifyManage/itemInformation/components/RowForm.vue

@@ -256,7 +256,7 @@
       }
     },
     components: {},
-    data() {
+    data () {
       return {
         // customForm:{
         //   addList:[]
@@ -270,20 +270,14 @@
         ]
       };
     },
-    watch: {
-      itemForm(val) {
-        if (val) {
-        }
-      }
-    },
-    created() {},
+    created () {},
     methods: {
       // 在 Input 值改变时触发
-      handleEdit(e) {
+      handleEdit (e) {
         let value = e.replace(/^(0+)|[^\d]+/g, ''); // 以0开头或者输入非数字,会被替换成空
       },
       // 添加自定义参数
-      addItem() {
+      addItem () {
         if (this.itemForm.addList.length < 10) {
           let item = { key: '', value: '' };
           this.itemForm.addList.push(item);
@@ -293,12 +287,12 @@
       },
 
       // 删除自定义参数
-      delt(item, index) {
+      delt (item, index) {
         this.itemForm.addList.splice(index, 1);
       },
 
       //子组件接收callback为父组件传过来的next()方法
-      validateForm(callback) {
+      validateForm (callback) {
         // let flag = true;
         //开始表单校验
         this.$refs.formCustom.validate((valid) => {

+ 31 - 17
src/views/classifyManage/itemInformation/components/item-list.vue

@@ -78,6 +78,28 @@
       columns () {
         const privateColumn = [];
 
+        if (!['8', '1', '2', '5', '6', '7'].includes(this.current?.type)) {
+          privateColumn.push({
+            prop: 'brandNum',
+            label: '牌号',
+            showOverflowTooltip: true
+          });
+        }
+        if (!['3'].includes(this.current?.type)) {
+          privateColumn.push({
+            prop: 'modelType',
+            label: '型号',
+            showOverflowTooltip: true
+          });
+        }
+        if (!['3', '4'].includes(this.current?.type)) {
+          privateColumn.push({
+            prop: 'specification',
+            label: '规格',
+            showOverflowTooltip: true
+          });
+        }
+
         return [
           {
             columnKey: 'index',
@@ -88,25 +110,19 @@
             fixed: 'left'
           },
           {
-            prop: 'name',
+            prop: 'informationCode',
             label: '物品编码',
-            sortable: 'custom',
-            showOverflowTooltip: true,
-            minWidth: 110
+            showOverflowTooltip: true
           },
           {
-            prop: 'jobNumber',
+            prop: 'informationName',
             label: '物品名称',
-            sortable: 'custom',
-            showOverflowTooltip: true,
-            minWidth: 110
+            showOverflowTooltip: true
           },
           {
-            prop: 'loginName',
+            prop: 'classificationCode',
             label: '物品类型',
-            sortable: 'custom',
-            showOverflowTooltip: true,
-            minWidth: 110
+            showOverflowTooltip: true
           },
           ...privateColumn,
           {
@@ -123,8 +139,7 @@
           {
             prop: 'classificationUrl',
             label: '分类',
-            showOverflowTooltip: true,
-            minWidth: 110
+            showOverflowTooltip: true
           },
           {
             columnKey: 'action',
@@ -132,8 +147,7 @@
             width: 200,
             align: 'left',
             resizable: false,
-            slot: 'action',
-            showOverflowTooltip: true
+            slot: 'action'
           }
         ];
       }
@@ -171,7 +185,7 @@
       /* 删除 */
       remove (row) {
         const loading = this.$loading({ lock: true });
-        removeItem(row.id).then((msg) => {
+        removeItem(id).then((msg) => {
           loading.close();
           this.$message.success(msg);
           this.reload();

+ 457 - 0
src/views/classifyManage/itemInformation/components/item-match.vue

@@ -0,0 +1,457 @@
+<template>
+  <div>
+    <el-tabs v-model="activeName" type="card">
+      <el-tab-pane
+        label="匹配产品"
+        name="product"
+        v-if="defaultNum == 'w06' || defaultNum == 'w04'"
+      >
+        <el-button type="primary" @click="clickAdd([4], '选择产品')"
+          >添加</el-button
+        >
+        <el-table
+          :data="productData"
+          class="table-box"
+          :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
+        >
+          <el-table-column type="index" label="序号" width="50">
+          </el-table-column>
+          <el-table-column prop="informationCode" label="物品编码">
+          </el-table-column>
+          <el-table-column
+            prop="informationName"
+            label="物品名称"
+            show-overflow-tooltip
+          >
+          </el-table-column>
+          <el-table-column prop="brandNum" label="牌号"> </el-table-column>
+          <el-table-column prop="modelType" label="型号"> </el-table-column>
+          <el-table-column
+            label="物品类型"
+            prop="classificationCode"
+            :formatter="classificationCodeFormatter"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="classificationUrl"
+            show-overflow-tooltip
+            label="分类"
+          >
+          </el-table-column>
+          <el-table-column label="操作">
+            <template slot-scope="scope">
+              <el-button
+                type="text"
+                @click="handleDelete(scope.$index, scope.row)"
+                >删除</el-button
+              >
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-tab-pane>
+      <el-tab-pane
+        label="匹配模具"
+        name="mould"
+        v-if="defaultNum == 'w01' || defaultNum == 'w07'"
+      >
+        <el-button type="primary" @click="clickAdd([6], '选择模具')"
+          >添加</el-button
+        >
+        <el-table
+          :data="mouldData"
+          class="table-box"
+          :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
+        >
+          <el-table-column type="index" label="序号" width="50">
+          </el-table-column>
+          <el-table-column prop="informationCode" label="物品编码" width="120">
+          </el-table-column>
+          <el-table-column
+            prop="informationName"
+            label="物品名称"
+            show-overflow-tooltip
+          >
+          </el-table-column>
+          <el-table-column prop="brandNum" label="牌号"> </el-table-column>
+          <el-table-column prop="modelType" label="型号"> </el-table-column>
+          <el-table-column
+            prop="shrinkageCoefficient"
+            label="收缩系数"
+            :formatter="shrinkFormatter"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="dieBodyModel"
+            width="120"
+            label="大模体型号"
+            :formatter="modleFormatter"
+          >
+          </el-table-column>
+          <el-table-column
+            label="物品类型"
+            prop="classificationCode"
+            :formatter="classificationCodeFormatter"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="classificationUrl"
+            show-overflow-tooltip
+            label="分类"
+          >
+          </el-table-column>
+          <el-table-column label="操作">
+            <template slot-scope="scope">
+              <el-button
+                type="text"
+                @click="handleDelete(scope.$index, scope.row)"
+                >删除</el-button
+              >
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-tab-pane>
+      <el-tab-pane label="匹配备品备件" name="part" v-if="defaultNum == 'w01'">
+        <el-button type="primary" @click="clickAdd([7], '选择备品备件')"
+          >添加</el-button
+        >
+        <el-table
+          :data="partData"
+          class="table-box"
+          :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
+        >
+          <el-table-column type="index" label="序号" width="50">
+          </el-table-column>
+          <el-table-column prop="informationCode" label="物品编码">
+          </el-table-column>
+          <el-table-column
+            prop="informationName"
+            label="物品名称"
+            show-overflow-tooltip
+          >
+          </el-table-column>
+          <el-table-column prop="modelType" label="型号"> </el-table-column>
+          <el-table-column
+            label="物品类型"
+            prop="classificationCode"
+            :formatter="classificationCodeFormatter"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="classificationUrl"
+            show-overflow-tooltip
+            label="分类"
+          >
+          </el-table-column>
+          <el-table-column label="操作">
+            <template slot-scope="scope">
+              <el-button
+                type="text"
+                @click="handleDelete(scope.$index, scope.row)"
+                >删除</el-button
+              >
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-tab-pane>
+      <el-tab-pane label="BOM表" name="bom" v-if="defaultNum == 'w07'">
+        <div class="bom-top">
+          <el-button type="primary" @click="clickAdd([3], '选择物料')"
+            >添加</el-button
+          >
+          <div class="top-input">
+            <span>基本数量</span>
+            <el-input
+              class="input-box"
+              @input="handleEdit"
+              v-model="itemForm.basicNum"
+              placeholder="请输入"
+            ></el-input>
+            <span>{{ itemForm.measuringUnit }}</span>
+          </div>
+        </div>
+        <el-table
+          :data="bomData"
+          class="table-box"
+          :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
+        >
+          <el-table-column type="index" label="序号" width="50">
+          </el-table-column>
+          <el-table-column prop="informationCode" label="物品编码" width="120">
+          </el-table-column>
+          <el-table-column
+            prop="informationName"
+            label="物品名称"
+            show-overflow-tooltip
+          >
+          </el-table-column>
+          <el-table-column prop="brandNum" label="牌号"> </el-table-column>
+          <el-table-column
+            label="物品类型"
+            prop="classificationCode"
+            :formatter="classificationCodeFormatter"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="classificationUrl"
+            label="分类"
+            show-overflow-tooltip
+          >
+          </el-table-column>
+          <el-table-column prop="num" label="数量" width="120">
+            <template slot-scope="scope">
+              <el-input
+                type="number"
+                v-model="scope.row.num"
+                placeholder="请输入"
+                oninput="value=value.replace(/[^0-9.]/g,'')"
+              ></el-input>
+            </template>
+          </el-table-column>
+          <el-table-column label="计量单位" prop="measuringUnit">
+          </el-table-column>
+          <el-table-column label="操作">
+            <template slot-scope="scope">
+              <el-button
+                type="text"
+                @click="handleDelete(scope.$index, scope.row)"
+                >删除</el-button
+              >
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-tab-pane>
+      <el-tab-pane
+        label="匹配设备"
+        name="facility"
+        v-if="defaultNum == 'w04' || defaultNum == 'w05'"
+      >
+        <el-button type="primary" @click="clickAdd([1], '选择设备')"
+          >添加</el-button
+        >
+        <el-table
+          :data="facilityData"
+          class="table-box"
+          :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
+        >
+          <el-table-column type="index" label="序号" width="50">
+          </el-table-column>
+          <el-table-column prop="informationCode" label="物品编码">
+          </el-table-column>
+          <el-table-column
+            prop="informationName"
+            label="物品名称"
+            show-overflow-tooltip
+          >
+          </el-table-column>
+          <el-table-column prop="modelType" label="型号"> </el-table-column>
+          <el-table-column
+            label="物品类型"
+            prop="classificationCode"
+            :formatter="classificationCodeFormatter"
+          >
+          </el-table-column>
+          <el-table-column
+            prop="classificationUrl"
+            label="分类"
+            show-overflow-tooltip
+          >
+          </el-table-column>
+          <el-table-column label="操作">
+            <template slot-scope="scope">
+              <el-button
+                type="text"
+                @click="handleDelete(scope.$index, scope.row)"
+                >删除</el-button
+              >
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-tab-pane>
+    </el-tabs>
+
+    <!-- 选择添加 -->
+    <AddDialog
+      ref="addDialogRef"
+      @submit="selectedEquipment"
+      :typeValue="typeValue"
+      :dialogTitle="dialogTitle"
+      :mapList="mapList"
+    />
+  </div>
+</template>
+
+<script>
+  import AddDialog from './AddDialog.vue';
+  export default {
+    components: { AddDialog },
+    prop: {
+      defaultNum: String
+    },
+    data () {
+      return {
+        activeName: 'mould',
+        typeValue: [],
+        productData: [],
+        mouldData: [],
+        partData: [],
+        bomData: [],
+        facilityData: [],
+        mapList: []
+      };
+    },
+    methods: {
+      getMapList () {
+        return this.mapList.map((item) => {
+          const obj = item;
+
+          obj.informationId = obj.id;
+          delete obj.id;
+          return obj;
+        });
+      },
+      setDefault (val) {
+        switch (val) {
+          case 'w06': {
+            this.activeName = 'product';
+            break;
+          }
+          case 'w01': {
+            this.activeName = 'mould';
+            break;
+          }
+          case 'w07': {
+            this.activeName = 'mould';
+            break;
+          }
+          case 'w04': {
+            this.activeName = 'product';
+            break;
+          }
+          case 'w05': {
+            this.activeName = 'facility';
+            break;
+          }
+          default:
+            break;
+        }
+      },
+      matchList (key, data) {
+        switch (key) {
+          case 'w01': {
+            this.facilityData = data[key];
+            break;
+          }
+          case 'w04': {
+            this.mouldData = data[key];
+            break;
+          }
+          case 'w05': {
+            this.partData = data[key];
+            break;
+          }
+          case 'w07': {
+            this.productData = data[key];
+            break;
+          }
+          case 'w06': {
+            this.bomData = data[key];
+            break;
+          }
+          default:
+            break;
+        }
+      },
+      // 物品类型格式化
+      classificationCodeFormatter (row) {
+        let itemName = '';
+        this.typeList.map((item) => {
+          if (item.prefix == row.classificationCode) {
+            itemName = item.name;
+          }
+        });
+        return itemName;
+      },
+      //点击添加打开弹窗
+      clickAdd (val, name) {
+        this.$refs.addDialogRef.equipmentdialog = true;
+        if (val) {
+          this.typeValue = val;
+          this.dialogTitle = name;
+          this.mapAddList();
+        }
+      },
+      mapAddList () {
+        this.mapList = [];
+        if (this.defaultNum == 'w01') {
+          this.mapList = this.partData.concat(this.mouldData);
+        } else if (this.defaultNum == 'w04') {
+          this.mapList = this.facilityData.concat(this.productData);
+        } else if (this.defaultNum == 'w05') {
+          this.mapList = this.facilityData;
+        } else if (this.defaultNum == 'w06') {
+          this.mapList = this.productData;
+        } else if (this.defaultNum == 'w07') {
+          this.mapList = this.mouldData.concat(this.bomData);
+        }
+      },
+      handleDelete (index, row) {
+        this.$confirm(`确认删除[${row.informationName}]吗?`)
+          .then(async () => {
+            switch (this.activeName) {
+              case 'product': {
+                this.productData.splice(index, 1);
+                break;
+              }
+              case 'mould': {
+                this.mouldData.splice(index, 1);
+                break;
+              }
+              case 'part': {
+                this.partData.splice(index, 1);
+                break;
+              }
+              case 'bom': {
+                this.bomData.splice(index, 1);
+                break;
+              }
+              case 'facility': {
+                this.facilityData.splice(index, 1);
+                break;
+              }
+              default:
+                break;
+            }
+            this.mapAddList();
+          })
+          .catch(() => {});
+      },
+      // 选择的设备
+      selectedEquipment (val) {
+        switch (this.activeName) {
+          case 'product': {
+            this.productData = val;
+            break;
+          }
+          case 'mould': {
+            this.mouldData = val;
+            break;
+          }
+          case 'part': {
+            this.partData = val;
+            break;
+          }
+          case 'bom': {
+            this.bomData = val;
+            break;
+          }
+          case 'facility': {
+            this.facilityData = val;
+            break;
+          }
+          default:
+            break;
+        }
+      }
+    }
+  };
+</script>

+ 13 - 13
src/views/classifyManage/itemInformation/details.vue

@@ -205,7 +205,7 @@
   import { getDetails } from '@/api/classifyManage/itemInformation';
   export default {
     components: { ItemDetail, RowDetail },
-    data() {
+    data () {
       return {
         pageTitle: '',
         typeList: [
@@ -239,12 +239,12 @@
         itemValue: ''
       };
     },
-    created() {
+    created () {
       this.getDetilInfo(this.$route.query.id);
     },
     methods: {
-      async getDetilInfo(id) {
-        const res = await getDetails({ id: id });
+      async getDetilInfo (id) {
+        const res = await getDetails(id);
         if (res.success) {
           this.customForm = res.data;
           this.defaultNum = res.data.classificationCode;
@@ -256,7 +256,7 @@
         }
       },
 
-      formatterValue(code) {
+      formatterValue (code) {
         this.typeList.map((item) => {
           if (item.prefix == code) {
             this.itemValue = item.value;
@@ -264,11 +264,11 @@
         });
       },
 
-      goBack() {
+      goBack () {
         this.$router.go(-1);
       },
       // 显示默认选中的tab
-      setDefault(val) {
+      setDefault (val) {
         switch (val) {
           case 'w06': {
             this.activeName = 'product';
@@ -295,7 +295,7 @@
         }
       },
 
-      matchList(key, data) {
+      matchList (key, data) {
         switch (key) {
           case 'w01': {
             this.facilityData = data[key];
@@ -322,25 +322,25 @@
         }
       },
 
-      handleDelete(index, row) {},
+      handleDelete (index, row) {},
 
       //点击添加打开弹窗
-      clickAdd() {
+      clickAdd () {
         this.$refs.addDialogRef.equipmentdialog = true;
       },
 
-      handleCurrent(page) {
+      handleCurrent (page) {
         this.pagination.page = page;
         // this._getList(this.params)
       },
-      handleSize(size) {
+      handleSize (size) {
         this.pagination.page = 1;
         this.pagination.size = size;
         // this._getList(this.params)
       },
 
       // 物品类型格式化
-      classificationCodeFormatter(row) {
+      classificationCodeFormatter (row) {
         let itemName = '';
         this.typeList.map((item) => {
           if (item.prefix == row.classificationCode) {

+ 24 - 4
src/views/classifyManage/itemInformation/index.vue

@@ -22,7 +22,27 @@
             </div>
           </ele-toolbar>
           <div class="ele-border-lighter sys-organization-list">
-            <asset-tree @handleNodeClick="onNodeClick" />
+            <asset-tree
+              @handleNodeClick="onNodeClick"
+              ref="commonTree"
+              :treeFormate="
+                (list) => {
+                  return [
+                    {
+                      children: list,
+                      id: '0',
+                      level: 0,
+                      name: '物品信息表',
+                      originId: null,
+                      originType: {},
+                      parentId: null,
+                      type: {},
+                      weight: 0
+                    }
+                  ];
+                }
+              "
+            />
           </div>
         </div>
         <template v-slot:content>
@@ -51,12 +71,12 @@
         this.current = node;
       },
       openEdit () {
-        // const selectList = this.$refs.commonTree.getSelectList()
+        const selectList = this.$refs.commonTree.getSelectList();
         this.$router.push({
           path: '/classifyManage/itemInformation/add',
           query: {
-            pageTitle: '新建物品'
-            // selectNode: JSON.stringify(selectList)
+            pageTitle: '新建物品',
+            selectNode: JSON.stringify(selectList)
           }
         });
       }

+ 0 - 0
src/views/classifyManage/components/addDialog.vue → src/views/classifyManage/treeClassify/components/addDialog.vue


+ 0 - 0
src/views/classifyManage/components/classifyManageEdit.vue → src/views/classifyManage/treeClassify/components/classifyManageEdit.vue


+ 0 - 0
src/views/classifyManage/components/classifyManageSearch.vue → src/views/classifyManage/treeClassify/components/classifyManageSearch.vue


+ 1 - 1
src/views/classifyManage/components/list-edit.vue → src/views/classifyManage/treeClassify/components/list-edit.vue

@@ -83,7 +83,7 @@
           />
         </el-form-item>
         <el-form-item label="与下层分隔:" prop="separate">
-          <DictSelection dictName="分隔符" clearable v-model="formData.type">
+          <DictSelection dictName="分隔符" clearable v-model="formData.separate">
           </DictSelection>
         </el-form-item>
         <el-form-item label="本层排序:" prop="sort">

+ 0 - 0
src/views/classifyManage/details.vue → src/views/classifyManage/treeClassify/details.vue


+ 1 - 1
src/views/classifyManage/index.vue → src/views/classifyManage/treeClassify/index.vue

@@ -111,7 +111,7 @@
       // 编辑
       junmpEdit ({ id }) {
         this.$router.push({
-          path: '/classifyManage/details',
+          path: '/classifyManage/treeClassify/details',
           query: {
             id
           }