ol-base-components 3.2.6 → 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.6",
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
 
@@ -188,11 +188,11 @@
188
188
  </el-select>
189
189
  </el-form-item>
190
190
 
191
- <el-form-item v-if="currentOptionConfig.sourceType === 'api' && show" label="文本字段">
191
+ <el-form-item v-if="currentOptionConfig.sourceType === 'api'" label="文本字段">
192
192
  <el-input v-model="currentOptionConfig.labelField" placeholder="如:name" />
193
193
  </el-form-item>
194
194
 
195
- <el-form-item v-if="currentOptionConfig.sourceType === 'api' && show" label="值字段">
195
+ <el-form-item v-if="currentOptionConfig.sourceType === 'api'" label="值字段">
196
196
  <el-input v-model="currentOptionConfig.valueField" placeholder="如:id" />
197
197
  </el-form-item>
198
198
 
@@ -234,7 +234,7 @@
234
234
  </div>
235
235
  </el-form-item>
236
236
 
237
- <el-form-item v-if="currentOptionConfig.sourceType === 'dict' && show" label="预览">
237
+ <el-form-item v-if="currentOptionConfig.sourceType === 'dict' && isPreview" label="预览">
238
238
  <div class="preview-box">
239
239
  <el-tag v-for="(item, index) in previewOptions" :key="index" style="margin: 5px">
240
240
  {{ item.value }} ({{ item.key }})
@@ -360,10 +360,13 @@ export default {
360
360
  type: Boolean,
361
361
  default: false,
362
362
  },
363
+ isPreview: {
364
+ type: Boolean,
365
+ default: false,
366
+ },
363
367
  },
364
368
  data() {
365
369
  return {
366
- show: false,
367
370
  dialogVisible: false,
368
371
  configList: [],
369
372
  optionsDialogVisible: false,
@@ -380,8 +383,7 @@ export default {
380
383
  },
381
384
  previewOptions: [],
382
385
  allDictList: [],
383
- dictLoading: false,
384
- dictQuery: "",
386
+ allDictListBackup: [],
385
387
  sortable: null,
386
388
  currentConfig: {}, // 配置选项
387
389
  };
@@ -392,13 +394,15 @@ export default {
392
394
  return this.customs.filter(custom => !selectedKeys.includes(custom.key));
393
395
  },
394
396
  },
397
+ created() {
398
+ this.loadAllDictList();
399
+ },
395
400
  watch: {
396
401
  visible: {
397
402
  handler(newVal) {
398
403
  this.dialogVisible = newVal;
399
404
  if (newVal) {
400
405
  this.configList = JSON.parse(JSON.stringify(this.tableSearch));
401
- this.loadAllDictList();
402
406
  this.$nextTick(() => {
403
407
  this.initSortable();
404
408
  });
@@ -791,45 +795,28 @@ export default {
791
795
  });
792
796
 
793
797
  this.allDictList = dictList;
798
+ this.allDictListBackup = dictList;
794
799
  } catch (error) {
795
800
  console.error("加载字典列表失败:", error);
796
801
  this.allDictList = [];
802
+ this.allDictListBackup = [];
797
803
  }
798
804
  },
799
- async remoteDictQuery(query) {
805
+ filterDict(query) {
800
806
  if (!query) {
801
- this.allDictList = [];
807
+ this.allDictList = this.allDictListBackup || [];
802
808
  return;
803
809
  }
804
-
805
- try {
806
- this.dictLoading = true;
807
- const wmsStr = localStorage.getItem("wms") || "{}";
808
- const wmsData = JSON.parse(wmsStr);
809
- const dictData = wmsData.SET_enumsSelect || {};
810
-
811
- const dictList = [];
812
- Object.keys(dictData).forEach(key => {
813
- if (key && key.toLowerCase().includes(query.toLowerCase())) {
814
- const dictItem = dictData[key];
815
- if (dictItem) {
816
- dictList.push({
817
- key: String(key),
818
- label: dictItem.desc || key,
819
- });
820
- }
821
- }
822
- });
823
-
824
- this.allDictList = dictList;
825
- } catch (error) {
826
- console.error("搜索字典失败:", error);
827
- this.$message.error("搜索字典失败");
828
- } finally {
829
- this.dictLoading = false;
830
- }
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;
831
817
  },
832
818
  handleDictKeyChange(dictKey) {
819
+ this.allDictList = this.allDictListBackup || [];
833
820
  if (dictKey) {
834
821
  this.loadPreviewOptions();
835
822
  }