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

1.物料基础档案详情,其他页签修改保存添加操作成功提示
2.物料基础档案,其他页签查询详情添加加载效果

002390 1 éve
szülő
commit
59af22c17c
1 módosított fájl, 266 hozzáadás és 83 törlés
  1. 266 83
      src/views/material/basicFile/details.vue

+ 266 - 83
src/views/material/basicFile/details.vue

@@ -494,8 +494,9 @@
       :close-on-press-escape="false"
       :close-on-click-modal="false"
       class="otherDialog"
+     
     >
-      <div v-loading="otherDeatils.loading">
+      <div  v-loading="otherDeatils.loading">
         <!-- 其他标签页操作  修改、删除 -->
         <el-row :gutter="10" class="mb10">
           <el-col :span="1.5" v-if="!otherDeatils.isEdit">
@@ -1190,7 +1191,6 @@
         console.log(type, id, '查询其他标签页列表详情');
         this.otherDeatils.form = this.mainMsg.form;
         console.log(this.otherDeatils.form, 'this.otherDeatils.form');
-        this.otherDeatils.loading = true;
         switch (type) {
           // 财物信息
           case 'material_finance':
@@ -1221,82 +1221,146 @@
         }
       },
       // 查询财务信息详情
-      getFinanceDetails(id) {
-        materialApi.financeDetails(id).then(res => {
-          this.otherDeatils.loading = false;
-          let _this = this;
-          console.log('查询财务信息详情', res);
-          if (res.code == 200) {
-            this.otherDeatils.value = res.data.data;
-            // _this.handleAddReferLabel('otherDeatils');
+      async getFinanceDetails(id) {
+        
+        try {
+
+          this.otherDeatils.loading = true;
+
+          let {code,data} = await materialApi.financeDetails(id);
+
+            if (code == 200) {
+
+            this.otherDeatils.value = data.data;
+
           }
-        })
+
+        } catch (error) {}
+        finally{
+          setTimeout(()=>{
+
+            this.otherDeatils.loading = false;
+          },200)
+        }
       },
       // 获取利润中心详情
-      getCenterDetails(id) {
-        let _this = this;
-        materialApi.centerDetails(id).then(res => {
-          this.otherDeatils.loading = false;
-          console.log(res, '获取利润中心详情');
-          if (res.code == 200) {
-            this.otherDeatils.value = res.data.data;
-            // _this.handleAddReferLabel('otherDeatils');
+      async getCenterDetails(id) {
+        try {
+
+          this.otherDeatils.loading = true;
+
+          let {code,data} = await materialApi.centerDetails(id);
+
+            if (code == 200) {
+
+            this.otherDeatils.value = data.data;
+
           }
-        })
+
+        } catch (error) {}
+        finally{
+          setTimeout(()=>{
+
+            this.otherDeatils.loading = false;
+          },200)
+        }
       },
       // 获取采购详细信息详情
-      getPurchaseDetails(id) {
-        let _this = this;
-        materialApi.purchaseDetails(id).then(res => {
-          this.otherDeatils.loading = false;
-          console.log(res, '获取采购详细信息详情');
-          if (res.code == 200) {
-            this.otherDeatils.value = res.data.data;
-            // _this.handleAddReferLabel('otherDeatils');
+      async getPurchaseDetails(id) {
+       
+        try {
+
+          this.otherDeatils.loading = true;
+
+          let {code,data} = await materialApi.purchaseDetails(id);
+
+            if (code == 200) {
+
+            this.otherDeatils.value = data.data;
+
           }
-        })
+
+        } catch (error) {}
+        finally{
+          setTimeout(()=>{
+
+            this.otherDeatils.loading = false;
+          },200)
+        }
       },
       // 获取成本信息详情
-      getCostDetails(id) {
-        let _this = this;
-        materialApi.costDetails(id).then(res => {
-          this.otherDeatils.loading = false;
-          console.log(res, '获取成本信息详情');
-          if (res.code == 200) {
-            this.otherDeatils.value = res.data.data;
-            // _this.handleAddReferLabel('otherDeatils');
+      async getCostDetails(id) {
+        try {
+
+          this.otherDeatils.loading = true;
+
+          let {code,data} = await materialApi.costDetails(id);
+
+            if (code == 200) {
+
+            this.otherDeatils.value = data.data;
+
           }
-        })
+
+        } catch (error) {}
+        finally{
+        setTimeout(()=>{
+
+          this.otherDeatils.loading = false;
+        },200)
+        }
       },
       // 获取计划信息详情
-      getPlanDetails(id) {
-        let _this = this;
-        materialApi.planDetails(id).then(res => {
-          this.otherDeatils.loading = false;
-          console.log(res, '获取计划信息详情');
-          if (res.code == 200) {
-            this.otherDeatils.value = res.data.data;
-            // _this.handleAddReferLabel('otherDeatils');
+      async getPlanDetails(id) {
+
+        try {
+
+          this.otherDeatils.loading = true;
+
+          let {code,data} = await materialApi.planDetails(id);
+
+            if (code == 200) {
+
+            this.otherDeatils.value = data.data;
+
           }
-        })
-      },
-      // 获取库存详细信息详情
-      getInventoryDetails(id) {
-        let _this = this;
-        materialApi.inventoryDetails(id).then(res => {
+
+        } catch (error) {}
+        finally{
+          setTimeout(()=>{
+
           this.otherDeatils.loading = false;
-          console.log(res, '获取库存详细信息详情');
-          if (res.code == 200) {
-            this.otherDeatils.value = res.data.data;
-            // _this.handleAddReferLabel('otherDeatils');
+        },200)
+        }
+
+      },
+      //  
+      async getInventoryDetails(id) {
+        try {
+
+          this.otherDeatils.loading = true;
+
+          let {code,data} = await materialApi.inventoryDetails(id);
+
+            if (code == 200) {
+
+            this.otherDeatils.value = data.data;
+
           }
-        })
+
+        } catch (error) {}
+        finally{
+          setTimeout(()=>{
+
+          this.otherDeatils.loading = false;
+          },200)
+        }
       },
 
 
       /* 二级标签页 */
       // 根据物料id获取医药行业信息详细信息
-      getMedcineDetails(id) {
+      async getMedcineDetails(id) {
         let _this = this;
         console.log(id);
         materialApi.medcineDetailsInfo(id).then((res) => {
@@ -1409,7 +1473,7 @@
       },
       // 除基本信息之后的修改
       handleOtherEdit(type) {
-        debugger
+        // debugger
         console.log('除基本信息之后的修改', type);
         if ('table' === type) {
           if (this.mainMsg.checkedList.length == 1) {
@@ -2088,64 +2152,183 @@
         })
       },
       // 保存财务信息——单个数据
-      handleSaveFinance(data) {
+      async handleSaveFinance(data) {
+
         console.log(data, '保存财务信息——单个数据');
-        materialApi.financeEdit(data).then(res => {
-          if (res.code == 200) {
+        try {
+
+          this.otherDeatils.loading = true;
+
+          let {code,msg} = await materialApi.financeEdit(data);
+
+          if (code == 200) {
             this.otherDeatils.isEdit = false;
             this.handleOtherRefresh();
+            this.$message({
+              message: msg,
+              type: 'success'
+            });
           }
-        })
+        } catch (error) {
+        }finally{
+          this.otherDeatils.loading = false;
+        }
+
+
+        // this.otherDeatils.loading = true;
+        // materialApi.financeEdit(data).then(res => {
+        //   if (res.code == 200) {
+        //     this.otherDeatils.isEdit = false;
+        //     this.handleOtherRefresh();
+        //   }
+        //   this.otherDeatils.loading = false;
+        // })
       },
       // 保存利润中心信息
-      handleSaveCenter(data) {
+      async handleSaveCenter(data) {
         console.log(data, '保存利润中心信息');
-        materialApi.centerEdit(data).then(res => {
-          if (res.code == 200) {
+        try {
+          
+          this.otherDeatils.loading = true;
+          
+          let {code,msg} = await materialApi.centerEdit(data);
+
+          if (code == 200) {
             this.otherDeatils.isEdit = false;
             this.handleOtherRefresh();
+            this.$message({
+              message: msg,
+              type: 'success'
+            });
           }
-        })
+
+        } catch (error) {}
+        finally{
+          this.otherDeatils.loading = false;
+        }
+        // materialApi.centerEdit(data).then(res => {
+        //   if (res.code == 200) {
+        //     this.otherDeatils.isEdit = false;
+        //     this.handleOtherRefresh();
+        //   }
+        // })
       },
       // 保存采购信息
-      handleSavePurchase(data) {
+      async handleSavePurchase(data) {
         console.log(data, '保存采购信息');
-        materialApi.purchaseEdit(data).then(res => {
-          if (res.code == 200) {
+        try {
+          
+          this.otherDeatils.loading = true;
+          
+          let {code,msg} = await materialApi.purchaseEdit(data);
+
+          if (code == 200) {
             this.otherDeatils.isEdit = false;
             this.handleOtherRefresh();
+            this.$message({
+              message: msg,
+              type: 'success'
+            });
           }
-        })
+
+        } catch (error) {}
+        finally{
+          this.otherDeatils.loading = false;
+        }
+        // materialApi.purchaseEdit(data).then(res => {
+        //   if (res.code == 200) {
+        //     this.otherDeatils.isEdit = false;
+        //     this.handleOtherRefresh();
+        //   }
+        // })
       },
       // 保存库存信息
-      handleSaveInventoryEdit(data) {
+      async handleSaveInventoryEdit(data) {
         console.log(data, '保存库存信息');
-        materialApi.inventoryEdit(data).then(res => {
-          if (res.code == 200) {
+        try {
+          
+          this.otherDeatils.loading = true;
+          
+          let {code,msg} = await materialApi.inventoryEdit(data);
+
+          if (code == 200) {
             this.otherDeatils.isEdit = false;
             this.handleOtherRefresh();
+            this.$message({
+              message: msg,
+              type: 'success'
+            });
           }
-        })
+
+        } catch (error) {}
+        finally{
+          this.otherDeatils.loading = false;
+        }
+       
+        // materialApi.inventoryEdit(data).then(res => {
+        //   if (res.code == 200) {
+        //     this.otherDeatils.isEdit = false;
+        //     this.handleOtherRefresh();
+        //   }
+        // })
       },
       // 保存计划信息
-      handleSavePlan(data) {
+      async handleSavePlan(data) {
         console.log(data, '保存计划信息');
-        materialApi.planEdit(data).then(res => {
-          if (res.code == 200) {
+        try {
+          
+          this.otherDeatils.loading = true;
+          
+          let {code,msg} = await materialApi.planEdit(data);
+
+          if (code == 200) {
             this.otherDeatils.isEdit = false;
             this.handleOtherRefresh();
+            this.$message({
+              message: msg,
+              type: 'success'
+            });
           }
-        })
+
+        } catch (error) {}
+        finally{
+          this.otherDeatils.loading = false;
+        }
+        // materialApi.planEdit(data).then(res => {
+        //   if (res.code == 200) {
+        //     this.otherDeatils.isEdit = false;
+        //     this.handleOtherRefresh();
+        //   }
+        // })
       },
       // 保存成本信息
-      handleSaveCost(data) {
+      async handleSaveCost(data) {
         console.log(data, '保存成本信息');
-        materialApi.costEdit(data).then(res => {
-          if (res.code == 200) {
+        try {
+          
+          this.otherDeatils.loading = true;
+          
+          let {code,msg} = await materialApi.costEdit(data);
+
+          if (code == 200) {
             this.otherDeatils.isEdit = false;
             this.handleOtherRefresh();
+            this.$message({
+              message: msg,
+              type: 'success'
+            });
           }
-        })
+
+        } catch (error) {}
+        finally{
+          this.otherDeatils.loading = false;
+        }
+        // materialApi.costEdit(data).then(res => {
+        //   if (res.code == 200) {
+        //     this.otherDeatils.isEdit = false;
+        //     this.handleOtherRefresh();
+        //   }
+        // })
       },
 
       judgeIsRequriedByProps(message){