@weitutech/by-components 1.1.81 → 1.1.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -61092,6 +61092,38 @@ const deepClone = target => {
61092
61092
  // 返回最终结果
61093
61093
  return result;
61094
61094
  };
61095
+
61096
+ /**
61097
+ * 比较两个值是否相等,支持字符串和数字类型的自动转换
61098
+ * @param {*} value1 第一个值
61099
+ * @param {*} value2 第二个值
61100
+ * @returns {boolean} 是否相等
61101
+ */
61102
+ const isValueEqual = (value1, value2) => {
61103
+ // 如果两个值严格相等,直接返回 true
61104
+ if (value1 === value2) {
61105
+ return true;
61106
+ }
61107
+
61108
+ // 处理 0 的特殊情况
61109
+ if (value1 === 0 && value2 === 0) {
61110
+ return true;
61111
+ }
61112
+
61113
+ // 尝试数字转换比较
61114
+ const num1 = Number(value1);
61115
+ const num2 = Number(value2);
61116
+
61117
+ // 如果转换后都是有效数字且相等
61118
+ if (!isNaN(num1) && !isNaN(num2) && num1 === num2) {
61119
+ return true;
61120
+ }
61121
+
61122
+ // 尝试字符串转换比较
61123
+ const str1 = String(value1);
61124
+ const str2 = String(value2);
61125
+ return str1 === str2;
61126
+ };
61095
61127
  ;// ./src/utils/tableUtils.js
61096
61128
 
61097
61129
 
@@ -63066,8 +63098,8 @@ var custom_date_picker_component = normalizeComponent(
63066
63098
  )
63067
63099
 
63068
63100
  /* harmony default export */ var custom_date_picker = (custom_date_picker_component.exports);
63069
- ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7d802f52-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/common-selector/ByCommonSelector.vue?vue&type=template&id=2c9d1694
63070
- var ByCommonSelectorvue_type_template_id_2c9d1694_render = function render() {
63101
+ ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7d802f52-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/common-selector/ByCommonSelector.vue?vue&type=template&id=36584f2f
63102
+ var ByCommonSelectorvue_type_template_id_36584f2f_render = function render() {
63071
63103
  var _vm = this,
63072
63104
  _c = _vm._self._c;
63073
63105
  return _c('div', {
@@ -63113,7 +63145,8 @@ var ByCommonSelectorvue_type_template_id_2c9d1694_render = function render() {
63113
63145
  "collapse-tags": _vm.multiple && _vm.enhancedCollapseTags,
63114
63146
  "remote-method": _vm.getResult,
63115
63147
  "loading": _vm.loading,
63116
- "placeholder": _vm.placeholder
63148
+ "placeholder": _vm.placeholder,
63149
+ "disabled": _vm.enhancedDisabled
63117
63150
  },
63118
63151
  on: {
63119
63152
  "change": _vm.selected,
@@ -63509,7 +63542,7 @@ var ByCommonSelectorvue_type_template_id_2c9d1694_render = function render() {
63509
63542
  }
63510
63543
  }, [_vm._v(" 加载中... ")]) : _vm._e()], 2);
63511
63544
  };
63512
- var ByCommonSelectorvue_type_template_id_2c9d1694_staticRenderFns = [];
63545
+ var ByCommonSelectorvue_type_template_id_36584f2f_staticRenderFns = [];
63513
63546
 
63514
63547
  ;// ./node_modules/pinyin-pro/dist/index.mjs
63515
63548
 
@@ -73790,8 +73823,10 @@ function segment(word, options) {
73790
73823
 
73791
73824
 
73792
73825
 
73826
+
73793
73827
  //拼音库,用于搜索栏生成A~Z字母
73794
73828
 
73829
+
73795
73830
  // 全部选项可能的名称
73796
73831
  const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'all'];
73797
73832
  /* harmony default export */ var ByCommonSelectorvue_type_script_lang_js = ({
@@ -73993,7 +74028,7 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
73993
74028
  default: 'status'
73994
74029
  },
73995
74030
  /**
73996
- * 增强下拉选择器中,选项的description字段是否
74031
+ * 增强下拉选择器中,选项的description字段是否显示
73997
74032
  * true: 显示 标题 + 描述 (如: 何其灿 13063048088)
73998
74033
  * false: 只显示 标题
73999
74034
  */
@@ -74053,7 +74088,9 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
74053
74088
  // enhancedSelect 相关数据
74054
74089
  allData: new Map(),
74055
74090
  // 缓存所有数据
74056
- enhancedSelectOpened: false // 标记 enhancedSelect 是否已经打开过
74091
+ enhancedSelectOpened: false,
74092
+ // 标记 enhancedSelect 是否已经打开过
74093
+ enhancedDisabled: false
74057
74094
  };
