From b6a04be0a4cbf5d5a44006a09b83f52a71dfce27 Mon Sep 17 00:00:00 2001
From: haoyahui <2032914783@qq.com>
Date: 星期五, 17 十一月 2023 10:19:48 +0800
Subject: [PATCH] 部门管理,仓库管理库管员,库存管理

---
 admin-web/src/views/stock/transfer/transferApplication/edit.vue |   52 +++++++++++++++++++++++++++++-----------------------
 1 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/admin-web/src/views/stock/transfer/transferApplication/edit.vue b/admin-web/src/views/stock/transfer/transferApplication/edit.vue
index a990b13..e09140b 100644
--- a/admin-web/src/views/stock/transfer/transferApplication/edit.vue
+++ b/admin-web/src/views/stock/transfer/transferApplication/edit.vue
@@ -174,8 +174,8 @@
 </template>
 <script>
 import { transferAdd } from '@/api/stock/transfer';
-import { getCategorySelectTree, getTree, goodsTemplate, goodsModel } from '@/api/baseSetting/finsystenant';
-import { getParentTenant,queryWarehouseGoods } from '@/api/stock/transfer';
+import { getCategorySelectTree, goodsModel, warehouseSelectNumber } from '@/api/baseSetting/finsystenant';
+import { getParentTenant, queryWarehouseGoods } from '@/api/stock/transfer';
 import MyButton from '@/components/myButton/myButton';
 import winMd from '@/components/win/win-md';
 import upload from '@/components/upload/index';
@@ -219,7 +219,7 @@
         unit: null, //鍗曚綅
       },
       rules: {
-        warehouseId: [{ required: true, message: '璇烽�夋嫨', trigger: 'change' }],
+        outAgencyId: [{ required: true, message: '璇烽�夋嫨', trigger: 'change' }],
         createTime: [{ required: true, message: '璇烽�夋嫨', trigger: 'change' }],
 
         baseCategoryIds: [{ required: true, message: '璇烽�夋嫨', trigger: 'change' }],
@@ -256,14 +256,18 @@
       this.getgoodsTemplate();
       this.getgoodsModel();
       this.getCategoryTree();
-      this.formData.transferGoods.push(JSON.parse(JSON.stringify(this.goodsItem)));
     },
 
     // 鑾峰彇涓婄骇鏈烘瀯
     handegetParentTenant() {
       getParentTenant().then((res) => {
-        this.agencyOptions = [res];
-        this.formData.outAgencyId = res.id;
+        if (res.id != this.userInfo.tenantId) {
+          this.agencyOptions = [res];
+          this.formData.outAgencyId = res.id;
+          this.formData.transferGoods.push(JSON.parse(JSON.stringify(this.goodsItem)));
+        }else{
+          this.$message.warning('鏃犱笂绾ф満鏋�')
+        }
       });
     },
 
@@ -340,12 +344,12 @@
 
     // 鐗╁搧鍚嶇О鍒楄〃閫夋嫨
     goodsTemplateChange(e, index) {
-      let temp = this.formData.transferGoods.find(v=>v.baseGoodsTemplateId==e)
-      if(temp) {
-        this.$message.warning('宸查�夎繃姝ょ墿鍝�')
-        return
-      }else{
-        this.formData.transferGoods[index].baseGoodsTemplateId = e
+      let temp = this.formData.transferGoods.find((v) => v.baseGoodsTemplateId == e);
+      if (temp) {
+        this.$message.warning('宸查�夎繃姝ょ墿鍝�');
+        return;
+      } else {
+        this.formData.transferGoods[index].baseGoodsTemplateId = e;
       }
       this.formData.transferGoods[index].modelsOptions = [];
       this.formData.transferGoods[index].modelsIds = [];
@@ -357,15 +361,22 @@
     },
 
     // 瑙勬牸鍨嬪彿閫夋嫨
-    modelChange(e, index) {
+    async modelChange(e, index) {
       let arr = [...this.formData.transferGoods[index].models];
       let str = JSON.stringify(arr);
-      e.forEach((item) => {
+      for (let item of e) {
         if (str.indexOf(item) == -1) {
           let temp = this.goodsModelAll.find((v) => v.id == item);
-          arr.push({ ...this.modelsItem, baseGoodsModelsId: item, unit: temp.unit });
+          let num = await warehouseSelectNumber({
+            baseGoodsModelsId: item,
+            warehouseType: 0,
+            states: 1,
+            buyType: 1,
+            agencyId: this.formData.outAgencyId,
+          });
+          arr.push({ ...this.modelsItem, baseGoodsModelsId: item, unit: temp.unit, worehouseCount: num });
         }
-      });
+      }
       this.formData.transferGoods[index].models = arr;
     },
 
@@ -395,9 +406,9 @@
     countsChange(e, goodsIndex, index) {
       const curItem = this.formData.transferGoods[goodsIndex].models[index];
       const worehouseCount = curItem.worehouseCount;
-      if(e==0) {
+      if (e == 0) {
         this.$message.warning('鏁伴噺涓嶈兘涓�0');
-        curItem.counts = null
+        curItem.counts = null;
       }
       if (e > worehouseCount) {
         this.$message.warning('鏁伴噺瓒呰繃鐜版湁搴撳瓨');
@@ -427,11 +438,6 @@
     },
 
     close() {
-      this.formData = {
-        warehouseId: '', // 璋冩嫧浠撳簱id
-        procureTime: '', // 璋冩嫧鏃堕棿
-        transferGoods: [],
-      };
       this.$emit('close');
     },
   },

--
Gitblit v1.9.1