@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.
@@ -94778,8 +94778,8 @@ ByDialogService.install = function (Vue) {
94778
94778
  Vue.prototype.$byDialog = ByDialogService;
94779
94779
  };
94780
94780
  /* harmony default export */ var by_dialog_ByDialogService = (ByDialogService);
94781
- ;// ./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-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=727f392c
94782
- var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
94781
+ ;// ./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-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=1f03b3c0
94782
+ var ByCascaderPanelvue_type_template_id_1f03b3c0_render = function render() {
94783
94783
  var _vm = this,
94784
94784
  _c = _vm._self._c;
94785
94785
  return _c('div', {
@@ -94798,7 +94798,10 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
94798
94798
  }, [_vm._v("可选(" + _vm._s(_vm.selectedCount) + "/" + _vm._s(_vm.totalCount) + ")")]) : _vm._e(), _c('div', {
94799
94799
  staticClass: "search-section"
94800
94800
  }, [_c('div', {
94801
- staticClass: "search-container"
94801
+ staticClass: "search-container",
94802
+ class: {
94803
+ 'has-dropdown-filter': _vm.showDropdownFilter
94804
+ }
94802
94805
  }, [_c('div', {
94803
94806
  staticClass: "search-input-wrap",
94804
94807
  class: {
@@ -94897,7 +94900,37 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
94897
94900
  slot: "reference"
94898
94901
  }, [_c('i', {
94899
94902
  staticClass: "el-icon-edit-outline"
94900
- })])], 1)], 1) : _vm._e()], 1), _vm.showRefreshBtn ? _c('el-tooltip', {
94903
+ })])], 1)], 1) : _vm._e()], 1), _vm.showDropdownFilter ? _c('div', {
94904
+ staticClass: "dropdown-filter-group"
94905
+ }, [_vm.dropdownFilterTitle ? _c('span', {
94906
+ staticClass: "dropdown-filter-title"
94907
+ }, [_vm._v(_vm._s(_vm.dropdownFilterTitle) + ":")]) : _vm._e(), _c('el-select', {
94908
+ staticClass: "dropdown-filter-select",
94909
+ attrs: {
94910
+ "placeholder": _vm.dropdownFilterPlaceholder,
94911
+ "clearable": "",
94912
+ "size": "mini",
94913
+ "disabled": _vm.panelViewMode
94914
+ },
94915
+ on: {
94916
+ "change": _vm.handleDropdownFilterChange
94917
+ },
94918
+ model: {
94919
+ value: _vm.dropdownFilterValue,
94920
+ callback: function ($$v) {
94921
+ _vm.dropdownFilterValue = $$v;
94922
+ },
94923
+ expression: "dropdownFilterValue"
94924
+ }
94925
+ }, _vm._l(_vm.normalizedDropdownFilterOptions, function (opt) {
94926
+ return _c('el-option', {
94927
+ key: 'df-' + opt.value,
94928
+ attrs: {
94929
+ "label": opt.label,
94930
+ "value": opt.value
94931
+ }
94932
+ });
94933
+ }), 1)], 1) : _vm._e(), _vm.showRefreshBtn ? _c('el-tooltip', {
94901
94934
  attrs: {
94902
94935
  "content": _vm.refreshTooltip,
94903
94936
  "placement": "top",
@@ -94939,8 +94972,8 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
94939
94972
  directives: [{
94940
94973
  name: "show",
94941
94974
  rawName: "v-show",
94942
- value: _vm.searchInput === '' || !_vm.isShowSearch,
94943
- expression: "searchInput === '' || !isShowSearch"
94975
+ value: !_vm.isFilterView,
94976
+ expression: "!isFilterView"
94944
94977
  }],
94945
94978
  ref: "cascaderPanel",
94946
94979
  staticClass: "cascader-panel-inner",
@@ -94956,6 +94989,17 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
94956
94989
  "expand-change": _vm.handleExpandChange,
94957
94990
  "change": _vm.handleValueChange
94958
94991
  },
94992
+ scopedSlots: _vm._u([{
94993
+ key: "default",
94994
+ fn: function ({
94995
+ node,
94996
+ data
94997
+ }) {
94998
+ return [_vm._v(" " + _vm._s(node.label)), _vm.showDropdownFilter && _vm.getNodeFilterFieldText(data) ? _c('span', {
94999
+ staticClass: "node-filter-field"
95000
+ }, [_vm._v(_vm._s(_vm.getNodeFilterFieldText(data)))]) : _vm._e()];
95001
+ }
95002
+ }], null, false, 181072543),
94959
95003
  model: {
94960
95004
  value: _vm.mainPanelValue,
94961
95005
  callback: function ($$v) {
@@ -94963,12 +95007,12 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
94963
95007
  },
94964
95008
  expression: "mainPanelValue"
94965
95009
  }
94966
- }) : _vm._e(), _vm.searchOptions.length > 0 ? _c('el-cascader-panel', {
95010
+ }) : _vm._e(), _vm.viewOptions.length > 0 ? _c('el-cascader-panel', {
94967
95011
  directives: [{
94968
95012
  name: "show",
94969
95013
  rawName: "v-show",
94970
- value: _vm.searchInput !== '' && _vm.isShowSearch,
94971
- expression: "searchInput !== '' && isShowSearch"
95014
+ value: _vm.isFilterView,
95015
+ expression: "isFilterView"
94972
95016
  }],
94973
95017
  ref: "searchCascaderPanel",
94974
95018
  staticClass: "cascader-panel-inner",
@@ -94977,13 +95021,24 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
94977
95021
  },
94978
95022
  attrs: {
94979
95023
  "append-to-body": false,
94980
- "options": _vm.searchOptions,
95024
+ "options": _vm.viewOptions,
94981
95025
  "props": _vm.cascaderProps
94982
95026
  },
94983
95027
  on: {
94984
95028
  "expand-change": _vm.handleExpandChange,
94985
95029
  "change": _vm.handleSearchValueChange
94986
95030
  },
95031
+ scopedSlots: _vm._u([{
95032
+ key: "default",
95033
+ fn: function ({
95034
+ node,
95035
+ data
95036
+ }) {
95037
+ return [_vm._v(" " + _vm._s(node.label)), _vm.showDropdownFilter && _vm.getNodeFilterFieldText(data) ? _c('span', {
95038
+ staticClass: "node-filter-field"
95039
+ }, [_vm._v(_vm._s(_vm.getNodeFilterFieldText(data)))]) : _vm._e()];
95040
+ }
95041
+ }], null, false, 181072543),
94987
95042
  model: {
94988
95043
  value: _vm.searchPanelValue,
94989
95044
  callback: function ($$v) {
@@ -94991,13 +95046,7 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
94991
95046
  },
94992
95047
  expression: "searchPanelValue"
94993
95048
  }
94994
- }) : _vm._e(), _vm.isShowSearch && _vm.searchOptions.length === 0 ? _c('div', {
94995
- directives: [{
94996
- name: "show",
94997
- rawName: "v-show",
94998
- value: _vm.searchInput !== '',
94999
- expression: "searchInput !== ''"
95000
- }],
95049
+ }) : _vm._e(), _vm.isFilterView && _vm.viewOptions.length === 0 ? _c('div', {
95001
95050
  staticClass: "empty-search"
95002
95051
  }, [_c('el-empty', {
95003
95052
  attrs: {
@@ -95054,7 +95103,9 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
95054
95103
  "padding": "0 !important",
95055
95104
  "vertical-align": "middle !important"
95056
95105
  }
95057
- }, [_vm._v(_vm._s(item.label || ''))]), _vm.showSubtitle && _vm.subtitleField && item[_vm.subtitleField] ? _c('div', {
95106
+ }, [_vm._v(_vm._s(item.label || ''))]), _vm.showDropdownFilter && _vm.getNodeFilterFieldText(item) ? _c('span', {
95107
+ staticClass: "item-filter-field"
95108
+ }, [_vm._v(_vm._s(_vm.getNodeFilterFieldText(item)))]) : _vm._e(), _vm.showSubtitle && _vm.subtitleField && item[_vm.subtitleField] ? _c('div', {
95058
95109
  staticClass: "item-subtitle",
95059
95110
  staticStyle: {
95060
95111
  "line-height": "1 !important",
@@ -95079,7 +95130,7 @@ var ByCascaderPanelvue_type_template_id_727f392c_render = function render() {
95079
95130
  staticClass: "empty-state"
95080
95131
  }, [_vm._v("暂无选中项")]) : _vm._e()], 2)])])])]);