74058
74095
  },
74059
74096
  computed: {
@@ -74076,13 +74113,13 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
74076
74113
  if (this.multiple) {
74077
74114
  // 多选情况:value 是数组
74078
74115
  if (Array.isArray(this.value) && this.value.length > 0) {
74079
- const defaultItems = this.enhancedAllOptions.filter(option => this.value.includes(option.id) || this.value.includes(Number(option.id)) || this.value.includes(0) && option.id === 0);
74116
+ const defaultItems = this.enhancedAllOptions.filter(option => this.value.some(val => isValueEqual(val, option.id)));
74080
74117
  return defaultItems;
74081
74118
  }
74082
74119
  } else {
74083
74120
  // 单选情况:value 是单个值
74084
74121
  if (this.value !== '') {
74085
- const defaultItem = this.enhancedAllOptions.find(option => option.id === this.value || option.id === Number(this.value) || this.value === 0 && option.id === 0);
74122
+ const defaultItem = this.enhancedAllOptions.find(option => isValueEqual(this.value, option.id));
74086
74123
  return defaultItem ? [defaultItem] : [];
74087
74124
  }
74088
74125
  }
@@ -74190,6 +74227,25 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
74190
74227
  if (val !== this.localSuffixInputValue) {
74191
74228
  this.localSuffixInputValue = val;
74192
74229
  }
74230
+ },
74231
+ enhancedAllOptions: {
74232
+ handler(newOptions) {
74233
+ if (this.type === 'enhancedSelect') {
74234
+ this.enhancedDisabled = true;
74235
+ // 验证 enhancedAllOptions 是否已加载
74236
+ if (!newOptions || newOptions.length === 0) {
74237
+ // console.warn('[ByCommonSelector] enhancedSelect 类型需要提供 enhancedAllOptions 属性用于默认值回显')
74238
+ return;
74239
+ }
74240
+
74241
+ // 当 enhancedAllOptions 加载完成后,重新处理默认值
74242
+ this.$nextTick(() => {
74243
+ this.handleEnhancedSelectDefaultValue();
74244
+ this.enhancedDisabled = false;
74245
+ });
74246
+ }
74247
+ },
74248
+ immediate: true
74193
74249
  }
74194
74250
  },
74195
74251
  created() {
@@ -74202,11 +74258,6 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
74202
74258
  }
74203
74259
  },
