@weitutech/by-components 1.2.32 → 1.2.34

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.
@@ -94768,8 +94768,8 @@ ByDialogService.install = function (Vue) {
94768
94768
  Vue.prototype.$byDialog = ByDialogService;
94769
94769
  };
94770
94770
  /* harmony default export */ var by_dialog_ByDialogService = (ByDialogService);
94771
- ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"185687ec-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=727f392c
94772
- var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
94771
+ ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"185687ec-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=1f03b3c0
94772
+ var ByCascaderPanelvue_type_template_id_1f03b3c0_render = function render() {
94773
94773
  var _vm = this,
94774
94774
  _c = _vm._self._c;
94775
94775
  return _c('div', {
@@ -94788,7 +94788,10 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
94788
94788
  }, [_vm._v("可选(" + _vm._s(_vm.selectedCount) + "/" + _vm._s(_vm.totalCount) + ")")]) : _vm._e(), _c('div', {
94789
94789
  staticClass: "search-section"
94790
94790
  }, [_c('div', {
94791
- staticClass: "search-container"
94791
+ staticClass: "search-container",
94792
+ class: {
94793
+ 'has-dropdown-filter': _vm.showDropdownFilter
94794
+ }
94792
94795
  }, [_c('div', {
94793
94796
  staticClass: "search-input-wrap",
94794
94797
  class: {
@@ -94887,7 +94890,37 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
94887
94890
  slot: "reference"
94888
94891
  }, [_c('i', {
94889
94892
  staticClass: "el-icon-edit-outline"
94890
- })])], 1)], 1) : _vm._e()], 1), _vm.showRefreshBtn ? _c('el-tooltip', {
94893
+ })])], 1)], 1) : _vm._e()], 1), _vm.showDropdownFilter ? _c('div', {
94894
+ staticClass: "dropdown-filter-group"
94895
+ }, [_vm.dropdownFilterTitle ? _c('span', {
94896
+ staticClass: "dropdown-filter-title"
94897
+ }, [_vm._v(_vm._s(_vm.dropdownFilterTitle) + ":")]) : _vm._e(), _c('el-select', {
94898
+ staticClass: "dropdown-filter-select",
94899
+ attrs: {
94900
+ "placeholder": _vm.dropdownFilterPlaceholder,
94901
+ "clearable": "",
94902
+ "size": "mini",
94903
+ "disabled": _vm.panelViewMode
94904
+ },
94905
+ on: {
94906
+ "change": _vm.handleDropdownFilterChange
94907
+ },
94908
+ model: {
94909
+ value: _vm.dropdownFilterValue,
94910
+ callback: function ($$v) {
94911
+ _vm.dropdownFilterValue = $$v;
94912
+ },
94913
+ expression: "dropdownFilterValue"
94914
+ }
94915
+ }, _vm._l(_vm.normalizedDropdownFilterOptions, function (opt) {
94916
+ return _c('el-option', {
94917
+ key: 'df-' + opt.value,
94918
+ attrs: {
94919
+ "label": opt.label,
94920
+ "value": opt.value
94921
+ }
94922
+ });
94923
+ }), 1)], 1) : _vm._e(), _vm.showRefreshBtn ? _c('el-tooltip', {
94891
94924
  attrs: {
94892
94925
  "content": _vm.refreshTooltip,
94893
94926
  "placement": "top",
@@ -94929,8 +94962,8 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
94929
94962
  directives: [{
94930
94963
  name: "show",
94931
94964
  rawName: "v-show",
94932
- value: _vm.searchInput === '' || !_vm.isShowSearch,
94933
- expression: "searchInput === '' || !isShowSearch"
94965
+ value: !_vm.isFilterView,
94966
+ expression: "!isFilterView"
94934
94967
  }],
94935
94968
  ref: "cascaderPanel",
94936
94969
  staticClass: "cascader-panel-inner",
@@ -94946,6 +94979,17 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
94946
94979
  "expand-change": _vm.handleExpandChange,
94947
94980
  "change": _vm.handleValueChange
94948
94981
  },
94982
+ scopedSlots: _vm._u([{
94983
+ key: "default",
94984
+ fn: function ({
94985
+ node,
94986
+ data
94987
+ }) {
94988
+ return [_vm._v(" " + _vm._s(node.label)), _vm.showDropdownFilter && _vm.getNodeFilterFieldText(data) ? _c('span', {
94989
+ staticClass: "node-filter-field"
94990
+ }, [_vm._v(_vm._s(_vm.getNodeFilterFieldText(data)))]) : _vm._e()];
94991
+ }
94992
+ }], null, false, 181072543),
94949
94993
  model: {
94950
94994
  value: _vm.mainPanelValue,
94951
94995
  callback: function ($$v) {
@@ -94953,12 +94997,12 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
94953
94997
  },
94954
94998
  expression: "mainPanelValue"
94955
94999
  }
94956
- }) : _vm._e(), _vm.searchOptions.length > 0 ? _c('el-cascader-panel', {
95000
+ }) : _vm._e(), _vm.viewOptions.length > 0 ? _c('el-cascader-panel', {
94957
95001
  directives: [{
94958
95002
  name: "show",
94959
95003
  rawName: "v-show",
94960
- value: _vm.searchInput !== '' && _vm.isShowSearch,
94961
- expression: "searchInput !== '' && isShowSearch"
95004
+ value: _vm.isFilterView,
95005
+ expression: "isFilterView"
94962
95006
  }],
94963
95007
  ref: "searchCascaderPanel",
94964
95008
  staticClass: "cascader-panel-inner",
@@ -94967,13 +95011,24 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
94967
95011
  },
94968
95012
  attrs: {
94969
95013
  "append-to-body": false,
94970
- "options": _vm.searchOptions,
95014
+ "options": _vm.viewOptions,
94971
95015
  "props": _vm.cascaderProps
94972
95016
  },
94973
95017
  on: {
94974
95018
  "expand-change": _vm.handleExpandChange,
94975
95019
  "change": _vm.handleSearchValueChange
94976
95020
  },
95021
+ scopedSlots: _vm._u([{
95022
+ key: "default",
95023
+ fn: function ({
95024
+ node,
95025
+ data
95026
+ }) {
95027
+ return [_vm._v(" " + _vm._s(node.label)), _vm.showDropdownFilter && _vm.getNodeFilterFieldText(data) ? _c('span', {
95028
+ staticClass: "node-filter-field"
95029
+ }, [_vm._v(_vm._s(_vm.getNodeFilterFieldText(data)))]) : _vm._e()];
95030
+ }
95031
+ }], null, false, 181072543),
94977
95032
  model: {
94978
95033
  value: _vm.searchPanelValue,
94979
95034
  callback: function ($$v) {
@@ -94981,13 +95036,7 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
94981
95036
  },
94982
95037
  expression: "searchPanelValue"
94983
95038
  }
94984
- }) : _vm._e(), _vm.isShowSearch && _vm.searchOptions.length === 0 ? _c('div', {
94985
- directives: [{
94986
- name: "show",
94987
- rawName: "v-show",
94988
- value: _vm.searchInput !== '',
94989
- expression: "searchInput !== ''"
94990
- }],
95039
+ }) : _vm._e(), _vm.isFilterView && _vm.viewOptions.length === 0 ? _c('div', {
94991
95040
  staticClass: "empty-search"
94992
95041
  }, [_c('el-empty', {
94993
95042
  attrs: {
@@ -95044,7 +95093,9 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
95044
95093
  "padding": "0 !important",
95045
95094
  "vertical-align": "middle !important"
95046
95095
  }
95047
- }, [_vm._v(_vm._s(item.label || ''))]), _vm.showSubtitle && _vm.subtitleField && item[_vm.subtitleField] ? _c('div', {
95096
+ }, [_vm._v(_vm._s(item.label || ''))]), _vm.showDropdownFilter && _vm.getNodeFilterFieldText(item) ? _c('span', {
95097
+ staticClass: "item-filter-field"
95098
+ }, [_vm._v(_vm._s(_vm.getNodeFilterFieldText(item)))]) : _vm._e(), _vm.showSubtitle && _vm.subtitleField && item[_vm.subtitleField] ? _c('div', {
95048
95099
  staticClass: "item-subtitle",
95049
95100
  staticStyle: {
95050
95101
  "line-height": "1 !important",
@@ -95069,7 +95120,7 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
95069
95120
  staticClass: "empty-state"
95070
95121
  }, [_vm._v("暂无选中项")]) : _vm._e()], 2)])])])]);
