Holla-Tako 5 months ago
parent
commit
c94e1f12ff
1 changed files with 48 additions and 29 deletions
  1. 48 29
      src/page/basicData/components/warehouseListEdit.vue

+ 48 - 29
src/page/basicData/components/warehouseListEdit.vue

@@ -71,7 +71,7 @@
71
           <template>
71
           <template>
72
             <el-col :span="8">
72
             <el-col :span="8">
73
               <el-form-item label="统一货位编码" prop="tyhwbm">
73
               <el-form-item label="统一货位编码" prop="tyhwbm">
74
-                <el-input v-model="form.tyhwbm" :readonly="readonly || isEdit" />
74
+                <el-input v-model="form.tyhwbm" disabled placeholder="保存后生成" />
75
               </el-form-item>
75
               </el-form-item>
76
             </el-col>
76
             </el-col>
77
 
77
 
@@ -251,6 +251,7 @@ export default {
251
       orgNameDEl: "",
251
       orgNameDEl: "",
252
       aisleId: null,
252
       aisleId: null,
253
       ajdh: null,
253
       ajdh: null,
254
+      tyajbm: null,
254
       gaojOption: [],
255
       gaojOption: [],
255
       form: {
256
       form: {
256
         warehouseCode: "",
257
         warehouseCode: "",
@@ -263,13 +264,14 @@ export default {
263
         warehouseCode: number_data_del_tw,
264
         warehouseCode: number_data_del_tw,
264
         warehouseUseTime: simple_required,
265
         warehouseUseTime: simple_required,
265
         warehouseCapacity: simple_required,
266
         warehouseCapacity: simple_required,
266
-        tyhwbm: simple_required,
267
+        // tyhwbm: simple_required,
267
       },
268
       },
268
     };
269
     };
269
   },
270
   },
270
   created() {},
271
   created() {},
271
   methods: {
272
   methods: {
272
     setUp() {
273
     setUp() {
274
+      this.tyajbm = null
273
       this.initHouseIdNameMap("storehouseId");
275
       this.initHouseIdNameMap("storehouseId");
274
       this.initOrgIdNameMap();
276
       this.initOrgIdNameMap();
275
       this.initHouseOptions();
277
       this.initHouseOptions();
@@ -280,7 +282,13 @@ export default {
280
     parseResp(resp) {
282
     parseResp(resp) {
281
       console.log("resp", resp);
283
       console.log("resp", resp);
282
       resp.houseName = parseInt(resp.houseName);
284
       resp.houseName = parseInt(resp.houseName);
283
-      this.getFileAojianGet({ orgId: this.orgId, cfid: resp.storehouseId });
285
+      this.aisleId = resp.aisleId
286
+      this.getFileAojianGet({ unitId: this.orgId, storehouseId: resp.storehouseId, libraryType: 0 }).then(_ => {
287
+        const h = this.gaojOption.find((d) => d.id === resp.aisleId);
288
+        if(h) {
289
+          this.tyajbm = h.tyajbm
290
+        }
291
+      })
284
       return resp;
292
       return resp;
285
     },
293
     },
286
 
294
 
@@ -310,9 +318,11 @@ export default {
310
         console.log("3333", h);
318
         console.log("3333", h);
311
         this.ajmc = h.ajmc;
319
         this.ajmc = h.ajmc;
312
         this.ajdh = h.ajdh;
320
         this.ajdh = h.ajdh;
321
+        this.tyajbm = h.tyajbm
313
       }else {
322
       }else {
314
         this.ajmc = null
323
         this.ajmc = null
315
         this.ajdh = null
324
         this.ajdh = null
325
+        this.tyajbm = null
316
       }
326
       }
317
 
327
 
318
     },
328
     },
@@ -365,6 +375,7 @@ export default {
365
       return {
375
       return {
366
         warehouseJson: JSON.stringify(data),
376
         warehouseJson: JSON.stringify(data),
367
         fileIds: '[]',
377
         fileIds: '[]',
378
+        tyajbm: this.tyajbm,
368
       };
379
       };
369
     },
380
     },
370
     checkWareCode() {
381
     checkWareCode() {
@@ -381,38 +392,46 @@ export default {
381
         })
392
         })
382
       }
393
       }
383
     },
394
     },
395
+
396
+    async doSave() {
397
+      const data = this.getLocalData();
398
+
399
+      const fd = new FormData();
400
+      for (const key in data) {
401
+        fd.append(key, data[key]);
402
+      }
403
+
404
+      // console.log(fd.get("storehouseJson"));
405
+
406
+      const resp = await getFileAojianAddOrEdit(data);
407
+      if (resp.status === "success") {
408
+        this.$message.success("保存成功");
409
+        this.show = false;
410
+        this.$emit("on-save");
411
+      } else {
412
+        this.$message.error(resp.msg);
413
+      }
414
+    },
384
     save() {
415
     save() {
385
 
416
 
386
       console.log("data", this.form);
417
       console.log("data", this.form);
387
       this.$refs.editForm.validate(async (ok) => {
418
       this.$refs.editForm.validate(async (ok) => {
388
         if (ok) {
419
         if (ok) {
389
-          findWareCode({
390
-            storehouseId: this.form.storehouseId,
391
-            warehouseCode: this.form.warehouseCode,
392
-            orgId: this.orgId,
393
-          }).then(async (resp) => {
394
-            if(resp == 0) {
395
-              return this.$message.error('货位编号已存在')
396
-            }else if(resp == 1) {
397
-              const data = this.getLocalData();
398
-
399
-              const fd = new FormData();
400
-              for (const key in data) {
401
-                fd.append(key, data[key]);
402
-              }
403
-
404
-              // console.log(fd.get("storehouseJson"));
405
-
406
-              const resp = await getFileAojianAddOrEdit(data);
407
-              if (resp.status === "success") {
408
-                this.$message.success("保存成功");
409
-                this.show = false;
410
-                this.$emit("on-save");
411
-              } else {
412
-                this.$message.error(resp.msg);
420
+          if(this.isAdd) {
421
+            findWareCode({
422
+              storehouseId: this.form.storehouseId,
423
+              warehouseCode: this.form.warehouseCode,
424
+              orgId: this.orgId,
425
+            }).then(async (resp) => {
426
+              if(resp == 0) {
427
+                return this.$message.error('货位编号已存在')
428
+              }else if(resp == 1) {
429
+                this.doSave()
413
               }
430
               }
414
-            }
415
-          })
431
+            })
432
+          }else if(this.isEdit) {
433
+            this.doSave()
434
+          }
416
         }
435
         }
417
       });
436
       });
418
     },
437
     },