Explorar el Código

1.0.2 抽盘里的放置位置选择框优化

liuyanpeng hace 8 meses
padre
commit
0e70f92cdb
Se han modificado 2 ficheros con 39 adiciones y 5 borrados
  1. 1 1
      package.json
  2. 38 4
      src/components/customer/AssetInventoryStep5.vue

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "client-eam-v5",
   "description": "Leanwo Prodog Client",
-  "version": "1.0.1",
+  "version": "1.0.2",
   "author": "yangzhijie1488 <yangzhijie1488@163.com>",
   "scripts": {
     "ins": "npm install --registry=http://wuzhixin.vip:4873",

+ 38 - 4
src/components/customer/AssetInventoryStep5.vue

@@ -114,8 +114,16 @@
 
               <a-form-item label="放置位置">
                 <a-select
-                  v-model:value="filter.locationIds" mode="multiple" style="width: 100%"
-                  :filter-option="filterOption" :options="locationData" @change="fetchLocation"
+                  v-model:value="filter.locationIds"
+                  v-model:search-value="locationSearchValue"
+                  mode="multiple"
+                  show-search
+                  style="width: 100%"
+                  :filter-option="filterOption"
+                  :options="locationData"
+                  @change="fetchLocation"
+                  @search="handleLocationSearch"
+                  @dropdown-visible-change="handleLocationDropdownChange"
                 />
               </a-form-item>
 
@@ -242,6 +250,8 @@ export default {
         hasScrap: 'All',
       },
       locationData: [],
+      locationSearchValue: '', // 放置位置搜索文本
+      lastLocationSearchValue: '', // 保存最后的搜索值
       additionalHql: '',
       pagination: {
         per_page: Common.pageSize, // required
@@ -573,9 +583,31 @@ export default {
 
     //查询放置位置
     fetchLocation: function () {
-      console.log('查询位置');
       var _self = this;
-      console.log(_self.filter.locationIds);
+      // 在选择后,恢复搜索值,保持筛选状态
+      _self.$nextTick(() => {
+        if (_self.lastLocationSearchValue) {
+          _self.locationSearchValue = _self.lastLocationSearchValue;
+        }
+      });
+    },
+
+    // 处理放置位置搜索
+    handleLocationSearch: function (value) {
+      this.locationSearchValue = value;
+      this.lastLocationSearchValue = value; // 保存最后的搜索值
+    },
+
+    // 处理下拉框显示/隐藏
+    handleLocationDropdownChange: function (open) {
+      var _self = this;
+      // 当下拉框关闭时,延迟清空搜索值,方便下次直接输入新的筛选条件
+      if (!open) {
+        setTimeout(() => {
+          _self.locationSearchValue = '';
+          _self.lastLocationSearchValue = '';
+        }, 100);
+      }
     },
 
     // 取消默认上传
@@ -817,6 +849,8 @@ export default {
       this.filter.assetNo1 = null;
       this.filter.assetNo2 = null;
       this.filter.locationIds = [];
+      this.locationSearchValue = ''; // 清空放置位置搜索文本
+      this.lastLocationSearchValue = ''; // 清空最后的搜索值
       (this.custodianNameFieldValue = {
         id: null,
         displayValue: [''],