95071
95122
  };
95072
- var ByCascaderPanelvue_type_template_id_727f392c_staticRenderFns = [];
95123
+ var ByCascaderPanelvue_type_template_id_1f03b3c0_staticRenderFns = [];
95073
95124
 
95074
95125
  ;// ./src/utils/cascaderUtils.js
95075
95126
 
@@ -95241,6 +95292,58 @@ class CascaderUtils {
95241
95292
  return result;
95242
95293
  }
95243
95294
 
95295
+ /**
95296
+ * 判断节点指定字段是否匹配下拉筛选值
95297
+ * @param {Object} node
95298
+ * @param {String} field
95299
+ * @param {*} filterValue
95300
+ * @returns {Boolean}
95301
+ */
95302
+ static isFilterFieldMatched(node, field, filterValue) {
95303
+ if (!node || !field || filterValue === null || filterValue === undefined || filterValue === '') {
95304
+ return false;
95305
+ }
95306
+ const raw = node[field];
95307
+ if (raw === null || raw === undefined || raw === '') {
95308
+ return false;
95309
+ }
95310
+ return String(raw).trim() === String(filterValue).trim();
95311
+ }
95312
+
95313
+ /**
95314
+ * 按数据字段过滤树:保留字段匹配的节点及其祖先路径
95315
+ * @param {Array} tree - 树形数据
95316
+ * @param {String} field - 数据中用于筛选的字段名
95317
+ * @param {*} filterValue - 下拉选中值
95318
+ * @param {Object} cascaderProps - 级联配置
95319
+ * @returns {Array} 过滤后的树
95320
+ */
95321
+ static filterTreeByField(tree, field, filterValue, cascaderProps) {
95322
+ if (!Array.isArray(tree) || !field || filterValue === null || filterValue === undefined || filterValue === '') {
95323
+ return tree || [];
95324
+ }
95325
+ const childrenKey = cascaderProps && cascaderProps.children || 'children';
95326
+ const result = [];
95327
+ tree.forEach(node => {
95328
+ const children = node[childrenKey];
95329
+ const hasChildren = Array.isArray(children) && children.length > 0;
95330
+ if (hasChildren) {
95331
+ const matchedChildren = this.filterTreeByField(children, field, filterValue, cascaderProps);
95332
+ if (matchedChildren.length > 0) {
95333
+ result.push({
95334
+ ...node,
95335
+ [childrenKey]: matchedChildren
95336
+ });
95337
+ }
95338
+ } else if (this.isFilterFieldMatched(node, field, filterValue)) {
95339
+ result.push({
95340
+ ...node
95341
+ });
95342
+ }
95343
+ });
95344
+ return result;
95345
+ }
95346
+
95244
95347
  /**
95245
95348
  * 获取叶子节点的值
95246
95349
  * @param {Array} tree - 树形数据
@@ -95692,6 +95795,13 @@ class CascaderUtils {
95692
95795
 
95693
95796
 
95694
95797
 
95798
+
95799
+
95800
+
95801
+
95802
+
95803
+
95804
+
95695
95805
  /* harmony default export */ var ByCascaderPanelvue_type_script_lang_js = ({
95696
95806
  name: 'ByCascaderPanel',
95697
95807
  props: {
@@ -95806,6 +95916,15 @@ class CascaderUtils {
95806
95916
  refreshing: {
95807
95917
  type: Boolean,
95808
95918
  default: false
95919
+ },
95920
+ /**
95921
+ * 下拉筛选配置。外部传入且 enabled 不为 false、并指定 field 时才展示下拉框。
95922
+ * { enabled, title, placeholder, options: [{ label, value }], field }
95923
+ * field 为数据中用于过滤和展示的字段名。
95924
+ */
95925
+ dropdownFilter: {
95926
+ type: Object,
95927
+ default: null
95809
95928
  }
95810
95929
  },
95811
95930
  data() {
@@ -95825,7 +95944,9 @@ class CascaderUtils {
95825
95944
  // 防止循环更新的标志
95826
95945
  batchSearchVisible: false,
95827
95946
  // 批量搜索弹窗显示状态
95828
- batchSearchContent: '' // 批量搜索输入内容
95947
+ batchSearchContent: '',
95948
+ // 批量搜索输入内容
95949
+ dropdownFilterValue: '' // 下拉筛选当前值,未开启时不使用
95829
95950
  };
95830
95951
  },
95831
95952
  computed: {
@@ -95898,6 +96019,61 @@ class CascaderUtils {
95898
96019
  this.searchSelectedValues = value ? [value] : [];
95899
96020
  }
95900
96021
  }
96022
+ },
96023
+ // 是否展示下拉筛选(外部有配置且指定了数据字段才展示)
96024
+ showDropdownFilter() {
96025
+ const cfg = this.dropdownFilter;
96026
+ return !!(cfg && typeof cfg === 'object' && cfg.enabled !== false && cfg.field);
96027
+ },
96028
+ dropdownFilterPlaceholder() {
96029
+ return this.dropdownFilter && this.dropdownFilter.placeholder || '请选择';
96030
+ },
96031
+ dropdownFilterTitle() {
96032
+ const title = this.dropdownFilter && this.dropdownFilter.title;
96033
+ return title != null && String(title).trim() !== '' ? String(title).trim() : '';
96034
+ },
96035
+ dropdownFilterField() {
96036
+ return this.dropdownFilter && this.dropdownFilter.field || '';
96037
+ },
96038
+ normalizedDropdownFilterOptions() {
96039
+ const opts = this.dropdownFilter && this.dropdownFilter.options || [];
96040
+ return opts.map(opt => {
96041
+ if (opt != null && typeof opt === 'object') {
96042
+ return {
96043
+ label: opt.label != null ? opt.label : opt.value,
96044
+ value: opt.value != null ? opt.value : opt.label
96045
+ };
96046
+ }
96047
+ return {
96048
+ label: String(opt),
96049
+ value: opt
96050
+ };
96051
+ });
96052
+ },
96053
+ hasActiveDropdownFilter() {
96054
+ return this.showDropdownFilter && this.dropdownFilterValue !== '' && this.dropdownFilterValue !== null && this.dropdownFilterValue !== undefined;
96055
+ },
96056
+ // 下拉筛选后的展示树;未筛选时等于完整 processed 树,保证原有逻辑不变
96057
+ displayOptions() {
96058
+ if (!this.hasActiveDropdownFilter) {
96059
+ return this.filteredOptions;
96060
+ }
96061
+ return CascaderUtils.filterTreeByField(this.filteredOptions, this.dropdownFilterField, this.dropdownFilterValue, this.cascaderProps);
96062
+ },
96063
+ isFilterView() {
96064
+ if (this.searchInput !== '' && this.isShowSearch) {
96065
+ return true;
96066
+ }
96067
+ return this.hasActiveDropdownFilter;
96068
+ },
96069
+ viewOptions() {
96070
+ if (this.searchInput !== '' && this.isShowSearch) {
96071
+ return this.searchOptions;
96072
+ }
96073
+ if (this.hasActiveDropdownFilter) {
96074
+ return this.displayOptions;
96075
+ }
96076
+ return [];
95901
96077
  }
95902
96078
  },
95903
96079
  watch: {
@@ -95937,6 +96113,9 @@ class CascaderUtils {
95937
96113
  // 普通模式下的全选判断
95938
96114
  this.isAllSelected = this.selectedCount === this.totalCount;
95939
96115
  }
96116
+ if (this.hasActiveDropdownFilter) {
96117
+ this.updateFilterAllSelectedState();
96118
+ }
95940
96119
  } else {
95941
96120
  // 单选模式:最多只能有一个选中项
95942
96121
  if (newVal.length > 1) {
@@ -95953,6 +96132,11 @@ class CascaderUtils {
95953
96132
  if (val) {
95954
96133
  this.batchSearchVisible = false;
95955
96134
  }
96135
+ },
96136
+ showDropdownFilter(val) {
96137
+ if (!val) {
96138
+ this.dropdownFilterValue = '';
96139
+ }
95956
96140
  }
95957
96141
  },
95958
96142
  mounted() {
@@ -96024,6 +96208,11 @@ class CascaderUtils {
96024
96208
  this.filteredOptions = this.processOptions(this.options);
96025
96209
  this.countTotalItems();
96026
96210
  this.updateSelectedItems();
96211
+ if (this.searchInput) {
96212
+ this.handleSearch();
96213
+ } else if (this.hasActiveDropdownFilter) {
96214
+ this.syncFilterViewSelection();
96215
+ }
96027
96216
  },
96028
96217
  // 处理选项数据,添加禁用状态
96029
96218
  processOptions(options) {
@@ -96112,10 +96301,14 @@ class CascaderUtils {
96112
96301
  this.searchInput = this.searchInput.trim();
96113
96302
  if (this.searchInput === '') {
96114
96303
  this.isShowSearch = false;
96304
+ this.searchOptions = [];
96305
+ if (this.hasActiveDropdownFilter) {
96306
+ this.syncFilterViewSelection();
96307
+ }
96115
96308
  return;
96116
96309
  }
96117
96310
  this.isShowSearch = false;
96118
- this.searchOptions = CascaderUtils.searchInTree(this.filteredOptions, this.searchInput, this.cascaderProps);
96311
+ this.searchOptions = CascaderUtils.searchInTree(this.displayOptions, this.searchInput, this.cascaderProps);
96119
96312
 
96120
96313
  // 只设置搜索范围内的选中值
96121
96314
  this.searchSelectedValues = CascaderUtils.getSearchSelectedValues(this.selectedValues, this.searchOptions, this.cascaderProps);
@@ -96152,7 +96345,7 @@ class CascaderUtils {
96152
96345
  handleExpandChange(values = []) {
96153
96346
  if (values.length === 1) {
96154
96347
  this.$nextTick(() => {
96155
- const panel = this.$refs.cascaderPanel || this.$refs.searchCascaderPanel;
96348
+ const panel = this.isFilterView ? this.$refs.searchCascaderPanel || this.$refs.cascaderPanel : this.$refs.cascaderPanel || this.$refs.searchCascaderPanel;
96156
96349
  if (panel) {
96157
96350
  const menus = panel.menus;
96158
96351
  const targetNode = menus[0].find(node => node.value == values[0]);
@@ -96192,15 +96385,15 @@ class CascaderUtils {
96192
96385
  this.$emit('input', emitValue);
96193
96386
  });
96194
96387
  },
96195
- // 搜索模式值变化处理
96388
+ // 搜索 / 下拉筛选视图值变化处理
96196
96389
  handleSearchValueChange(value) {
96197
- // 获取搜索面板中所有可能的叶子节点值
96198
- const searchLeafValues = CascaderUtils.getLeafValues(this.searchOptions, this.cascaderProps);
96390
+ // 获取当前筛选/搜索视图中所有可能的叶子节点值
96391
+ const viewLeafValues = CascaderUtils.getLeafValues(this.viewOptions, this.cascaderProps);
96199
96392
  if (this.isMultiple) {
96200
- // 多选模式:从主选择列表中移除搜索范围内的项,然后添加搜索面板中选中的项
96393
+ // 多选模式:从主选择列表中移除视图范围内的项,然后添加视图中选中的项
96201
96394
  this.selectedValues = this.selectedValues.filter(path => {
96202
96395
  const leafValue = path[path.length - 1];
96203
- return !searchLeafValues.includes(leafValue);
96396
+ return !viewLeafValues.includes(leafValue);
96204
96397
  });
96205
96398
  this.selectedValues = [...this.selectedValues, ...this.searchSelectedValues];
96206
96399
  } else {
@@ -96270,15 +96463,26 @@ class CascaderUtils {
96270
96463
  // 单选模式下不支持全选
96271
96464
  return;
96272
96465
  }
96273
- if (this.isAllSelected) {
96466
+ const config = {
96467
+ disabledField: this.disabledField,
96468
+ disabledValue: this.disabledValue,
96469
+ disabledCheck: this.disabledCheck
96470
+ };
96471
+ if (this.hasActiveDropdownFilter) {
96472
+ const viewPaths = CascaderUtils.getAllLeafPaths(this.displayOptions, config, this.cascaderProps);
96473
+ const viewLeafSet = new Set(viewPaths.map(path => path[path.length - 1]));
96474
+ if (this.isAllSelected) {
96475
+ this.selectedValues = this.selectedValues.filter(path => !viewLeafSet.has(path[path.length - 1]));
96476
+ } else {
96477
+ const preserved = this.selectedValues.filter(path => !viewLeafSet.has(path[path.length - 1]));
96478
+ this.selectedValues = [...preserved, ...viewPaths];
96479
+ }
96480
+ this.searchSelectedValues = CascaderUtils.getSearchSelectedValues(this.selectedValues, this.viewOptions, this.cascaderProps);
96481
+ this.updateSelectedItems();
96482
+ } else if (this.isAllSelected) {
96274
96483
  this.selectedValues = [];
96275
96484
  this.selectedItems = [];
96276
96485
  } else {
96277
- const config = {
96278
- disabledField: this.disabledField,
96279
- disabledValue: this.disabledValue,
96280
- disabledCheck: this.disabledCheck
96281
- };
96282
96486
  // 无论是普通模式还是聚合模式,全选时都选择所有可选的叶子节点
96283
96487
  this.selectedValues = CascaderUtils.getAllLeafPaths(this.filteredOptions, config, this.cascaderProps);
96284
96488
  this.updateSelectedItems();
@@ -96431,6 +96635,55 @@ class CascaderUtils {
96431
96635
  }
96432
96636
  this.$emit('refresh');
96433
96637
  },
96638
+ getNodeFilterFieldText(data) {
96639
+ if (!this.showDropdownFilter || !this.dropdownFilterField || !data) {
96640
+ return '';
96641
+ }
96642
+ const raw = data.data && typeof data.data === 'object' ? data.data : data;
96643
+ const val = raw[this.dropdownFilterField];
96644
+ if (val === null || val === undefined || val === '') {
96645
+ return '';
96646
+ }
96647
+ return `(${val})`;
96648
+ },
96649
+ updateFilterAllSelectedState() {
96650
+ if (!this.hasActiveDropdownFilter) {
96651
+ return;
96652
+ }
96653
+ const config = {
96654
+ disabledField: this.disabledField,
96655
+ disabledValue: this.disabledValue,
96656
+ disabledCheck: this.disabledCheck
96657
+ };
96658
+ const viewPaths = CascaderUtils.getAllLeafPaths(this.displayOptions, config, this.cascaderProps);
96659
+ if (viewPaths.length === 0) {
96660
+ this.isAllSelected = false;
96661
+ return;
96662
+ }
96663
+ const selectedLeafSet = new Set(this.selectedValues.map(path => path[path.length - 1]));
96664
+ this.isAllSelected = viewPaths.every(path => selectedLeafSet.has(path[path.length - 1]));
96665
+ },
96666
+ syncFilterViewSelection() {
96667
+ this.searchSelectedValues = CascaderUtils.getSearchSelectedValues(this.selectedValues, this.viewOptions, this.cascaderProps);
96668
+ this.$nextTick(() => {
96669
+ if (this.viewOptions.length > 0) {
96670
+ this.handleSearchExpand();
96671
+ }
96672
+ });
96673
+ },
96674
+ handleDropdownFilterChange() {
96675
+ if (this.searchInput) {
96676
+ this.handleSearch();
96677
+ return;
96678
+ }
96679
+ this.isShowSearch = false;
96680
+ this.searchOptions = [];
96681
+ if (this.hasActiveDropdownFilter) {
96682
+ this.syncFilterViewSelection();
96683
+ } else {
96684
+ this.searchSelectedValues = [];
96685
+ }
96686
+ },
96434
96687
  // 处理批量搜索
96435
96688
  handleBatchSearch() {
96436
96689
  if (!this.batchSearchContent.trim()) {
@@ -96553,8 +96806,8 @@ class CascaderUtils {
96553
96806
  ;
96554
96807
  var ByCascaderPanel_component = normalizeComponent(
96555
96808
  cascader_panel_ByCascaderPanelvue_type_script_lang_js,
96556
- ByCascaderPanelvue_type_template_id_727f392c_render,
96557
- ByCascaderPanelvue_type_template_id_727f392c_staticRenderFns,
96809
+ ByCascaderPanelvue_type_template_id_1f03b3c0_render,
96810
+ ByCascaderPanelvue_type_template_id_1f03b3c0_staticRenderFns,
96558
96811
  false,
96559
96812
  null,
96560
96813
  null,
@@ -96563,8 +96816,8 @@ var ByCascaderPanel_component = normalizeComponent(
96563
96816
  )
96564
96817
 
96565
96818
  /* harmony default export */ var ByCascaderPanel = (ByCascaderPanel_component.exports);
96566
- ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"185687ec-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-pro/ByCascaderPanelPro.vue?vue&type=template&id=961f637e
96567
- var ByCascaderPanelProvue_type_template_id_961f637e_render = function render() {
96819
+ ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"185687ec-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-pro/ByCascaderPanelPro.vue?vue&type=template&id=296ae076
96820
+ var ByCascaderPanelProvue_type_template_id_296ae076_render = function render() {
96568
96821
  var _vm = this,
96569
96822
  _c = _vm._self._c;
96570
96823
  return _c('div', {
@@ -96583,7 +96836,10 @@ var ByCascaderPanelProvue_type_template_id_961f637e_render = function render() {
96583
96836
  }, [_vm._v("可选(" + _vm._s(_vm.selectedCount) + "/" + _vm._s(_vm.totalCount) + ")")]) : _vm._e(), _c('div', {
96584
96837
  staticClass: "search-section"
96585
96838
  }, [_c('div', {
96586
- staticClass: "search-container"
96839
+ staticClass: "search-container",
96840
+ class: {
96841
+ 'has-dropdown-filter': _vm.showDropdownFilter
96842
+ }
96587
96843
  }, [_c('div', {
96588
96844
  staticClass: "search-input-wrap",
96589
96845
  class: {
@@ -96679,7 +96935,37 @@ var ByCascaderPanelProvue_type_template_id_961f637e_render = function render() {
96679
96935
  slot: "reference"
96680
96936
  }, [_c('i', {
96681
96937
  staticClass: "el-icon-edit-outline"
96682
- })])], 1)], 1) : _vm._e()], 1), _vm.showRefreshBtn ? _c('el-tooltip', {
96938
+ })])], 1)], 1) : _vm._e()], 1), _vm.showDropdownFilter ? _c('div', {
96939
+ staticClass: "dropdown-filter-group"
96940
+ }, [_vm.dropdownFilterTitle ? _c('span', {
96941
+ staticClass: "dropdown-filter-title"
96942
+ }, [_vm._v(_vm._s(_vm.dropdownFilterTitle) + ":")]) : _vm._e(), _c('el-select', {
96943
+ staticClass: "dropdown-filter-select",
96944
+ attrs: {
96945
+ "placeholder": _vm.dropdownFilterPlaceholder,
96946
+ "clearable": "",
96947
+ "size": "mini",
96948
+ "disabled": _vm.panelViewMode
96949
+ },
96950
+ on: {
96951
+ "change": _vm.handleDropdownFilterChange
96952
+ },
96953
+ model: {
96954
+ value: _vm.dropdownFilterValue,
96955
+ callback: function ($$v) {
96956
+ _vm.dropdownFilterValue = $$v;
96957
+ },
96958
+ expression: "dropdownFilterValue"
96959
+ }
96960
+ }, _vm._l(_vm.normalizedDropdownFilterOptions, function (opt) {
96961
+ return _c('el-option', {
96962
+ key: 'df-' + opt.value,
96963
+ attrs: {
96964
+ "label": opt.label,
96965
+ "value": opt.value
96966
+ }
96967
+ });
96968
+ }), 1)], 1) : _vm._e(), _vm.showRefreshBtn ? _c('el-tooltip', {
96683
96969
  attrs: {
96684
96970
  "content": _vm.refreshTooltip,
96685
96971
  "placement": "top",
@@ -96720,8 +97006,8 @@ var ByCascaderPanelProvue_type_template_id_961f637e_render = function render() {
96720
97006
  directives: [{
96721
97007
  name: "show",
96722
97008
  rawName: "v-show",
96723
- value: _vm.searchInput === '' || !_vm.isShowSearch,
96724
- expression: "searchInput === '' || !isShowSearch"
97009
+ value: !_vm.isFilterView,
97010
+ expression: "!isFilterView"
96725
97011
  }],
96726
97012
  ref: "cascaderPanel",
96727
97013
  staticClass: "cascader-panel-inner",
@@ -96737,44 +97023,41 @@ var ByCascaderPanelProvue_type_template_id_961f637e_render = function render() {
96737
97023
  "column-min-width": _vm.columnMinWidth,
96738
97024
  "column-max-width": _vm.columnMaxWidth,
96739
97025
  "disabled-config": _vm.disabledConfig,
96740
- "is-view-mode": _vm.panelViewMode
97026
+ "is-view-mode": _vm.panelViewMode,
97027
+ "filter-field": _vm.showDropdownFilter ? _vm.dropdownFilterField : ''
96741
97028
  },
96742
97029
  on: {
96743
97030
  "input": _vm.onMainPanelInput,
96744
97031
  "change": _vm.handleValueChange,
96745
97032
  "store-ready": _vm.schedulePanelSyncFromExternalValue
96746
97033
  }
96747
- }) : _vm._e(), _vm.searchOptions.length > 0 ? _c('VirtualCascaderPanel', {
97034
+ }) : _vm._e(), _vm.viewOptions.length > 0 ? _c('VirtualCascaderPanel', {
96748
97035
  directives: [{
96749
97036
  name: "show",
96750
97037
  rawName: "v-show",
96751
- value: _vm.searchInput !== '' && _vm.isShowSearch,
96752
- expression: "searchInput !== '' && isShowSearch"
97038
+ value: _vm.isFilterView,
97039
+ expression: "isFilterView"
96753
97040
  }],
96754
97041
  ref: "searchCascaderPanel",
96755
97042
  staticClass: "cascader-panel-inner",
96756
97043
  attrs: {
96757
97044
  "value": _vm.compactSearchPanelValue,
96758
97045
  "sync-value-from-parent": false,
96759
- "options": _vm.searchOptions,
97046
+ "options": _vm.viewOptions,
96760
97047
  "props": _vm.cascaderProps,
96761
97048
  "height": _vm.computedPanelHeight - 20,
96762
97049
  "column-min-width": _vm.columnMinWidth,
96763
97050
  "column-max-width": _vm.columnMaxWidth,
96764
97051
  "disabled-config": _vm.disabledConfig,
96765
- "is-view-mode": _vm.panelViewMode
97052
+ "is-view-mode": _vm.panelViewMode,
97053
+ "filter-field": _vm.showDropdownFilter ? _vm.dropdownFilterField : ''
96766
97054
  },
96767
97055
  on: {
96768
97056
  "input": _vm.onSearchPanelInput,
96769
- "change": _vm.handleSearchValueChange
97057
+ "change": _vm.handleSearchValueChange,
97058
+ "store-ready": _vm.syncSearchPanelSelection
96770
97059
  }
96771
- }) : _vm._e(), _vm.isShowSearch && _vm.searchOptions.length === 0 ? _c('div', {
96772
- directives: [{
96773
- name: "show",
96774
- rawName: "v-show",
96775
- value: _vm.searchInput !== '',
96776
- expression: "searchInput !== ''"
96777
- }],
97060
+ }) : _vm._e(), _vm.isFilterView && _vm.viewOptions.length === 0 ? _c('div', {
96778
97061
  staticClass: "empty-search"
96779
97062
  }, [_c('el-empty', {
96780
97063
  attrs: {
@@ -96827,7 +97110,9 @@ var ByCascaderPanelProvue_type_template_id_961f637e_render = function render() {
96827
97110
  staticClass: "item-content"
96828
97111
  }, [_c('div', {
96829
97112
  staticClass: "item-label"
96830
- }, [_vm._v(_vm._s(item.label || ''))]), _vm.showSubtitle && _vm.subtitleField && item[_vm.subtitleField] ? _c('div', {
97113
+ }, [_vm._v(_vm._s(item.label || ''))]), _vm.showDropdownFilter && _vm.getNodeFilterFieldText(item) ? _c('span', {
97114
+ staticClass: "item-filter-field"
97115
+ }, [_vm._v(_vm._s(_vm.getNodeFilterFieldText(item)))]) : _vm._e(), _vm.showSubtitle && _vm.subtitleField && item[_vm.subtitleField] ? _c('div', {
96831
97116
  staticClass: "item-subtitle"
96832
97117
  }, [_vm._v(" " + _vm._s(item[_vm.subtitleField]) + " ")]) : _vm._e()]), !_vm.panelViewMode ? _c('div', {
96833
97118
  staticClass: "remove-btn",
@@ -96840,12 +97125,12 @@ var ByCascaderPanelProvue_type_template_id_961f637e_render = function render() {
96840
97125
  staticClass: "el-icon-close"
96841
97126
  })]) : _vm._e()])])];
96842
97127
  }
96843
- }], null, false, 1087530061)
97128
+ }], null, false, 244936201)
96844
97129
  }) : _c('div', {
96845
97130
  staticClass: "empty-state"
96846
97131
  }, [_vm._v("暂无选中项")])], 1)])])])]);
