@ctzy-web-client/plugin-component-vue 1.0.23 → 1.0.24

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.
Files changed (131) hide show
  1. package/es/advance-select/advance-operation.mjs +51 -37
  2. package/es/advance-select/advance-option.mjs +167 -97
  3. package/es/advance-select/advance-option.vue_vue_type_style_index_0_scoped_bc8f5626_lang.mjs +7 -0
  4. package/es/advance-select/advance-select.mjs +368 -310
  5. package/es/advance-select/index.mjs +5 -5
  6. package/es/application-slot/breadcrumb-item.mjs +20 -17
  7. package/es/application-slot/header-tools-item.mjs +20 -17
  8. package/es/breadcrumb-select/breadcrumb-select.mjs +134 -112
  9. package/es/contextmenu/contextmenu-item.mjs +19 -15
  10. package/es/contextmenu/contextmenu.mjs +72 -56
  11. package/es/data-form/data-form-item.mjs +48 -30
  12. package/es/data-form/data-form.mjs +213 -166
  13. package/es/data-form/form-components/bwa-date-picker.mjs +51 -39
  14. package/es/data-form/form-components/bwa-date-time-picker.mjs +56 -44
  15. package/es/data-form/form-components/bwa-input-float.mjs +48 -37
  16. package/es/data-form/form-components/bwa-input-integer.mjs +68 -50
  17. package/es/data-form/form-components/bwa-input.mjs +43 -32
  18. package/es/data-form/form-components/bwa-multi-select.mjs +40 -29
  19. package/es/data-form/form-components/bwa-rich-text-tinymce.mjs +554 -218
  20. package/es/data-form/form-components/bwa-rich-text.mjs +404 -316
  21. package/es/data-form/form-components/bwa-select.mjs +84 -70
  22. package/es/data-form/form-components/bwa-textarea.mjs +38 -27
  23. package/es/data-form/form-components/bwa-upload.mjs +172 -148
  24. package/es/data-form/form-components/bwa-user-multi-select.mjs +35 -24
  25. package/es/data-form/form-components/bwa-user-select.mjs +86 -61
  26. package/es/data-table/data-column-view.mjs +146 -115
  27. package/es/data-table/data-table-card.mjs +48 -40
  28. package/es/data-table/data-table-column.mjs +58 -45
  29. package/es/data-table/data-table.mjs +402 -316
  30. package/es/datatable-settings/datatable-settings.mjs +329 -254
  31. package/es/date-range/date-picker.mjs +130 -116
  32. package/es/date-range/date-range.mjs +215 -161
  33. package/es/drag-list/drag-item.mjs +56 -42
  34. package/es/drag-list/drag-list.mjs +60 -47
  35. package/es/dragable/dragable-item.mjs +23 -18
  36. package/es/dragable/dragable-operation.mjs +32 -24
  37. package/es/dragable/dragable.mjs +32 -23
  38. package/es/filter-panel/conditions/date-range-condition.mjs +50 -40
  39. package/es/filter-panel/conditions/department-condition/department-condition.mjs +99 -72
  40. package/es/filter-panel/conditions/department-condition/department-node.mjs +73 -59
  41. package/es/filter-panel/conditions/input-condition.mjs +90 -76
  42. package/es/filter-panel/conditions/multi-user-condition.mjs +67 -57
  43. package/es/filter-panel/conditions/multiple-menu-condition.mjs +54 -35
  44. package/es/filter-panel/conditions/single-menu-condition.mjs +65 -60
  45. package/es/filter-panel/conditions/single-user-condition.mjs +67 -57
  46. package/es/filter-panel/filter-panel-item.mjs +54 -39
  47. package/es/filter-panel/filter-panel.mjs +153 -135
  48. package/es/layout/layout.mjs +85 -78
  49. package/es/menu/menu-item.mjs +67 -52
  50. package/es/menu/menu.mjs +70 -53
  51. package/es/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.mjs +28 -0
  52. package/es/panel/panel.mjs +53 -40
  53. package/es/pct-filter-panel/pct-compents/pct-Input-condition.mjs +74 -63
  54. package/es/pct-filter-panel/pct-compents/pct-date-range-condition.mjs +76 -67
  55. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition.mjs +406 -178
  56. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.mjs +153 -138
  57. package/es/pct-filter-panel/pct-filter-panel-item.mjs +55 -40
  58. package/es/pct-filter-panel/pct-filter-panel.mjs +247 -227
  59. package/es/progress/progress-item.mjs +81 -61
  60. package/es/progress/progress.mjs +78 -64
  61. package/es/where-filter-panel/where-filter-panel.mjs +15 -12
  62. package/lib/advance-select/advance-operation.js +50 -36
  63. package/lib/advance-select/advance-option.js +166 -96
  64. package/lib/advance-select/advance-option.vue_vue_type_style_index_0_scoped_bc8f5626_lang.js +12 -0
  65. package/lib/advance-select/advance-select.js +366 -308
  66. package/lib/application-slot/breadcrumb-item.js +19 -16
  67. package/lib/application-slot/header-tools-item.js +19 -16
  68. package/lib/breadcrumb-select/breadcrumb-select.js +133 -111
  69. package/lib/contextmenu/contextmenu-item.js +18 -14
  70. package/lib/contextmenu/contextmenu.js +71 -55
  71. package/lib/data-form/data-form-item.js +47 -29
  72. package/lib/data-form/data-form.js +212 -165
  73. package/lib/data-form/form-components/bwa-date-picker.js +50 -38
  74. package/lib/data-form/form-components/bwa-date-time-picker.js +55 -43
  75. package/lib/data-form/form-components/bwa-input-float.js +47 -36
  76. package/lib/data-form/form-components/bwa-input-integer.js +67 -49
  77. package/lib/data-form/form-components/bwa-input.js +42 -31
  78. package/lib/data-form/form-components/bwa-multi-select.js +39 -28
  79. package/lib/data-form/form-components/bwa-rich-text-tinymce.js +553 -217
  80. package/lib/data-form/form-components/bwa-rich-text.js +403 -315
  81. package/lib/data-form/form-components/bwa-select.js +83 -69
  82. package/lib/data-form/form-components/bwa-textarea.js +37 -26
  83. package/lib/data-form/form-components/bwa-upload.js +171 -147
  84. package/lib/data-form/form-components/bwa-user-multi-select.js +34 -23
  85. package/lib/data-form/form-components/bwa-user-select.js +85 -60
  86. package/lib/data-table/data-column-view.js +146 -115
  87. package/lib/data-table/data-table-card.js +48 -40
  88. package/lib/data-table/data-table-column.js +57 -44
  89. package/lib/data-table/data-table.js +401 -315
  90. package/lib/datatable-settings/datatable-settings.js +328 -253
  91. package/lib/date-range/date-picker.js +129 -115
  92. package/lib/date-range/date-range.js +214 -160
  93. package/lib/drag-list/drag-item.js +55 -41
  94. package/lib/drag-list/drag-list.js +59 -46
  95. package/lib/dragable/dragable-item.js +22 -17
  96. package/lib/dragable/dragable-operation.js +31 -23
  97. package/lib/dragable/dragable.js +31 -22
  98. package/lib/filter-panel/conditions/date-range-condition.js +49 -39
  99. package/lib/filter-panel/conditions/department-condition/department-condition.js +98 -71
  100. package/lib/filter-panel/conditions/department-condition/department-node.js +72 -58
  101. package/lib/filter-panel/conditions/input-condition.js +89 -75
  102. package/lib/filter-panel/conditions/multi-user-condition.js +66 -56
  103. package/lib/filter-panel/conditions/multiple-menu-condition.js +53 -34
  104. package/lib/filter-panel/conditions/single-menu-condition.js +64 -59
  105. package/lib/filter-panel/conditions/single-user-condition.js +66 -56
  106. package/lib/filter-panel/filter-panel-item.js +53 -38
  107. package/lib/filter-panel/filter-panel.js +152 -134
  108. package/lib/layout/layout.js +84 -77
  109. package/lib/menu/menu-item.js +66 -51
  110. package/lib/menu/menu.js +69 -52
  111. package/lib/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js +32 -0
  112. package/lib/panel/panel.js +52 -39
  113. package/lib/pct-filter-panel/pct-compents/pct-Input-condition.js +73 -62
  114. package/lib/pct-filter-panel/pct-compents/pct-date-range-condition.js +75 -66
  115. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition.js +405 -177
  116. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.js +152 -137
  117. package/lib/pct-filter-panel/pct-filter-panel-item.js +54 -39
  118. package/lib/pct-filter-panel/pct-filter-panel.js +246 -226
  119. package/lib/progress/progress-item.js +80 -60
  120. package/lib/progress/progress.js +77 -63
  121. package/lib/where-filter-panel/where-filter-panel.js +14 -11
  122. package/package.json +2 -1
  123. package/src/advance-select/advance-option.vue +64 -13
  124. package/src/data-form/form-components/bwa-rich-text-tinymce.vue +1 -1
  125. package/src/datatable-settings/datatable-settings.vue +33 -3
  126. package/src/date-range/date-picker.vue +1 -1
  127. package/src/filter-panel/filter-panel.vue +2 -2
  128. package/src/pct-filter-panel/pct-compents/pct-Input-condition.vue +64 -64
  129. package/src/pct-filter-panel/pct-compents/pct-date-range-condition.vue +61 -61
  130. package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition.vue +302 -178
  131. package/src/pct-filter-panel/pct-filter-panel.vue +4 -4
