@weitutech/by-components 1.1.168 → 1.1.170
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/lib/by-components.common.js +69 -19
- package/lib/by-components.umd.js +69 -19
- package/lib/by-components.umd.min.js +1 -1
- package/package.json +1 -1
|
@@ -78157,8 +78157,8 @@ var custom_date_picker_component = normalizeComponent(
|
|
|
78157
78157
|
)
|
|
78158
78158
|
|
|
78159
78159
|
/* harmony default export */ var custom_date_picker = (custom_date_picker_component.exports);
|
|
78160
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"5daa4f39-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/common-selector/ByCommonSelector.vue?vue&type=template&id=
|
|
78161
|
-
var
|
|
78160
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"5daa4f39-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/common-selector/ByCommonSelector.vue?vue&type=template&id=05ec4584
|
|
78161
|
+
var ByCommonSelectorvue_type_template_id_05ec4584_render = function render() {
|
|
78162
78162
|
var _vm = this,
|
|
78163
78163
|
_c = _vm._self._c;
|
|
78164
78164
|
return _c('div', {
|
|
@@ -78750,7 +78750,7 @@ var ByCommonSelectorvue_type_template_id_53a73a0f_render = function render() {
|
|
|
78750
78750
|
}
|
|
78751
78751
|
}, [_vm._v(" 加载中... ")]) : _vm._e()], 2);
|
|
78752
78752
|
};
|
|
78753
|
-
var
|
|
78753
|
+
var ByCommonSelectorvue_type_template_id_05ec4584_staticRenderFns = [];
|
|
78754
78754
|
|
|
78755
78755
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.some.js
|
|
78756
78756
|
var es_iterator_some = __webpack_require__(3579);
|
|
@@ -89409,18 +89409,22 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
89409
89409
|
if (this.multiple) {
|
|
89410
89410
|
// 多选情况:value 是数组
|
|
89411
89411
|
if (Array.isArray(this.value) && this.value.length > 0) {
|
|
89412
|
-
const defaultItems = this.
|
|
89412
|
+
const defaultItems = this.normalizedEnhancedAllOptions.filter(option => this.value.some(val => isValueEqual(val, option.id)));
|
|
89413
89413
|
return defaultItems;
|
|
89414
89414
|
}
|
|
89415
89415
|
} else {
|
|
89416
89416
|
// 单选情况:value 是单个值
|
|
89417
89417
|
if (this.value !== '') {
|
|
89418
|
-
const defaultItem = this.
|
|
89418
|
+
const defaultItem = this.normalizedEnhancedAllOptions.find(option => isValueEqual(this.value, option.id));
|
|
89419
89419
|
return defaultItem ? [defaultItem] : [];
|
|
89420
89420
|
}
|
|
89421
89421
|
}
|
|
89422
89422
|
}
|
|
89423
89423
|
return this.dataList;
|
|
89424
|
+
},
|
|
89425
|
+
// 标准化后的 enhancedAllOptions(将 value/label 转为 id/name)
|
|
89426
|
+
normalizedEnhancedAllOptions() {
|
|
89427
|
+
return this.normalizeOptions(this.enhancedAllOptions || []);
|
|
89424
89428
|
}
|
|
89425
89429
|
},
|
|
89426
89430
|
watch: {
|
|
@@ -89460,12 +89464,15 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
89460
89464
|
},
|
|
89461
89465
|
options: {
|
|
89462
89466
|
handler(newOptions, oldOptions) {
|
|
89467
|
+
// 标准化数据格式(将 value/label 转为 id/name)
|
|
89468
|
+
const normalizedOptions = this.normalizeOptions(newOptions || []);
|
|
89469
|
+
|
|
89463
89470
|
// enhancedSelect 类型的特殊处理
|
|
89464
89471
|
if (this.type === 'enhancedSelect') {
|
|
89465
|
-
this.dataList =
|
|
89472
|
+
this.dataList = normalizedOptions;
|
|
89466
89473
|
// 更新缓存
|
|
89467
89474
|
this.allData.clear();
|
|
89468
|
-
|
|
89475
|
+
normalizedOptions.forEach(item => {
|
|
89469
89476
|
this.allData.set(item.id, item);
|
|
89470
89477
|
});
|
|
89471
89478
|
// 数据更新后,自动关闭加载状态
|
|
@@ -89480,7 +89487,7 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
89480
89487
|
|
|
89481
89488
|
// 其他类型的处理
|
|
89482
89489
|
if (!this.loadOptions) {
|
|
89483
|
-
this.localOptions = [...
|
|
89490
|
+
this.localOptions = [...normalizedOptions];
|
|
89484
89491
|
|
|
89485
89492
|
// 判断数据总量是否变化
|
|
89486
89493
|
const oldLength = oldOptions ? oldOptions.length : 0;
|
|
@@ -89534,7 +89541,7 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
89534
89541
|
return;
|
|
89535
89542
|
}
|
|
89536
89543
|
|
|
89537
|
-
// 当 enhancedAllOptions
|
|
89544
|
+
// 当 enhancedAllOptions 加载完成后,重新处理默认值(normalizedEnhancedAllOptions computed 会自动转换)
|
|
89538
89545
|
this.$nextTick(() => {
|
|
89539
89546
|
this.handleEnhancedSelectDefaultValue();
|
|
89540
89547
|
this.enhancedDisabled = false;
|
|
@@ -89578,6 +89585,46 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
89578
89585
|
this.clearAllCheckTimers();
|
|
89579
89586
|
},
|
|
89580
89587
|
methods: {
|
|
89588
|
+
// 标准化选项数据格式:将 value/label 转换为 id/name(如果数据中没有 id/name)
|
|
89589
|
+
normalizeOptions(options) {
|
|
89590
|
+
if (!Array.isArray(options) || options.length === 0) {
|
|
89591
|
+
return options;
|
|
89592
|
+
}
|
|
89593
|
+
|
|
89594
|
+
// 检查第一个选项是否同时包含 id 和 name
|
|
89595
|
+
const firstItem = options[0];
|
|
89596
|
+
const hasIdName = firstItem && 'id' in firstItem && 'name' in firstItem;
|
|
89597
|
+
|
|
89598
|
+
// 如果已经有 id 和 name,直接返回(不修改原数据)
|
|
89599
|
+
if (hasIdName) {
|
|
89600
|
+
return options;
|
|
89601
|
+
}
|
|
89602
|
+
|
|
89603
|
+
// 检查是否有 value 和 label
|
|
89604
|
+
const hasValueLabel = firstItem && 'value' in firstItem && 'label' in firstItem;
|
|
89605
|
+
|
|
89606
|
+
// 如果有 value 和 label,进行转换
|
|
89607
|
+
if (hasValueLabel) {
|
|
89608
|
+
return options.map(item => {
|
|
89609
|
+
const normalized = {
|
|
89610
|
+
...item
|
|
89611
|
+
};
|
|
89612
|
+
// 将 value 转为 id(如果 id 不存在)
|
|
89613
|
+
if ('value' in item && !('id' in item)) {
|
|
89614
|
+
normalized.id = item.value;
|
|
89615
|
+
}
|
|
89616
|
+
// 将 label 转为 name(如果 name 不存在)
|
|
89617
|
+
if ('label' in item && !('name' in item)) {
|
|
89618
|
+
normalized.name = item.label;
|
|
89619
|
+
}
|
|
89620
|
+
return normalized;
|
|
89621
|
+
});
|
|
89622
|
+
}
|
|
89623
|
+
|
|
89624
|
+
// 如果既没有完整的 id/name 也没有完整的 value/label,返回原数据
|
|
89625
|
+
// 这种情况在原有代码中也会有问题,不是本次修改引入的
|
|
89626
|
+
return options;
|
|
89627
|
+
},
|
|
89581
89628
|
// 清除所有检查定时器
|
|
89582
89629
|
clearAllCheckTimers() {
|
|
89583
89630
|
// 清除所有检查定时器
|
|
@@ -89710,7 +89757,8 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
89710
89757
|
this.loading = true;
|
|
89711
89758
|
const result = await this.loadOptions();
|
|
89712
89759
|
if (Array.isArray(result)) {
|
|
89713
|
-
|
|
89760
|
+
// 标准化数据格式(将 value/label 转为 id/name)
|
|
89761
|
+
this.localOptions = this.normalizeOptions(result);
|
|
89714
89762
|
this.initData();
|
|
89715
89763
|
|
|
89716
89764
|
// 数据加载完成后检查是否需要展开按钮
|
|
@@ -89732,10 +89780,12 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
89732
89780
|
initData() {
|
|
89733
89781
|
// enhancedSelect 类型的特殊处理
|
|
89734
89782
|
if (this.type === 'enhancedSelect') {
|
|
89735
|
-
|
|
89783
|
+
// 标准化数据格式(将 value/label 转为 id/name)
|
|
89784
|
+
const normalizedOptions = this.normalizeOptions(this.options || []);
|
|
89785
|
+
this.dataList = normalizedOptions;
|
|
89736
89786
|
this.selectedValue = this.value;
|
|
89737
89787
|
// 缓存所有数据
|
|
89738
|
-
|
|
89788
|
+
normalizedOptions.forEach(item => {
|
|
89739
89789
|
this.allData.set(item.id, item);
|
|
89740
89790
|
});
|
|
89741
89791
|
return;
|
|
@@ -89898,14 +89948,14 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
89898
89948
|
// 修复:优先从 enhancedAllOptions 中查找,确保多选时能正确获取对象数组
|
|
89899
89949
|
if (Array.isArray(value) && value.length > 0) {
|
|
89900
89950
|
// 从 enhancedAllOptions 中查找所有匹配的选项
|
|
89901
|
-
const items = this.
|
|
89951
|
+
const items = this.normalizedEnhancedAllOptions.filter(option => value.some(val => isValueEqual(val, option.id)));
|
|
89902
89952
|
obj = items;
|
|
89903
89953
|
}
|
|
89904
89954
|
} else {
|
|
89905
89955
|
obj = {};
|
|
89906
89956
|
if (value !== undefined && value !== null && value !== '') {
|
|
89907
89957
|
// 优先从 enhancedAllOptions 中查找
|
|
89908
|
-
const item = this.
|
|
89958
|
+
const item = this.normalizedEnhancedAllOptions.find(option => isValueEqual(value, option.id));
|
|
89909
89959
|
if (item) {
|
|
89910
89960
|
obj[this.enhancedDescriptionKey] = item[this.enhancedDescriptionKey];
|
|
89911
89961
|
obj[this.enhancedTitleKey] = item[this.enhancedTitleKey];
|
|
@@ -90019,19 +90069,19 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
90019
90069
|
},
|
|
90020
90070
|
// 处理 enhancedSelect 类型的默认值
|
|
90021
90071
|
handleEnhancedSelectDefaultValue() {
|
|
90022
|
-
if (this.value !== undefined && this.value !== null && this.value !== '' && this.
|
|
90072
|
+
if (this.value !== undefined && this.value !== null && this.value !== '' && this.normalizedEnhancedAllOptions && this.normalizedEnhancedAllOptions.length > 0) {
|
|
90023
90073
|
// 确保默认值能正确显示
|
|
90024
90074
|
this.selectedValue = this.value;
|
|
90025
90075
|
if (this.multiple) {
|
|
90026
90076
|
if (Array.isArray(this.value) && this.value.length > 0) {
|
|
90027
|
-
const items = this.
|
|
90077
|
+
const items = this.normalizedEnhancedAllOptions.filter(option => this.value.some(val => isValueEqual(val, option.id)));
|
|
90028
90078
|
if (items.length > 0) {
|
|
90029
90079
|
this.$emit('input', this.value);
|
|
90030
90080
|
this.$emit('change', items);
|
|
90031
90081
|
}
|
|
90032
90082
|
}
|
|
90033
90083
|
} else {
|
|
90034
|
-
const item = this.
|
|
90084
|
+
const item = this.normalizedEnhancedAllOptions.find(option => isValueEqual(this.value, option.id));
|
|
90035
90085
|
if (item) {
|
|
90036
90086
|
let obj = {};
|
|
90037
90087
|
obj[this.enhancedDescriptionKey] = item[this.enhancedDescriptionKey];
|
|
@@ -90215,8 +90265,8 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
90215
90265
|
;
|
|
90216
90266
|
var ByCommonSelector_component = normalizeComponent(
|
|
90217
90267
|
common_selector_ByCommonSelectorvue_type_script_lang_js,
|
|
90218
|
-
|
|
90219
|
-
|
|
90268
|
+
ByCommonSelectorvue_type_template_id_05ec4584_render,
|
|
90269
|
+
ByCommonSelectorvue_type_template_id_05ec4584_staticRenderFns,
|
|
90220
90270
|
false,
|
|
90221
90271
|
null,
|
|
90222
90272
|
null,
|
package/lib/by-components.umd.js
CHANGED
|
@@ -78167,8 +78167,8 @@ var custom_date_picker_component = normalizeComponent(
|
|
|
78167
78167
|
)
|
|
78168
78168
|
|
|
78169
78169
|
/* harmony default export */ var custom_date_picker = (custom_date_picker_component.exports);
|
|
78170
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"5daa4f39-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/common-selector/ByCommonSelector.vue?vue&type=template&id=
|
|
78171
|
-
var
|
|
78170
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"5daa4f39-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/common-selector/ByCommonSelector.vue?vue&type=template&id=05ec4584
|
|
78171
|
+
var ByCommonSelectorvue_type_template_id_05ec4584_render = function render() {
|
|
78172
78172
|
var _vm = this,
|
|
78173
78173
|
_c = _vm._self._c;
|
|
78174
78174
|
return _c('div', {
|
|
@@ -78760,7 +78760,7 @@ var ByCommonSelectorvue_type_template_id_53a73a0f_render = function render() {
|
|
|
78760
78760
|
}
|
|
78761
78761
|
}, [_vm._v(" 加载中... ")]) : _vm._e()], 2);
|
|
78762
78762
|
};
|
|
78763
|
-
var
|
|
78763
|
+
var ByCommonSelectorvue_type_template_id_05ec4584_staticRenderFns = [];
|
|
78764
78764
|
|
|
78765
78765
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.some.js
|
|
78766
78766
|
var es_iterator_some = __webpack_require__(3579);
|
|
@@ -89419,18 +89419,22 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
89419
89419
|
if (this.multiple) {
|
|
89420
89420
|
// 多选情况:value 是数组
|
|
89421
89421
|
if (Array.isArray(this.value) && this.value.length > 0) {
|
|
89422
|
-
const defaultItems = this.
|
|
89422
|
+
const defaultItems = this.normalizedEnhancedAllOptions.filter(option => this.value.some(val => isValueEqual(val, option.id)));
|
|
89423
89423
|
return defaultItems;
|
|
89424
89424
|
}
|
|
89425
89425
|
} else {
|
|
89426
89426
|
// 单选情况:value 是单个值
|
|
89427
89427
|
if (this.value !== '') {
|
|
89428
|
-
const defaultItem = this.
|
|
89428
|
+
const defaultItem = this.normalizedEnhancedAllOptions.find(option => isValueEqual(this.value, option.id));
|
|
89429
89429
|
return defaultItem ? [defaultItem] : [];
|
|
89430
89430
|
}
|
|
89431
89431
|
}
|
|
89432
89432
|
}
|
|
89433
89433
|
return this.dataList;
|
|
89434
|
+
},
|
|
89435
|
+
// 标准化后的 enhancedAllOptions(将 value/label 转为 id/name)
|
|
89436
|
+
normalizedEnhancedAllOptions() {
|
|
89437
|
+
return this.normalizeOptions(this.enhancedAllOptions || []);
|
|
89434
89438
|
}
|
|
89435
89439
|
},
|
|
89436
89440
|
watch: {
|
|
@@ -89470,12 +89474,15 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
89470
89474
|
},
|
|
89471
89475
|
options: {
|
|
89472
89476
|
handler(newOptions, oldOptions) {
|
|
89477
|
+
// 标准化数据格式(将 value/label 转为 id/name)
|
|
89478
|
+
const normalizedOptions = this.normalizeOptions(newOptions || []);
|
|
89479
|
+
|
|
89473
89480
|
// enhancedSelect 类型的特殊处理
|
|
89474
89481
|
if (this.type === 'enhancedSelect') {
|
|
89475
|
-
this.dataList =
|
|
89482
|
+
this.dataList = normalizedOptions;
|
|
89476
89483
|
// 更新缓存
|
|
89477
89484
|
this.allData.clear();
|
|
89478
|
-
|
|
89485
|
+
normalizedOptions.forEach(item => {
|
|
89479
89486
|
this.allData.set(item.id, item);
|
|
89480
89487
|
});
|
|
89481
89488
|
// 数据更新后,自动关闭加载状态
|
|
@@ -89490,7 +89497,7 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
89490
89497
|
|
|
89491
89498
|
// 其他类型的处理
|
|
89492
89499
|
if (!this.loadOptions) {
|
|
89493
|
-
this.localOptions = [...
|
|
89500
|
+
this.localOptions = [...normalizedOptions];
|
|
89494
89501
|
|
|
89495
89502
|
// 判断数据总量是否变化
|
|
89496
89503
|
const oldLength = oldOptions ? oldOptions.length : 0;
|
|
@@ -89544,7 +89551,7 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
89544
89551
|
return;
|
|
89545
89552
|
}
|
|
89546
89553
|
|
|
89547
|
-
// 当 enhancedAllOptions
|
|
89554
|
+
// 当 enhancedAllOptions 加载完成后,重新处理默认值(normalizedEnhancedAllOptions computed 会自动转换)
|
|
89548
89555
|
this.$nextTick(() => {
|
|
89549
89556
|
this.handleEnhancedSelectDefaultValue();
|
|
89550
89557
|
this.enhancedDisabled = false;
|
|
@@ -89588,6 +89595,46 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
89588
89595
|
this.clearAllCheckTimers();
|
|
89589
89596
|
},
|
|
89590
89597
|
methods: {
|
|
89598
|
+
// 标准化选项数据格式:将 value/label 转换为 id/name(如果数据中没有 id/name)
|
|
89599
|
+
normalizeOptions(options) {
|
|
89600
|
+
if (!Array.isArray(options) || options.length === 0) {
|
|
89601
|
+
return options;
|
|
89602
|
+
}
|
|
89603
|
+
|
|
89604
|
+
// 检查第一个选项是否同时包含 id 和 name
|
|
89605
|
+
const firstItem = options[0];
|
|
89606
|
+
const hasIdName = firstItem && 'id' in firstItem && 'name' in firstItem;
|
|
89607
|
+
|
|
89608
|
+
// 如果已经有 id 和 name,直接返回(不修改原数据)
|
|
89609
|
+
if (hasIdName) {
|
|
89610
|
+
return options;
|
|
89611
|
+
}
|
|
89612
|
+
|
|
89613
|
+
// 检查是否有 value 和 label
|
|
89614
|
+
const hasValueLabel = firstItem && 'value' in firstItem && 'label' in firstItem;
|
|
89615
|
+
|
|
89616
|
+
// 如果有 value 和 label,进行转换
|
|
89617
|
+
if (hasValueLabel) {
|
|
89618
|
+
return options.map(item => {
|
|
89619
|
+
const normalized = {
|
|
89620
|
+
...item
|
|
89621
|
+
};
|
|
89622
|
+
// 将 value 转为 id(如果 id 不存在)
|
|
89623
|
+
if ('value' in item && !('id' in item)) {
|
|
89624
|
+
normalized.id = item.value;
|
|
89625
|
+
}
|
|
89626
|
+
// 将 label 转为 name(如果 name 不存在)
|
|
89627
|
+
if ('label' in item && !('name' in item)) {
|
|
89628
|
+
normalized.name = item.label;
|
|
89629
|
+
}
|
|
89630
|
+
return normalized;
|
|
89631
|
+
});
|
|
89632
|
+
}
|
|
89633
|
+
|
|
89634
|
+
// 如果既没有完整的 id/name 也没有完整的 value/label,返回原数据
|
|
89635
|
+
// 这种情况在原有代码中也会有问题,不是本次修改引入的
|
|
89636
|
+
return options;
|
|
89637
|
+
},
|
|
89591
89638
|
// 清除所有检查定时器
|
|
89592
89639
|
clearAllCheckTimers() {
|
|
89593
89640
|
// 清除所有检查定时器
|
|
@@ -89720,7 +89767,8 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
89720
89767
|
this.loading = true;
|
|
89721
89768
|
const result = await this.loadOptions();
|
|
89722
89769
|
if (Array.isArray(result)) {
|
|
89723
|
-
|
|
89770
|
+
// 标准化数据格式(将 value/label 转为 id/name)
|
|
89771
|
+
this.localOptions = this.normalizeOptions(result);
|
|
89724
89772
|
this.initData();
|
|
89725
89773
|
|
|
89726
89774
|
// 数据加载完成后检查是否需要展开按钮
|
|
@@ -89742,10 +89790,12 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
89742
89790
|
initData() {
|
|
89743
89791
|
// enhancedSelect 类型的特殊处理
|
|
89744
89792
|
if (this.type === 'enhancedSelect') {
|
|
89745
|
-
|
|
89793
|
+
// 标准化数据格式(将 value/label 转为 id/name)
|
|
89794
|
+
const normalizedOptions = this.normalizeOptions(this.options || []);
|
|
89795
|
+
this.dataList = normalizedOptions;
|
|
89746
89796
|
this.selectedValue = this.value;
|
|
89747
89797
|
// 缓存所有数据
|
|
89748
|
-
|
|
89798
|
+
normalizedOptions.forEach(item => {
|
|
89749
89799
|
this.allData.set(item.id, item);
|
|
89750
89800
|
});
|
|
89751
89801
|
return;
|
|
@@ -89908,14 +89958,14 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
89908
89958
|
// 修复:优先从 enhancedAllOptions 中查找,确保多选时能正确获取对象数组
|
|
89909
89959
|
if (Array.isArray(value) && value.length > 0) {
|
|
89910
89960
|
// 从 enhancedAllOptions 中查找所有匹配的选项
|
|
89911
|
-
const items = this.
|
|
89961
|
+
const items = this.normalizedEnhancedAllOptions.filter(option => value.some(val => isValueEqual(val, option.id)));
|
|
89912
89962
|
obj = items;
|
|
89913
89963
|
}
|
|
89914
89964
|
} else {
|
|
89915
89965
|
obj = {};
|
|
89916
89966
|
if (value !== undefined && value !== null && value !== '') {
|
|
89917
89967
|
// 优先从 enhancedAllOptions 中查找
|
|
89918
|
-
const item = this.
|
|
89968
|
+
const item = this.normalizedEnhancedAllOptions.find(option => isValueEqual(value, option.id));
|
|
89919
89969
|
if (item) {
|
|
89920
89970
|
obj[this.enhancedDescriptionKey] = item[this.enhancedDescriptionKey];
|
|
89921
89971
|
obj[this.enhancedTitleKey] = item[this.enhancedTitleKey];
|
|
@@ -90029,19 +90079,19 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
90029
90079
|
},
|
|
90030
90080
|
// 处理 enhancedSelect 类型的默认值
|
|
90031
90081
|
handleEnhancedSelectDefaultValue() {
|
|
90032
|
-
if (this.value !== undefined && this.value !== null && this.value !== '' && this.
|
|
90082
|
+
if (this.value !== undefined && this.value !== null && this.value !== '' && this.normalizedEnhancedAllOptions && this.normalizedEnhancedAllOptions.length > 0) {
|
|
90033
90083
|
// 确保默认值能正确显示
|
|
90034
90084
|
this.selectedValue = this.value;
|
|
90035
90085
|
if (this.multiple) {
|
|
90036
90086
|
if (Array.isArray(this.value) && this.value.length > 0) {
|
|
90037
|
-
const items = this.
|
|
90087
|
+
const items = this.normalizedEnhancedAllOptions.filter(option => this.value.some(val => isValueEqual(val, option.id)));
|
|
90038
90088
|
if (items.length > 0) {
|
|
90039
90089
|
this.$emit('input', this.value);
|
|
90040
90090
|
this.$emit('change', items);
|
|
90041
90091
|
}
|
|
90042
90092
|
}
|
|
90043
90093
|
} else {
|
|
90044
|
-
const item = this.
|
|
90094
|
+
const item = this.normalizedEnhancedAllOptions.find(option => isValueEqual(this.value, option.id));
|
|
90045
90095
|
if (item) {
|
|
90046
90096
|
let obj = {};
|
|
90047
90097
|
obj[this.enhancedDescriptionKey] = item[this.enhancedDescriptionKey];
|
|
@@ -90225,8 +90275,8 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
90225
90275
|
;
|
|
90226
90276
|
var ByCommonSelector_component = normalizeComponent(
|
|
90227
90277
|
common_selector_ByCommonSelectorvue_type_script_lang_js,
|
|
90228
|
-
|
|
90229
|
-
|
|
90278
|
+
ByCommonSelectorvue_type_template_id_05ec4584_render,
|
|
90279
|
+
ByCommonSelectorvue_type_template_id_05ec4584_staticRenderFns,
|
|
90230
90280
|
false,
|
|
90231
90281
|
null,
|
|
90232
90282
|
null,
|