huang_an 2 anos atrás
pai
commit
e2c0182b23

+ 12 - 0
src/api/factoryModel/index.js

@@ -22,3 +22,15 @@ export async function getFactoryarea(params) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+//查询工位
+// 查询工厂列表-分页
+export async function factoryworkstation(params) {
+  const res = await request.get(`/main/factoryworkstation/page`, {
+    params
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 6 - 0
src/api/warehouseManagement/warehouseDefinition.js

@@ -150,5 +150,11 @@ export default {
     if (res.data.code == 0) {
       return res.data.data;
     }
+  },
+  eomContact: async (params) => {
+    const res = await request.get(`/eom/contact/page`, params);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
   }
 };

+ 15 - 4
src/components/CommomSelect/factory-area-select.vue

@@ -12,12 +12,13 @@
       :key="item.id"
       :label="item.name"
       :value="item.id"
+      @click.native="returnName(item)"
     ></el-option>
   </el-select>
 </template>
 
 <script>
-  import { getFactoryarea } from '@/api/factoryModel';
+  import { getFactoryarea, factoryworkstation } from '@/api/factoryModel';
   export default {
     model: {
       prop: 'value',
@@ -34,7 +35,7 @@
       },
       augr: {
         type: Number,
-        default: 1
+        default: 0
       }
     },
     data() {
@@ -63,12 +64,22 @@
       }
     },
     methods: {
+      returnName(item) {
+        this.$emit('returnName', item.name);
+      },
       async getList() {
-        const res = await getFactoryarea({
+        let params = {
           pageNum: -1,
           size: -1,
           type: this.augr
-        });
+        };
+        if (this.augr == 0) {
+          delete params.type;
+          const res = await factoryworkstation(params);
+          this.dictList = res.list;
+          return;
+        }
+        const res = await getFactoryarea(params);
         this.dictList = res.list;
       }
     }

+ 5 - 3
src/views/ledgerAssets/equipment/components/equipment-list.vue

@@ -195,9 +195,11 @@
             showOverflowTooltip: true,
             minWidth: 110,
             formatter: (_row) => {
-              return _row.position.length != 0
-                ? _row.position[0].pathName
-                : '-';
+              const positionDetail =
+                _row.position.length != 0
+                  ? _row.position[0].detailPosition
+                  : '-';
+              return _row.deviceLocationName + '-' + positionDetail;
             }
           },
           {

+ 88 - 13
src/views/ledgerAssets/equipment/edit.vue

@@ -278,7 +278,7 @@
                   placeholder="请选择"
                 >
                   <el-option
-                    v-for="item in options.supplierId"
+                    v-for="item in suppList"
                     :key="item.id"
                     :label="item.name"
                     :value="item.id"
@@ -296,30 +296,34 @@
                   style="margin-right: 10px"
                   v-model="zcInfo.factoryRoomId1"
                   :augr="1"
+                  @returnName="returnName1"
                 />
                 <FactoryAreaSelect
                   placeholder="请选择厂房"
                   style="margin-right: 10px"
                   v-model="zcInfo.factoryRoomId2"
                   :augr="2"
+                  @returnName="returnName2"
                 />
                 <FactoryAreaSelect
                   placeholder="请选择车间"
                   style="margin-right: 10px"
                   v-model="zcInfo.factoryRoomId3"
                   :augr="3"
+                  @returnName="returnName3"
                 />
                 <FactoryAreaSelect
                   style="margin-right: 10px"
                   placeholder="请选择产线"
                   v-model="zcInfo.factoryRoomId4"
                   :augr="4"
+                  @returnName="returnName4"
                 />
                 <FactoryAreaSelect
                   style="margin-right: 10px"
                   placeholder="请输入工位"
                   v-model="zcInfo.factoryRoomId5"
-                  :augr="5"
+                  @returnName="returnName5"
                 />
               </el-form-item>
             </el-descriptions-item>
@@ -814,6 +818,11 @@
           factoryRoomId3: '',
           factoryRoomId4: '',
           factoryRoomId5: '',
+          factoryRoomName1: '',
+          factoryRoomName2: '',
+          factoryRoomName3: '',
+          factoryRoomName4: '',
+          factoryRoomName5: '',
           // 	固定资产编码
           fixCode: '',
           // 颜色
@@ -907,7 +916,8 @@
         depList: [],
         warehouseList: [],
         areaList: [],
-        shelvesList: []
+        shelvesList: [],
+        suppList: []
       };
     },
     watch: {},