74204
74260
  mounted() {
74205
- // 验证 enhancedSelect 类型是否提供了 enhancedAllOptions
74206
- if (this.type === 'enhancedSelect' && (!this.enhancedAllOptions || this.enhancedAllOptions.length === 0)) {
74207
- console.error('[ByCommonSelector] enhancedSelect 类型需要提供 enhancedAllOptions 属性用于默认值回显');
74208
- }
74209
-
74210
74261
  // 在组件挂载后,检查是否需要展开按钮
74211
74262
  this.$nextTick(() => {
74212
74263
  this.checkNeedExpand();
@@ -74370,10 +74421,6 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
74370
74421
  this.$nextTick(() => {
74371
74422
  this.checkNeedExpand();
74372
74423
  this.scheduleExpandCheck();
74373
- // 异步加载数据后,重新处理默认值(仅 enhancedSelect)
74374
- if (this.type === 'enhancedSelect') {
74375
- this.handleEnhancedSelectDefaultValue();
74376
- }
74377
74424
  });
74378
74425
  } else {
74379
74426
  // console.error('loadOptions函数返回值必须是数组')
@@ -74555,14 +74602,14 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
74555
74602
  // 修复:优先从 enhancedAllOptions 中查找,确保多选时能正确获取对象数组
74556
74603
  if (Array.isArray(value) && value.length > 0) {
74557
74604
  // 从 enhancedAllOptions 中查找所有匹配的选项
74558
- const items = this.enhancedAllOptions.filter(option => value.includes(option.id) || value.includes(Number(option.id)) || value.includes(0) && option.id === 0);
74605
+ const items = this.enhancedAllOptions.filter(option => value.some(val => isValueEqual(val, option.id)));
74559
74606
  obj = items;
74560
74607
  }
74561
74608
  } else {
74562
74609
  obj = {};
74563
74610
  if (value !== undefined && value !== null && value !== '') {
74564
74611
  // 优先从 enhancedAllOptions 中查找
74565
- const item = this.enhancedAllOptions.find(option => option.id === value || option.id === Number(value) || value === 0 && option.id === 0);
74612
+ const item = this.enhancedAllOptions.find(option => isValueEqual(value, option.id));
74566
74613
  if (item) {
74567
74614
  obj[this.enhancedDescriptionKey] = item[this.enhancedDescriptionKey];
74568
74615
  obj[this.enhancedTitleKey] = item[this.enhancedTitleKey];
@@ -74570,7 +74617,7 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
74570
74617
  } else {
74571
74618
  // 如果从 enhancedAllOptions 中找不到,再从 dataList 中查找
74572
74619
  this.dataList.forEach(item => {
74573
- if (value === item.id || value === 0 && item.id === 0) {
74620
+ if (isValueEqual(value, item.id)) {
74574
74621
  obj[this.enhancedDescriptionKey] = item[this.enhancedDescriptionKey];
74575
74622
  obj[this.enhancedTitleKey] = item[this.enhancedTitleKey];
74576
74623
  obj.id = item.id;
@@ -74660,7 +74707,6 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
74660
74707
  }
74661
74708
  },
74662
74709
  emitChange(value) {
74663
- // console.log('001:触发了-emitChange ==:', value)
74664
74710
  this.$emit('input', value);
74665
74711
  },
74666
74712
  handleSuffixInputChange(value) {
@@ -74669,37 +74715,27 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
74669
74715
  this.$emit('update:suffixInputValue', value);
74670
74716
  },
74671
74717
  // ******************** enhancedSelect 相关方法 ********************
74718
+
74672
74719
  getResult(q) {
74673
- // 设置加载状态
74674
74720
  this.loading = true;
74675
-
74676
- // 触发外部搜索事件,让外部控制数据
74677
74721
  this.$emit('search', q);
74678
-
74679
- // 返回 Promise 以满足 remote 的要求
74680
74722
  return Promise.resolve();
74681
74723
  },
74724
+ // 处理 enhancedSelect 类型的默认值
74682
74725
  handleEnhancedSelectDefaultValue() {
74683
- // console.log('001:this.value ==:', this.value)
74684
- // console.log('002:this.enhancedAllOptions ==:', this.enhancedAllOptions)
74685
- // 针对 enhancedSelect 类型处理默认值
74686
- if (this.value !== undefined && this.value !== null && this.value !== '') {
74726
+ if (this.value !== undefined && this.value !== null && this.value !== '' && this.enhancedAllOptions && this.enhancedAllOptions.length > 0) {
74687
74727
  // 确保默认值能正确显示
74688
74728
  this.selectedValue = this.value;
74689
74729
  if (this.multiple) {
74690
- // 多选情况:value 是数组
74691
74730
  if (Array.isArray(this.value) && this.value.length > 0) {
74692
- // enhancedAllOptions 数组中查找所有对应的选项
74693
- const items = this.enhancedAllOptions.filter(option => this.value.includes(option.id) || this.value.includes(Number(option.id)) || this.value.includes(0) && option.id === 0);
74731
+ const items = this.enhancedAllOptions.filter(option => this.value.some(val => isValueEqual(val, option.id)));
74694
74732
  if (items.length > 0) {
74695
74733
  this.$emit('input', this.value);
74696
74734
  this.$emit('change', items);
74697
74735
  }
74698
74736
  }
74699
74737
  } else {
74700
- // 单选情况:value 是单个值
74701
- // 在 enhancedAllOptions 数组中查找对应的选项
74702
- const item = this.enhancedAllOptions.find(option => option.id === this.value || option.id === Number(this.value) || this.value === 0 && option.id === 0);
74738
+ const item = this.enhancedAllOptions.find(option => isValueEqual(this.value, option.id));
74703
74739
  if (item) {
74704
74740
  let obj = {};
74705
74741
  obj[this.enhancedDescriptionKey] = item[this.enhancedDescriptionKey];
@@ -74736,8 +74772,8 @@ const allOptionsNames = ['全部', '全选', '所有', '全部选项', 'All', 'a
74736
74772
  ;
74737
74773
  var ByCommonSelector_component = normalizeComponent(
74738
74774
  common_selector_ByCommonSelectorvue_type_script_lang_js,
74739
- ByCommonSelectorvue_type_template_id_2c9d1694_render,
74740
- ByCommonSelectorvue_type_template_id_2c9d1694_staticRenderFns,
74775
+ ByCommonSelectorvue_type_template_id_36584f2f_render,
74776
+ ByCommonSelectorvue_type_template_id_36584f2f_staticRenderFns,
74741
74777
  false,
74742
74778
  null,
74743
74779
  null,