95081
95132
  };
95082
- var ByCascaderPanelvue_type_template_id_727f392c_staticRenderFns = [];
95133
+ var ByCascaderPanelvue_type_template_id_1f03b3c0_staticRenderFns = [];
95083
95134
 
95084
95135
  ;// ./src/utils/cascaderUtils.js
95085
95136
 
@@ -95251,6 +95302,58 @@ class CascaderUtils {
95251
95302
  return result;
95252
95303
  }
95253
95304
 
95305
+ /**
95306
+ * 判断节点指定字段是否匹配下拉筛选值
95307
+ * @param {Object} node
95308
+ * @param {String} field
95309
+ * @param {*} filterValue
95310
+ * @returns {Boolean}
95311
+ */
95312
+ static isFilterFieldMatched(node, field, filterValue) {
95313
+ if (!node || !field || filterValue === null || filterValue === undefined || filterValue === '') {
95314
+ return false;
95315
+ }
95316
+ const raw = node[field];
95317
+ if (raw === null || raw === undefined || raw === '') {
95318
+ return false;
95319
+ }
95320
+ return String(raw).trim() === String(filterValue).trim();
95321
+ }
95322
+
95323
+ /**
95324
+ * 按数据字段过滤树:保留字段匹配的节点及其祖先路径
95325
+ * @param {Array} tree - 树形数据
95326
+ * @param {String} field - 数据中用于筛选的字段名
95327
+ * @param {*} filterValue - 下拉选中值
95328
+ * @param {Object} cascaderProps - 级联配置
95329
+ * @returns {Array} 过滤后的树
95330
+ */
95331
+ static filterTreeByField(tree, field, filterValue, cascaderProps) {
95332
+ if (!Array.isArray(tree) || !field || filterValue === null || filterValue === undefined || filterValue === '') {
95333
+ return tree || [];
95334
+ }
95335
+ const childrenKey = cascaderProps && cascaderProps.children || 'children';
95336
+ const result = [];
95337
+ tree.forEach(node => {
95338
+ const children = node[childrenKey];
95339
+ const hasChildren = Array.isArray(children) && children.length > 0;
95340
+ if (hasChildren) {
95341
+ const matchedChildren = this.filterTreeByField(children, field, filterValue, cascaderProps);
95342
+ if (matchedChildren.length > 0) {
95343
+ result.push({
95344
+ ...node,
95345
+ [childrenKey]: matchedChildren
95346
+ });
95347
+ }
95348
+ } else if (this.isFilterFieldMatched(node, field, filterValue)) {
95349
+ result.push({
95350
+ ...node
95351
+ });
95352
+ }
95353
+ });
95354
+ return result;
95355
+ }
95356
+
95254
95357
  /**
95255
95358
  * 获取叶子节点的值
95256
95359
  * @param {Array} tree - 树形数据
@@ -95702,6 +95805,13 @@ class CascaderUtils {
95702
95805
 
95703
95806
 
95704
95807
 
95808
+
95809
+
95810
+
95811
+
95812
+
95813
+
95814
+
95705
95815
  /* harmony default export */ var ByCascaderPanelvue_type_script_lang_js = ({
95706
95816
  name: 'ByCascaderPanel',
95707
95817
  props: {
@@ -95816,6 +95926,15 @@ class CascaderUtils {
95816
95926
  refreshing: {
95817
95927
  type: Boolean,
95818
95928
  default: false
95929
+ },
95930
+ /**
95931
+ * 下拉筛选配置。外部传入且 enabled 不为 false、并指定 field 时才展示下拉框。
95932
+ * { enabled, title, placeholder, options: [{ label, value }], field }
95933
+ * field 为数据中用于过滤和展示的字段名。
95934
+ */
95935
+ dropdownFilter: {
95936
+ type: Object,
95937
+ default: null
95819
95938
  }
95820
95939
  },
95821
95940
  data() {
@@ -95835,7 +95954,9 @@ class CascaderUtils {
95835
95954
  // 防止循环更新的标志
95836
95955
  batchSearchVisible: false,
95837
95956
  // 批量搜索弹窗显示状态
95838
- batchSearchContent: '' // 批量搜索输入内容
95957
+ batchSearchContent: '',
95958
+ // 批量搜索输入内容
95959
+ dropdownFilterValue: '' // 下拉筛选当前值,未开启时不使用
95839
95960
  };
95840
95961
  },
95841
95962
  computed: {
@@ -95908,6 +96029,61 @@ class CascaderUtils {
95908
96029
  this.searchSelectedValues = value ? [value] : [];
95909
96030
  }
95910
96031
  }
96032
+ },
96033
+ // 是否展示下拉筛选(外部有配置且指定了数据字段才展示)
96034
+ showDropdownFilter() {
96035
+ const cfg = this.dropdownFilter;
96036
+ return !!(cfg && typeof cfg === 'object' && cfg.enabled !== false && cfg.field);
96037
+ },
96038
+ dropdownFilterPlaceholder() {
96039
+ return this.dropdownFilter && this.dropdownFilter.placeholder || '请选择';
96040
+ },
96041
+ dropdownFilterTitle() {
96042
+ const title = this.dropdownFilter && this.dropdownFilter.title;
96043
+ return title != null && String(title).trim() !== '' ? String(title).trim() : '';
96044
+ },
96045
+ dropdownFilterField() {
96046
+ return this.dropdownFilter && this.dropdownFilter.field || '';
96047
+ },
96048
+ normalizedDropdownFilterOptions() {
96049
+ const opts = this.dropdownFilter && this.dropdownFilter.options || [];
96050
+ return opts.map(opt => {
96051
+ if (opt != null && typeof opt === 'object') {
96052
+ return {
96053
+ label: opt.label != null ? opt.label : opt.value,
96054
+ value: opt.value != null ? opt.value : opt.label
96055
+ };
96056
+ }
96057
+ return {
96058
+ label: String(opt),
96059
+ value: opt
96060
+ };
96061
+ });
96062
+ },
96063
+ hasActiveDropdownFilter() {
96064
+ return this.showDropdownFilter && this.dropdownFilterValue !== '' && this.dropdownFilterValue !== null && this.dropdownFilterValue !== undefined;
96065
+ },
96066
+ // 下拉筛选后的展示树;未筛选时等于完整 processed 树,保证原有逻辑不变
96067
+ displayOptions() {
96068
+ if (!this.hasActiveDropdownFilter) {
96069
+ return this.filteredOptions;
96070
+ }
96071
+ return CascaderUtils.filterTreeByField(this.filteredOptions, this.dropdownFilterField, this.dropdownFilterValue, this.cascaderProps);
96072
+ },
96073
+ isFilterView() {
96074
+ if (this.searchInput !== '' && this.isShowSearch) {
96075
+ return true;
96076
+ }
96077
+ return this.hasActiveDropdownFilter;
96078
+ },
96079
+ viewOptions() {
96080
+ if (this.searchInput !== '' && this.isShowSearch) {
96081
+ return this.searchOptions;
96082
+ }
96083
+ if (this.hasActiveDropdownFilter) {
96084
+ return this.displayOptions;
96085
+ }
96086
+ return [];
95911
96087
  }
95912
96088
  },
95913
96089
  watch: {
@@ -95947,6 +96123,9 @@ class CascaderUtils {
95947
96123
  // 普通模式下的全选判断
95948
96124
  this.isAllSelected = this.selectedCount === this.totalCount;
95949
96125
  }
96126
+ if (this.hasActiveDropdownFilter) {
96127
+ this.updateFilterAllSelectedState();
96128
+ }
95950
96129
  } else {
95951
96130
  // 单选模式:最多只能有一个选中项
95952
96131
  if (newVal.length > 1) {
@@ -95963,6 +96142,11 @@ class CascaderUtils {
95963
96142
  if (val) {
95964
96143
  this.batchSearchVisible = false;
95965
96144
  }
96145
+ },
96146
+ showDropdownFilter(val) {
96147
+ if (!val) {
96148
+ this.dropdownFilterValue = '';
96149
+ }
95966
96150
  }
95967
96151
  },
95968
96152
  mounted() {
@@ -96034,6 +96218,11 @@ class CascaderUtils {
96034
96218
  this.filteredOptions = this.processOptions(this.options);
96035
96219
  this.countTotalItems();
96036
96220
  this.updateSelectedItems();
96221
+ if (this.searchInput) {
96222
+ this.handleSearch();
96223
+ } else if (this.hasActiveDropdownFilter) {
96224
+ this.syncFilterViewSelection();
96225
+ }
96037
96226
  },
96038
96227
  // 处理选项数据,添加禁用状态
96039
96228
  processOptions(options) {
@@ -96122,10 +96311,14 @@ class CascaderUtils {
96122
96311
  this.searchInput = this.searchInput.trim();
96123
96312
  if (this.searchInput === '') {
96124
96313
  this.isShowSearch = false;
96314
+ this.searchOptions = [];
96315
+ if (this.hasActiveDropdownFilter) {
96316
+ this.syncFilterViewSelection();
96317
+ }
96125
96318
  return;
96126
96319
  }
96127
96320
  this.isShowSearch = false;
96128
- this.searchOptions = CascaderUtils.searchInTree(this.filteredOptions, this.searchInput, this.cascaderProps);
96321
+ this.searchOptions = CascaderUtils.searchInTree(this.displayOptions, this.searchInput, this.cascaderProps);
96129
96322
 
96130
96323
  // 只设置搜索范围内的选中值
96131
96324
  this.searchSelectedValues = CascaderUtils.getSearchSelectedValues(this.selectedValues, this.searchOptions, this.cascaderProps);
@@ -96162,7 +96355,7 @@ class CascaderUtils {
96162
96355
  handleExpandChange(values = []) {
96163
96356
  if (values.length === 1) {
96164
96357
  this.$nextTick(() => {
96165
- const panel = this.$refs.cascaderPanel || this.$refs.searchCascaderPanel;
96358
+ const panel = this.isFilterView ? this.$refs.searchCascaderPanel || this.$refs.cascaderPanel : this.$refs.cascaderPanel || this.$refs.searchCascaderPanel;
96166
96359
  if (panel) {
96167
96360
  const menus = panel.menus;
96168
96361
  const targetNode = menus[0].find(node => node.value == values[0]);
@@ -96202,15 +96395,15 @@ class CascaderUtils {
96202
96395
  this.$emit('input', emitValue);
96203
96396
  });
96204
96397
  },
96205
- // 搜索模式值变化处理
96398
+ // 搜索 / 下拉筛选视图值变化处理
96206
96399
  handleSearchValueChange(value) {
96207
- // 获取搜索面板中所有可能的叶子节点值
96208
- const searchLeafValues = CascaderUtils.getLeafValues(this.searchOptions, this.cascaderProps);
96400
+ // 获取当前筛选/搜索视图中所有可能的叶子节点值
96401
+ const viewLeafValues = CascaderUtils.getLeafValues(this.viewOptions, this.cascaderProps);
96209
96402
  if (this.isMultiple) {
96210
- // 多选模式:从主选择列表中移除搜索范围内的项,然后添加搜索面板中选中的项
96403
+ // 多选模式:从主选择列表中移除视图范围内的项,然后添加视图中选中的项
96211
96404
  this.selectedValues = this.selectedValues.filter(path => {
96212
96405
  const leafValue = path[path.length - 1];
96213
- return !searchLeafValues.includes(leafValue);
96406
+ return !viewLeafValues.includes(leafValue);
96214
96407
  });
96215
96408
  this.selectedValues = [...this.selectedValues, ...this.searchSelectedValues];
96216
96409
  } else {
@@ -96280,15 +96473,26 @@ class CascaderUtils {
96280
96473
  // 单选模式下不支持全选
96281
96474
  return;
96282
96475
  }
96283
- if (this.isAllSelected) {
96476
+ const config = {
96477
+ disabledField: this.disabledField,
96478
+ disabledValue: this.disabledValue,
96479
+ disabledCheck: this.disabledCheck
96480
+ };
96481
+ if (this.hasActiveDropdownFilter) {
96482
+ const viewPaths = CascaderUtils.getAllLeafPaths(this.displayOptions, config, this.cascaderProps);
96483
+ const viewLeafSet = new Set(viewPaths.map(path => path[path.length - 1]));
96484
+ if (this.isAllSelected) {
96485
+ this.selectedValues = this.selectedValues.filter(path => !viewLeafSet.has(path[path.length - 1]));
96486
+ } else {
96487
+ const preserved = this.selectedValues.filter(path => !viewLeafSet.has(path[path.length - 1]));
96488
+ this.selectedValues = [...preserved, ...viewPaths];
96489
+ }
96490
+ this.searchSelectedValues = CascaderUtils.getSearchSelectedValues(this.selectedValues, this.viewOptions, this.cascaderProps);
96491
+ this.updateSelectedItems();
96492
+ } else if (this.isAllSelected) {
96284
96493
  this.selectedValues = [];
96285
96494
  this.selectedItems = [];
96286
96495
  } else {
96287
- const config = {
96288
- disabledField: this.disabledField,
96289
- disabledValue: this.disabledValue,
96290
- disabledCheck: this.disabledCheck
96291
- };
96292
96496
  // 无论是普通模式还是聚合模式,全选时都选择所有可选的叶子节点
96293
96497
  this.selectedValues = CascaderUtils.getAllLeafPaths(this.filteredOptions, config, this.cascaderProps);
96294
96498
  this.updateSelectedItems();
@@ -96441,6 +96645,55 @@ class CascaderUtils {
96441
96645
  }
96442
96646
  this.$emit('refresh');
96443
96647
  },
96648
+ getNodeFilterFieldText(data) {
96649
+ if (!this.showDropdownFilter || !this.dropdownFilterField || !data) {
96650
+ return '';
96651
+ }
96652
+ const raw = data.data && typeof data.data === 'object' ? data.data : data;
96653
+ const val = raw[this.dropdownFilterField];
96654
+ if (val === null || val === undefined || val === '') {
96655
+ return '';
96656
+ }
96657
+ return `(${val})`;
96658
+ },
96659
+ updateFilterAllSelectedState() {
96660
+ if (!this.hasActiveDropdownFilter) {
96661
+ return;
96662
+ }
96663
+ const config = {
96664
+ disabledField: this.disabledField,
96665
+ disabledValue: this.disabledValue,
96666
+ disabledCheck: this.disabledCheck
96667
+ };
96668
+ const viewPaths = CascaderUtils.getAllLeafPaths(this.displayOptions, config, this.cascaderProps);
96669
+ if (viewPaths.length === 0) {
96670
+ this.isAllSelected = false;
96671
+ return;
96672
+ }
96673
+ const selectedLeafSet = new Set(this.selectedValues.map(path => path[path.length - 1]));
96674
+ this.isAllSelected = viewPaths.every(path => selectedLeafSet.has(path[path.length - 1]));
96675
+ },
96676
+ syncFilterViewSelection() {
96677
+ this.searchSelectedValues = CascaderUtils.getSearchSelectedValues(this.selectedValues, this.viewOptions, this.cascaderProps);
96678
+ this.$nextTick(() => {
96679
+ if (this.viewOptions.length > 0) {
96680
+ this.handleSearchExpand();
96681
+ }
96682
+ });
96683
+ },
96684
+ handleDropdownFilterChange() {
96685
+ if (this.searchInput) {
96686
+ this.handleSearch();
96687
+ return;
96688
+ }
96689
+ this.isShowSearch = false;
96690
+ this.searchOptions = [];
96691
+ if (this.hasActiveDropdownFilter) {
96692
+ this.syncFilterViewSelection();
96693
+ } else {
96694
+ this.searchSelectedValues = [];
96695
+ }
96696
+ },
96444
96697
  // 处理批量搜索
96445
96698
  handleBatchSearch() {
96446
96699
  if (!this.batchSearchContent.trim()) {
@@ -96563,8 +96816,8 @@ class CascaderUtils {
96563
96816
  ;
96564
96817
  var ByCascaderPanel_component = normalizeComponent(
96565
96818
  cascader_panel_ByCascaderPanelvue_type_script_lang_js,
96566
- ByCascaderPanelvue_type_template_id_727f392c_render,
96567
- ByCascaderPanelvue_type_template_id_727f392c_staticRenderFns,
96819
+ ByCascaderPanelvue_type_template_id_1f03b3c0_render,
96820
+ ByCascaderPanelvue_type_template_id_1f03b3c0_staticRenderFns,
96568
96821
  false,
96569
96822
  null,
96570
96823
  null,
@@ -96573,8 +96826,8 @@ var ByCascaderPanel_component = normalizeComponent(
96573
96826
  )
96574
96827
 
96575
96828
  /* harmony default export */ var ByCascaderPanel = (ByCascaderPanel_component.exports);
96576
- ;// ./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-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-pro/ByCascaderPanelPro.vue?vue&type=template&id=961f637e
96577
- var ByCascaderPanelProvue_type_template_id_961f637e_render = function render() {
96829
+ ;// ./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-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-pro/ByCascaderPanelPro.vue?vue&type=template&id=296ae076
96830
+ var ByCascaderPanelProvue_type_template_id_296ae076_render = function render() {
96578
96831
  var _vm = this,
96579
96832
  _c = _vm._self._c;
96580
96833
  return _c('div', {
@@ -96593,7 +96846,10 @@ var ByCascaderPanelProvue_type_template_id_961f637e_render = function render() {
96593
96846
  }, [_vm._v("可选(" + _vm._s(_vm.selectedCount) + "/" + _vm._s(_vm.totalCount) + ")")]) : _vm._e(), _c('div', {
96594
96847
  staticClass: "search-section"
96595
96848
  }, [_c('div', {
96596
- staticClass: "search-container"
96849
+ staticClass: "search-container",
96850
+ class: {
96851
+ 'has-dropdown-filter': _vm.showDropdownFilter
96852
+ }
96597
96853
  }, [_c('div', {
96598
96854
  staticClass: "search-input-wrap",
96599
96855
  class: {
@@ -96689,7 +96945,37 @@ var ByCascaderPanelProvue_type_template_id_961f637e_render = function render() {
96689
96945
  slot: "reference"
96690
96946
  }, [_c('i', {
96691
96947
  staticClass: "el-icon-edit-outline"
96692
- })])], 1)], 1) : _vm._e()], 1), _vm.showRefreshBtn ? _c('el-tooltip', {
96948
+ })])], 1)], 1) : _vm._e()], 1), _vm.showDropdownFilter ? _c('div', {
96949
+ staticClass: "dropdown-filter-group"
96950
+ }, [_vm.dropdownFilterTitle ? _c('span', {
96951
+ staticClass: "dropdown-filter-title"
96952
+ }, [_vm._v(_vm._s(_vm.dropdownFilterTitle) + ":")]) : _vm._e(), _c('el-select', {
96953
+ staticClass: "dropdown-filter-select",
96954
+ attrs: {
96955
+ "placeholder": _vm.dropdownFilterPlaceholder,
96956
+ "clearable": "",
96957
+ "size": "mini",
96958
+ "disabled": _vm.panelViewMode
96959
+ },
96960
+ on: {
96961
+ "change": _vm.handleDropdownFilterChange
96962
+ },
96963
+ model: {
96964
+ value: _vm.dropdownFilterValue,
96965
+ callback: function ($$v) {
96966
+ _vm.dropdownFilterValue = $$v;
96967
+ },
96968
+ expression: "dropdownFilterValue"
96969
+ }
96970
+ }, _vm._l(_vm.normalizedDropdownFilterOptions, function (opt) {
96971
+ return _c('el-option', {
96972
+ key: 'df-' + opt.value,
96973
+ attrs: {
96974
+ "label": opt.label,
96975
+ "value": opt.value
96976
+ }
96977
+ });
96978
+ }), 1)], 1) : _vm._e(), _vm.showRefreshBtn ? _c('el-tooltip', {
96693
96979
  attrs: {
96694
96980
  "content": _vm.refreshTooltip,
96695
96981
  "placement": "top",
@@ -96730,8 +97016,8 @@ var ByCascaderPanelProvue_type_template_id_961f637e_render = function render() {
96730
97016
  directives: [{
96731
97017
  name: "show",
96732
97018
  rawName: "v-show",
96733
- value: _vm.searchInput === '' || !_vm.isShowSearch,
96734
- expression: "searchInput === '' || !isShowSearch"
97019
+ value: !_vm.isFilterView,
97020
+ expression: "!isFilterView"
96735
97021
  }],
96736
97022
  ref: "cascaderPanel",
96737
97023
  staticClass: "cascader-panel-inner",
@@ -96747,44 +97033,41 @@ var ByCascaderPanelProvue_type_template_id_961f637e_render = function render() {
96747
97033
  "column-min-width": _vm.columnMinWidth,
96748
97034
  "column-max-width": _vm.columnMaxWidth,
96749
97035
  "disabled-config": _vm.disabledConfig,
96750
- "is-view-mode": _vm.panelViewMode
97036
+ "is-view-mode": _vm.panelViewMode,
97037
+ "filter-field": _vm.showDropdownFilter ? _vm.dropdownFilterField : ''
96751
97038
  },
96752
97039
  on: {
96753
97040
  "input": _vm.onMainPanelInput,
96754
97041
  "change": _vm.handleValueChange,
96755
97042
  "store-ready": _vm.schedulePanelSyncFromExternalValue
96756
97043
  }
96757
- }) : _vm._e(), _vm.searchOptions.length > 0 ? _c('VirtualCascaderPanel', {
97044
+ }) : _vm._e(), _vm.viewOptions.length > 0 ? _c('VirtualCascaderPanel', {
96758
97045
  directives: [{
96759
97046
  name: "show",
96760
97047
  rawName: "v-show",
96761
- value: _vm.searchInput !== '' && _vm.isShowSearch,
96762
- expression: "searchInput !== '' && isShowSearch"
97048
+ value: _vm.isFilterView,
97049
+ expression: "isFilterView"
96763
97050
  }],
96764
97051
  ref: "searchCascaderPanel",
96765
97052
  staticClass: "cascader-panel-inner",
96766
97053
  attrs: {
96767
97054
  "value": _vm.compactSearchPanelValue,
96768
97055
  "sync-value-from-parent": false,
96769
- "options": _vm.searchOptions,
97056
+ "options": _vm.viewOptions,
96770
97057
  "props": _vm.cascaderProps,
96771
97058
  "height": _vm.computedPanelHeight - 20,
96772
97059
  "column-min-width": _vm.columnMinWidth,
96773
97060
  "column-max-width": _vm.columnMaxWidth,
96774
97061
  "disabled-config": _vm.disabledConfig,
96775
- "is-view-mode": _vm.panelViewMode
97062
+ "is-view-mode": _vm.panelViewMode,
97063
+ "filter-field": _vm.showDropdownFilter ? _vm.dropdownFilterField : ''
96776
97064
  },
96777
97065
  on: {
96778
97066
  "input": _vm.onSearchPanelInput,
96779
- "change": _vm.handleSearchValueChange
97067
+ "change": _vm.handleSearchValueChange,
97068
+ "store-ready": _vm.syncSearchPanelSelection
96780
97069
  }
96781
- }) : _vm._e(), _vm.isShowSearch && _vm.searchOptions.length === 0 ? _c('div', {
96782
- directives: [{
96783
- name: "show",
96784
- rawName: "v-show",
96785
- value: _vm.searchInput !== '',
96786
- expression: "searchInput !== ''"
96787
- }],
97070
+ }) : _vm._e(), _vm.isFilterView && _vm.viewOptions.length === 0 ? _c('div', {
96788
97071
  staticClass: "empty-search"
96789
97072
  }, [_c('el-empty', {
96790
97073
  attrs: {
@@ -96837,7 +97120,9 @@ var ByCascaderPanelProvue_type_template_id_961f637e_render = function render() {
96837
97120
  staticClass: "item-content"
96838
97121
  }, [_c('div', {
96839
97122
  staticClass: "item-label"
96840
- }, [_vm._v(_vm._s(item.label || ''))]), _vm.showSubtitle && _vm.subtitleField && item[_vm.subtitleField] ? _c('div', {
97123
+ }, [_vm._v(_vm._s(item.label || ''))]), _vm.showDropdownFilter && _vm.getNodeFilterFieldText(item) ? _c('span', {
97124
+ staticClass: "item-filter-field"
97125
+ }, [_vm._v(_vm._s(_vm.getNodeFilterFieldText(item)))]) : _vm._e(), _vm.showSubtitle && _vm.subtitleField && item[_vm.subtitleField] ? _c('div', {
96841
97126
  staticClass: "item-subtitle"
96842
97127
  }, [_vm._v(" " + _vm._s(item[_vm.subtitleField]) + " ")]) : _vm._e()]), !_vm.panelViewMode ? _c('div', {
96843
97128
  staticClass: "remove-btn",
@@ -96850,12 +97135,12 @@ var ByCascaderPanelProvue_type_template_id_961f637e_render = function render() {
96850
97135
  staticClass: "el-icon-close"
96851
97136
  })]) : _vm._e()])])];
96852
97137
  }
96853
- }], null, false, 1087530061)
97138
+ }], null, false, 244936201)
96854
97139
  }) : _c('div', {
96855
97140
  staticClass: "empty-state"
96856
97141
  }, [_vm._v("暂无选中项")])], 1)])])])]);
