Kaynağa Gözat

fix:修复仓库详情不回显示

zhangxin 1 ay önce
ebeveyn
işleme
e6082cc8ff
1 değiştirilmiş dosya ile 15 ekleme ve 16 silme
  1. 15 16
      pages/wareHouse/components/edit.vue

+ 15 - 16
pages/wareHouse/components/edit.vue

@@ -481,27 +481,26 @@ export default {
481 481
     },
482 482
     onLoad(options) {
483 483
         this.getTypeList();
484
-        this.$nextTick(()=>{
484
+        this.$nextTick(async()=>{
485 485
             if(options.formType == 'add'){
486 486
                 this.clearForm()
487 487
             }else if(options.formType == 'edit'){
488
-                uni.$u.api.wareHouseDetail({
488
+                const res = await uni.$u.api.wareHouseDetail({
489 489
                     id: options.id,
490 490
                     userId: this.$store.state.user.userInfo.userId,
491
-                }).then(res => {
492
-                    const keys = Object.keys(res.data)
493
-                    keys.forEach(item => {
494
-                        this.formData[item] = res.data[item]
495
-                    })
496
-                    this.formData.recycleTime = this.$dayjs(res.data.recycleTime).format('YYYY-MM-DD') || ''
497
-                    this.echoInfoType = res.data.type || '1'
498
-                    this.echoInfoProductAttribute = res.data.productAttribute || '1'
499
-                    this.echoInfoProductCondition = res.data.productCondition || '1'
500
-                    this.echoInfoStockStatus = res.data.stockStatus || '0'
501
-                    this.$nextTick(()=>{
502
-                        this.$refs.addForm.resetFields();
503
-                    })
504
-                });
491
+                })
492
+                this.formData = res.data
493
+                this.formData.recycleTime = this.$dayjs(res.data.recycleTime).format('YYYY-MM-DD') || ''
494
+                this.echoInfoType = res.data.type || '1'
495
+                this.formData.type = res.data.type || '1'
496
+                this.echoInfoProductAttribute = res.data.productAttribute || '1'
497
+                this.formData.productAttribute = res.data.productAttribute || '1'
498
+                this.echoInfoProductCondition = res.data.productCondition || '1'
499
+                this.formData.productCondition = res.data.productCondition || '1'
500
+                this.echoInfoStockStatus = res.data.stockStatus || '0'
501
+                this.formData.stockStatus = res.data.stockStatus || '0'
502
+                this.formData.stock = res.data.stock ? res.data.stock : 1
503
+                
505 504
             }
506 505
         })
507 506
     },