From 0d704977a91adb83c3ff9c1769fe4b73fc54a565 Mon Sep 17 00:00:00 2001
From: futian.liu <liufutianyoo@163.com>
Date: 星期四, 21 十二月 2023 17:29:38 +0800
Subject: [PATCH] 采购单模板下载和导入

---
 admin-web/src/views/stock/inventorycount/inventorytask/edit.vue |   48 +++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/admin-web/src/views/stock/inventorycount/inventorytask/edit.vue b/admin-web/src/views/stock/inventorycount/inventorytask/edit.vue
index 7708d9f..5bca285 100644
--- a/admin-web/src/views/stock/inventorycount/inventorytask/edit.vue
+++ b/admin-web/src/views/stock/inventorycount/inventorytask/edit.vue
@@ -1,6 +1,6 @@
 <template>
   <win-sm :title="`${setting.title}鐩樼偣`" @close="close" :width="'800px'">
-    <el-form ref="ruleForm" :model="formData" :rules="rules" class="demo-ruleForm" label-width="100px">
+    <el-form v-loading="loading" ref="ruleForm" :model="formData" :rules="rules" class="demo-ruleForm" label-width="100px">
       <el-form-item label="鐩樼偣鍗曞悕" prop="businessFormName">
         <el-input
           v-model="formData.businessFormName"
@@ -11,7 +11,7 @@
         />
       </el-form-item>
       <el-form-item label="鐩樼偣浠撳簱" prop="warehouseId">
-        <el-select v-model="formData.warehouseId" placeholder="璇烽�夋嫨" style="width: 100%">
+        <el-select @change="getPdr" v-model="formData.warehouseId" placeholder="璇烽�夋嫨" style="width: 100%">
           <el-option v-for="item in warehouseOptions" :key="item.id" :label="item.warehouseName" :value="item.id" />
         </el-select>
       </el-form-item>
@@ -44,13 +44,13 @@
 </template>
 
 <script>
-import { selectTenantWarehouse, tenantUserQueryUser } from '@/api/baseSetting/finsystenant';
-import { inventoryAdd, inventoryEdit } from '@/api/stock/inventory';
-import { warehouseManagerList } from '@/api/foudation/store';
+import {selectTenantWarehouse, tenantUserQueryUser} from '@/api/baseSetting/finsystenant';
+import {inventoryAdd, inventoryEdit} from '@/api/stock/inventory';
+import {warehouseManagerList} from '@/api/foudation/store';
 import winSm from '@/components/win/win-sm';
 import myButton from '@/components/myButton/myButton';
-import { formatDate } from '@/utils/DateFormatter';
-import { mapGetters } from 'vuex';
+import {formatDate} from '@/utils/DateFormatter';
+import {mapGetters} from 'vuex';
 
 export default {
   components: { winSm, myButton },
@@ -62,13 +62,20 @@
   },
   data() {
     return {
-      loading:true,
+      count: 0,
+      loading: true,
       checkAll: false,
       checkedList: [],
       warehouseOptions: [], // 浠撳簱鍒楄〃
       operatorOptions: [],
       operatorOptions2: [],
-      formData: {},
+      formData: {
+        businessFormName: '',
+        warehouseId: '',
+        operatorUserId: '',
+        monitorUserId: '',
+        remark: '',
+      },
       rules: {
         businessFormName: [{ required: true, message: '璇疯緭鍏�', trigger: 'blur' }],
         warehouseId: [{ required: true, message: '璇烽�夋嫨', trigger: 'blur' }],
@@ -90,26 +97,38 @@
       this.formData.businessFormName = formatDate(new Date(), 'yyyy骞碝M鏈堜唤鐩樼偣');
     }
     this.handleSelectTenantWarehouse();
-    this.getPdr();
+    //this.getPdr();
     this.getJpr();
   },
   methods: {
     // 鑾峰彇浠撳簱鍒楄〃
     handleSelectTenantWarehouse() {
       selectTenantWarehouse({ agencyId: this.userInfo.tenantId }).then((res) => {
+        this.count++
         this.warehouseOptions = res;
+        if(this.count>1){
+          this.loading = false
+        }
       });
     },
     // 鑾峰彇鐩樼偣浜�
     getPdr() {
-      warehouseManagerList({ tenantId: this.userInfo.tenantId }).then((res) => {
+      warehouseManagerList({ warehouseId: this.formData.warehouseId }).then((res) => {
+        this.count++
         this.operatorOptions = res;
+        if(this.count>1){
+          this.loading = false
+        }
       });
     },
     // 鑾峰彇鐩戠洏浜�
     getJpr() {
       tenantUserQueryUser({ tenantId: this.userInfo.tenantId }).then((res) => {
+        this.count++
         this.operatorOptions2 = res;
+        if(this.count>1){
+          this.loading = false
+        }
       });
     },
     getEditInfo(id) {},
@@ -120,18 +139,25 @@
       this.$refs.ruleForm.validate((valid) => {
         if (valid) {
           const params = Object.assign({}, this.formData);
+          this.loading = true
           if (this.setting.id) {
             // 缂栬緫鎺ュ彛
             inventoryEdit(params).then((res) => {
+              this.loading = false
               this.$message.success('淇濆瓨鎴愬姛锛�');
               this.close();
               this.$emit('search');
+            }).catch(()=>{
+              this.loading = false
             });
           } else {
             inventoryAdd(params).then((res) => {
+              this.loading = false
               this.$message.success('淇濆瓨鎴愬姛锛�');
               this.close();
               this.$emit('search');
+            }).catch(()=>{
+              this.loading = false
             });
           }
         } else {

--
Gitblit v1.9.1