96857
97142
  };
96858
- var ByCascaderPanelProvue_type_template_id_961f637e_staticRenderFns = [];
97143
+ var ByCascaderPanelProvue_type_template_id_296ae076_staticRenderFns = [];
96859
97144
 
96860
97145
  ;// ./src/components/cascader-panel-pro/cascaderStorePro.js
96861
97146
 
@@ -97147,14 +97432,22 @@ class CascaderUtilsPro {
97147
97432
  minWidth = 180,
97148
97433
  maxWidth = 420,
97149
97434
  extraPadding = 56,
97150
- hasCheckbox = true
97435
+ hasCheckbox = true,
97436
+ filterField = ''
97151
97437
  } = options;
97152
97438
  if (!nodes || nodes.length === 0) {
97153
97439
  return minWidth;
97154
97440
  }
97155
97441
  let maxLabelWidth = 0;
97156
97442
  nodes.forEach(node => {
97157
- maxLabelWidth = Math.max(maxLabelWidth, this.measureCascaderLabelWidth(node.label));
97443
+ let text = node.label || '';
97444
+ if (filterField) {
97445
+ const extra = node.raw && node.raw[filterField];
97446
+ if (extra !== null && extra !== undefined && extra !== '') {
97447
+ text += ` (${extra})`;
97448
+ }
97449
+ }
97450
+ maxLabelWidth = Math.max(maxLabelWidth, this.measureCascaderLabelWidth(text));
97158
97451
  });