@@ -936,6 +946,21 @@
       }
     },
     methods: {
+      returnName1(val) {
+        this.zcInfo.factoryRoomName1 = val;
+      },
+      returnName2(val) {
+        this.zcInfo.factoryRoomName2 = val;
+      },
+      returnName3(val) {
+        this.zcInfo.factoryRoomName3 = val;
+      },
+      returnName4(val) {
+        this.zcInfo.factoryRoomName4 = val;
+      },
+      returnName5(val) {
+        this.zcInfo.factoryRoomName5 = val;
+      },
       async twoClick(val) {
         this.positionInfo.workshopName = val.name;
         const res = await warehouseDefinition.getListByAreaId(val.id);
@@ -1102,6 +1127,21 @@
         if (!this.basicInfo && this.pageType == 'add') {
           return this.$message.error('请选择物品编码');
         }
+        if (!this.zcInfo.factoryRoomId1) {
+          return this.$message.error('请选择工厂');
+        }
+        if (!this.zcInfo.factoryRoomId2) {
+          return this.$message.error('请选择厂房');
+        }
+        if (!this.zcInfo.factoryRoomId3) {
+          return this.$message.error('请选择车间');
+        }
+        if (!this.zcInfo.factoryRoomId4) {
+          return this.$message.error('请选择产线');
+        }
+        if (!this.zcInfo.factoryRoomId5) {
+          return this.$message.error('请选择工位');
+        }
         this.$refs.form.validate((valid) => {
           if (valid) {
             console.log('ppp', this.positionInfo);
@@ -1155,8 +1195,19 @@
               this.zcInfo.factoryRoomId5
             ];
             const nonEmptyFactoryRoomIds = factoryRoomIds.filter((id) => id);
-            par.position.pathIds = nonEmptyFactoryRoomIds.join(',');
-
+            par.factoryRoomId = nonEmptyFactoryRoomIds.join(',');
+            //---
+            const factoryRoomNames = [
+              this.zcInfo.factoryRoomName1,
+              this.zcInfo.factoryRoomName2,
+              this.zcInfo.factoryRoomName3,
+              this.zcInfo.factoryRoomName4,
+              this.zcInfo.factoryRoomName5
+            ];
+            const nonEmptyFactoryRoomNames = factoryRoomNames.filter(
+              (id) => id
+            );
+            par.factoryRoomName = nonEmptyFactoryRoomNames.join(',');
             //==
             par.deviceLocationName = par.location.toString();
             // par.sss = par.position.detailPosition;
@@ -1216,6 +1267,9 @@
       // 获取设备详情
       async getInfo() {
         const data = await getAssetInfo(this.id);
+        for (const key of Object.keys(this.zcInfo)) {
+          this.zcInfo[key] = data[key];
+        }
         data.extInfoSelf = data.extInfoSelf || [];
         this.form = data;
         this.form.location = data.deviceLocationName.split(',');
@@ -1225,6 +1279,19 @@
         this.cbexpirationTime = data.expirationTime;
         this.sourceDICT = data.sourceDICT;
         this.networkStatus = data.networkStatus;
+
+        if (data.factoryRoomId) {
+          const pathIds = data.factoryRoomId.split(',');
+          this.zcInfo.factoryRoomId1 = pathIds[0];
+
+          this.zcInfo.factoryRoomId2 = pathIds[1];
+
+          this.zcInfo.factoryRoomId3 = pathIds[2];
+
+          this.zcInfo.factoryRoomId4 = pathIds[3];
+
+          this.zcInfo.factoryRoomId5 = pathIds[4];
+        }
         if (data.positionList?.length) {
           this.positionInfo.detailPosition =
             data.positionList[0].detailPosition;
@@ -1232,15 +1299,15 @@
           const pathIds = data.positionList[0].pathIds.split(',');
           const pathName = data.positionList[0].pathName.split(',');
 
-          this.zcInfo.factoryRoomId1 = pathIds[0];
+          // this.zcInfo.factoryRoomId1 = pathIds[0];
 
-          this.zcInfo.factoryRoomId2 = pathIds[1];
+          // this.zcInfo.factoryRoomId2 = pathIds[1];
 
-          this.zcInfo.factoryRoomId3 = pathIds[2];
+          // this.zcInfo.factoryRoomId3 = pathIds[2];
 
-          this.zcInfo.factoryRoomId4 = pathIds[3];
+          // this.zcInfo.factoryRoomId4 = pathIds[3];
 
-          this.zcInfo.factoryRoomId5 = pathIds[4];
+          // this.zcInfo.factoryRoomId5 = pathIds[4];
 
           this.$nextTick(() => {
             // this.$refs.WorkshopSelectRef.getList();
@@ -1277,9 +1344,9 @@
           this.isLink = true;
         }
         // // 资产信息
-        // for (const key of Object.keys(this.zcInfo)) {
-        //   this.zcInfo[key] = data[key];
-        // }
+        // this.zcInfo.codeNumber = data.codeNumber;
+        // this.zcInfo.fixCode = data.fixCode;
+
         this.getwhbm();
         this.getqsbm();
         if (data.attUrl && data.attUrl.length > 0) {
@@ -1295,6 +1362,14 @@
         // 物联参数
         this.isIotEnable = data.isIotEnable;
         this.iotId = data.iotId;
+        //供应商
+        const rep = await warehouseDefinition.eomContact({
+          type: 2,
+          status: 1,
+          size: -1,
+          pageNum: 1
+        });
+        this.suppList = rep.list;
       },
       // 设置标准产能
       setbzcn(val) {