浏览代码

优化库区获取方式

Qukatie 1 年之前
父节点
当前提交
8e39553ac0
共有 2 个文件被更改,包括 73 次插入16 次删除
  1. 5 2
      src/api/basicdata/warehouse.js
  2. 68 14
      src/views/Warehousing/stockTransfer/AddOrUpdate.vue

+ 5 - 2
src/api/basicdata/warehouse.js

@@ -85,9 +85,12 @@ export function treeselect(ancestors) {
 }
 
 // 查询库区分页
-export function tWarehouseListPage(ancestors) {
+export function tWarehouseListPage(ancestors,fName,pageNum,pageSize) {
   const query = {
-    ancestors
+    ancestors,
+    fName,
+    pageNum,
+    pageSize
   }
   return request({
     url: '/basicdata/warehouse/listPage',

+ 68 - 14
src/views/Warehousing/stockTransfer/AddOrUpdate.vue

@@ -909,7 +909,7 @@
                     @focus="getTreeselect(scope)"
                   >
                   </el-input> -->
-                  <el-select
+                  <!-- <el-select
                   filterable
                   :disabled="
                   !form.fWarehouseid ||
@@ -926,7 +926,29 @@
                     :label="item.fName"
                     :value="item.fId"
                   ></el-option>
-                </el-select>
+                </el-select> -->
+                <el-select
+                   v-model="scope.row.fWarehouseInformation"
+                   style="width: 100%"
+                    placeholder="请选择库区"
+                    :disabled="
+                      !form.fWarehouseid ||
+                      browseStatus ||
+                      scope.row.fBillstatus >= 40
+                    "
+                    filterable
+                    remote
+                    :remote-method="loadOptions"
+                    @change="fWarehouseChange(scope.row)"
+                    @visible-change="vsWarehouseChange(scope.row.fWarehouseInformation)"
+                    >
+                     <el-option
+                       v-for="(item, index) in fWarehouseidOptions"
+                       :key="index.fId"
+                       :label="item.fName"
+                       :value="item.fName"
+                    ></el-option>
+                 </el-select>
                 </span>
                 <span v-else-if="item.label == 'fBusinessType'">
                   <el-select
@@ -3779,6 +3801,37 @@ export default {
     },
   },
   methods: {
+    fWarehouseChange(row){
+      this.fWarehouseidOptions.forEach(e=>{
+        if(e.fName==row.fWarehouseInformation){
+          row.fTransferWarehouselocid=e.fId
+        }
+      })
+      
+    },
+    vsWarehouseChange(query){
+      if(query.length>1){
+        setTimeout(() => {
+       tWarehouseListPage(this.form.fWarehouseid,query,1,20).then((response) => {
+            this.fWarehouseidOptions = response.data
+          })
+      }, 200);
+      }
+   
+    },
+    //下拉分页监听事件
+    loadOptions(query) {
+      if(query.length>1){
+        setTimeout(() => {
+      //   // 这里替换为你的API请求
+       tWarehouseListPage(this.form.fWarehouseid,query,1,20).then((response) => {
+            this.fWarehouseidOptions = response.data
+          })
+      //     console.log('200')
+      }, 200);
+      }
+  
+    },
     init() {
       this.approVal = false;
       this.resetForm("form");
@@ -4481,17 +4534,17 @@ export default {
         })
         .catch((_) => {});
     },
-    getTreeselect(row) {
-      this.treeselectList.fWarehouselocid = null;
-      this.TreeIndex = row.$index;
-      this.choiceWarehouse = true;
-      tWarehouseListPage(this.form.fWarehouseid).then((response) => {
-            this.fWarehouseidOptions = response.data
-          })
+    // getTreeselect(row) {
+    //   this.treeselectList.fWarehouselocid = null;
+    //   this.TreeIndex = row.$index;
+    //   this.choiceWarehouse = true;
+    //   tWarehouseListPage(this.form.fWarehouseid).then((response) => {
+    //         this.fWarehouseidOptions = response.data
+    //       })
       // treeselect(this.form.fWarehouseid).then((response) => {
       //   this.fWarehouseidOptions = response.data;
       // });
-    },
+    // },
     confirm() {
       this.$set(
         this.detailList[this.TreeIndex],
@@ -4658,9 +4711,10 @@ export default {
             this.form.fTrademodeid.toString()
           );
         }
-        tWarehouseListPage(this.form.fWarehouseid).then((response) => {
-            this.fWarehouseidOptions = response.data
-          })
+        // //下拉分页
+        // tWarehouseListPage(this.form.fWarehouseid,'',1,20).then((response) => {
+        //     this.fWarehouseidOptions = response.data
+        //   })
         if (!this.copyStatus) {
           if (response.data.warehouseBillsItem) {
             response.data.warehouseBillsItem.map((e) => {
@@ -6286,7 +6340,7 @@ export default {
         this.$set(this.form, 'fContacts', res.data.fContacts)
         this.$set(this.form, 'fTel', res.data.fTel)
       })
-      tWarehouseListPage(this.form.fWarehouseid).then((response) => {
+      tWarehouseListPage(this.form.fWarehouseid,'',1,20).then((response) => {
             this.fWarehouseidOptions = response.data
           })
     },