97159
97452
  const checkboxWidth = hasCheckbox ? 28 : 0;
97160
97453
  const arrowWidth = 24;
@@ -97313,6 +97606,58 @@ class CascaderUtilsPro {
97313
97606
  return result;
97314
97607
  }
97315
97608
 
97609
+ /**
97610
+ * 判断节点指定字段是否匹配下拉筛选值
97611
+ * @param {Object} node
97612
+ * @param {String} field
97613
+ * @param {*} filterValue
97614
+ * @returns {Boolean}
97615
+ */
97616
+ static isFilterFieldMatched(node, field, filterValue) {
97617
+ if (!node || !field || filterValue === null || filterValue === undefined || filterValue === '') {
97618
+ return false;
97619
+ }
97620
+ const raw = node[field];
97621
+ if (raw === null || raw === undefined || raw === '') {
97622
+ return false;
97623
+ }
97624
+ return String(raw).trim() === String(filterValue).trim();
97625
+ }
97626
+
97627
+ /**
97628
+ * 按数据字段过滤树:保留字段匹配的节点及其祖先路径
97629
+ * @param {Array} tree - 树形数据
97630
+ * @param {String} field - 数据中用于筛选的字段名
97631
+ * @param {*} filterValue - 下拉选中值
97632
+ * @param {Object} cascaderProps - 级联配置
97633
+ * @returns {Array} 过滤后的树
97634
+ */
97635
+ static filterTreeByField(tree, field, filterValue, cascaderProps) {
97636
+ if (!Array.isArray(tree) || !field || filterValue === null || filterValue === undefined || filterValue === '') {
97637
+ return tree || [];
97638
+ }
97639
+ const childrenKey = cascaderProps && cascaderProps.children || 'children';
97640
+ const result = [];
97641
+ tree.forEach(node => {
97642
+ const children = node[childrenKey];
97643
+ const hasChildren = Array.isArray(children) && children.length > 0;
97644
+ if (hasChildren) {
97645
+ const matchedChildren = this.filterTreeByField(children, field, filterValue, cascaderProps);
97646
+ if (matchedChildren.length > 0) {
97647
+ result.push({
97648
+ ...node,
97649
+ [childrenKey]: matchedChildren
97650
+ });
97651
+ }
97652
+ } else if (this.isFilterFieldMatched(node, field, filterValue)) {
97653
+ result.push({
97654
+ ...node
97655
+ });
97656
+ }
97657
+ });
97658
+ return result;
97659
+ }
97660
+
97316
97661
  /**
97317
97662
  * 基于扁平 store 快速搜索(父节点命中时直接复用 raw 子树,跳过子级遍历)
97318
97663
  */
