002390 1 an în urmă
părinte
comite
bc528a5c2b
1 a modificat fișierele cu 37 adăugiri și 26 ștergeri
  1. 37 26
      src/views/material/basicFile/details.vue

+ 37 - 26
src/views/material/basicFile/details.vue

@@ -982,7 +982,9 @@
           // 医药行业
           case 'material_medcine':
             this.getTagList('material_medcine', (form) => {
-              this.medcineData.form = form;
+              this.medcineData.form = [...form];
+              this.medcineData.value = initParams(this.medcineData.form,'prop');
+              this.medcineRules = initRules(form);
               this.getMedcineDetails(this.materialId, 'material_medcine');
             })
             break;
@@ -1122,7 +1124,7 @@
             }
 
             // _this.handleAddReferLabel('basicData');
-
+            this.count++;
           }
         })
       },
@@ -1437,7 +1439,7 @@
       async getMedcineDetails(id) {
         let _this = this;
         console.log(id);
-        materialApi.medcineDetailsInfo(id).then((res) => {
+        await materialApi.medcineDetailsInfo(id).then((res) => {
           this.loading = false;
           console.log(res, '医药行业');
           let {code, data} = res;
@@ -1446,6 +1448,7 @@
             // this.medcineData.form = data.form;
             // _this.handleAddReferLabel('medcineData');
             console.log(' _this.medcineData', _this.medcineData, res);
+            this.count++;
           }
         })
       },
@@ -1486,27 +1489,30 @@
         })
       },
       // 获取物料列表表头
-      getTagList(templateCode, cb) {
-        let _this = this
-        materialApi.tagList({templateCode}).then(res => {
+      async getTagList(templateCode, cb) {
+        let _this = this;
+        await materialApi.tagList({templateCode}).then(async (res) => {
           console.log(res, `获取${templateCode}表头`);
           let dictIdList = [];
           if (res.code == 200) {
 
-            res.data.map(item => {
-
-              // 查字典
-              if (item.dictId && item.dictId != '') {
-                // 通过接口获取有dict的对应的数据
-                getDicts(item.dictId).then(dict => {
-                  if (dict.data) {
-                    item['dictValue'] = dict.data;
-                  }
-                })
-              }
+            res.data.map(async(item) => {
+                // 查字典
+                if (item.dictId && item.dictId != '') {
+                  // 通过接口获取有dict的对应的数据
+                  await getDicts(item.dictId).then(dict => {
+                    if (dict.data) {
+                      item['dictValue'] = dict.data;
+                    }
+                   
+                  })
+                }
 
             })
 
+              return cb(res.data);
+            
+
             // 动态更改dict
             // res.data.forEach(item => {
             //   if (item.dictId) {
@@ -1520,7 +1526,7 @@
 
             // console.log(_this.dict, 'dicts');
 
-            return cb(res.data);
+            // return cb(res.data);
           }
         })
       },
@@ -1630,7 +1636,10 @@
             // 基本信息
             case 'material':
               await this.getTagList('material', async(form) => {
+                // this.basicData.form = [...form];
                 this.basicData.form = [...form];
+                this.rules = initRules(form);
+                this.basicData.value = initParams(this.basicData.form,'prop')
                 await  this.getMaterialDetails(this.materialId, 'material');
               })
               break;
@@ -2462,28 +2471,30 @@
       async handleRest() {
         this.loading = true;
         // 基本信息
-        await this.getTagList('material', (form) => {
+        await this.getTagList('material', async(form) => {
           this.basicData.form = [...form];
           this.rules = initRules(form);
           this.basicData.value = initParams(this.basicData.form,'prop')
-          this.getMaterialDetails(this.materialId, 'material');
+          await this.getMaterialDetails(this.materialId, 'material');
         })
         // 医疗行业
-        await this.getTagList('material_medcine', (form) => {
-          form.forEach((item) => {
-            this.medcineData.value[item.prop] = ''
-          })
-          this.medcineData.form = form;
+        await this.getTagList('material_medcine',async (form) => {
+          // form.forEach((item) => {
+          //   this.medcineData.value[item.prop] = ''
+          // })
+          this.medcineData.form = [...form];
           this.medcineData.value = initParams(this.medcineData.form,'prop');
           this.medcineRules = initRules(form);
-          this.getMedcineDetails(this.materialId, 'material_medcine');
+          await this.getMedcineDetails(this.materialId, 'material_medcine');
         })
 
       },
+
       
     },
 
     watch: {
+
       // 监听主标签修改标识,控制其他标签是否禁止点击
       'updateButtonGroup': function (nVal, oVal) {
         console.log(nVal, 'nVal', oVal, 'oVal');