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

Merge branch 'dev' into 'purchaseDev'

Dev

See merge request new-business/drp-web!231
黄梓星 1 éve
szülő
commit
f722c0e4cb
1 módosított fájl, 129 hozzáadás és 94 törlés
  1. 129 94
      src/views/material/basicFile/details.vue

+ 129 - 94
src/views/material/basicFile/details.vue

@@ -240,8 +240,11 @@
                 </el-form>
 
                 <!-- 其他展示为列表 -->
-                <el-table v-else :data="mainMsg.value" @cell-dblclick="handleMaindbClick"
-                          @selection-change="handleMainChange">
+                <el-table v-else 
+                  :data="mainMsg.value" 
+                  @cell-dblclick="handleMaindbClick"
+                  @selection-change="handleMainChange"
+                  >
                   <el-table-column type="selection" width="55"/>
                   <el-table-column type="index" v-if="mainMsg.form.length" label="序号" width="55" align="center"/>
                   <el-table-column v-for="m in  mainMsg.form" v-if="m.show" :label="m.name" align="center"
@@ -888,6 +891,7 @@
         this.activeMainTab = detailsTabs[e.index].code;
 
         this.collapseActive.splice(1, 1, this.activeMainTab);
+
         console.log(this.collapseActive, 'this.collapseActive');
 
         this.handleOtherListRefresh();
@@ -1024,9 +1028,10 @@
         })
       },
       // 获取物料基本信息详细信息