@@ -97856,8 +98201,8 @@ class CascaderUtilsPro {
97856
98201
  return paths;
97857
98202
  }
97858
98203
  }
97859
- ;// ./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-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-pro/VirtualCascaderPanel.vue?vue&type=template&id=05f77638
97860
- var VirtualCascaderPanelvue_type_template_id_05f77638_render = function render() {
98204
+ ;// ./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-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-pro/VirtualCascaderPanel.vue?vue&type=template&id=7d8ff846
98205
+ var VirtualCascaderPanelvue_type_template_id_7d8ff846_render = function render() {
97861
98206
  var _vm = this,
97862
98207
  _c = _vm._self._c;
97863
98208
  return _c('div', {
@@ -97938,7 +98283,9 @@ var VirtualCascaderPanelvue_type_template_id_05f77638_render = function render()
97938
98283
  }
97939
98284
  }, [_c('span')])], 1) : _vm._e(), _c('span', {
97940
98285
  staticClass: "el-cascader-node__label"
97941
- }, [_vm._v(_vm._s(item.label))]), !item.isLeaf ? _c('span', {
98286
+ }, [_vm.filterField ? [_vm._v(" " + _vm._s(item.label)), _vm.getFilterFieldText(item) ? _c('span', {
98287
+ staticClass: "node-filter-field"
98288
+ }, [_vm._v(_vm._s(_vm.getFilterFieldText(item)))]) : _vm._e()] : [_vm._v(_vm._s(item.label))]], 2), !item.isLeaf ? _c('span', {
97942
98289
  staticClass: "el-cascader-node__postfix"
97943
98290
  }, [_c('i', {
97944
98291
  staticClass: "el-icon-arrow-right el-cascader-node__icon-arrow"
@@ -97948,7 +98295,7 @@ var VirtualCascaderPanelvue_type_template_id_05f77638_render = function render()
97948
98295
  })], 1);