96847
97132
  };
96848
- var ByCascaderPanelProvue_type_template_id_961f637e_staticRenderFns = [];
97133
+ var ByCascaderPanelProvue_type_template_id_296ae076_staticRenderFns = [];
96849
97134
 
96850
97135
  ;// ./src/components/cascader-panel-pro/cascaderStorePro.js
96851
97136
 
@@ -97137,14 +97422,22 @@ class CascaderUtilsPro {
97137
97422
  minWidth = 180,
97138
97423
  maxWidth = 420,
97139
97424
  extraPadding = 56,
97140
- hasCheckbox = true
97425
+ hasCheckbox = true,
97426
+ filterField = ''
97141
97427
  } = options;
97142
97428
  if (!nodes || nodes.length === 0) {
97143
97429
  return minWidth;
97144
97430
  }
97145
97431
  let maxLabelWidth = 0;
97146
97432
  nodes.forEach(node => {
97147
- maxLabelWidth = Math.max(maxLabelWidth, this.measureCascaderLabelWidth(node.label));
97433
+ let text = node.label || '';
97434
+ if (filterField) {
97435
+ const extra = node.raw && node.raw[filterField];
97436
+ if (extra !== null && extra !== undefined && extra !== '') {
97437
+ text += ` (${extra})`;
97438
+ }
97439
+ }
97440
+ maxLabelWidth = Math.max(maxLabelWidth, this.measureCascaderLabelWidth(text));
97148
97441
  });