-      getMaterialDetails(id, templateCode) {
+      async getMaterialDetails(id, templateCode) {
+
         let _this = this;
-        materialApi.materialDetails(
+        await materialApi.materialDetails(
           id,
           templateCode,
         ).then(res => {
@@ -1097,58 +1102,87 @@
 
 
       // 查询财务信息列表
-      getFinanceList(materialId) {
-        materialApi.financeList({materialId}).then(res => {
-          console.log(res, '查询财务信息列表');
-          if (res.code == 200) {
-            this.mainMsg.value = res.data.tableBody.rows;
+      async getFinanceList(materialId) {
+        try {
+          this.loading = true;
+          let {code,data} = await materialApi.financeList({materialId});
+          if (code == 200) {
+            this.mainMsg.value = data.tableBody.rows;
           }
-        })
+          
+        } catch (error) {
+          
+        }finally{
+          this.loading = false;
+        }
       },
       // 查询计划信息列表
-      getPlanList(materialId) {
-        materialApi.planList({materialId}).then(res => {
-          console.log(res, '查询计划信息列表');
-          if (res.code == 200) {
-            this.mainMsg.value = res.data.tableBody.rows;
+      async getPlanList(materialId) {
+        try {
+          this.loading = true;
+          let {code,data} = await materialApi.planList({materialId});
+          if (code == 200) {
+            this.mainMsg.value = data.tableBody.rows;
           }
-        })
+        } catch (error) {
+          
+        }finally{
+          this.loading = false;
+        }
       },
       // 查询成本信息列表
-      getCostList(materialId) {
-        materialApi.costList({materialId}).then((res) => {
-          console.log(res, '成本信息列表+表头');
-          if (res.code == 200) {
-            this.mainMsg.value = res.data.tableBody.rows;
+      async getCostList(materialId) {
+        try {
+          this.loading = true;
+          let {code,data} = await materialApi.costList({materialId});
+          if (code == 200) {
+            this.mainMsg.value = data.tableBody.rows;
           }
-        })
+        } catch (error) {
+          
+        }finally{
+          this.loading = false;
+        }
       },
       // 查询利润中心列表
-      getCenterList(materialId) {
-        materialApi.centerList({materialId}).then(res => {
-          console.log(res, '查询利润中心信息');
-          if (res.code == 200) {
-            this.mainMsg.value = res.data.tableBody.rows;
+      async getCenterList(materialId) {
+        try {
+          this.loading = true;
+          let {code,data} = await materialApi.centerList({materialId});
+          if (code == 200) {
+            this.mainMsg.value = data.tableBody.rows;
           }
-        })
+        } catch (error) {
+          
+        }finally{
+          this.loading = false;
+        }
       },
       // 查询采购中心列表
-      getPurchaseList(materialId) {
-        materialApi.purchaseList({materialId}).then(res => {
-          console.log(res, '查询采购中心');
-          if (res.code == 200) {
-            this.mainMsg.value = res.data.tableBody.rows;
+      async getPurchaseList(materialId) {
+        try {
+          this.loading = true;
+          let {code,data} = await materialApi.purchaseList({materialId});
+          if (code == 200) {
+            this.mainMsg.value = data.tableBody.rows;
           }
-        })
+        } catch (error) {
+          
+        }finally{
+          this.loading = false;
+        }
       },
       // 获取库存信息列表
-      getInventoryList(materialId) {
-        materialApi.inventoryList({materialId}).then(res => {
-          console.log(res, '获取库存信息列表');
-          if (res.code == 200) {
-            this.mainMsg.value = res.data.tableBody.rows;
+      async getInventoryList(materialId) {
+        try {
+          this.loading = true;
+          let {code,data} = await materialApi.inventoryList({materialId});
+          if (code == 200) {
+            this.mainMsg.value = data.tableBody.rows;
           }
-        })
+        } catch (error) {}finally{
+          this.loading = false;
+        }
       },
 
       // 查询其他标签页列表详情
@@ -1449,61 +1483,62 @@
         }
       },
       // 其他标签页刷新
-      handleOtherListRefresh() {
-        switch (this.activeMainTab) {
+     async handleOtherListRefresh() {
+          switch (this.activeMainTab) {
 
-          // 基本信息
-          case 'material':
-            this.getTagList('material', (form) => {
-              this.basicData.form = [...form];
-              this.getMaterialDetails(this.materialId, 'material');
-            })
-            break;
-          // 财物信息
-          case 'material_finance':
-            this.getTagList('material_finance', (form) => {
-              this.mainMsg.form = [...form];
-              this.getFinanceList(this.materialId);
-            });
-            break;
-          // 利润中心信息
-          case 'profit_center':
-            this.getTagList('profit_center', (form) => {
-              this.mainMsg.form = [...form];
-              this.getCenterList(this.materialId);
-            });
-            break;
-          // 采购信息
-          case 'material_purchase':
-            this.getTagList('material_purchase', (form) => {
-              this.mainMsg.form = [...form];
-              this.getPurchaseList(this.materialId);
-            });
-            break;
-          // 库存信息
-          case 'material_inventory':
-            this.getTagList('material_inventory', (form) => {
-              this.mainMsg.form = [...form];
-              this.getInventoryList(this.materialId);
-            });
-            break;
-          // 计划信息
-          case 'material_plan':
-            this.getTagList('material_plan', (form) => {
-              this.mainMsg.form = [...form];
-              this.getPlanList(this.materialId);
-            });
-            break;
-          // 成本信息
-          case 'material_cost':
-            this.getTagList('material_cost', (form) => {
-              this.mainMsg.form = [...form];
-              this.getCostList(this.materialId);
-            });
-            break;
-          default:
-            break;
-        }
+            // 基本信息
+            case 'material':
+              await this.getTagList('material', async(form) => {
+                this.basicData.form = [...form];
+                await  this.getMaterialDetails(this.materialId, 'material');
+              })
+              break;
+            // 财物信息
+            case 'material_finance':
+              await this.getTagList('material_finance', async(form) => {
+                this.mainMsg.form = [...form];
+                await this.getFinanceList(this.materialId);
+              });
+              break;
+            // 利润中心信息
+            case 'profit_center':
+              await this.getTagList('profit_center', async(form) => {
+                this.mainMsg.form = [...form];
+                await this.getCenterList(this.materialId);
+              });
+              break;
+            // 采购信息
+            case 'material_purchase':
+              await this.getTagList('material_purchase', async(form) => {
+                this.mainMsg.form = [...form];
+                await this.getPurchaseList(this.materialId);
+              });
+              break;
+            // 库存信息
+            case 'material_inventory':
+              await this.getTagList('material_inventory', async(form) => {
+                this.mainMsg.form = [...form];
+                await  this.getInventoryList(this.materialId);
+              });
+              break;
+            // 计划信息
+            case 'material_plan':
+            await this.getTagList('material_plan', async(form) => {
+                this.mainMsg.form = [...form];
+                await this.getPlanList(this.materialId);
+              });
+              break;
+            // 成本信息
+            case 'material_cost':
+              await this.getTagList('material_cost',async(form) => {
+                this.mainMsg.form = [...form];
+                await this.getCostList(this.materialId);
+              });
+              break;
+            default:
+              break;
+          }
+       
       },
       // 修改
       handleBasicEdit() {