wsx před 10 měsíci
rodič
revize
a103e183be

+ 4 - 1
src/views/warehouseManagement/stockLedger/components/item-search.vue

@@ -276,7 +276,10 @@
       },
 
       getWarehouseListHandle(val) {
-        this.warehouseList = this.allWarehouseList.filter(item => item.factoryId === val);
+        this.params.warehouseId = '';
+        this.warehouseList = this.allWarehouseList.filter(
+          (item) => item.factoryId === val
+        );
       },
 
       //搜索数据源

+ 31 - 17
src/views/warehouseManagement/stocktaking/plan/components/plan-search.vue

@@ -12,7 +12,7 @@
           <el-select
             filterable
             placeholder="请选择"
-            @change="getTreeData"
+            @change="getWarehouseListHandle"
             v-model="where.factoryId"
             clearable
             class="w100"
@@ -133,6 +133,7 @@
   import DeptSelect from '@/components/CommomSelect/new-dept-select.vue';
   import storageApi from '@/api/warehouseManagement/index.js';
   import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
+  import { getWarehouseList } from '@/api/classifyManage/itemInformation';
   export default {
     components: { DeptSelect },
     data() {
@@ -153,6 +154,7 @@
         // 表单数据
         defaultWhere: { ...defaultWhere },
         warehouseList: [],
+        allWarehouseList: [],
         factoryList: [],
         where: { ...defaultWhere },
         treeData: [],
@@ -172,6 +174,7 @@
     },
     created() {
       this.getFactoryList();
+      this.getAllWarehouseList();
     },
     methods: {
       async nodeClick(id, data) {
@@ -190,23 +193,29 @@
           this.userList = userData.list;
         }
       },
-      async getTreeData(val) {
-        this.where.targetWarehouse = '';
-        this.where.sourceWarehouse = '';
-        try {
-          this.treeLoading = true;
-          let res = await storageApi.getWarehouseTrees({
-            factoriesId: val
-          });
-          this.treeLoading = false;
-          if (res?.code === '0') {
-            this.warehouseList = res.data;
-          }
-        } catch (error) {
-          console.log(error);
-        }
-        this.treeLoading = false;
+      getWarehouseListHandle(val) {
+        this.where.warehouseId = '';
+        this.warehouseList = this.allWarehouseList.filter(
+          (item) => item.factoryId === val
+        );
       },
+      // async getTreeData(val) {
+      //   this.where.targetWarehouse = '';
+      //   this.where.sourceWarehouse = '';
+      //   try {
+      //     this.treeLoading = true;
+      //     let res = await storageApi.getWarehouseTrees({
+      //       factoriesId: val
+      //     });
+      //     this.treeLoading = false;
+      //     if (res?.code === '0') {
+      //       this.warehouseList = res.data;
+      //     }
+      //   } catch (error) {
+      //     console.log(error);
+      //   }
+      //   this.treeLoading = false;
+      // },
       //获取工厂列表
       async getFactoryList() {
         const res = await warehouseDefinition.getFactoryarea({
@@ -216,6 +225,11 @@
         });
         this.factoryList = res.list;
       },
+      async getAllWarehouseList() {
+        const { data } = await getWarehouseList();
+        this.allWarehouseList = data;
+      },
+
       /* 搜索 */
       search() {
         console.log(this.where);