From 62b6a7fac3f2acde70b578431147c4a01f19c182 Mon Sep 17 00:00:00 2001
From: 黎星凯 <13949086503@163.com>
Date: 星期一, 15 四月 2024 09:07:05 +0800
Subject: [PATCH] bug修改

---
 admin-web/src/views/stock/inventorycount/inventorytask/inventory.vue |   55 ++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/admin-web/src/views/stock/inventorycount/inventorytask/inventory.vue b/admin-web/src/views/stock/inventorycount/inventorytask/inventory.vue
index 45ecc56..07441f8 100644
--- a/admin-web/src/views/stock/inventorycount/inventorytask/inventory.vue
+++ b/admin-web/src/views/stock/inventorycount/inventorytask/inventory.vue
@@ -1,6 +1,6 @@
 <template>
   <win-md :title="setting.title" @close="close" :width="'1200px'">
-    <el-form class="form" ref="ruleForm" :model="formData" :rules="rules">
+    <el-form v-loading="loading" class="form" ref="ruleForm" :model="formData" :rules="rules">
       <el-row :gutter="20" style="margin-bottom: 20px" type="flex" align="middle">
         <el-col :span="6">鐩樼偣鍗曞彿锛歿{ formData.businessFormCode }}</el-col>
         <el-col :span="6">鐩樼偣浠诲姟锛歿{ formData.businessFormName }}</el-col>
@@ -10,21 +10,22 @@
         </el-col>
       </el-row>
       <el-table
-        v-loading="loading"
         :data="formData.formInventoryGoodsList"
         :rules="rules"
-        height="400"
+        height="500"
         :stripe="true"
         class="the-table"
       >
         <el-table-column prop="goodsTemplateName" label="鐗╁搧鍚嶇О"> </el-table-column>
         <el-table-column prop="baseGoodsModelsName" label="鍨嬪彿" align="center"> </el-table-column>
+        <el-table-column prop="baseGoodsModelsId" label="鍨嬪彿id" v-show="false" align="center"> </el-table-column>
         <el-table-column prop="type" label="绫诲埆"> </el-table-column>
         <el-table-column prop="unit" label="鍗曚綅" align="center"> </el-table-column>
         <el-table-column prop="inventoryCount" label="搴旀湁搴撳瓨" align="center"> </el-table-column>
         <el-table-column prop="realNum" label="瀹炵洏鏁伴噺" align="center">
           <template slot-scope="scope">
             <el-form-item
+              style="margin-bottom: 0"
               label-width="0"
               :prop="`formInventoryGoodsList[${scope.$index}].realNum`"
               :rules="rules.realNum"
@@ -46,7 +47,8 @@
 <script>
 import winMd from '@/components/win/win-md';
 import myButton from '@/components/myButton/myButton';
-import { inventoryQuery, inventoryTemporaryStorage, inventoryFinish } from '@/api/stock/inventory';
+import {inventoryDetail, inventoryFinish, inventoryQuery, inventoryTemporaryStorage} from '@/api/stock/inventory';
+
 export default {
   components: { winMd, myButton },
   props: {
@@ -57,7 +59,7 @@
   },
   data() {
     return {
-      loading: false,
+      loading: true,
       btnLoading: false,
       formData: {
         businessFormCode: '',
@@ -75,38 +77,42 @@
   },
   created() {
     const info = JSON.parse(this.setting.info);
-    console.log('info', info);
     if (info.states == 1) {
       // 缁х画鐩樼偣
-
+      inventoryDetail({ id: this.setting.id }).then((res) => {
+        this.loading = false
+        this.formData = res;
+        this.formData.id = this.setting.id;
+      }).catch(()=>{
+        this.loading = false
+      });
     } else {
       inventoryQuery({ id: this.setting.id }).then((res) => {
+        this.loading = false
         this.formData = res;
         this.formData.id = this.setting.id;
+      }).catch(()=>{
+        this.loading = false
       });
     }
-      inventoryQuery({ id: this.setting.id }).then((res) => {
-        this.formData = res;
-        this.formData.id = this.setting.id;
-      });
   },
   methods: {
     close() {
       this.$emit('close');
     },
     staging() {
-      this.$refs['ruleForm'].validate((valid) => {
-        if (valid) {
-          const params = {
-            ...this.formData,
-            inventoryGoodsList: this.formData.formInventoryGoodsList,
-          };
-          inventoryTemporaryStorage(params).then(() => {
-            this.$message.success('鏆傚瓨鎴愬姛锛�');
-            this.close();
-            this.$emit('search');
-          });
-        }
+      const params = {
+        id: this.formData.id,
+        inventoryGoodsList: this.formData.formInventoryGoodsList,
+      };
+      this.loading = true
+      inventoryTemporaryStorage(params).then(() => {
+        this.loading = false
+        this.$message.success('鏆傚瓨鎴愬姛锛�');
+        this.close();
+        this.$emit('search');
+      }).catch(()=>{
+        this.loading = false
       });
     },
     save() {
@@ -116,10 +122,13 @@
             ...this.formData,
             inventoryGoodsList: this.formData.formInventoryGoodsList,
           };
+          this.loading = true
           inventoryFinish(params).then(() => {
             this.$message.success('鏆傚瓨鎴愬姛锛�');
             this.close();
             this.$emit('search');
+          }).catch(()=>{
+            this.loading = false
           });
         }
       });

--
Gitblit v1.9.1