@weitutech/by-components 1.1.82 → 1.1.83
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 +57 -33
- package/lib/by-components.umd.js +57 -33
- package/lib/by-components.umd.min.js +1 -1
- package/package.json +1 -1
|
@@ -61092,6 +61092,38 @@ const deepClone = target => {
|
|
|
61092
61092
|
// 返回最终结果
|
|
61093
61093
|
return result;
|
|
61094
61094
|
};
|
|
61095
|
+
|
|
61096
|
+
/**
|
|
61097
|
+
* 比较两个值是否相等,支持字符串和数字类型的自动转换
|
|
61098
|
+
* @param {*} value1 第一个值
|
|
61099
|
+
* @param {*} value2 第二个值
|
|
61100
|
+
* @returns {boolean} 是否相等
|
|
61101
|
+
*/
|
|
61102
|
+
const isValueEqual = (value1, value2) => {
|
|
61103
|
+
// 如果两个值严格相等,直接返回 true
|
|
61104
|
+
if (value1 === value2) {
|
|
61105
|
+
return true;
|
|
61106
|
+
}
|
|
61107
|
+
|
|
61108
|
+
// 处理 0 的特殊情况
|
|
61109
|
+
if (value1 === 0 && value2 === 0) {
|
|
61110
|
+
return true;
|
|
61111
|
+
}
|
|
61112
|
+
|
|
61113
|
+
// 尝试数字转换比较
|
|
61114
|
+
const num1 = Number(value1);
|
|
61115
|
+
const num2 = Number(value2);
|
|
61116
|
+
|
|
61117
|
+
// 如果转换后都是有效数字且相等
|
|
61118
|
+
if (!isNaN(num1) && !isNaN(num2) && num1 === num2) {
|
|
61119
|
+
return true;
|
|
61120
|
+
}
|
|
61121
|
+
|
|
61122
|
+
// 尝试字符串转换比较
|
|
61123
|
+
const str1 = String(value1);
|
|
61124
|
+
const str2 = String(value2);
|
|
61125
|
+
return str1 === str2;
|
|
61126
|
+
};
|
|
61095
61127
|
;// ./src/utils/tableUtils.js
|
|
61096
61128
|
|
|
61097
61129
|
|
|
@@ -63066,8 +63098,8 @@ var custom_date_picker_component = normalizeComponent(
|
|
|
63066
63098
|
)
|
|
63067
63099
|
|
|
63068
63100
|
/* harmony default export */ var custom_date_picker = (custom_date_picker_component.exports);
|
|
63069
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7d802f52-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=
|
|
63070
|
-
var
|
|
63101
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7d802f52-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=36584f2f
|
|
63102
|
+
var ByCommonSelectorvue_type_template_id_36584f2f_render = function render() {
|
|
63071
63103
|
var _vm = this,
|
|
63072
63104
|
_c = _vm._self._c;
|
|
63073
63105
|
return _c('div', {
|
|
@@ -63113,7 +63145,8 @@ var ByCommonSelectorvue_type_template_id_fbdd4830_render = function render() {
|
|
|
63113
63145
|
"collapse-tags": _vm.multiple && _vm.enhancedCollapseTags,
|
|
63114
63146
|
"remote-method": _vm.getResult,
|
|
63115
63147
|
"loading": _vm.loading,
|
|
63116
|
-
"placeholder": _vm.placeholder
|
|
63148
|
+
"placeholder": _vm.placeholder,
|
|
63149
|
+
"disabled": _vm.enhancedDisabled
|
|
63117
63150
|
},
|
|
63118
63151
|
on: {
|
|
63119
63152
|
"change": _vm.selected,
|
|
@@ -63509,7 +63542,7 @@ var ByCommonSelectorvue_type_template_id_fbdd4830_render = function render() {
|
|
|
63509
63542
|
}
|
|
63510
63543
|
}, [_vm._v(" 加载中... ")]) : _vm._e()], 2);
|
|
63511
63544
|
};
|
|
63512
|
-
var
|
|
63545
|
+
var ByCommonSelectorvue_type_template_id_36584f2f_staticRenderFns = [];
|
|
63513
63546
|
|
|
63514
63547
|
;// ./node_modules/pinyin-pro/dist/index.mjs
|
|
63515
63548
|
|
|
@@ -73790,8 +73823,10 @@ function segment(word, options) {
|
|
|
73790
73823
|
|
|
73791
73824
|
|
|
73792
73825
|
|
|
73826
|
+
|
|
73793
73827
|
//拼音库,用于搜索栏生成A~Z字母
|
|
73794
73828
|
|
|
73829
|
+
|
|
73795
73830
|
// 全部选项可能的名称
|
|
73796
73831
|
const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'all'];
|
|
73797
73832
|
/* harmony default export */ var ByCommonSelectorvue_type_script_lang_js = ({
|
|
@@ -74053,7 +74088,9 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74053
74088
|
// enhancedSelect 相关数据
|
|
74054
74089
|
allData: new Map(),
|
|
74055
74090
|
// 缓存所有数据
|
|
74056
|
-
enhancedSelectOpened: false
|
|
74091
|
+
enhancedSelectOpened: false,
|
|
74092
|
+
// 标记 enhancedSelect 是否已经打开过
|
|
74093
|
+
enhancedDisabled: false
|
|
74057
74094
|
};
|
|
74058
74095
|
},
|
|
74059
74096
|
computed: {
|
|
@@ -74076,13 +74113,13 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74076
74113
|
if (this.multiple) {
|
|
74077
74114
|
// 多选情况:value 是数组
|
|
74078
74115
|
if (Array.isArray(this.value) && this.value.length > 0) {
|
|
74079
|
-
const defaultItems = this.enhancedAllOptions.filter(option => this.value.
|
|
74116
|
+
const defaultItems = this.enhancedAllOptions.filter(option => this.value.some(val => isValueEqual(val, option.id)));
|
|
74080
74117
|
return defaultItems;
|
|
74081
74118
|
}
|
|
74082
74119
|
} else {
|
|
74083
74120
|
// 单选情况:value 是单个值
|
|
74084
74121
|
if (this.value !== '') {
|
|
74085
|
-
const defaultItem = this.enhancedAllOptions.find(option =>
|
|
74122
|
+
const defaultItem = this.enhancedAllOptions.find(option => isValueEqual(this.value, option.id));
|
|
74086
74123
|
return defaultItem ? [defaultItem] : [];
|
|
74087
74124
|
}
|
|
74088
74125
|
}
|
|
@@ -74194,15 +74231,17 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74194
74231
|
enhancedAllOptions: {
|
|
74195
74232
|
handler(newOptions) {
|
|
74196
74233
|
if (this.type === 'enhancedSelect') {
|
|
74234
|
+
this.enhancedDisabled = true;
|
|
74197
74235
|
// 验证 enhancedAllOptions 是否已加载
|
|
74198
74236
|
if (!newOptions || newOptions.length === 0) {
|
|
74199
|
-
console.warn('[ByCommonSelector] enhancedSelect 类型需要提供 enhancedAllOptions 属性用于默认值回显')
|
|
74237
|
+
// console.warn('[ByCommonSelector] enhancedSelect 类型需要提供 enhancedAllOptions 属性用于默认值回显')
|
|
74200
74238
|
return;
|
|
74201
74239
|
}
|
|
74202
74240
|
|
|
74203
74241
|
// 当 enhancedAllOptions 加载完成后,重新处理默认值
|
|
74204
74242
|
this.$nextTick(() => {
|
|
74205
74243
|
this.handleEnhancedSelectDefaultValue();
|
|
74244
|
+
this.enhancedDisabled = false;
|
|
74206
74245
|
});
|
|
74207
74246
|
}
|
|
74208
74247
|
},
|
|
@@ -74382,10 +74421,6 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74382
74421
|
this.$nextTick(() => {
|
|
74383
74422
|
this.checkNeedExpand();
|
|
74384
74423
|
this.scheduleExpandCheck();
|
|
74385
|
-
// 异步加载数据后,重新处理默认值(仅 enhancedSelect)
|
|
74386
|
-
if (this.type === 'enhancedSelect') {
|
|
74387
|
-
this.handleEnhancedSelectDefaultValue();
|
|
74388
|
-
}
|
|
74389
74424
|
});
|
|
74390
74425
|
} else {
|
|
74391
74426
|
// console.error('loadOptions函数返回值必须是数组')
|
|
@@ -74567,14 +74602,14 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74567
74602
|
// 修复:优先从 enhancedAllOptions 中查找,确保多选时能正确获取对象数组
|
|
74568
74603
|
if (Array.isArray(value) && value.length > 0) {
|
|
74569
74604
|
// 从 enhancedAllOptions 中查找所有匹配的选项
|
|
74570
|
-
const items = this.enhancedAllOptions.filter(option => value.
|
|
74605
|
+
const items = this.enhancedAllOptions.filter(option => value.some(val => isValueEqual(val, option.id)));
|
|
74571
74606
|
obj = items;
|
|
74572
74607
|
}
|
|
74573
74608
|
} else {
|
|
74574
74609
|
obj = {};
|
|
74575
74610
|
if (value !== undefined && value !== null && value !== '') {
|
|
74576
74611
|
// 优先从 enhancedAllOptions 中查找
|
|
74577
|
-
const item = this.enhancedAllOptions.find(option =>
|
|
74612
|
+
const item = this.enhancedAllOptions.find(option => isValueEqual(value, option.id));
|
|
74578
74613
|
if (item) {
|
|
74579
74614
|
obj[this.enhancedDescriptionKey] = item[this.enhancedDescriptionKey];
|
|
74580
74615
|
obj[this.enhancedTitleKey] = item[this.enhancedTitleKey];
|
|
@@ -74582,7 +74617,7 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74582
74617
|
} else {
|
|
74583
74618
|
// 如果从 enhancedAllOptions 中找不到,再从 dataList 中查找
|
|
74584
74619
|
this.dataList.forEach(item => {
|
|
74585
|
-
if (value
|
|
74620
|
+
if (isValueEqual(value, item.id)) {
|
|
74586
74621
|
obj[this.enhancedDescriptionKey] = item[this.enhancedDescriptionKey];
|
|
74587
74622
|
obj[this.enhancedTitleKey] = item[this.enhancedTitleKey];
|
|
74588
74623
|
obj.id = item.id;
|
|
@@ -74672,7 +74707,6 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74672
74707
|
}
|
|
74673
74708
|
},
|
|
74674
74709
|
emitChange(value) {
|
|
74675
|
-
// console.log('001:触发了-emitChange ==:', value)
|
|
74676
74710
|
this.$emit('input', value);
|
|
74677
74711
|
},
|
|
74678
74712
|
handleSuffixInputChange(value) {
|
|
@@ -74681,37 +74715,27 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74681
74715
|
this.$emit('update:suffixInputValue', value);
|
|
74682
74716
|
},
|
|
74683
74717
|
// ******************** enhancedSelect 相关方法 ********************
|
|
74718
|
+
|
|
74684
74719
|
getResult(q) {
|
|
74685
|
-
// 设置加载状态
|
|
74686
74720
|
this.loading = true;
|
|
74687
|
-
|
|
74688
|
-
// 触发外部搜索事件,让外部控制数据
|
|
74689
74721
|
this.$emit('search', q);
|
|
74690
|
-
|
|
74691
|
-
// 返回 Promise 以满足 remote 的要求
|
|
74692
74722
|
return Promise.resolve();
|
|
74693
74723
|
},
|
|
74724
|
+
// 处理 enhancedSelect 类型的默认值
|
|
74694
74725
|
handleEnhancedSelectDefaultValue() {
|
|
74695
|
-
|
|
74696
|
-
// console.log('002:this.enhancedAllOptions ==:', this.enhancedAllOptions)
|
|
74697
|
-
// 针对 enhancedSelect 类型处理默认值
|
|
74698
|
-
if (this.value !== undefined && this.value !== null && this.value !== '') {
|
|
74726
|
+
if (this.value !== undefined && this.value !== null && this.value !== '' && this.enhancedAllOptions && this.enhancedAllOptions.length > 0) {
|
|
74699
74727
|
// 确保默认值能正确显示
|
|
74700
74728
|
this.selectedValue = this.value;
|
|
74701
74729
|
if (this.multiple) {
|
|
74702
|
-
// 多选情况:value 是数组
|
|
74703
74730
|
if (Array.isArray(this.value) && this.value.length > 0) {
|
|
74704
|
-
|
|
74705
|
-
const items = this.enhancedAllOptions.filter(option => this.value.includes(option.id) || this.value.includes(Number(option.id)) || this.value.includes(0) && option.id === 0);
|
|
74731
|
+
const items = this.enhancedAllOptions.filter(option => this.value.some(val => isValueEqual(val, option.id)));
|
|
74706
74732
|
if (items.length > 0) {
|
|
74707
74733
|
this.$emit('input', this.value);
|
|
74708
74734
|
this.$emit('change', items);
|
|
74709
74735
|
}
|
|
74710
74736
|
}
|
|
74711
74737
|
} else {
|
|
74712
|
-
|
|
74713
|
-
// 在 enhancedAllOptions 数组中查找对应的选项
|
|
74714
|
-
const item = this.enhancedAllOptions.find(option => option.id === this.value || option.id === Number(this.value) || this.value === 0 && option.id === 0);
|
|
74738
|
+
const item = this.enhancedAllOptions.find(option => isValueEqual(this.value, option.id));
|
|
74715
74739
|
if (item) {
|
|
74716
74740
|
let obj = {};
|
|
74717
74741
|
obj[this.enhancedDescriptionKey] = item[this.enhancedDescriptionKey];
|
|
@@ -74748,8 +74772,8 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74748
74772
|
;
|
|
74749
74773
|
var ByCommonSelector_component = normalizeComponent(
|
|
74750
74774
|
common_selector_ByCommonSelectorvue_type_script_lang_js,
|
|
74751
|
-
|
|
74752
|
-
|
|
74775
|
+
ByCommonSelectorvue_type_template_id_36584f2f_render,
|
|
74776
|
+
ByCommonSelectorvue_type_template_id_36584f2f_staticRenderFns,
|
|
74753
74777
|
false,
|
|
74754
74778
|
null,
|
|
74755
74779
|
null,
|
package/lib/by-components.umd.js
CHANGED
|
@@ -61102,6 +61102,38 @@ const deepClone = target => {
|
|
|
61102
61102
|
// 返回最终结果
|
|
61103
61103
|
return result;
|
|
61104
61104
|
};
|
|
61105
|
+
|
|
61106
|
+
/**
|
|
61107
|
+
* 比较两个值是否相等,支持字符串和数字类型的自动转换
|
|
61108
|
+
* @param {*} value1 第一个值
|
|
61109
|
+
* @param {*} value2 第二个值
|
|
61110
|
+
* @returns {boolean} 是否相等
|
|
61111
|
+
*/
|
|
61112
|
+
const isValueEqual = (value1, value2) => {
|
|
61113
|
+
// 如果两个值严格相等,直接返回 true
|
|
61114
|
+
if (value1 === value2) {
|
|
61115
|
+
return true;
|
|
61116
|
+
}
|
|
61117
|
+
|
|
61118
|
+
// 处理 0 的特殊情况
|
|
61119
|
+
if (value1 === 0 && value2 === 0) {
|
|
61120
|
+
return true;
|
|
61121
|
+
}
|
|
61122
|
+
|
|
61123
|
+
// 尝试数字转换比较
|
|
61124
|
+
const num1 = Number(value1);
|
|
61125
|
+
const num2 = Number(value2);
|
|
61126
|
+
|
|
61127
|
+
// 如果转换后都是有效数字且相等
|
|
61128
|
+
if (!isNaN(num1) && !isNaN(num2) && num1 === num2) {
|
|
61129
|
+
return true;
|
|
61130
|
+
}
|
|
61131
|
+
|
|
61132
|
+
// 尝试字符串转换比较
|
|
61133
|
+
const str1 = String(value1);
|
|
61134
|
+
const str2 = String(value2);
|
|
61135
|
+
return str1 === str2;
|
|
61136
|
+
};
|
|
61105
61137
|
;// ./src/utils/tableUtils.js
|
|
61106
61138
|
|
|
61107
61139
|
|
|
@@ -63076,8 +63108,8 @@ var custom_date_picker_component = normalizeComponent(
|
|
|
63076
63108
|
)
|
|
63077
63109
|
|
|
63078
63110
|
/* harmony default export */ var custom_date_picker = (custom_date_picker_component.exports);
|
|
63079
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7d802f52-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=
|
|
63080
|
-
var
|
|
63111
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7d802f52-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=36584f2f
|
|
63112
|
+
var ByCommonSelectorvue_type_template_id_36584f2f_render = function render() {
|
|
63081
63113
|
var _vm = this,
|
|
63082
63114
|
_c = _vm._self._c;
|
|
63083
63115
|
return _c('div', {
|
|
@@ -63123,7 +63155,8 @@ var ByCommonSelectorvue_type_template_id_fbdd4830_render = function render() {
|
|
|
63123
63155
|
"collapse-tags": _vm.multiple && _vm.enhancedCollapseTags,
|
|
63124
63156
|
"remote-method": _vm.getResult,
|
|
63125
63157
|
"loading": _vm.loading,
|
|
63126
|
-
"placeholder": _vm.placeholder
|
|
63158
|
+
"placeholder": _vm.placeholder,
|
|
63159
|
+
"disabled": _vm.enhancedDisabled
|
|
63127
63160
|
},
|
|
63128
63161
|
on: {
|
|
63129
63162
|
"change": _vm.selected,
|
|
@@ -63519,7 +63552,7 @@ var ByCommonSelectorvue_type_template_id_fbdd4830_render = function render() {
|
|
|
63519
63552
|
}
|
|
63520
63553
|
}, [_vm._v(" 加载中... ")]) : _vm._e()], 2);
|
|
63521
63554
|
};
|
|
63522
|
-
var
|
|
63555
|
+
var ByCommonSelectorvue_type_template_id_36584f2f_staticRenderFns = [];
|
|
63523
63556
|
|
|
63524
63557
|
;// ./node_modules/pinyin-pro/dist/index.mjs
|
|
63525
63558
|
|
|
@@ -73800,8 +73833,10 @@ function segment(word, options) {
|
|
|
73800
73833
|
|
|
73801
73834
|
|
|
73802
73835
|
|
|
73836
|
+
|
|
73803
73837
|
//拼音库,用于搜索栏生成A~Z字母
|
|
73804
73838
|
|
|
73839
|
+
|
|
73805
73840
|
// 全部选项可能的名称
|
|
73806
73841
|
const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'all'];
|
|
73807
73842
|
/* harmony default export */ var ByCommonSelectorvue_type_script_lang_js = ({
|
|
@@ -74063,7 +74098,9 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74063
74098
|
// enhancedSelect 相关数据
|
|
74064
74099
|
allData: new Map(),
|
|
74065
74100
|
// 缓存所有数据
|
|
74066
|
-
enhancedSelectOpened: false
|
|
74101
|
+
enhancedSelectOpened: false,
|
|
74102
|
+
// 标记 enhancedSelect 是否已经打开过
|
|
74103
|
+
enhancedDisabled: false
|
|
74067
74104
|
};
|
|
74068
74105
|
},
|
|
74069
74106
|
computed: {
|
|
@@ -74086,13 +74123,13 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74086
74123
|
if (this.multiple) {
|
|
74087
74124
|
// 多选情况:value 是数组
|
|
74088
74125
|
if (Array.isArray(this.value) && this.value.length > 0) {
|
|
74089
|
-
const defaultItems = this.enhancedAllOptions.filter(option => this.value.
|
|
74126
|
+
const defaultItems = this.enhancedAllOptions.filter(option => this.value.some(val => isValueEqual(val, option.id)));
|
|
74090
74127
|
return defaultItems;
|
|
74091
74128
|
}
|
|
74092
74129
|
} else {
|
|
74093
74130
|
// 单选情况:value 是单个值
|
|
74094
74131
|
if (this.value !== '') {
|
|
74095
|
-
const defaultItem = this.enhancedAllOptions.find(option =>
|
|
74132
|
+
const defaultItem = this.enhancedAllOptions.find(option => isValueEqual(this.value, option.id));
|
|
74096
74133
|
return defaultItem ? [defaultItem] : [];
|
|
74097
74134
|
}
|
|
74098
74135
|
}
|
|
@@ -74204,15 +74241,17 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74204
74241
|
enhancedAllOptions: {
|
|
74205
74242
|
handler(newOptions) {
|
|
74206
74243
|
if (this.type === 'enhancedSelect') {
|
|
74244
|
+
this.enhancedDisabled = true;
|
|
74207
74245
|
// 验证 enhancedAllOptions 是否已加载
|
|
74208
74246
|
if (!newOptions || newOptions.length === 0) {
|
|
74209
|
-
console.warn('[ByCommonSelector] enhancedSelect 类型需要提供 enhancedAllOptions 属性用于默认值回显')
|
|
74247
|
+
// console.warn('[ByCommonSelector] enhancedSelect 类型需要提供 enhancedAllOptions 属性用于默认值回显')
|
|
74210
74248
|
return;
|
|
74211
74249
|
}
|
|
74212
74250
|
|
|
74213
74251
|
// 当 enhancedAllOptions 加载完成后,重新处理默认值
|
|
74214
74252
|
this.$nextTick(() => {
|
|
74215
74253
|
this.handleEnhancedSelectDefaultValue();
|
|
74254
|
+
this.enhancedDisabled = false;
|
|
74216
74255
|
});
|
|
74217
74256
|
}
|
|
74218
74257
|
},
|
|
@@ -74392,10 +74431,6 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74392
74431
|
this.$nextTick(() => {
|
|
74393
74432
|
this.checkNeedExpand();
|
|
74394
74433
|
this.scheduleExpandCheck();
|
|
74395
|
-
// 异步加载数据后,重新处理默认值(仅 enhancedSelect)
|
|
74396
|
-
if (this.type === 'enhancedSelect') {
|
|
74397
|
-
this.handleEnhancedSelectDefaultValue();
|
|
74398
|
-
}
|
|
74399
74434
|
});
|
|
74400
74435
|
} else {
|
|
74401
74436
|
// console.error('loadOptions函数返回值必须是数组')
|
|
@@ -74577,14 +74612,14 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74577
74612
|
// 修复:优先从 enhancedAllOptions 中查找,确保多选时能正确获取对象数组
|
|
74578
74613
|
if (Array.isArray(value) && value.length > 0) {
|
|
74579
74614
|
// 从 enhancedAllOptions 中查找所有匹配的选项
|
|
74580
|
-
const items = this.enhancedAllOptions.filter(option => value.
|
|
74615
|
+
const items = this.enhancedAllOptions.filter(option => value.some(val => isValueEqual(val, option.id)));
|
|
74581
74616
|
obj = items;
|
|
74582
74617
|
}
|
|
74583
74618
|
} else {
|
|
74584
74619
|
obj = {};
|
|
74585
74620
|
if (value !== undefined && value !== null && value !== '') {
|
|
74586
74621
|
// 优先从 enhancedAllOptions 中查找
|
|
74587
|
-
const item = this.enhancedAllOptions.find(option =>
|
|
74622
|
+
const item = this.enhancedAllOptions.find(option => isValueEqual(value, option.id));
|
|
74588
74623
|
if (item) {
|
|
74589
74624
|
obj[this.enhancedDescriptionKey] = item[this.enhancedDescriptionKey];
|
|
74590
74625
|
obj[this.enhancedTitleKey] = item[this.enhancedTitleKey];
|
|
@@ -74592,7 +74627,7 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74592
74627
|
} else {
|
|
74593
74628
|
// 如果从 enhancedAllOptions 中找不到,再从 dataList 中查找
|
|
74594
74629
|
this.dataList.forEach(item => {
|
|
74595
|
-
if (value
|
|
74630
|
+
if (isValueEqual(value, item.id)) {
|
|
74596
74631
|
obj[this.enhancedDescriptionKey] = item[this.enhancedDescriptionKey];
|
|
74597
74632
|
obj[this.enhancedTitleKey] = item[this.enhancedTitleKey];
|
|
74598
74633
|
obj.id = item.id;
|
|
@@ -74682,7 +74717,6 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74682
74717
|
}
|
|
74683
74718
|
},
|
|
74684
74719
|
emitChange(value) {
|
|
74685
|
-
// console.log('001:触发了-emitChange ==:', value)
|
|
74686
74720
|
this.$emit('input', value);
|
|
74687
74721
|
},
|
|
74688
74722
|
handleSuffixInputChange(value) {
|
|
@@ -74691,37 +74725,27 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74691
74725
|
this.$emit('update:suffixInputValue', value);
|
|
74692
74726
|
},
|
|
74693
74727
|
// ******************** enhancedSelect 相关方法 ********************
|
|
74728
|
+
|
|
74694
74729
|
getResult(q) {
|
|
74695
|
-
// 设置加载状态
|
|
74696
74730
|
this.loading = true;
|
|
74697
|
-
|
|
74698
|
-
// 触发外部搜索事件,让外部控制数据
|
|
74699
74731
|
this.$emit('search', q);
|
|
74700
|
-
|
|
74701
|
-
// 返回 Promise 以满足 remote 的要求
|
|
74702
74732
|
return Promise.resolve();
|
|
74703
74733
|
},
|
|
74734
|
+
// 处理 enhancedSelect 类型的默认值
|
|
74704
74735
|
handleEnhancedSelectDefaultValue() {
|
|
74705
|
-
|
|
74706
|
-
// console.log('002:this.enhancedAllOptions ==:', this.enhancedAllOptions)
|
|
74707
|
-
// 针对 enhancedSelect 类型处理默认值
|
|
74708
|
-
if (this.value !== undefined && this.value !== null && this.value !== '') {
|
|
74736
|
+
if (this.value !== undefined && this.value !== null && this.value !== '' && this.enhancedAllOptions && this.enhancedAllOptions.length > 0) {
|
|
74709
74737
|
// 确保默认值能正确显示
|
|
74710
74738
|
this.selectedValue = this.value;
|
|
74711
74739
|
if (this.multiple) {
|
|
74712
|
-
// 多选情况:value 是数组
|
|
74713
74740
|
if (Array.isArray(this.value) && this.value.length > 0) {
|
|
74714
|
-
|
|
74715
|
-
const items = this.enhancedAllOptions.filter(option => this.value.includes(option.id) || this.value.includes(Number(option.id)) || this.value.includes(0) && option.id === 0);
|
|
74741
|
+
const items = this.enhancedAllOptions.filter(option => this.value.some(val => isValueEqual(val, option.id)));
|
|
74716
74742
|
if (items.length > 0) {
|
|
74717
74743
|
this.$emit('input', this.value);
|
|
74718
74744
|
this.$emit('change', items);
|
|
74719
74745
|
}
|
|
74720
74746
|
}
|
|
74721
74747
|
} else {
|
|
74722
|
-
|
|
74723
|
-
// 在 enhancedAllOptions 数组中查找对应的选项
|
|
74724
|
-
const item = this.enhancedAllOptions.find(option => option.id === this.value || option.id === Number(this.value) || this.value === 0 && option.id === 0);
|
|
74748
|
+
const item = this.enhancedAllOptions.find(option => isValueEqual(this.value, option.id));
|
|
74725
74749
|
if (item) {
|
|
74726
74750
|
let obj = {};
|
|
74727
74751
|
obj[this.enhancedDescriptionKey] = item[this.enhancedDescriptionKey];
|
|
@@ -74758,8 +74782,8 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
|
|
|
74758
74782
|
;
|
|
74759
74783
|
var ByCommonSelector_component = normalizeComponent(
|
|
74760
74784
|
common_selector_ByCommonSelectorvue_type_script_lang_js,
|
|
74761
|
-
|
|
74762
|
-
|
|
74785
|
+
ByCommonSelectorvue_type_template_id_36584f2f_render,
|
|
74786
|
+
ByCommonSelectorvue_type_template_id_36584f2f_staticRenderFns,
|
|
74763
74787
|
false,
|
|
74764
74788
|
null,
|
|
74765
74789
|
null,
|