ol-base-components 3.2.7 → 3.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol-base-components",
3
- "version": "3.2.7",
3
+ "version": "3.2.8",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
@@ -39,7 +39,9 @@ export default {
39
39
  },
40
40
 
41
41
  mounted() {
42
- this.init();
42
+ this.$nextTick(() => {
43
+ this.init();
44
+ });
43
45
  },
44
46
  methods: {
45
47
  init() {
@@ -69,8 +71,10 @@ export default {
69
71
  }).then(res => {
70
72
  if (res.code !== 200) return;
71
73
  const configList = res.result.settingJson ? JSON.parse(res.result.settingJson) : [];
72
- this.formSearchData.tableSearch = configList;
73
- this.key++;
74
+ this.$set(this.formSearchData, "tableSearch", configList);
75
+ this.$nextTick(() => {
76
+ this.key++;
77
+ });
74
78
  });
75
79
  },
76
80
  //保存
@@ -156,11 +156,8 @@
156
156
  <el-select
157
157
  v-model="currentOptionConfig.dictKey"
158
158
  filterable
159
- remote
160
- reserve-keyword
159
+ :filter-method="filterDict"
161
160
  placeholder="请输入字典,如:orderTypeEnum"
162
- :remote-method="remoteDictQuery"
163
- :loading="dictLoading"
164
161
  style="width: 100%"
165
162
  @change="handleDictKeyChange"
166
163
  clearable
@@ -170,7 +167,10 @@
170
167
  :key="dict.key"
171
168
  :label="dict.label"
172
169
  :value="dict.key"
173
- />
170
+ >
171
+ <span style="float: left">{{ dict.label }}</span>
172
+ <span style="float: right; color: #8492a6; font-size: 13px">{{ dict.key }}</span>
173
+ </el-option>
174
174
  </el-select>
175
175
  </el-form-item>
176
176
 
@@ -383,8 +383,7 @@ export default {
383
383
  },
384
384
  previewOptions: [],
385
385
  allDictList: [],
386
- dictLoading: false,
387
- dictQuery: "",
386
+ allDictListBackup: [],
388
387
  sortable: null,
389
388
  currentConfig: {}, // 配置选项
390
389
  };
@@ -395,13 +394,15 @@ export default {
395
394
  return this.customs.filter(custom => !selectedKeys.includes(custom.key));
396
395
  },
397
396
  },
397
+ created() {
398
+ this.loadAllDictList();
399
+ },
398
400
  watch: {
399
401
  visible: {
400
402
  handler(newVal) {
401
403
  this.dialogVisible = newVal;
402
404
  if (newVal) {
403
405
  this.configList = JSON.parse(JSON.stringify(this.tableSearch));
404
- this.loadAllDictList();
405
406
  this.$nextTick(() => {
406
407
  this.initSortable();
407
408
  });
@@ -794,45 +795,28 @@ export default {
794
795
  });
795
796
 
796
797
  this.allDictList = dictList;
798
+ this.allDictListBackup = dictList;
797
799
  } catch (error) {
798
800
  console.error("加载字典列表失败:", error);
799
801
  this.allDictList = [];
802
+ this.allDictListBackup = [];
800
803
  }
801
804
  },
802
- async remoteDictQuery(query) {
805
+ filterDict(query) {
803
806
  if (!query) {
804
- this.allDictList = [];
807
+ this.allDictList = this.allDictListBackup || [];
805
808
  return;
806
809
  }
807
-
808
- try {
809
- this.dictLoading = true;
810
- const wmsStr = localStorage.getItem("wms") || "{}";
811
- const wmsData = JSON.parse(wmsStr);
812
- const dictData = wmsData.SET_enumsSelect || {};
813
-
814
- const dictList = [];
815
- Object.keys(dictData).forEach(key => {
816
- if (key && key.toLowerCase().includes(query.toLowerCase())) {
817
- const dictItem = dictData[key];
818
- if (dictItem) {
819
- dictList.push({
820
- key: String(key),
821
- label: dictItem.desc || key,
822
- });
823
- }
824
- }
825
- });
826
-
827
- this.allDictList = dictList;
828
- } catch (error) {
829
- console.error("搜索字典失败:", error);
830
- this.$message.error("搜索字典失败");
831
- } finally {
832
- this.dictLoading = false;
833
- }
810
+ const filteredList = this.allDictListBackup.filter(item => {
811
+ return (
812
+ item.key.toLowerCase().includes(query.toLowerCase()) ||
813
+ item.label.toLowerCase().includes(query.toLowerCase())
814
+ );
815
+ });
816
+ this.allDictList = filteredList;
834
817
  },
835
818
  handleDictKeyChange(dictKey) {
819
+ this.allDictList = this.allDictListBackup || [];
836
820
  if (dictKey) {
837
821
  this.loadPreviewOptions();
838
822
  }