@weitutech/by-components 1.1.111 → 1.1.112
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 +163 -7
- package/lib/by-components.umd.js +163 -7
- package/lib/by-components.umd.min.js +1 -1
- package/lib/index.css +1 -1
- package/package.json +1 -1
|
@@ -77604,8 +77604,8 @@ ByDialogService.install = function (Vue) {
|
|
|
77604
77604
|
Vue.prototype.$byDialog = ByDialogService;
|
|
77605
77605
|
};
|
|
77606
77606
|
/* harmony default export */ var by_dialog_ByDialogService = (ByDialogService);
|
|
77607
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"ffbc40de-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/cascader-panel/ByCascaderPanel.vue?vue&type=template&id=
|
|
77608
|
-
var
|
|
77607
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"ffbc40de-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/cascader-panel/ByCascaderPanel.vue?vue&type=template&id=0db80f4a
|
|
77608
|
+
var ByCascaderPanelvue_type_template_id_0db80f4a_render = function render() {
|
|
77609
77609
|
var _vm = this,
|
|
77610
77610
|
_c = _vm._self._c;
|
|
77611
77611
|
return _c('div', {
|
|
@@ -77623,6 +77623,8 @@ var ByCascaderPanelvue_type_template_id_68b04ea5_render = function render() {
|
|
|
77623
77623
|
staticStyle: {
|
|
77624
77624
|
"padding-left": "20px"
|
|
77625
77625
|
}
|
|
77626
|
+
}, [_c('div', {
|
|
77627
|
+
staticClass: "search-container"
|
|
77626
77628
|
}, [_c('el-input', {
|
|
77627
77629
|
staticClass: "search-input",
|
|
77628
77630
|
attrs: {
|
|
@@ -77640,7 +77642,71 @@ var ByCascaderPanelvue_type_template_id_68b04ea5_render = function render() {
|
|
|
77640
77642
|
},
|
|
77641
77643
|
expression: "searchInput"
|
|
77642
77644
|
}
|
|
77643
|
-
})
|
|
77645
|
+
}), _vm.isMultiple ? _c('el-popover', {
|
|
77646
|
+
attrs: {
|
|
77647
|
+
"placement": "bottom-start",
|
|
77648
|
+
"width": 300,
|
|
77649
|
+
"trigger": "click",
|
|
77650
|
+
"popper-class": "batch-search-popover"
|
|
77651
|
+
},
|
|
77652
|
+
on: {
|
|
77653
|
+
"show": _vm.handleBatchSearchShow
|
|
77654
|
+
},
|
|
77655
|
+
model: {
|
|
77656
|
+
value: _vm.batchSearchVisible,
|
|
77657
|
+
callback: function ($$v) {
|
|
77658
|
+
_vm.batchSearchVisible = $$v;
|
|
77659
|
+
},
|
|
77660
|
+
expression: "batchSearchVisible"
|
|
77661
|
+
}
|
|
77662
|
+
}, [_c('div', {
|
|
77663
|
+
staticClass: "batch-search-container"
|
|
77664
|
+
}, [_c('div', {
|
|
77665
|
+
staticClass: "popover-title"
|
|
77666
|
+
}, [_vm._v("批量输入")]), _c('el-input', {
|
|
77667
|
+
staticClass: "batch-search-textarea",
|
|
77668
|
+
attrs: {
|
|
77669
|
+
"type": "textarea",
|
|
77670
|
+
"rows": 10,
|
|
77671
|
+
"placeholder": "请输入名称,多个名称用换行、逗号、分号、空格分隔"
|
|
77672
|
+
},
|
|
77673
|
+
model: {
|
|
77674
|
+
value: _vm.batchSearchContent,
|
|
77675
|
+
callback: function ($$v) {
|
|
77676
|
+
_vm.batchSearchContent = $$v;
|
|
77677
|
+
},
|
|
77678
|
+
expression: "batchSearchContent"
|
|
77679
|
+
}
|
|
77680
|
+
}), _c('div', {
|
|
77681
|
+
staticClass: "popover-footer"
|
|
77682
|
+
}, [_c('el-button', {
|
|
77683
|
+
attrs: {
|
|
77684
|
+
"size": "mini"
|
|
77685
|
+
},
|
|
77686
|
+
on: {
|
|
77687
|
+
"click": function ($event) {
|
|
77688
|
+
_vm.batchSearchVisible = false;
|
|
77689
|
+
}
|
|
77690
|
+
}
|
|
77691
|
+
}, [_vm._v("取消")]), _c('el-button', {
|
|
77692
|
+
attrs: {
|
|
77693
|
+
"size": "mini",
|
|
77694
|
+
"type": "primary"
|
|
77695
|
+
},
|
|
77696
|
+
on: {
|
|
77697
|
+
"click": _vm.handleBatchSearch
|
|
77698
|
+
}
|
|
77699
|
+
}, [_vm._v("确定")])], 1)], 1), _c('el-button', {
|
|
77700
|
+
staticClass: "batch-search-btn",
|
|
77701
|
+
attrs: {
|
|
77702
|
+
"slot": "reference",
|
|
77703
|
+
"size": "mini",
|
|
77704
|
+
"type": "text"
|
|
77705
|
+
},
|
|
77706
|
+
slot: "reference"
|
|
77707
|
+
}, [_c('i', {
|
|
77708
|
+
staticClass: "el-icon-edit-outline"
|
|
77709
|
+
})])], 1) : _vm._e()], 1)]), _c('div', {
|
|
77644
77710
|
staticClass: "menu"
|
|
77645
77711
|
}, [_vm.searchInput === '' && _vm.isMultiple && _vm.showSelectAll ? _c('div', {
|
|
77646
77712
|
staticClass: "all-select",
|
|
@@ -77792,7 +77858,7 @@ var ByCascaderPanelvue_type_template_id_68b04ea5_render = function render() {
|
|
|
77792
77858
|
staticClass: "empty-state"
|
|
77793
77859
|
}, [_vm._v("暂无选中项")]) : _vm._e()], 2)])])])]);
|
|
77794
77860
|
};
|
|
77795
|
-
var
|
|
77861
|
+
var ByCascaderPanelvue_type_template_id_0db80f4a_staticRenderFns = [];
|
|
77796
77862
|
|
|
77797
77863
|
;// ./src/utils/cascaderUtils.js
|
|
77798
77864
|
|
|
@@ -78407,6 +78473,9 @@ class CascaderUtils {
|
|
|
78407
78473
|
|
|
78408
78474
|
|
|
78409
78475
|
|
|
78476
|
+
|
|
78477
|
+
|
|
78478
|
+
|
|
78410
78479
|
/* harmony default export */ var ByCascaderPanelvue_type_script_lang_js = ({
|
|
78411
78480
|
name: 'ByCascaderPanel',
|
|
78412
78481
|
props: {
|
|
@@ -78503,7 +78572,11 @@ class CascaderUtils {
|
|
|
78503
78572
|
totalCount: 0,
|
|
78504
78573
|
selectedCount: 0,
|
|
78505
78574
|
isAllSelected: false,
|
|
78506
|
-
isInternalUpdate: false
|
|
78575
|
+
isInternalUpdate: false,
|
|
78576
|
+
// 防止循环更新的标志
|
|
78577
|
+
batchSearchVisible: false,
|
|
78578
|
+
// 批量搜索弹窗显示状态
|
|
78579
|
+
batchSearchContent: '' // 批量搜索输入内容
|
|
78507
78580
|
};
|
|
78508
78581
|
},
|
|
78509
78582
|
computed: {
|
|
@@ -79060,6 +79133,89 @@ class CascaderUtils {
|
|
|
79060
79133
|
const optionsToSearch = this.filteredOptions.length > 0 ? this.filteredOptions : this.options;
|
|
79061
79134
|
findPath(optionsToSearch, values);
|
|
79062
79135
|
return paths;
|
|
79136
|
+
},
|
|
79137
|
+
// 处理批量搜索弹窗显示
|
|
79138
|
+
handleBatchSearchShow() {
|
|
79139
|
+
// 如果左侧搜索框有输入内容,则清空
|
|
79140
|
+
if (this.searchInput) {
|
|
79141
|
+
this.searchInput = '';
|
|
79142
|
+
this.isShowSearch = false;
|
|
79143
|
+
this.searchOptions = [];
|
|
79144
|
+
}
|
|
79145
|
+
},
|
|
79146
|
+
// 处理批量搜索
|
|
79147
|
+
handleBatchSearch() {
|
|
79148
|
+
if (!this.batchSearchContent.trim()) {
|
|
79149
|
+
this.batchSearchVisible = false;
|
|
79150
|
+
return;
|
|
79151
|
+
}
|
|
79152
|
+
|
|
79153
|
+
// 分割输入内容(支持换行、逗号、分号等分隔符)
|
|
79154
|
+
const inputNames = this.batchSearchContent.split(/[\n,;,;\s]+/).filter(item => item.trim()).map(item => item.trim());
|
|
79155
|
+
if (inputNames.length === 0) {
|
|
79156
|
+
this.batchSearchVisible = false;
|
|
79157
|
+
return;
|
|
79158
|
+
}
|
|
79159
|
+
|
|
79160
|
+
// 在级联数据中搜索匹配的名称
|
|
79161
|
+
const matchedPaths = this.searchNamesInCascader(inputNames);
|
|
79162
|
+
if (matchedPaths.length > 0) {
|
|
79163
|
+
// 将匹配的路径添加到选中值中
|
|
79164
|
+
const newSelectedValues = [...this.selectedValues];
|
|
79165
|
+
matchedPaths.forEach(path => {
|
|
79166
|
+
// 检查是否已经存在,避免重复添加
|
|
79167
|
+
const exists = newSelectedValues.some(existingPath => existingPath.length === path.length && existingPath.every((value, index) => value === path[index]));
|
|
79168
|
+
if (!exists) {
|
|
79169
|
+
newSelectedValues.push(path);
|
|
79170
|
+
}
|
|
79171
|
+
});
|
|
79172
|
+
this.selectedValues = newSelectedValues;
|
|
79173
|
+
this.updateSelectedItems();
|
|
79174
|
+
|
|
79175
|
+
// 发出事件
|
|
79176
|
+
this.$nextTick(() => {
|
|
79177
|
+
this.isInternalUpdate = true; // 标记为内部更新
|
|
79178
|
+
let emitValue = this.currentValue;
|
|
79179
|
+
|
|
79180
|
+
// 聚合模式下,发出聚合后的值
|
|
79181
|
+
if (this.aggregationMode) {
|
|
79182
|
+
emitValue = CascaderUtils.getAggregatedSelectedValues(this.selectedValues, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
|
|
79183
|
+
if (!this.isMultiple && emitValue.length > 0) {
|
|
79184
|
+
emitValue = emitValue[0]; // 单选模式下返回单个值
|
|
79185
|
+
}
|
|
79186
|
+
}
|
|
79187
|
+
this.$emit('input', emitValue);
|
|
79188
|
+
});
|
|
79189
|
+
}
|
|
79190
|
+
|
|
79191
|
+
// 关闭弹窗并清空内容
|
|
79192
|
+
this.batchSearchVisible = false;
|
|
79193
|
+
this.batchSearchContent = '';
|
|
79194
|
+
},
|
|
79195
|
+
// 在级联数据中搜索匹配的名称
|
|
79196
|
+
searchNamesInCascader(names) {
|
|
79197
|
+
const matchedPaths = [];
|
|
79198
|
+
const labelKey = this.cascaderProps.label || 'label';
|
|
79199
|
+
const searchInOptions = (options, currentPath = []) => {
|
|
79200
|
+
for (const option of options) {
|
|
79201
|
+
const newPath = [...currentPath, option[this.cascaderProps.value]];
|
|
79202
|
+
const optionLabel = String(option[labelKey] || '');
|
|
79203
|
+
|
|
79204
|
+
// 检查是否匹配任何输入的名称
|
|
79205
|
+
const isMatched = names.some(name => optionLabel.toLowerCase().includes(name.toLowerCase()));
|
|
79206
|
+
if (isMatched && !option[this.cascaderProps.children]) {
|
|
79207
|
+
// 如果是叶子节点且匹配,添加到结果中
|
|
79208
|
+
matchedPaths.push(newPath);
|
|
79209
|
+
}
|
|
79210
|
+
|
|
79211
|
+
// 递归搜索子节点
|
|
79212
|
+
if (option[this.cascaderProps.children] && option[this.cascaderProps.children].length > 0) {
|
|
79213
|
+
searchInOptions(option[this.cascaderProps.children], newPath);
|
|
79214
|
+
}
|
|
79215
|
+
}
|
|
79216
|
+
};
|
|
79217
|
+
searchInOptions(this.filteredOptions);
|
|
79218
|
+
return matchedPaths;
|
|
79063
79219
|
}
|
|
79064
79220
|
}
|
|
79065
79221
|
});
|
|
@@ -79075,8 +79231,8 @@ class CascaderUtils {
|
|
|
79075
79231
|
;
|
|
79076
79232
|
var ByCascaderPanel_component = normalizeComponent(
|
|
79077
79233
|
cascader_panel_ByCascaderPanelvue_type_script_lang_js,
|
|
79078
|
-
|
|
79079
|
-
|
|
79234
|
+
ByCascaderPanelvue_type_template_id_0db80f4a_render,
|
|
79235
|
+
ByCascaderPanelvue_type_template_id_0db80f4a_staticRenderFns,
|
|
79080
79236
|
false,
|
|
79081
79237
|
null,
|
|
79082
79238
|
null,
|
package/lib/by-components.umd.js
CHANGED
|
@@ -77614,8 +77614,8 @@ ByDialogService.install = function (Vue) {
|
|
|
77614
77614
|
Vue.prototype.$byDialog = ByDialogService;
|
|
77615
77615
|
};
|
|
77616
77616
|
/* harmony default export */ var by_dialog_ByDialogService = (ByDialogService);
|
|
77617
|
-
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"ffbc40de-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/cascader-panel/ByCascaderPanel.vue?vue&type=template&id=
|
|
77618
|
-
var
|
|
77617
|
+
;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"ffbc40de-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/cascader-panel/ByCascaderPanel.vue?vue&type=template&id=0db80f4a
|
|
77618
|
+
var ByCascaderPanelvue_type_template_id_0db80f4a_render = function render() {
|
|
77619
77619
|
var _vm = this,
|
|
77620
77620
|
_c = _vm._self._c;
|
|
77621
77621
|
return _c('div', {
|
|
@@ -77633,6 +77633,8 @@ var ByCascaderPanelvue_type_template_id_68b04ea5_render = function render() {
|
|
|
77633
77633
|
staticStyle: {
|
|
77634
77634
|
"padding-left": "20px"
|
|
77635
77635
|
}
|
|
77636
|
+
}, [_c('div', {
|
|
77637
|
+
staticClass: "search-container"
|
|
77636
77638
|
}, [_c('el-input', {
|
|
77637
77639
|
staticClass: "search-input",
|
|
77638
77640
|
attrs: {
|
|
@@ -77650,7 +77652,71 @@ var ByCascaderPanelvue_type_template_id_68b04ea5_render = function render() {
|
|
|
77650
77652
|
},
|
|
77651
77653
|
expression: "searchInput"
|
|
77652
77654
|
}
|
|
77653
|
-
})
|
|
77655
|
+
}), _vm.isMultiple ? _c('el-popover', {
|
|
77656
|
+
attrs: {
|
|
77657
|
+
"placement": "bottom-start",
|
|
77658
|
+
"width": 300,
|
|
77659
|
+
"trigger": "click",
|
|
77660
|
+
"popper-class": "batch-search-popover"
|
|
77661
|
+
},
|
|
77662
|
+
on: {
|
|
77663
|
+
"show": _vm.handleBatchSearchShow
|
|
77664
|
+
},
|
|
77665
|
+
model: {
|
|
77666
|
+
value: _vm.batchSearchVisible,
|
|
77667
|
+
callback: function ($$v) {
|
|
77668
|
+
_vm.batchSearchVisible = $$v;
|
|
77669
|
+
},
|
|
77670
|
+
expression: "batchSearchVisible"
|
|
77671
|
+
}
|
|
77672
|
+
}, [_c('div', {
|
|
77673
|
+
staticClass: "batch-search-container"
|
|
77674
|
+
}, [_c('div', {
|
|
77675
|
+
staticClass: "popover-title"
|
|
77676
|
+
}, [_vm._v("批量输入")]), _c('el-input', {
|
|
77677
|
+
staticClass: "batch-search-textarea",
|
|
77678
|
+
attrs: {
|
|
77679
|
+
"type": "textarea",
|
|
77680
|
+
"rows": 10,
|
|
77681
|
+
"placeholder": "请输入名称,多个名称用换行、逗号、分号、空格分隔"
|
|
77682
|
+
},
|
|
77683
|
+
model: {
|
|
77684
|
+
value: _vm.batchSearchContent,
|
|
77685
|
+
callback: function ($$v) {
|
|
77686
|
+
_vm.batchSearchContent = $$v;
|
|
77687
|
+
},
|
|
77688
|
+
expression: "batchSearchContent"
|
|
77689
|
+
}
|
|
77690
|
+
}), _c('div', {
|
|
77691
|
+
staticClass: "popover-footer"
|
|
77692
|
+
}, [_c('el-button', {
|
|
77693
|
+
attrs: {
|
|
77694
|
+
"size": "mini"
|
|
77695
|
+
},
|
|
77696
|
+
on: {
|
|
77697
|
+
"click": function ($event) {
|
|
77698
|
+
_vm.batchSearchVisible = false;
|
|
77699
|
+
}
|
|
77700
|
+
}
|
|
77701
|
+
}, [_vm._v("取消")]), _c('el-button', {
|
|
77702
|
+
attrs: {
|
|
77703
|
+
"size": "mini",
|
|
77704
|
+
"type": "primary"
|
|
77705
|
+
},
|
|
77706
|
+
on: {
|
|
77707
|
+
"click": _vm.handleBatchSearch
|
|
77708
|
+
}
|
|
77709
|
+
}, [_vm._v("确定")])], 1)], 1), _c('el-button', {
|
|
77710
|
+
staticClass: "batch-search-btn",
|
|
77711
|
+
attrs: {
|
|
77712
|
+
"slot": "reference",
|
|
77713
|
+
"size": "mini",
|
|
77714
|
+
"type": "text"
|
|
77715
|
+
},
|
|
77716
|
+
slot: "reference"
|
|
77717
|
+
}, [_c('i', {
|
|
77718
|
+
staticClass: "el-icon-edit-outline"
|
|
77719
|
+
})])], 1) : _vm._e()], 1)]), _c('div', {
|
|
77654
77720
|
staticClass: "menu"
|
|
77655
77721
|
}, [_vm.searchInput === '' && _vm.isMultiple && _vm.showSelectAll ? _c('div', {
|
|
77656
77722
|
staticClass: "all-select",
|
|
@@ -77802,7 +77868,7 @@ var ByCascaderPanelvue_type_template_id_68b04ea5_render = function render() {
|
|
|
77802
77868
|
staticClass: "empty-state"
|
|
77803
77869
|
}, [_vm._v("暂无选中项")]) : _vm._e()], 2)])])])]);
|
|
77804
77870
|
};
|
|
77805
|
-
var
|
|
77871
|
+
var ByCascaderPanelvue_type_template_id_0db80f4a_staticRenderFns = [];
|
|
77806
77872
|
|
|
77807
77873
|
;// ./src/utils/cascaderUtils.js
|
|
77808
77874
|
|
|
@@ -78417,6 +78483,9 @@ class CascaderUtils {
|
|
|
78417
78483
|
|
|
78418
78484
|
|
|
78419
78485
|
|
|
78486
|
+
|
|
78487
|
+
|
|
78488
|
+
|
|
78420
78489
|
/* harmony default export */ var ByCascaderPanelvue_type_script_lang_js = ({
|
|
78421
78490
|
name: 'ByCascaderPanel',
|
|
78422
78491
|
props: {
|
|
@@ -78513,7 +78582,11 @@ class CascaderUtils {
|
|
|
78513
78582
|
totalCount: 0,
|
|
78514
78583
|
selectedCount: 0,
|
|
78515
78584
|
isAllSelected: false,
|
|
78516
|
-
isInternalUpdate: false
|
|
78585
|
+
isInternalUpdate: false,
|
|
78586
|
+
// 防止循环更新的标志
|
|
78587
|
+
batchSearchVisible: false,
|
|
78588
|
+
// 批量搜索弹窗显示状态
|
|
78589
|
+
batchSearchContent: '' // 批量搜索输入内容
|
|
78517
78590
|
};
|
|
78518
78591
|
},
|
|
78519
78592
|
computed: {
|
|
@@ -79070,6 +79143,89 @@ class CascaderUtils {
|
|
|
79070
79143
|
const optionsToSearch = this.filteredOptions.length > 0 ? this.filteredOptions : this.options;
|
|
79071
79144
|
findPath(optionsToSearch, values);
|
|
79072
79145
|
return paths;
|
|
79146
|
+
},
|
|
79147
|
+
// 处理批量搜索弹窗显示
|
|
79148
|
+
handleBatchSearchShow() {
|
|
79149
|
+
// 如果左侧搜索框有输入内容,则清空
|
|
79150
|
+
if (this.searchInput) {
|
|
79151
|
+
this.searchInput = '';
|
|
79152
|
+
this.isShowSearch = false;
|
|
79153
|
+
this.searchOptions = [];
|
|
79154
|
+
}
|
|
79155
|
+
},
|
|
79156
|
+
// 处理批量搜索
|
|
79157
|
+
handleBatchSearch() {
|
|
79158
|
+
if (!this.batchSearchContent.trim()) {
|
|
79159
|
+
this.batchSearchVisible = false;
|
|
79160
|
+
return;
|
|
79161
|
+
}
|
|
79162
|
+
|
|
79163
|
+
// 分割输入内容(支持换行、逗号、分号等分隔符)
|
|
79164
|
+
const inputNames = this.batchSearchContent.split(/[\n,;,;\s]+/).filter(item => item.trim()).map(item => item.trim());
|
|
79165
|
+
if (inputNames.length === 0) {
|
|
79166
|
+
this.batchSearchVisible = false;
|
|
79167
|
+
return;
|
|
79168
|
+
}
|
|
79169
|
+
|
|
79170
|
+
// 在级联数据中搜索匹配的名称
|
|
79171
|
+
const matchedPaths = this.searchNamesInCascader(inputNames);
|
|
79172
|
+
if (matchedPaths.length > 0) {
|
|
79173
|
+
// 将匹配的路径添加到选中值中
|
|
79174
|
+
const newSelectedValues = [...this.selectedValues];
|
|
79175
|
+
matchedPaths.forEach(path => {
|
|
79176
|
+
// 检查是否已经存在,避免重复添加
|
|
79177
|
+
const exists = newSelectedValues.some(existingPath => existingPath.length === path.length && existingPath.every((value, index) => value === path[index]));
|
|
79178
|
+
if (!exists) {
|
|
79179
|
+
newSelectedValues.push(path);
|
|
79180
|
+
}
|
|
79181
|
+
});
|
|
79182
|
+
this.selectedValues = newSelectedValues;
|
|
79183
|
+
this.updateSelectedItems();
|
|
79184
|
+
|
|
79185
|
+
// 发出事件
|
|
79186
|
+
this.$nextTick(() => {
|
|
79187
|
+
this.isInternalUpdate = true; // 标记为内部更新
|
|
79188
|
+
let emitValue = this.currentValue;
|
|
79189
|
+
|
|
79190
|
+
// 聚合模式下,发出聚合后的值
|
|
79191
|
+
if (this.aggregationMode) {
|
|
79192
|
+
emitValue = CascaderUtils.getAggregatedSelectedValues(this.selectedValues, this.filteredOptions, this.cascaderProps, this.parentNodePrefix);
|
|
79193
|
+
if (!this.isMultiple && emitValue.length > 0) {
|
|
79194
|
+
emitValue = emitValue[0]; // 单选模式下返回单个值
|
|
79195
|
+
}
|
|
79196
|
+
}
|
|
79197
|
+
this.$emit('input', emitValue);
|
|
79198
|
+
});
|
|
79199
|
+
}
|
|
79200
|
+
|
|
79201
|
+
// 关闭弹窗并清空内容
|
|
79202
|
+
this.batchSearchVisible = false;
|
|
79203
|
+
this.batchSearchContent = '';
|
|
79204
|
+
},
|
|
79205
|
+
// 在级联数据中搜索匹配的名称
|
|
79206
|
+
searchNamesInCascader(names) {
|
|
79207
|
+
const matchedPaths = [];
|
|
79208
|
+
const labelKey = this.cascaderProps.label || 'label';
|
|
79209
|
+
const searchInOptions = (options, currentPath = []) => {
|
|
79210
|
+
for (const option of options) {
|
|
79211
|
+
const newPath = [...currentPath, option[this.cascaderProps.value]];
|
|
79212
|
+
const optionLabel = String(option[labelKey] || '');
|
|
79213
|
+
|
|
79214
|
+
// 检查是否匹配任何输入的名称
|
|
79215
|
+
const isMatched = names.some(name => optionLabel.toLowerCase().includes(name.toLowerCase()));
|
|
79216
|
+
if (isMatched && !option[this.cascaderProps.children]) {
|
|
79217
|
+
// 如果是叶子节点且匹配,添加到结果中
|
|
79218
|
+
matchedPaths.push(newPath);
|
|
79219
|
+
}
|
|
79220
|
+
|
|
79221
|
+
// 递归搜索子节点
|
|
79222
|
+
if (option[this.cascaderProps.children] && option[this.cascaderProps.children].length > 0) {
|
|
79223
|
+
searchInOptions(option[this.cascaderProps.children], newPath);
|
|
79224
|
+
}
|
|
79225
|
+
}
|
|
79226
|
+
};
|
|
79227
|
+
searchInOptions(this.filteredOptions);
|
|
79228
|
+
return matchedPaths;
|
|
79073
79229
|
}
|
|
79074
79230
|
}
|
|
79075
79231
|
});
|
|
@@ -79085,8 +79241,8 @@ class CascaderUtils {
|
|
|
79085
79241
|
;
|
|
79086
79242
|
var ByCascaderPanel_component = normalizeComponent(
|
|
79087
79243
|
cascader_panel_ByCascaderPanelvue_type_script_lang_js,
|
|
79088
|
-
|
|
79089
|
-
|
|
79244
|
+
ByCascaderPanelvue_type_template_id_0db80f4a_render,
|
|
79245
|
+
ByCascaderPanelvue_type_template_id_0db80f4a_staticRenderFns,
|
|
79090
79246
|
false,
|
|
79091
79247
|
null,
|
|
79092
79248
|
null,
|