97149
97442
  const checkboxWidth = hasCheckbox ? 28 : 0;
97150
97443
  const arrowWidth = 24;
@@ -97303,6 +97596,58 @@ class CascaderUtilsPro {
97303
97596
  return result;
97304
97597
  }
97305
97598
 
97599
+ /**
97600
+ * 判断节点指定字段是否匹配下拉筛选值
97601
+ * @param {Object} node
97602
+ * @param {String} field
97603
+ * @param {*} filterValue
97604
+ * @returns {Boolean}
97605
+ */
97606
+ static isFilterFieldMatched(node, field, filterValue) {
97607
+ if (!node || !field || filterValue === null || filterValue === undefined || filterValue === '') {
97608
+ return false;
97609
+ }
97610
+ const raw = node[field];
97611
+ if (raw === null || raw === undefined || raw === '') {
97612
+ return false;
97613
+ }
97614
+ return String(raw).trim() === String(filterValue).trim();
97615
+ }
97616
+
97617
+ /**
97618
+ * 按数据字段过滤树:保留字段匹配的节点及其祖先路径
97619
+ * @param {Array} tree - 树形数据
97620
+ * @param {String} field - 数据中用于筛选的字段名
97621
+ * @param {*} filterValue - 下拉选中值
97622
+ * @param {Object} cascaderProps - 级联配置
97623
+ * @returns {Array} 过滤后的树
97624
+ */
97625
+ static filterTreeByField(tree, field, filterValue, cascaderProps) {
97626
+ if (!Array.isArray(tree) || !field || filterValue === null || filterValue === undefined || filterValue === '') {
97627
+ return tree || [];
97628
+ }
97629
+ const childrenKey = cascaderProps && cascaderProps.children || 'children';
97630
+ const result = [];
97631
+ tree.forEach(node => {
97632
+ const children = node[childrenKey];
97633
+ const hasChildren = Array.isArray(children) && children.length > 0;
97634
+ if (hasChildren) {
97635
+ const matchedChildren = this.filterTreeByField(children, field, filterValue, cascaderProps);
97636
+ if (matchedChildren.length > 0) {
97637
+ result.push({
97638
+ ...node,
97639
+ [childrenKey]: matchedChildren
97640
+ });
97641
+ }
97642
+ } else if (this.isFilterFieldMatched(node, field, filterValue)) {
97643
+ result.push({
97644
+ ...node
97645
+ });
97646
+ }
97647
+ });
97648
+ return result;
97649
+ }
97650
+
97306
97651
  /**
97307
97652
  * 基于扁平 store 快速搜索(父节点命中时直接复用 raw 子树,跳过子级遍历)
97308
97653
  */