97949
98296
  }), 0);
97950
98297
  };
97951
- var VirtualCascaderPanelvue_type_template_id_05f77638_staticRenderFns = [];
98298
+ var VirtualCascaderPanelvue_type_template_id_7d8ff846_staticRenderFns = [];
97952
98299
 
97953
98300
  ;// ./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-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-pro/VirtualList.vue?vue&type=template&id=43cb1148
97954
98301
  var VirtualListvue_type_template_id_43cb1148_render = function render() {
@@ -98432,6 +98779,11 @@ class SelectionStatePro {
98432
98779
  syncValueFromParent: {
98433
98780
  type: Boolean,
98434
98781
  default: true
98782
+ },
98783
+ // 下拉筛选字段名:有值时在节点名称后展示该字段内容
98784
+ filterField: {
98785
+ type: String,
98786
+ default: ''
98435
98787
  }
98436
98788
  },
98437
98789
  data() {
@@ -98548,7 +98900,8 @@ class SelectionStatePro {
98548
98900
  const width = CascaderUtilsPro.getCascaderColumnWidth(columnNodes, {
98549
98901
  minWidth: this.columnMinWidth,
98550
98902
  maxWidth: this.columnMaxWidth,
98551
- hasCheckbox: this.multiple || this.checkStrictly
98903
+ hasCheckbox: this.multiple || this.checkStrictly,
98904
+ filterField: this.filterField
98552
98905
  });
98553
98906
  return {
98554
98907
  width: width + 'px',
@@ -98556,6 +98909,17 @@ class SelectionStatePro {
98556
98909
  maxWidth: width + 'px'
98557
98910
  };
98558
98911
  },
98912
+ getFilterFieldText(item) {
98913
+ if (!this.filterField || !item) {
98914
+ return '';
98915
+ }
98916
+ const raw = item.raw || item;
98917
+ const val = raw[this.filterField];
98918
+ if (val === null || val === undefined || val === '') {
98919
+ return '';
98920
+ }
98921
+ return `(${val})`;
98922
+ },
98559
98923
  rebuildStore() {
98560
98924
  this.store = buildCascaderStore(this.options, this.disabledConfig, this.props, CascaderUtilsPro);
98561
98925
  this.selection = new SelectionStatePro(this.store);
@@ -98865,8 +99229,8 @@ class SelectionStatePro {
98865
99229
  ;
98866
99230
  var VirtualCascaderPanel_component = normalizeComponent(
98867
99231
  cascader_panel_pro_VirtualCascaderPanelvue_type_script_lang_js,
98868
- VirtualCascaderPanelvue_type_template_id_05f77638_render,
98869
- VirtualCascaderPanelvue_type_template_id_05f77638_staticRenderFns,
99232
+ VirtualCascaderPanelvue_type_template_id_7d8ff846_render,
99233
+ VirtualCascaderPanelvue_type_template_id_7d8ff846_staticRenderFns,
98870
99234
  false,
98871
99235
  null,
98872
99236
  null,
@@ -99022,6 +99386,15 @@ var VirtualCascaderPanel_component = normalizeComponent(
99022
99386
  columnMaxWidth: {
99023
99387
  type: Number,
99024
99388
  default: 420
99389
+ },
99390
+ /**
99391
+ * 下拉筛选配置。外部传入且 enabled 不为 false、并指定 field 时才展示下拉框。
99392
+ * { enabled, title, placeholder, options: [{ label, value }], field }
99393
+ * field 为数据中用于过滤和展示的字段名。
99394
+ */
99395
+ dropdownFilter: {
99396
+ type: Object,
99397
+ default: null
99025
99398
  }
99026
99399
  },
99027
99400
  data() {
@@ -99049,7 +99422,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
99049
99422
  searchLeafSetCache: null,
99050
99423
  panelSyncTimer: null,
99051
99424
  // 外部 v-model 回显同步中,避免与用户操作冲突
99052
- isExternalSync: false
99425
+ isExternalSync: false,
99426
+ dropdownFilterValue: ''
99053
99427
  };
99054
99428
  },
99055
99429
  computed: {
@@ -99150,6 +99524,59 @@ var VirtualCascaderPanel_component = normalizeComponent(
99150
99524
  this.searchSelectedValues = value ? [value] : [];
99151
99525
  }
99152
99526
  }
99527
+ },
99528
+ showDropdownFilter() {
99529
+ const cfg = this.dropdownFilter;
99530
+ return !!(cfg && typeof cfg === 'object' && cfg.enabled !== false && cfg.field);
99531
+ },
99532
+ dropdownFilterPlaceholder() {
99533
+ return this.dropdownFilter && this.dropdownFilter.placeholder || '请选择';
99534
+ },
99535
+ dropdownFilterTitle() {
99536
+ const title = this.dropdownFilter && this.dropdownFilter.title;
99537
+ return title != null && String(title).trim() !== '' ? String(title).trim() : '';
99538
+ },
99539
+ dropdownFilterField() {
99540
+ return this.dropdownFilter && this.dropdownFilter.field || '';
99541
+ },
99542
+ normalizedDropdownFilterOptions() {
99543
+ const opts = this.dropdownFilter && this.dropdownFilter.options || [];
99544
+ return opts.map(opt => {
99545
+ if (opt != null && typeof opt === 'object') {
99546
+ return {
99547
+ label: opt.label != null ? opt.label : opt.value,
99548
+ value: opt.value != null ? opt.value : opt.label
99549
+ };
99550
+ }
99551
+ return {
99552
+ label: String(opt),
99553
+ value: opt
99554
+ };
99555
+ });
99556
+ },
99557
+ hasActiveDropdownFilter() {
99558
+ return this.showDropdownFilter && this.dropdownFilterValue !== '' && this.dropdownFilterValue !== null && this.dropdownFilterValue !== undefined;
99559
+ },
99560
+ displayOptions() {
99561
+ if (!this.hasActiveDropdownFilter) {
99562
+ return this.filteredOptions;
99563
+ }
99564
+ return CascaderUtilsPro.filterTreeByField(this.filteredOptions, this.dropdownFilterField, this.dropdownFilterValue, this.cascaderProps);
99565
+ },
99566
+ isFilterView() {
99567
+ if (this.searchInput !== '' && this.isShowSearch) {
99568
+ return true;
99569
+ }
99570
+ return this.hasActiveDropdownFilter;
99571
+ },
99572
+ viewOptions() {
99573
+ if (this.searchInput !== '' && this.isShowSearch) {
99574
+ return this.searchOptions;
99575
+ }
99576
+ if (this.hasActiveDropdownFilter) {
99577
+ return this.displayOptions;
99578
+ }
99579
+ return [];
99153
99580
  }
99154
99581
  },
99155
99582
  watch: {
@@ -99175,6 +99602,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
99175
99602
  searchInput(val) {
99176
99603
  if (!val) {
99177
99604
  this.clearSearchState();
99605
+ if (this.hasActiveDropdownFilter) {
99606
+ this.prepareFilterView();
99607
+ }
99178
99608
  return;
99179
99609
  }
99180
99610
  this.scheduleSearch();
@@ -99202,6 +99632,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
99202
99632
  } else if (panel && panel.store && panel.selection && this.aggregationMode) {
99203
99633
  this.isAllSelected = panel.selection.size() === panel.store.totalLeafCount && panel.store.totalLeafCount > 0;
99204
99634
  }
99635
+ if (this.hasActiveDropdownFilter) {
99636
+ this.updateFilterAllSelectedState();
99637
+ }
99205
99638
  } else {
99206
99639
  if (newVal.length > 1) {
99207
99640
  this.selectedItems = [newVal[newVal.length - 1]];
@@ -99216,6 +99649,11 @@ var VirtualCascaderPanel_component = normalizeComponent(
99216
99649
  if (val) {
99217
99650
  this.batchSearchVisible = false;
99218
99651
  }
99652
+ },
99653
+ showDropdownFilter(val) {
99654
+ if (!val) {
99655
+ this.dropdownFilterValue = '';
99656
+ }
99219
99657
  }
99220
99658
  },
99221
99659
  mounted() {
@@ -99269,6 +99707,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
99269
99707
  this.selectedValues = selection.getCheckedPaths();
99270
99708
  }
99271
99709
  panel.bumpSelectionView();
99710
+ if (this.hasActiveDropdownFilter) {
99711
+ this.updateFilterAllSelectedState();
99712
+ }
99272
99713
  return;
99273
99714
  }
99274
99715
  if (selection.isCompactSelection()) {
@@ -99276,11 +99717,17 @@ var VirtualCascaderPanel_component = normalizeComponent(
99276
99717
  this.selectedCount = selection.size();
99277
99718
  this.isAllSelected = selection.size() === store.totalLeafCount;
99278
99719
  panel.bumpSelectionView();
99720
+ if (this.hasActiveDropdownFilter) {
99721
+ this.updateFilterAllSelectedState();
99722
+ }
99279
99723
  return;
99280
99724
  }
99281
99725
  this.selectedValues = selection.getCheckedPaths();
99282
99726
  this.updateSelectedItems();
99283
99727
  panel.bumpSelectionView();
99728
+ if (this.hasActiveDropdownFilter) {
99729
+ this.updateFilterAllSelectedState();
99730
+ }
99284
99731
  },
99285
99732
  /**
99286
99733
  * 用户操作(勾选/全选/清除/删除)统一提交:更新展示 + emit,标记内部更新防回显覆盖
@@ -99534,6 +99981,11 @@ var VirtualCascaderPanel_component = normalizeComponent(
99534
99981
  } else {
99535
99982
  this.updateSelectedItems();
99536
99983
  }
99984
+ if (this.searchInput) {
99985
+ this.scheduleSearch();
99986
+ } else if (this.hasActiveDropdownFilter) {
99987
+ this.prepareFilterView();
99988
+ }
99537
99989
  },
99538
99990
  // 处理选项数据,添加禁用状态(浅拷贝,避免 JSON 深拷贝大数据卡顿)
99539
99991
  processOptions(options) {
@@ -99619,13 +100071,20 @@ var VirtualCascaderPanel_component = normalizeComponent(
99619
100071
  const keyword = this.searchInput.trim();
99620
100072
  if (!keyword) {
99621
100073
  this.clearSearchState();
100074
+ if (this.hasActiveDropdownFilter) {
100075
+ this.prepareFilterView();
100076
+ }
99622
100077
  return;
99623
100078
  }
99624
- const panel = this.$refs.cascaderPanel;
99625
- if (panel && panel.store) {
99626
- this.searchOptions = CascaderUtilsPro.searchFromStore(panel.store, keyword, this.cascaderProps);
100079
+ if (this.hasActiveDropdownFilter) {
100080
+ this.searchOptions = CascaderUtilsPro.searchInTree(this.displayOptions, keyword, this.cascaderProps);
99627
100081
  } else {
99628
- this.searchOptions = CascaderUtilsPro.searchInTree(this.filteredOptions, keyword, this.cascaderProps);
100082
+ const panel = this.$refs.cascaderPanel;
100083
+ if (panel && panel.store) {
100084
+ this.searchOptions = CascaderUtilsPro.searchFromStore(panel.store, keyword, this.cascaderProps);
100085
+ } else {
100086
+ this.searchOptions = CascaderUtilsPro.searchInTree(this.filteredOptions, keyword, this.cascaderProps);
100087
+ }
99629
100088
  }
99630
100089
  this.searchLeafSetCache = new Set(CascaderUtilsPro.getLeafValues(this.searchOptions, this.cascaderProps));
99631
100090
  this.searchSelectedValues = this.getSearchSelectedPathsFromMain(this.searchLeafSetCache);
@@ -99657,7 +100116,7 @@ var VirtualCascaderPanel_component = normalizeComponent(
99657
100116
  if (this.searchLeafSetCache) {
99658
100117
  return this.searchLeafSetCache;
99659
100118
  }
99660
- return new Set(CascaderUtilsPro.getLeafValues(this.searchOptions, this.cascaderProps));
100119
+ return new Set(CascaderUtilsPro.getLeafValues(this.viewOptions, this.cascaderProps));
99661
100120
  },
99662
100121
  syncSearchPanelSelection() {
99663
100122
  const searchPanel = this.$refs.searchCascaderPanel;
@@ -99677,12 +100136,57 @@ var VirtualCascaderPanel_component = normalizeComponent(
99677
100136
  },
99678
100137
  // 搜索模式下的展开处理
99679
100138
  handleSearchExpand() {
99680
- if (this.$refs.searchCascaderPanel && this.searchOptions.length > 0) {
99681
- const firstOption = this.searchOptions[0];
100139
+ if (this.$refs.searchCascaderPanel && this.viewOptions.length > 0) {
100140
+ const firstOption = this.viewOptions[0];
99682
100141
  const valueKey = this.cascaderProps.value || 'value';
99683
100142
  this.$refs.searchCascaderPanel.expandPathValues([firstOption[valueKey]], true);
99684
100143
  }
99685
100144
  },
100145
+ prepareFilterView() {
100146
+ this.searchLeafSetCache = new Set(CascaderUtilsPro.getLeafValues(this.displayOptions, this.cascaderProps));
100147
+ this.$nextTick(() => {
100148
+ this.syncSearchPanelSelection();
100149
+ this.handleSearchExpand();
100150
+ });
100151
+ },
100152
+ handleDropdownFilterChange() {
100153
+ if (this.searchInput) {
100154
+ this.scheduleSearch();
100155
+ return;
100156
+ }
100157
+ this.clearSearchState();
100158
+ if (this.hasActiveDropdownFilter) {
100159
+ this.prepareFilterView();
100160
+ }
100161
+ },
100162
+ getNodeFilterFieldText(data) {
100163
+ if (!this.showDropdownFilter || !this.dropdownFilterField || !data) {
100164
+ return '';
100165
+ }
100166
+ const raw = data.data && typeof data.data === 'object' ? data.data : data;
100167
+ const val = raw[this.dropdownFilterField];
100168
+ if (val === null || val === undefined || val === '') {
100169
+ return '';
100170
+ }
100171
+ return `(${val})`;
100172
+ },
100173
+ updateFilterAllSelectedState() {
100174
+ if (!this.hasActiveDropdownFilter) {
100175
+ return;
100176
+ }
100177
+ const viewPaths = CascaderUtilsPro.getAllLeafPaths(this.displayOptions, this.disabledConfig, this.cascaderProps);
100178
+ if (viewPaths.length === 0) {
100179
+ this.isAllSelected = false;
100180
+ return;
100181
+ }
100182
+ const panel = this.$refs.cascaderPanel;
100183
+ if (panel && panel.selection && panel.selection.selectedLeafSet) {
100184
+ this.isAllSelected = viewPaths.every(path => panel.selection.selectedLeafSet.has(path[path.length - 1]));
100185
+ return;
100186
+ }
100187
+ const selectedLeafSet = new Set(this.selectedValues.map(path => path[path.length - 1]));
100188
+ this.isAllSelected = viewPaths.every(path => selectedLeafSet.has(path[path.length - 1]));
100189
+ },
99686
100190
  // 值变化处理(面板勾选)
99687
100191
  handleValueChange() {
99688
100192
  this.commitUserSelectionChange();
@@ -99774,6 +100278,26 @@ var VirtualCascaderPanel_component = normalizeComponent(
99774
100278
  }
99775
100279
  const panel = this.$refs.cascaderPanel;
99776
100280
  const searchPanel = this.$refs.searchCascaderPanel;
100281
+ if (this.hasActiveDropdownFilter && panel && panel.selection && panel.store) {
100282
+ const viewPaths = CascaderUtilsPro.getAllLeafPaths(this.displayOptions, this.disabledConfig, this.cascaderProps);
100283
+ const viewLeafSet = new Set(viewPaths.map(path => path[path.length - 1]));
100284
+ if (this.isAllSelected) {
100285
+ viewLeafSet.forEach(leaf => {
100286
+ panel.selection.selectedLeafSet.delete(leaf);
100287
+ });
100288
+ } else {
100289
+ viewLeafSet.forEach(leaf => {
100290
+ panel.selection.selectedLeafSet.add(leaf);
100291
+ });
100292
+ }
100293
+ panel.selection._reconcileAllRoots();
100294
+ panel.bumpSelectionView();
100295
+ if (searchPanel && searchPanel.selection) {
100296
+ this.syncSearchPanelSelection();
100297
+ }
100298
+ this.commitUserSelectionChange();
100299
+ return;
100300
+ }
99777
100301
  if (this.isAllSelected) {
99778
100302
  this.clearPanelSelectionState(panel);
99779
100303
  this.clearPanelSelectionState(searchPanel);
@@ -99899,6 +100423,9 @@ var VirtualCascaderPanel_component = normalizeComponent(
99899
100423
  if (this.panelViewMode) return;
99900
100424
  this.searchInput = '';
99901
100425
  this.clearSearchState();
100426
+ if (this.hasActiveDropdownFilter) {
100427
+ this.prepareFilterView();
100428
+ }
99902
100429
  this.$emit('refresh');
99903
100430
  },
99904
100431
  // 处理批量搜索
@@ -100027,8 +100554,8 @@ var VirtualCascaderPanel_component = normalizeComponent(
100027
100554
  ;
100028
100555
  var ByCascaderPanelPro_component = normalizeComponent(
100029
100556
  cascader_panel_pro_ByCascaderPanelProvue_type_script_lang_js,
100030
- ByCascaderPanelProvue_type_template_id_961f637e_render,
100031
- ByCascaderPanelProvue_type_template_id_961f637e_staticRenderFns,
100557
+ ByCascaderPanelProvue_type_template_id_296ae076_render,
100558
+ ByCascaderPanelProvue_type_template_id_296ae076_staticRenderFns,
100032
100559
  false,
100033
100560
  null,
100034
100561
  null,