@@ -1,61 +1,61 @@
1
- <template>
2
- <div :class="ns.e('cont')">
3
- <div v-if="column && showTitle" :class="ns.e('label')">{{ column.title }}</div>
4
- <el-date-picker
5
- v-model="value"
6
- type="daterange"
7
- range-separator="至"
8
- start-placeholder="开始日期"
9
- end-placeholder="结束日期"
10
- :value-format="valueFormat"
11
- size="small"
12
- />
13
- </div>
14
- </template>
15
-
16
- <script setup>
17
- import {computed, inject} from 'vue';
18
- import {useNamespace, filterPanelItemKey} from '@ctzy-web-client/web-base-client-vue';
19
- const ns = useNamespace('pct-daterange');
20
- defineOptions({
21
- name: 'BwaPctDateRangeCondition',
22
- __conditionTitle__: '日期选择',
23
- __conditionDefault__: () => ({ start: '', end: '' }),
24
- });
25
-
26
- const props = defineProps({
27
- modelValue: {
28
- type: null,
29
- },
30
- valueFormat: {
31
- type: String,
32
- default: 'YYYY-MM-DD',
33
- },
34
- showTitle: {
35
- type: Boolean,
36
- default: false
37
- }
38
- });
39
-
40
- const emit = defineEmits(['update:modelValue']);
41
-
42
- const filterPanelItem = inject(filterPanelItemKey);
43
- const column = computed(() => filterPanelItem?.column ?? null);
44
-
45
- const value = computed({
46
- get: () => {
47
- if (props.modelValue && props.modelValue.start && props.modelValue.end) {
48
- return [props.modelValue.start, props.modelValue.end];
49
- }
50
- return [];
51
- },
52
- set: (v) => {
53
- if (v && v.length === 2) {
54
- emit('update:modelValue', { start: v[0], end: v[1] });
55
- } else {
56
- emit('update:modelValue', { start: '', end: '' });
57
- }
58
- },
59
- });
60
- </script>
61
-
1
+ <template>
2
+ <div :class="ns.e('cont')">
3
+ <div v-if="column && showTitle" :class="ns.e('label')">{{ column.title }}</div>
4
+ <el-date-picker
5
+ v-model="value"
6
+ type="daterange"
7
+ range-separator="至"
8
+ start-placeholder="开始日期"
9
+ end-placeholder="结束日期"
10
+ :value-format="valueFormat"
11
+
12
+ />
13
+ </div>
14
+ </template>
15
+
16
+ <script setup>
17
+ import {computed, inject} from 'vue';
18
+ import {useNamespace, filterPanelItemKey} from '@ctzy-web-client/web-base-client-vue';
19
+ const ns = useNamespace('pct-daterange');
20
+ defineOptions({
21
+ name: 'BwaPctDateRangeCondition',
22
+ __conditionTitle__: '日期选择',
23
+ __conditionDefault__: () => ({ start: '', end: '' }),
24
+ });
25
+
26
+ const props = defineProps({
27
+ modelValue: {
28
+ type: null,
29
+ },
30
+ valueFormat: {
31
+ type: String,
32
+ default: 'YYYY-MM-DD',
33
+ },
34
+ showTitle: {
35
+ type: Boolean,
36
+ default: false
37
+ }
38
+ });
39
+
40
+ const emit = defineEmits(['update:modelValue']);
41
+
42
+ const filterPanelItem = inject(filterPanelItemKey);
43
+ const column = computed(() => filterPanelItem?.column ?? null);
44
+
45
+ const value = computed({
46
+ get: () => {
47
+ if (props.modelValue && props.modelValue.start && props.modelValue.end) {
48
+ return [props.modelValue.start, props.modelValue.end];
49
+ }
50
+ return [];
51
+ },
52
+ set: (v) => {
53
+ if (v && v.length === 2) {
54
+ emit('update:modelValue', { start: v[0], end: v[1] });
55
+ } else {
56
+ emit('update:modelValue', { start: '', end: '' });
57
+ }
58
+ },
59
+ });
60
+ </script>
61
+
@@ -1,178 +1,302 @@
1
- <template>
2
- <div :class="ns.e('conditbox')">
3
- <div v-if="showTitle" :class="ns.e('title')">{{column.title}}</div>
4
- <el-select
5
- :multiple="multiple"
6
- v-model="modelValue"
7
- @visible-change="visibleChange"
8
- :class="ns.e('options')"
9
- :loading="loading"
10
- :placeholder="placeholderStr"
11
- :clearable="true"
12
- :filterable="showSearch"
13
- :remote="remote"
14
- :remote-method="remoteMethod"
15
- size="small"
16
- >
17
- <el-option
18
- v-for="item in data"
19
- :key="item[valuePropStr] + ''"
20
- :value="item[valuePropStr] + ''"
21
- :label="item[labelPropStr] + ''"
22
- />
23
- </el-select>
24
- </div>
25
- </template>
26
-
27
- <script setup>
28
- import { useNamespace } from '@ctzy-web-client/web-base-client-vue';
29
- import {computed, unref, defineEmits, inject, ref, useAttrs, watch} from 'vue';
30
- import {dataProps} from "../../hooks/use-data";
31
-
32
- import {
33
- useService,
34
- HttpRequest,
35
- filterPanelItemKey
36
- } from '@ctzy-web-client/web-base-client-vue';
37
-
38
- const httpRequest = useService(HttpRequest);
39
- defineOptions({
40
- name: 'BwaPctMultipleMenuCondition',
41
- __conditionTitle__: '多选列表',
42
- __conditionDefault__: () => [],
43
- });
44
-
45
- const props = defineProps({
46
- ...dataProps,
47
- modelValue: {
48
- type: null,
49
- },
50
- options: {
51
- type: Array,
52
- default: () => [],
53
- },
54
- labelProp: {
55
- type: String,
56
- default: 'label',
57
- },
58
- valueProp: {
59
- type: String,
60
- default: 'value',
61
- },
62
- multiple: {
63
- type: Boolean,
64
- default: true,
65
- },
66
- showSearch: {
67
- type: Boolean,
68
- default: true,
69
- },
70
- placeholder: {
71
- type: String,
72
- default: '请选择',
73
- },
74
- remote: {
75
- type: Boolean,
76
- default: true,
77
- },
78
- size: {
79
- type: String,
80
- default: 'small',
81
- },
82
- searchPlaceholder: {
83
- type: String,
84
- default: '',
85
- },
86
- labelAttr: '',
87
- valueAttr: '',
88
- searchAttr: '',
89
- itfInfo: null,
90
- // 自定义选项时 是否通过展开自动触发自定义search
91
- isRequiredByVisibleChange: {
92
- type: Boolean,
93
- default: false,
94
- },
95
- });
96
-
97
- const ns = useNamespace('pctfilterpanel-item');
98
- const isShowPopper = ref(false)
99
-
100
- const attrs = useAttrs();
101
- const showTitle = computed(() => attrs.showTitle)
102
-
103
- const data = ref([])
104
- const loading = ref(false)
105
- const emit = defineEmits(['update:modelValue', 'search']);
106
-
107
- const filterPanelItem = inject(filterPanelItemKey, null);
108
- const column = computed(() => filterPanelItem?.column ?? null);
109
-
110
- /**
111
- * 页面参数层级覆盖配置文件传递的参数层级
112
- */
113
- if (props.itfInfo) {
114
- column.value.componentProps = {
115
- itfInfo: props.itfInfo || {},
116
- labelAttr: props.labelAttr || 'label',
117
- valueAttr: props.valueAttr || 'value',
118
- searchAttr: props.searchAttr || 'search'
119
- }
120
- }
121
-
122
- const searchPlaceholderStr = computed(() => column.value?.componentProps?.searchPlaceholder || props.searchPlaceholder)
123
- const placeholderStr = computed(() => showTitle.value ? props.placeholder : column.value.title)
124
-
125
- const labelPropStr = computed(() => column.value?.componentProps?.labelAttr || props.labelProp)
126
- const valuePropStr = computed(() => column.value?.componentProps?.valueAttr || props.valueProp)
127
-
128
- const getData = async (query) => {
129
- loading.value = true
130
- const { itfInfo, searchAttr } = column.value.componentProps
131
- const {url, method, options, params } = {
132
- url: unref(itfInfo).url,
133
- method: unref(itfInfo).method || 'POST',
134
- options: unref(itfInfo).options || {},
135
- params: { ...unref(itfInfo).params, [searchAttr]: query || ''} || {},
136
- }
137
- data.value = (await unref(httpRequest)[method.toLowerCase()](url, params, options))?.data
138
- loading.value = false
139
- }
140
-
141
- data.value = props.options ?? []
142
- const visibleChange = (val) => {
143
- isShowPopper.value = val
144
- if (!val || !column.value.componentProps || column.value?.componentProps?.options) {
145
- if (isShowPopper.value && props.isRequiredByVisibleChange) {
146
- emit('search', '')
147
- }
148
- return
149
- }
150
- getData()
151
- }
152
-
153
- const remoteMethod = (query) => {
154
- if (column.value.componentProps) {
155
- getData(query)
156
- } else {
157
- emit('search', query)
158
- }
159
- }
160
-
161
- const modelValue = computed({
162
- get: () => {
163
- if (props.multiple) {
164
- return Array.isArray(props.modelValue)
165
- ? props.modelValue.map((item) => item )
166
- : [];
167
- } else {
168
- return props.modelValue == null || Array.isArray(props.modelValue) ? '' : props.modelValue;
169
- }
170
- },
171
- set: (v) => emit('update:modelValue', v),
172
- });
173
-
174
- defineExpose({
175
- data
176
- })
177
- </script>
178
-
1
+ <template>
2
+ <div :class="ns.e('conditbox')">
3
+ <div v-if="showTitle" :class="ns.e('title')">{{column.title}}</div>
4
+ <BwaAdvanceSelect
5
+ :multiple="multiple"
6
+ v-model="modelValue"
7
+ @search="handleFieldSearch"
8
+ :class="ns.e('options')"
9
+ @visible-change="visibleChange"
10
+ source="pct"
11
+ :showSearch="false"
12
+ :showSelectIcon="!multiple"
13
+ :showSelection="false"
14
+ :loading="loading"
15
+ :width="popperWidth"
16
+ borderRadius="4px"
17
+ ref="advanceSelectRef"
18
+ >
19
+ <template #reference-content="{ selected }">
20
+ <div :class="ns.e('content')" v-if="multiple">
21
+ <div v-if="selected && selected.length > 0">
22
+ <ElTooltip :content="selected[0].label" placement="top" effect="light" append-to=".bwa-application">
23
+ <el-tag :class="ns.e('tag')" closable @close="handleClose(selected[0])" type="info">{{selected[0].label}}
24
+ </el-tag>
25
+ </ElTooltip>
26
+ <ElTooltip content="Bottom center" placement="top" effect="light" append-to=".bwa-application">
27
+ <template #content>
28
+ <div :class="ns.e('tag_box')">
29
+ <template v-for="(item, index) in selected">
30
+ <el-tag
31
+ :class="ns.e('tag_details')"
32
+ type="info"
33
+ closable @close="handleClose(item)"
34
+ v-if="index !== 0"
35
+ >
36
+ {{item.label}}
37
+ </el-tag>
38
+ </template>
39
+ </div>
40
+
41
+ </template>
42
+ <el-tag :class="ns.e('tag')" type="info" v-if="selected.length > 1">+{{selected.length - 1}}</el-tag>
43
+ </ElTooltip>
44
+
45
+ </div>
46
+ <div v-else :class="ns.e('contentBox_placeholder')">{{placeholderStr}}</div>
47
+ <ElIcon
48
+ @mouseenter="isHoverIcon = true"
49
+ @mouseleave="isHoverIcon = false"
50
+ @click.stop="handleIconClick"
51
+ :class="ns.be('option', 'selected')"
52
+ >
53
+ <CircleClose
54
+ v-if="isHoverIcon && selected.length > 0"
55
+ class="delete-icon"
56
+ />
57
+ <ArrowUp v-else-if="isShowPopper" />
58
+ <ArrowDown v-else />
59
+ </ElIcon>
60
+ </div>
61
+ <div v-else :class="ns.e('content')">
62
+ <ElTooltip :disabled="!selected.label" :content="selected.label" placement="top" effect="light" append-to=".bwa-application">
63
+ <div :class="[ns.e('contentBox'), ns.e('contentBox_label')]" v-if="selected.label">{{selected.label || placeholderStr}}</div>
64
+ <div :class="[ns.e('contentBox'), ns.e('contentBox_placeholder')]" v-else>{{placeholderStr}}</div>
65
+ </ElTooltip>
66
+ <ElIcon
67
+ :class="ns.be('option', 'selected')"
68
+ >
69
+ <ArrowUp v-if="isShowPopper" />
70
+ <ArrowDown v-else />
71
+ </ElIcon>
72
+ </div>
73
+ </template>
74
+
75
+ <template #contentTop>
76
+ <div :class="ns.e('contentTop')" v-if="showSearch && !column.componentProps?.options">
77
+ <ElInput
78
+ v-model="search"
79
+ :class="ns.e('select')"
80
+ :placeholder="searchPlaceholderStr"
81
+ type="text"
82
+ prefix-icon="Search"
83
+ clearable
84
+ />
85
+ </div>
86
+ </template>
87
+ <slot>
88
+ <BwaAdvanceOption
89
+ v-for="item in data"
90
+ :key="item[valuePropStr] + ''"
91
+ :value="item[valuePropStr] + ''"
92
+ :label="item[labelPropStr] + ''"
93
+ :class="ns.be('filter', 'option')"
94
+ >
95
+ </BwaAdvanceOption>
96
+ </slot>
97
+ <template #contentBottom>
98
+ <div :class="ns.e('clear')" @click="handleClearClick">清除已选</div>
99
+ </template>
100
+ </BwaAdvanceSelect>
101
+ </div>
102
+ </template>
103
+
104
+ <script setup>
105
+ import {ElOption, ElSelect, ElTooltip, ElIcon, ElInput, ElTag} from 'element-plus';
106
+ import {ArrowUp, ArrowDown} from '@element-plus/icons';
107
+ import { useNamespace } from '@ctzy-web-client/web-base-client-vue';
108
+ import {computed, unref, defineEmits, inject, ref, useAttrs, watch, onMounted, nextTick} from 'vue';
109
+ import {dataProps} from "../../hooks/use-data";
110
+
111
+ import {
112
+ useService,
113
+ HttpRequest,
114
+ filterPanelItemKey
115
+ } from '@ctzy-web-client/web-base-client-vue';
116
+ import BwaAdvanceSelect from '../../advance-select/advance-select.vue';
117
+ import BwaAdvanceOption from '../../advance-select/advance-option.vue';
118
+
119
+ const httpRequest = useService(HttpRequest);
120
+ defineOptions({
121
+ name: 'BwaPctMultipleMenuCondition',
122
+ __conditionTitle__: '多选列表',
123
+ __conditionDefault__: () => [],
124
+ });
125
+
126
+ const props = defineProps({
127
+ ...dataProps,
128
+ modelValue: {
129
+ type: null,
130
+ },
131
+ options: {
132
+ type: Array,
133
+ default: () => [],
134
+ },
135
+ labelProp: {
136
+ type: String,
137
+ default: 'label',
138
+ },
139
+ valueProp: {
140
+ type: String,
141
+ default: 'value',
142
+ },
143
+ multiple: {
144
+ type: Boolean,
145
+ default: true,
146
+ },
147
+ showSearch: {
148
+ type: Boolean,
149
+ default: true,
150
+ },
151
+ placeholder: {
152
+ type: String,
153
+ default: '请选择',
154
+ },
155
+ remote: {
156
+ type: Boolean,
157
+ default: true,
158
+ },
159
+ size: {
160
+ type: String,
161
+ default: 'small',
162
+ },
163
+ searchPlaceholder: {
164
+ type: String,
165
+ default: '',
166
+ },
167
+ labelAttr: '',
168
+ valueAttr: '',
169
+ searchAttr: '',
170
+ itfInfo: null,
171
+ // 自定义选项时 是否通过展开自动触发自定义search
172
+ isRequiredByVisibleChange: {
173
+ type: Boolean,
174
+ default: false,
175
+ },
176
+ });
177
+ const popperWidth = ref('240px')
178
+ onMounted(() => {
179
+ nextTick(() => {
180
+ const offsetWidth = document.getElementsByClassName('bwa-pctfilterpanel-item__options')[0]?.offsetWidth
181
+ if (offsetWidth > 0) {
182
+ popperWidth.value = offsetWidth + 'px'
183
+ }
184
+ })
185
+ })
186
+ const ns = useNamespace('pctfilterpanel-item');
187
+ const isShowPopper = ref(false)
188
+ const isHoverIcon = ref(false)
189
+
190
+ const attrs = useAttrs();
191
+ const showTitle = computed(() => attrs.showTitle)
192
+
193
+ const data = ref([])
194
+ const loading = ref(false)
195
+ const emit = defineEmits(['update:modelValue', 'search']);
196
+
197
+ const filterPanelItem = inject(filterPanelItemKey, null);
198
+ const column = computed(() => filterPanelItem?.column ?? null);
199
+
200
+ /**
201
+ * 页面参数层级覆盖配置文件传递的参数层级
202
+ */
203
+ if (props.itfInfo) {
204
+ column.value.componentProps = {
205
+ itfInfo: props.itfInfo || {},
206
+ labelAttr: props.labelAttr || 'label',
207
+ valueAttr: props.valueAttr || 'value',
208
+ searchAttr: props.searchAttr || 'search'
209
+ }
210
+ }
211
+
212
+ const searchPlaceholderStr = computed(() => column.value?.componentProps?.searchPlaceholder || props.searchPlaceholder)
213
+ const placeholderStr = computed(() => showTitle.value ? props.placeholder : column.value.title)
214
+
215
+ const labelPropStr = computed(() => column.value?.componentProps?.labelAttr || props.labelProp)
216
+ const valuePropStr = computed(() => column.value?.componentProps?.valueAttr || props.valueProp)
217
+ const handleClose = (val)=>{
218
+
219
+ // 优化后
220
+ // 1. 空值兜底:避免 modelValue.value 为 null/undefined 时报错
221
+ const currentModelValue = Array.isArray(modelValue.value) ? modelValue.value : [];
222
+ // 2. 严格相等 + 类型统一:解决 1 vs "1" 不匹配,同时避免隐式类型转换
223
+ modelValue.value = currentModelValue.filter(item =>
224
+ String(item) !== String(val.value)
225
+ );
226
+
227
+ }
228
+ const handleIconClick = () => {
229
+ if (isHoverIcon.value) {
230
+ // 多选清空逻辑:重置 modelValue 为空数组
231
+ modelValue.value = []
232
+ isHoverIcon.value = false; // 重置悬浮状态
233
+ return;
234
+ }
235
+ // 原有逻辑:切换下拉显隐
236
+ isShowPopper.value = !isShowPopper.value;
237
+ };
238
+ const getData = async (query) => {
239
+ loading.value = true
240
+ const { itfInfo, searchAttr } = column.value.componentProps
241
+ const {url, method, options, params } = {
242
+ url: unref(itfInfo).url,
243
+ method: unref(itfInfo).method || 'POST',
244
+ options: unref(itfInfo).options || {},
245
+ params: { ...unref(itfInfo).params, [searchAttr]: query || ''} || {},
246
+ }
247
+ data.value = (await unref(httpRequest)[method.toLowerCase()](url, params, options))?.data
248
+ loading.value = false
249
+ }
250
+
251
+ data.value = props.options ?? []
252
+ const visibleChange = (val) => {
253
+ isShowPopper.value = val
254
+ if (!val || !column.value.componentProps || column.value?.componentProps?.options) {
255
+ if (isShowPopper.value && props.isRequiredByVisibleChange) {
256
+ emit('search', '')
257
+ }
258
+ return
259
+ }
260
+ getData()
261
+ }
262
+
263
+ const handleFieldSearch = (query) => {
264
+ if (column.value.componentProps) {
265
+ getData(query)
266
+ } else {
267
+ emit('search', query)
268
+ }
269
+ }
270
+
271
+ const search = ref('')
272
+ watch(() => search.value, val => {
273
+ handleFieldSearch(val)
274
+ })
275
+
276
+ const modelValue = computed({
277
+ get: () => {
278
+ if (props.multiple) {
279
+ return Array.isArray(props.modelValue)
280
+ ? props.modelValue.map((item) => item )
281
+ : [];
282
+ } else {
283
+ return props.modelValue == null || Array.isArray(props.modelValue) ? '' : props.modelValue;
284
+ }
285
+ },
286
+ set: (v) => emit('update:modelValue', v),
287
+ });
288
+
289
+ /**
290
+ * 清除已选
291
+ */
292
+ const advanceSelectRef = ref(null)
293
+ const handleClearClick = () => {
294
+ if (advanceSelectRef.value) {
295
+ advanceSelectRef.value.handleClearClick()
296
+ }
297
+ }
298
+
299
+ defineExpose({
300
+ data
301
+ })
302
+ </script>
@@ -42,7 +42,7 @@
42
42
  <div v-if="showTitle" :class="ns.e('title')" style="padding-right: 8px">{{searchTitle}}</div>
43
43
  <ElInput
44
44
  prefix-icon="Search"
45
- size="small"
45
+
46
46
  clearable
47
47
  v-model="searchValue"
48
48
  :placeholder="searchPlaceholder"
@@ -60,7 +60,7 @@
60
60
  >
61
61
  <template #reference-content>
62
62
  <ElButton
63
- size="small"
63
+
64
64
  :class="ns.e('filterBut')"
65
65
  >
66
66
  <div :class="ns.be('filter', 'plus')"></div>
@@ -90,7 +90,7 @@
90
90
 
91
91
 
92
92
  <ElButton
93
- size="small"
93
+
94
94
  type="primary"
95
95
  :class="ns.e('reset')"
96
96
  @click="handleSearch"
@@ -98,7 +98,7 @@
98
98
  查询
99
99
  </ElButton>
100
100
  <ElButton
101
- size="small"
101
+
102
102
  :class="ns.e('reset')"
103
103
  @click="handleReset"
104
104
  >