@@ -97846,8 +98191,8 @@ class CascaderUtilsPro {
97846
98191
  return paths;
97847
98192
  }
97848
98193
  }
97849
- ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"185687ec-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-pro/VirtualCascaderPanel.vue?vue&type=template&id=05f77638
97850
- var VirtualCascaderPanelvue_type_template_id_05f77638_render = function render() {
98194
+ ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"185687ec-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-pro/VirtualCascaderPanel.vue?vue&type=template&id=7d8ff846
98195
+ var VirtualCascaderPanelvue_type_template_id_7d8ff846_render = function render() {
97851
98196
  var _vm = this,
97852
98197
  _c = _vm._self._c;
97853
98198
  return _c('div', {
@@ -97928,7 +98273,9 @@ var VirtualCascaderPanelvue_type_template_id_05f77638_render = function render()
97928
98273
  }
97929
98274
  }, [_c('span')])], 1) : _vm._e(), _c('span', {
97930
98275
  staticClass: "el-cascader-node__label"
97931
- }, [_vm._v(_vm._s(item.label))]), !item.isLeaf ? _c('span', {
98276
+ }, [_vm.filterField ? [_vm._v(" " + _vm._s(item.label)), _vm.getFilterFieldText(item) ? _c('span', {
98277
+ staticClass: "node-filter-field"
98278
+ }, [_vm._v(_vm._s(_vm.getFilterFieldText(item)))]) : _vm._e()] : [_vm._v(_vm._s(item.label))]], 2), !item.isLeaf ? _c('span', {
97932
98279
  staticClass: "el-cascader-node__postfix"
97933
98280
  }, [_c('i', {
97934
98281
  staticClass: "el-icon-arrow-right el-cascader-node__icon-arrow"
@@ -97938,7 +98285,7 @@ var VirtualCascaderPanelvue_type_template_id_05f77638_render = function render()
97938
98285
  })], 1);
97939
98286
  }), 0);
97940
98287
  };
97941
- var VirtualCascaderPanelvue_type_template_id_05f77638_staticRenderFns = [];
98288
+ var VirtualCascaderPanelvue_type_template_id_7d8ff846_staticRenderFns = [];
97942
98289
 
97943
98290
  ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"185687ec-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-pro/VirtualList.vue?vue&type=template&id=43cb1148
97944
98291
  var VirtualListvue_type_template_id_43cb1148_render = function render() {
@@ -98422,6 +98769,11 @@ class SelectionStatePro {
98422
98769
  syncValueFromParent: {
98423
98770
  type: Boolean,
98424
98771
  default: true
98772
+ },
98773
+ // 下拉筛选字段名:有值时在节点名称后展示该字段内容
98774
+ filterField: {
98775
+ type: String,
98776
+ default: ''
98425
98777
  }
98426
98778
  },
98427
98779
  data() {
@@ -98538,7 +98890,8 @@ class SelectionStatePro {
98538
98890
  const width = CascaderUtilsPro.getCascaderColumnWidth(columnNodes, {
98539
98891
  minWidth: this.columnMinWidth,
98540
98892
  maxWidth: this.columnMaxWidth,
98541
- hasCheckbox: this.multiple || this.checkStrictly
98893
+ hasCheckbox: this.multiple || this.checkStrictly,
98894
+ filterField: this.filterField
98542
98895
  });
98543
98896
  return {
98544
98897
  width: width + 'px',
@@ -98546,6 +98899,17 @@ class SelectionStatePro {
98546
98899
  maxWidth: width + 'px'
98547
98900
  };
98548
98901
  },
98902
+ getFilterFieldText(item) {
98903
+ if (!this.filterField || !item) {
98904
+ return '';
98905
+ }
98906
+ const raw = item.raw || item;
98907
+ const val = raw[this.filterField];
98908
+ if (val === null || val === undefined || val === '') {
98909
+ return '';
98910
+ }
98911
+ return `(${val})`;
98912
+ },
98549
98913
  rebuildStore() {
98550
98914
  this.store = buildCascaderStore(this.options, this.disabledConfig, this.props, CascaderUtilsPro);
98551
98915
  this.selection = new SelectionStatePro(this.store);
@@ -98855,8 +99219,8 @@ class SelectionStatePro {
98855
99219
  ;
98856
99220
  var VirtualCascaderPanel_component = normalizeComponent(
98857
99221
  cascader_panel_pro_VirtualCascaderPanelvue_type_script_lang_js,
98858
- VirtualCascaderPanelvue_type_template_id_05f77638_render,
98859
- VirtualCascaderPanelvue_type_template_id_05f77638_staticRenderFns,
99222
+ VirtualCascaderPanelvue_type_template_id_7d8ff846_render,
99223
+ VirtualCascaderPanelvue_type_template_id_7d8ff846_staticRenderFns,
98860
99224
  false,
98861
99225
  null,
98862
99226
  null,
@@ -99012,6 +99376,15 @@ var VirtualCascaderPanel_component = normalizeComponent(
99012
99376
  columnMaxWidth: {
99013
99377
  type: Number,
99014
99378
  default: 420
99379
+ },
99380
+ /**
99381
+ * 下拉筛选配置。外部传入且 enabled 不为 false、并指定 field 时才展示下拉框。
99382
+ * { enabled, title, placeholder, options: [{ label, value }], field }
99383
+ * field 为数据中用于过滤和展示的字段名。
99384
+ */
99385
+ dropdownFilter: {
99386
+ type: Object,
99387
+ default: null
99015
99388
  }
99016
99389
  },
99017
99390
  data() {
@@ -99039,7 +99412,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
99039
99412
  searchLeafSetCache: null,
99040
99413
  panelSyncTimer: null,
99041
99414
  // 外部 v-model 回显同步中,避免与用户操作冲突
99042
- isExternalSync: false
99415
+ isExternalSync: false,
99416
+ dropdownFilterValue: ''
99043
99417
  };
99044
99418
  },
99045
99419
  computed: {
@@ -99140,6 +99514,59 @@ var VirtualCascaderPanel_component = normalizeComponent(
99140
99514
  this.searchSelectedValues = value ? [value] : [];
99141
99515
  }
99142
99516
  }
99517
+ },
99518
+ showDropdownFilter() {
99519
+ const cfg = this.dropdownFilter;
99520
+ return !!(cfg && typeof cfg === 'object' && cfg.enabled !== false && cfg.field);
99521
+ },
99522
+ dropdownFilterPlaceholder() {
99523
+ return this.dropdownFilter && this.dropdownFilter.placeholder || '请选择';
99524
+ },
99525
+ dropdownFilterTitle() {
99526
+ const title = this.dropdownFilter && this.dropdownFilter.title;
99527
+ return title != null && String(title).trim() !== '' ? String(title).trim() : '';
99528
+ },
99529
+ dropdownFilterField() {
99530
+ return this.dropdownFilter && this.dropdownFilter.field || '';
99531
+ },
99532
+ normalizedDropdownFilterOptions() {
99533
+ const opts = this.dropdownFilter && this.dropdownFilter.options || [];
99534
+ return opts.map(opt => {
99535
+ if (opt != null && typeof opt === 'object') {
99536
+ return {
99537
+ label: opt.label != null ? opt.label : opt.value,
99538
+ value: opt.value != null ? opt.value : opt.label
99539
+ };
99540
+ }
99541
+ return {
99542
+ label: String(opt),
99543
+ value: opt
99544
+ };
99545
+ });
99546
+ },
99547
+ hasActiveDropdownFilter() {
99548
+ return this.showDropdownFilter && this.dropdownFilterValue !== '' && this.dropdownFilterValue !== null && this.dropdownFilterValue !== undefined;
99549
+ },
99550
+ displayOptions() {
99551
+ if (!this.hasActiveDropdownFilter) {
99552
+ return this.filteredOptions;
99553
+ }
99554
+ return CascaderUtilsPro.filterTreeByField(this.filteredOptions, this.dropdownFilterField, this.dropdownFilterValue, this.cascaderProps);
99555
+ },
99556
+ isFilterView() {
99557
+ if (this.searchInput !== '' && this.isShowSearch) {
99558
+ return true;
99559
+ }
99560
+ return this.hasActiveDropdownFilter;
99561
+ },
99562
+ viewOptions() {
99563
+ if (this.searchInput !== '' && this.isShowSearch) {
99564
+ return this.searchOptions;
99565
+ }
99566
+ if (this.hasActiveDropdownFilter) {
99567
+ return this.displayOptions;
99568
+ }
99569
+ return [];
99143
99570
  }
99144
99571
  },
99145
99572
  watch: {
@@ -99165,6 +99592,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
99165
99592
  searchInput(val) {
99166
99593
  if (!val) {
99167
99594
  this.clearSearchState();
99595
+ if (this.hasActiveDropdownFilter) {
99596
+ this.prepareFilterView();
99597
+ }
99168
99598
  return;
99169
99599
  }
99170
99600
  this.scheduleSearch();
@@ -99192,6 +99622,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
99192
99622
  } else if (panel && panel.store && panel.selection && this.aggregationMode) {
99193
99623
  this.isAllSelected = panel.selection.size() === panel.store.totalLeafCount && panel.store.totalLeafCount > 0;
99194
99624
  }
99625
+ if (this.hasActiveDropdownFilter) {
99626
+ this.updateFilterAllSelectedState();
99627
+ }
99195
99628
  } else {
99196
99629
  if (newVal.length > 1) {
99197
99630
  this.selectedItems = [newVal[newVal.length - 1]];
@@ -99206,6 +99639,11 @@ var VirtualCascaderPanel_component = normalizeComponent(
99206
99639
  if (val) {
99207
99640
  this.batchSearchVisible = false;
99208
99641
  }
99642
+ },
99643
+ showDropdownFilter(val) {
99644
+ if (!val) {
99645
+ this.dropdownFilterValue = '';
99646
+ }
99209
99647
  }
99210
99648
  },
99211
99649
  mounted() {
@@ -99259,6 +99697,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
99259
99697
  this.selectedValues = selection.getCheckedPaths();
99260
99698
  }
99261
99699
  panel.bumpSelectionView();
99700
+ if (this.hasActiveDropdownFilter) {
99701
+ this.updateFilterAllSelectedState();
99702
+ }
99262
99703
  return;
99263
99704
  }
99264
99705
  if (selection.isCompactSelection()) {
@@ -99266,11 +99707,17 @@ var VirtualCascaderPanel_component = normalizeComponent(
99266
99707
  this.selectedCount = selection.size();
99267
99708
  this.isAllSelected = selection.size() === store.totalLeafCount;
99268
99709
  panel.bumpSelectionView();
99710
+ if (this.hasActiveDropdownFilter) {
99711
+ this.updateFilterAllSelectedState();
99712
+ }
99269
99713
  return;
99270
99714
  }
99271
99715
  this.selectedValues = selection.getCheckedPaths();
99272
99716
  this.updateSelectedItems();
99273
99717
  panel.bumpSelectionView();
99718
+ if (this.hasActiveDropdownFilter) {
99719
+ this.updateFilterAllSelectedState();
99720
+ }
99274
99721
  },
99275
99722
  /**
99276
99723
  * 用户操作(勾选/全选/清除/删除)统一提交:更新展示 + emit,标记内部更新防回显覆盖
@@ -99524,6 +99971,11 @@ var VirtualCascaderPanel_component = normalizeComponent(
99524
99971
  } else {
99525
99972
  this.updateSelectedItems();
99526
99973
  }
99974
+ if (this.searchInput) {
99975
+ this.scheduleSearch();
99976
+ } else if (this.hasActiveDropdownFilter) {
99977
+ this.prepareFilterView();
99978
+ }
99527
99979
  },
99528
99980
  // 处理选项数据,添加禁用状态(浅拷贝,避免 JSON 深拷贝大数据卡顿)
99529
99981
  processOptions(options) {
@@ -99609,13 +100061,20 @@ var VirtualCascaderPanel_component = normalizeComponent(
99609
100061
  const keyword = this.searchInput.trim();
99610
100062
  if (!keyword) {
99611
100063
  this.clearSearchState();
100064
+ if (this.hasActiveDropdownFilter) {
100065
+ this.prepareFilterView();
100066
+ }
99612
100067
  return;
99613
100068
  }
99614
- const panel = this.$refs.cascaderPanel;
99615
- if (panel && panel.store) {
99616
- this.searchOptions = CascaderUtilsPro.searchFromStore(panel.store, keyword, this.cascaderProps);
100069
+ if (this.hasActiveDropdownFilter) {
100070
+ this.searchOptions = CascaderUtilsPro.searchInTree(this.displayOptions, keyword, this.cascaderProps);
99617
100071
  } else {
99618
- this.searchOptions = CascaderUtilsPro.searchInTree(this.filteredOptions, keyword, this.cascaderProps);
100072
+ const panel = this.$refs.cascaderPanel;
100073
+ if (panel && panel.store) {
100074
+ this.searchOptions = CascaderUtilsPro.searchFromStore(panel.store, keyword, this.cascaderProps);
100075
+ } else {
100076
+ this.searchOptions = CascaderUtilsPro.searchInTree(this.filteredOptions, keyword, this.cascaderProps);
100077
+ }
99619
100078
  }
99620
100079
  this.searchLeafSetCache = new Set(CascaderUtilsPro.getLeafValues(this.searchOptions, this.cascaderProps));
99621
100080
  this.searchSelectedValues = this.getSearchSelectedPathsFromMain(this.searchLeafSetCache);
@@ -99647,7 +100106,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
99647
100106
  if (this.searchLeafSetCache) {
99648
100107
  return this.searchLeafSetCache;
99649
100108
  }
99650
- return new Set(CascaderUtilsPro.getLeafValues(this.searchOptions, this.cascaderProps));
100109
+ return new Set(CascaderUtilsPro.getLeafValues(this.viewOptions, this.cascaderProps));
99651
100110
  },
99652
100111
  syncSearchPanelSelection() {
99653
100112
  const searchPanel = this.$refs.searchCascaderPanel;
@@ -99667,12 +100126,57 @@ var VirtualCascaderPanel_component = normalizeComponent(
99667
100126
  },
99668
100127
  // 搜索模式下的展开处理
99669
100128
  handleSearchExpand() {
99670
- if (this.$refs.searchCascaderPanel && this.searchOptions.length > 0) {
99671
- const firstOption = this.searchOptions[0];
100129
+ if (this.$refs.searchCascaderPanel && this.viewOptions.length > 0) {
100130
+ const firstOption = this.viewOptions[0];
99672
100131
  const valueKey = this.cascaderProps.value || 'value';
99673
100132
  this.$refs.searchCascaderPanel.expandPathValues([firstOption[valueKey]], true);
99674
100133
  }
99675
100134
  },
100135
+ prepareFilterView() {
100136
+ this.searchLeafSetCache = new Set(CascaderUtilsPro.getLeafValues(this.displayOptions, this.cascaderProps));
100137
+ this.$nextTick(() => {
100138
+ this.syncSearchPanelSelection();
100139
+ this.handleSearchExpand();
100140
+ });
100141
+ },
100142
+ handleDropdownFilterChange() {
100143
+ if (this.searchInput) {
100144
+ this.scheduleSearch();
100145
+ return;
100146
+ }
100147
+ this.clearSearchState();
100148
+ if (this.hasActiveDropdownFilter) {
100149
+ this.prepareFilterView();
100150
+ }
100151
+ },
100152
+ getNodeFilterFieldText(data) {
100153
+ if (!this.showDropdownFilter || !this.dropdownFilterField || !data) {
100154
+ return '';
100155
+ }
100156
+ const raw = data.data && typeof data.data === 'object' ? data.data : data;
100157
+ const val = raw[this.dropdownFilterField];
100158
+ if (val === null || val === undefined || val === '') {
100159
+ return '';
100160
+ }
100161
+ return `(${val})`;
100162
+ },
100163
+ updateFilterAllSelectedState() {
100164
+ if (!this.hasActiveDropdownFilter) {
100165
+ return;
100166
+ }
100167
+ const viewPaths = CascaderUtilsPro.getAllLeafPaths(this.displayOptions, this.disabledConfig, this.cascaderProps);
100168
+ if (viewPaths.length === 0) {
100169
+ this.isAllSelected = false;
100170
+ return;
100171
+ }
100172
+ const panel = this.$refs.cascaderPanel;
100173
+ if (panel && panel.selection && panel.selection.selectedLeafSet) {
100174
+ this.isAllSelected = viewPaths.every(path => panel.selection.selectedLeafSet.has(path[path.length - 1]));
100175
+ return;
100176
+ }
100177
+ const selectedLeafSet = new Set(this.selectedValues.map(path => path[path.length - 1]));
100178
+ this.isAllSelected = viewPaths.every(path => selectedLeafSet.has(path[path.length - 1]));
100179
+ },
99676
100180
  // 值变化处理(面板勾选)
99677
100181
  handleValueChange() {
99678
100182
  this.commitUserSelectionChange();
@@ -99764,6 +100268,26 @@ var VirtualCascaderPanel_component = normalizeComponent(
99764
100268
  }
99765
100269
  const panel = this.$refs.cascaderPanel;
99766
100270
  const searchPanel = this.$refs.searchCascaderPanel;
100271
+ if (this.hasActiveDropdownFilter && panel && panel.selection && panel.store) {
100272
+ const viewPaths = CascaderUtilsPro.getAllLeafPaths(this.displayOptions, this.disabledConfig, this.cascaderProps);
100273
+ const viewLeafSet = new Set(viewPaths.map(path => path[path.length - 1]));
100274
+ if (this.isAllSelected) {
100275
+ viewLeafSet.forEach(leaf => {
100276
+ panel.selection.selectedLeafSet.delete(leaf);
100277
+ });
100278
+ } else {
100279
+ viewLeafSet.forEach(leaf => {
100280
+ panel.selection.selectedLeafSet.add(leaf);
100281
+ });
100282
+ }
100283
+ panel.selection._reconcileAllRoots();
100284
+ panel.bumpSelectionView();
100285
+ if (searchPanel && searchPanel.selection) {
100286
+ this.syncSearchPanelSelection();
100287
+ }
100288
+ this.commitUserSelectionChange();
100289
+ return;
100290
+ }
99767
100291
  if (this.isAllSelected) {
99768
100292
  this.clearPanelSelectionState(panel);
99769
100293
  this.clearPanelSelectionState(searchPanel);
@@ -99889,6 +100413,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
99889
100413
  if (this.panelViewMode) return;
99890
100414
  this.searchInput = '';
99891
100415
  this.clearSearchState();
100416
+ if (this.hasActiveDropdownFilter) {
100417
+ this.prepareFilterView();
100418
+ }
99892
100419
  this.$emit('refresh');
99893
100420
  },
99894
100421
  // 处理批量搜索
@@ -100017,8 +100544,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
100017
100544
  ;
100018
100545
  var ByCascaderPanelPro_component = normalizeComponent(
100019
100546
  cascader_panel_pro_ByCascaderPanelProvue_type_script_lang_js,
100020
- ByCascaderPanelProvue_type_template_id_961f637e_render,
100021
- ByCascaderPanelProvue_type_template_id_961f637e_staticRenderFns,
100547
+ ByCascaderPanelProvue_type_template_id_296ae076_render,
100548
+ ByCascaderPanelProvue_type_template_id_296ae076_staticRenderFns,
100022
100549
  false,
100023
100550
  null,
100024
100551
  null,