@lx-frontend/wrap-element-ui 1.0.15-beta.7 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lx-frontend/wrap-element-ui",
3
- "version": "1.0.15-beta.7",
3
+ "version": "1.0.15",
4
4
  "description": "wrap-element-ui",
5
5
  "author": "",
6
6
  "main": "src/components/index.ts",
@@ -23,7 +23,6 @@
23
23
  "src/components"
24
24
  ],
25
25
  "peerDependencies": {
26
- "dayjs": "^1.11.13",
27
26
  "element-ui": "^2.15.14",
28
27
  "lodash": "^4.17.21",
29
28
  "vue": "~2.7.16"
@@ -52,7 +51,6 @@
52
51
  "ali-oss": "^6.20.0",
53
52
  "autoprefixer": "^10.4.19",
54
53
  "cross-env": "^7.0.3",
55
- "dayjs": "^1.11.13",
56
54
  "eslint": "^8.57.0",
57
55
  "eslint-plugin-vue": "^9.27.0",
58
56
  "gulp": "^4.0.2",
@@ -70,8 +68,5 @@
70
68
  "vite-plugin-lib-inject-css": "^2.1.1",
71
69
  "vite-tsconfig-paths": "^4.3.2",
72
70
  "vue-template-compiler": "^2.6.10"
73
- },
74
- "dependencies": {
75
- "@lx-frontend/wrap-element-ui": "1.0.15-beta.1"
76
71
  }
77
- }
72
+ }
@@ -1,11 +1,5 @@
1
1
  import { computed, nextTick, ref, Ref, watch } from 'vue'
2
- import {
3
- FilterListType,
4
- IColumnConfig,
5
- IEmits,
6
- IFilterInput,
7
- IProps
8
- } from '../types';
2
+ import { IColumnConfig, IEmits, IProps } from '../types';
9
3
 
10
4
  interface IUseColumnHeaderOperationParams {
11
5
  props: IProps
@@ -15,6 +9,7 @@ interface IUseColumnHeaderOperationParams {
15
9
  }
16
10
 
17
11
  export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColumns }: IUseColumnHeaderOperationParams) {
12
+
18
13
  // column如果有sortable属性,点击列头部,会直接触发排序,为了在弹窗点确定时再触发排序,需要阻止点击立即排序
19
14
  // 所以,初始渲染时,将sortable设置为false,在触发排序逻辑时再设置成真实的值,再利用el-table自身的排序逻辑触发排序
20
15
  const inSorting = ref(false);
@@ -35,19 +30,17 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
35
30
  const tempSummaryList = ref<string[]>([]);
36
31
  const summaryList = ref<string[]>([]);
37
32
 
38
- const isColumnFiltering = computed(() => {
39
- return Object.keys(tempFilteredValue.value).some(
40
- (key) => {
41
- const value = tempFilteredValue.value[key]
42
- if (Array.isArray(value)) return value.length
43
- return value;
44
- }
45
- )
46
- });
33
+ // 生效中的搜索配置 临时搜索配置
34
+ const searchValue = ref<Record<string, string>>({});
35
+ const tempSearchValue = ref<Record<string, string>>({});
47
36
 
48
- const showColumnHeadSortIcon = ({ isColumnSortable, filters }: IColumnConfig) => {
49
- return isColumnSortable || (filters && Array.isArray(filters) && filters.length > 0)
50
- }
37
+ const isColumnFiltering = computed(() => Object.keys(tempFilteredValue.value).some(k => {
38
+ const value = tempFilteredValue.value[k]
39
+ if (!Array.isArray(value)) return value
40
+ return value.length;
41
+ }));
42
+
43
+ const showColumnHeadSortIcon = (column: IColumnConfig) => column.filters || column.isColumnSortable || column.search || column.summary || column.doubleDatePicker;
51
44
 
52
45
  watch(
53
46
  () => props.columnConfig,
@@ -79,34 +72,41 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
79
72
  return sums
80
73
  }
81
74
 
82
- const isColumnHeadActive = ({ prop, filters, _sortable }: IColumnConfig) => {
83
- const hasFilters = filters && Array.isArray(filters) && filters.length > 0
84
- const currentFilterActive = hasFilters && filters?.some(
85
- (item) => {
86
- if (item.type === 'doubleDatePicker' || item.type === 'monthDayPicker') {
87
- const [start, end] = item.prop
88
- return !!(filteredValue.value[start] || filteredValue.value[end])
89
- }
90
-
91
- if (item.type === 'checkbox') {
92
- return !!(filteredValue.value[item.prop] as any[]).length
93
- }
94
-
95
- return !!filteredValue.value[item.prop]
96
- }
75
+ const isColumnHeadActive = (column: IColumnConfig) => {
76
+ const hasPickerParams = !!(
77
+ column.doubleDatePicker
78
+ && (searchValue.value[column.doubleDatePicker.props[0]] || searchValue.value[column.doubleDatePicker.props[1]])
97
79
  )
98
80
 
99
- const isUseSort = Array.isArray(_sortable)
100
- ? _sortable.some(v => v.prop === sortProp.value)
101
- : sortProp.value === prop
102
-
103
- return currentFilterActive || isUseSort|| summaryList.value.includes(prop);
81
+ const isUseFilter = !!(column.filters && (Array.isArray(column.filters)
82
+ ? (filteredValue.value[column.prop] as any[]).length
83
+ : column.filters.type === 'radio'
84
+ ? filteredValue.value[column.filters.prop || column.prop]
85
+ : (filteredValue.value[column.filters.prop || column.prop] as any[]).length))
86
+
87
+ const isUseSort = Array.isArray(column._sortable)
88
+ ? column._sortable.some(v => v.prop === sortProp.value)
89
+ : sortProp.value === column.prop
90
+
91
+ const isUseSearch = Array.isArray(column.search)
92
+ ? column.search?.some(v => {
93
+ const props = typeof v.prop === 'string' ? [v.prop] : v.prop
94
+ return props.some(p => searchValue.value[p])
95
+ })
96
+ : !!searchValue.value[column.prop]
97
+
98
+ return isUseFilter
99
+ || isUseSearch
100
+ || hasPickerParams
101
+ || isUseSort
102
+ || summaryList.value.includes(column.prop);
104
103
  }
105
104
 
106
105
  const handleHeaderPopoverShow = (column: IColumnConfig) => {
107
106
  // 关闭其他的排序和筛选弹窗(理论上不写也能关闭其他,但是就是有些列会出现两个弹窗同时出现的情况)
108
107
  closeSortAndFilterPopover(column.prop);
109
108
  tempFilteredValue.value = { ...filteredValue.value };
109
+ tempSearchValue.value = { ...searchValue.value };
110
110
  tempSortType.value = sortType.value || '';
111
111
  tempSortProp.value = sortProp.value || '';
112
112
  // 临时合计项设置成实际的合计项
@@ -137,33 +137,39 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
137
137
 
138
138
  const emitSearch = () => {
139
139
  const params: Record<string, any> = {};
140
-
141
- const processFilter = (filters: FilterListType) => {
142
- filters.forEach((item) => {
143
- if (item.type === 'doubleDatePicker' || item.type === 'monthDayPicker') {
144
- const [start, end] = item.prop
145
- params[start] = filteredValue.value[start];
146
- params[end] = filteredValue.value[end];
147
- } else {
148
- params[item.prop] = filteredValue.value[item.prop];
149
- }
150
- });
151
- }
152
-
153
140
  // 仅提交显示的列的相关数据
154
141
  showingColumns.value.forEach(prop => {
155
- const { filters = [] } = columnMap.value[prop] as IColumnConfig;
156
- processFilter(filters);
157
- });
142
+ const column = columnMap.value[prop]
143
+ if (column.filters) {
144
+ const _prop = (Array.isArray(column.filters) ? prop : column.filters.prop) || prop
145
+ params[_prop] = filteredValue.value[_prop]
146
+ }
147
+ if (column.search) {
148
+ if (Array.isArray(column.search)) {
149
+ column.search.forEach(v => {
150
+ const props = typeof v.prop === 'string' ? [v.prop] : v.prop
151
+ props.forEach(p => {
152
+ params[p] = searchValue.value[p]
153
+ })
154
+ })
155
+ } else {
156
+ params[prop] = searchValue.value[prop]
157
+ }
158
+ }
159
+ if (column.doubleDatePicker) {
160
+ params[column.doubleDatePicker.props[0]] = searchValue.value[column.doubleDatePicker.props[0]]
161
+ params[column.doubleDatePicker.props[1]] = searchValue.value[column.doubleDatePicker.props[1]]
162
+ }
163
+ })
158
164
 
159
165
  if (props.colorFilterConfig) {
160
- const { filters = [] } = props.colorFilterConfig;
161
- processFilter(filters);
166
+ const { prop } = props.colorFilterConfig
167
+ params[prop] = filteredValue.value[prop]
162
168
  }
163
169
 
164
170
  Object.keys(params).forEach(key => {
165
- if (params[key] === undefined) delete params[key];
166
- });
171
+ if (params[key] === undefined) delete params[key]
172
+ })
167
173
 
168
174
  emit('search', {
169
175
  ...params,
@@ -171,26 +177,32 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
171
177
  });
172
178
  };
173
179
 
174
-
175
- const handleHeaderOperationConfirm = async (column: IColumnConfig) => {
176
- const inputFilters = (column.filters ?? []).filter(
177
- (item): item is IFilterInput => item.type === 'input'
178
- );
179
-
180
- const hasValidatorError = inputFilters.some(
181
- (item) => item.validator
182
- && !item.validator((tempFilteredValue.value[item.prop] as string).trim())
183
- )
184
-
185
- if (hasValidatorError) {
186
- return
187
- }
188
-
189
- inputFilters.forEach(
190
- (item) => {
191
- if (!tempFilteredValue.value[item.prop]) tempFilteredValue.value[item.prop] = ''
180
+ const handleHeaderOperationConfirm = async (column: IColumnConfig, scope) => {
181
+ if (column.search) {
182
+ // 校验
183
+ if (Array.isArray(column.search)) {
184
+ let validate = true;
185
+ column.search.forEach(v => {
186
+ if (!validate) return
187
+ if (!('type' in v) || v.type === 'input') {
188
+ if (!tempSearchValue.value[v.prop]) tempSearchValue.value[v.prop] = ''
189
+ if (v.validator) {
190
+ const result = v.validator(tempSearchValue.value[v.prop]?.trim());
191
+ if (!result) validate = false;
192
+ }
193
+ } else if (v.type === 'doubleDatePicker' || v.type === 'slot') {
194
+ if (v.validator) {
195
+ const result = v.validator(tempSearchValue.value);
196
+ if (!result) validate = false;
197
+ }
198
+ }
199
+ })
200
+ // 校验未通过
201
+ if (!validate) return
202
+ } else {
203
+ if (!tempSearchValue.value[column.prop]) tempSearchValue.value[column.prop] = ''
192
204
  }
193
- )
205
+ }
194
206
 
195
207
  summaryList.value = [...tempSummaryList.value];
196
208
  sortProp.value = tempSortProp.value || '';
@@ -209,8 +221,15 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
209
221
  }
210
222
 
211
223
  filteredValue.value = { ...tempFilteredValue.value };
224
+ searchValue.value = Object.keys(tempSearchValue.value).reduce((pre, key) => {
225
+ pre[key] = tempSearchValue.value[key]?.trim() ?? '';
226
+ return pre;
227
+ }, {});
212
228
 
213
229
  emitSearch();
230
+
231
+ filterColumns(scope.store);
232
+
214
233
  closeSortAndFilterPopover();
215
234
  await nextTick()
216
235
  tableDomRef.value?.doLayout();
@@ -241,27 +260,18 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
241
260
  }
242
261
 
243
262
  function handleResetFilterValue (column: IColumnConfig) {
244
- (column.filters || [])
245
- .forEach(
246
- (item) => {
247
- if (item.type === 'radio' || item.type === 'checkbox') {
248
- if (item.defaultValue) {
249
- filteredValue.value[item.prop] = item.defaultValue
250
- } else {
251
- filteredValue.value[item.prop] = item.type === 'radio' ? '' : []
252
- }
253
- } else if (item.type === 'doubleDatePicker' || item.type === 'monthDayPicker') {
254
- const [start, end] = item.prop
255
- filteredValue.value[start] = '';
256
- filteredValue.value[end] = '';
257
- } else {
258
- filteredValue.value[item.prop] = ''
259
- }
260
- }
261
- )
263
+ if (column.filters) {
264
+ if (Array.isArray(column.filters)) {
265
+ filteredValue.value[column.prop] = []
266
+ } else if (column.filters.default) {
267
+ filteredValue.value[column.filters.prop || column.prop] = column.filters.default
268
+ } else {
269
+ filteredValue.value[column.filters.prop || column.prop] = column.filters.type === 'radio' ? '' : []
270
+ }
271
+ }
262
272
  }
263
273
 
264
- const handleHeaderOperationReset = async (column: IColumnConfig) => {
274
+ const handleHeaderOperationReset = async (column: IColumnConfig, scope) => {
265
275
  if (
266
276
  sortProp.value &&
267
277
  (Array.isArray(column._sortable)
@@ -275,33 +285,94 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
275
285
  summaryList.value = summaryList.value.filter(item => item !== column.prop);
276
286
 
277
287
  handleResetFilterValue(column)
288
+ if (column.search) {
289
+ if (!Array.isArray(column.search)) {
290
+ searchValue.value[column.prop] = '';
291
+ } else {
292
+ column.search.forEach(v => {
293
+ const props = typeof v.prop === 'string' ? [v.prop] : v.prop
294
+ props.forEach(p => {
295
+ searchValue.value[p] = '';
296
+ })
297
+ })
298
+ }
299
+ }
300
+ if (column.doubleDatePicker) {
301
+ searchValue.value[column.doubleDatePicker.props[0]] = '';
302
+ searchValue.value[column.doubleDatePicker.props[1]] = '';
303
+ }
304
+
278
305
  emitSearch();
306
+
307
+ filterColumns(scope.store);
308
+
279
309
  closeSortAndFilterPopover();
280
310
  await nextTick();
281
311
  tableDomRef.value?.doLayout();
282
312
  }
283
313
 
314
+ const filterColumns = (store) => {
315
+ if (!props.localFilter) return
316
+ store.states.columns.forEach(column => {
317
+ if (filteredValue.value[column.property]) {
318
+ store.commit('filterChange', {
319
+ column,
320
+ values: filteredValue.value[column.property],
321
+ });
322
+ }
323
+ });
324
+
325
+ // 根据searchValue过滤数据
326
+ const data = store.states.data.filter(item => {
327
+ const flag = Object.keys(searchValue.value)
328
+ .filter(key => searchValue.value[key])
329
+ .reduce((pre, key) => {
330
+ const value = searchValue.value[key];
331
+
332
+ return pre && item[key] && `${item[key]}`.indexOf(value) > -1;
333
+ }, true);
334
+
335
+ return flag;
336
+ });
337
+
338
+ store.states.data = data;
339
+ }
340
+
284
341
  const setSearchParams = (params: Record<string, any>) => {
342
+ const _searchValue = {};
285
343
  const _filteredValue = {};
286
344
 
287
345
  // 设置搜索和过滤参数时,如果使用 showingColumns 遍历,会导致通过外部设置未显示的列的搜索和过滤参数丢失
288
- [props.colorFilterConfig, ...props.columnConfig].forEach(column => {
289
- (column?.filters ?? [])
290
- .forEach(
291
- (item) => {
292
- if (item.type === 'doubleDatePicker' || item.type === 'monthDayPicker') {
293
- const [start, end] = item.prop
294
- _filteredValue[start] = params[start]
295
- _filteredValue[end] = params[end]
296
- } else if (item.type === 'checkbox') {
297
- _filteredValue[item.prop] = params[item.prop] ?? item.defaultValue ?? []
298
- } else {
299
- _filteredValue[item.prop] = params[item.prop] ?? ''
300
- }
301
- }
302
- )
346
+ props.columnConfig.forEach(column => {
347
+ if (column.search) {
348
+ if (Array.isArray(column.search)) {
349
+ column.search.forEach(v => {
350
+ const props = typeof v.prop === 'string' ? [v.prop] : v.prop
351
+ props.forEach(p => {
352
+ _searchValue[p] = params[p];
353
+ })
354
+ });
355
+ } else {
356
+ _searchValue[column.prop] = params[column.prop] ?? '';
357
+ }
358
+ }
359
+ if (column.filters) {
360
+ const _prop = (Array.isArray(column.filters) ? column.prop : column.filters.prop) || column.prop
361
+ const value = params[_prop] ?? (Array.isArray(column.filters) ? [] : column.filters.default);
362
+ _filteredValue[_prop] = value;
363
+ }
364
+ if (column.doubleDatePicker) {
365
+ _searchValue[column.doubleDatePicker.props[0]] = params[column.doubleDatePicker.props[0]] ?? '';
366
+ _searchValue[column.doubleDatePicker.props[1]] = params[column.doubleDatePicker.props[1]] ?? '';
367
+ }
303
368
  })
304
369
 
370
+ if (props.colorFilterConfig) {
371
+ const { prop, filters } = props.colorFilterConfig
372
+ _filteredValue[prop] = params[prop] ?? (Array.isArray(filters) ? [] : filters?.default);
373
+ }
374
+
375
+ searchValue.value = { ...searchValue.value, ..._searchValue }
305
376
  filteredValue.value = { ...filteredValue.value, ..._filteredValue }
306
377
  }
307
378
 
@@ -319,11 +390,13 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
319
390
  filteredValue,
320
391
  showColumnHeadSortIcon,
321
392
  tempSortProp,
393
+ tempSearchValue,
322
394
  tempFilteredValue,
323
395
  tempSummaryList,
324
396
  tempSortType,
325
397
  sortProp,
326
398
  isColumnFiltering,
399
+ searchValue,
327
400
  inSorting,
328
401
  }
329
402
  }
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <div class="editable-table-sort-filter__filter">
3
+ <div class="editable-table-sort-filter__filter-title">
4
+ 筛选
5
+ </div>
6
+ <el-checkbox-group
7
+ v-if="column.filters && (Array.isArray(column.filters) || column.filters.type === 'checkbox')"
8
+ class="editable-table-sort-filter__filter-checkbox-group"
9
+ :value="tempFilteredValue[column.filters.prop || column.prop]"
10
+ @input="val => emit('update:tempFilteredValue', column.filters?.prop || column.prop, val)"
11
+ >
12
+ <el-checkbox
13
+ v-for="item in (Array.isArray(column.filters) ? column.filters : column.filters.options)"
14
+ :key="item.value"
15
+ :label="item.value"
16
+ :title="item.text"
17
+ class="editable-table-sort-filter__filter-checkbox"
18
+ >
19
+ <slot
20
+ name="filter-item"
21
+ v-bind="item"
22
+ >
23
+ {{ item.text }}
24
+ </slot>
25
+ </el-checkbox>
26
+ </el-checkbox-group>
27
+
28
+ <el-radio-group
29
+ v-if="column.filters && !Array.isArray(column.filters) && column.filters.type === 'radio'"
30
+ style="display: flex;flex-direction: column;gap: 6px;"
31
+ :value="tempFilteredValue[column.filters.prop || column.prop]"
32
+ @input="val => emit('update:tempFilteredValue', column.filters?.prop || column.prop, val)"
33
+ >
34
+ <el-radio
35
+ v-for="item in column.filters.options"
36
+ :key="item.value"
37
+ :label="item.value"
38
+ :title="item.text"
39
+ >
40
+ <slot
41
+ name="filter-item"
42
+ v-bind="item"
43
+ >
44
+ {{ item.text }}
45
+ </slot>
46
+ </el-radio>
47
+ </el-radio-group>
48
+ </div>
49
+ </template>
50
+
51
+ <script setup lang="ts">
52
+ import { IColumnConfig } from '../../types';
53
+
54
+ defineProps<{
55
+ column: IColumnConfig
56
+ tempFilteredValue: Record<string, string | number | number[] | string[]>
57
+ }>()
58
+
59
+ const emit = defineEmits<{
60
+ (e: 'update:tempFilteredValue', key: string, value: string): void
61
+ }>()
62
+ </script>
@@ -27,34 +27,80 @@
27
27
  {{ column.label }}
28
28
  </div>
29
29
 
30
- <div class="editable-table-sort-filter__item">
31
- <BizSortFilter
32
- v-if="column.isColumnSortable"
33
- :column="column"
34
- :temp-sort-prop="tempSortProp"
35
- :temp-sort-type="tempSortType"
36
- @update:sort="(type, prop) => emit('update:sort', type, prop)"
37
- />
38
- </div>
30
+ <Sort
31
+ v-if="column.isColumnSortable"
32
+ :column="column"
33
+ :temp-sort-prop="tempSortProp"
34
+ :temp-sort-type="tempSortType"
35
+ @update:sort="(type, prop) => emit('update:sort', type, prop)"
36
+ />
39
37
 
40
- <template v-if="column.filters">
38
+ <Search
39
+ v-if="!!column.search"
40
+ :column="column"
41
+ :temp-search-value="tempSearchValue"
42
+ @update:tempSearchValue="(key, val) => emit('update:tempSearchValue', key, val)"
43
+ >
44
+ <template
45
+ v-for="searchOption in (Array.isArray(column.search) ? column.search : []).filter(v => v.type === 'slot')"
46
+ #[searchOption.slotName]="rest"
47
+ >
48
+ <slot
49
+ :name="searchOption.slotName"
50
+ v-bind="rest"
51
+ />
52
+ </template>
53
+ </Search>
54
+
55
+ <div
56
+ v-if="column.doubleDatePicker"
57
+ class="editable-table-sort-filter__sort"
58
+ >
59
+ <div class="editable-table-sort-filter__search-title">
60
+ {{ column.doubleDatePicker.label }}
61
+ </div>
41
62
  <div
42
- v-for="(filterItem, index) in column.filters"
43
- :key="index"
44
- class="editable-table-sort-filter__item editable-table__filter-group__filter"
63
+ class="editable-table-sort-filter__date-picker-content"
64
+ style="display: flex;flex-direction: column;gap: 12px;"
45
65
  >
46
- <component
47
- :is="componentMap[filterItem.type]"
48
- :config="filterItem"
49
- :temp-filtered-value="tempFilteredValue"
50
- @update:tempFilteredValue="onUpdate"
66
+ <el-date-picker
67
+ @input="val => emit('update:tempSearchValue', column.doubleDatePicker.props[0], val || '')"
68
+ :value="tempSearchValue[column.doubleDatePicker.props[0]]"
69
+ value-format="yyyy-MM-dd"
70
+ format="yyyy-MM-dd"
71
+ type="date"
72
+ size="small"
73
+ placeholder="开始日期"
74
+ />
75
+ <el-date-picker
76
+ @input="val => emit('update:tempSearchValue', column.doubleDatePicker.props[1], val || '')"
77
+ :value="tempSearchValue[column.doubleDatePicker.props[1]]"
78
+ value-format="yyyy-MM-dd"
79
+ format="yyyy-MM-dd"
80
+ size="small"
81
+ type="date"
82
+ placeholder="结束日期"
51
83
  />
52
84
  </div>
53
- </template>
85
+ </div>
86
+
87
+ <BizFilter
88
+ v-if="column.filters && ((Array.isArray(column.filters) ? column.filters : column.filters.options).length > 0)"
89
+ :column="column"
90
+ :temp-filtered-value="tempFilteredValue"
91
+ @update:tempFilteredValue="(key, val) => emit('update:tempFilteredValue', key, val)"
92
+ >
93
+ <template #filter-item="item">
94
+ <slot
95
+ name="filter-item"
96
+ v-bind="item"
97
+ />
98
+ </template>
99
+ </BizFilter>
54
100
 
55
101
  <div
56
102
  v-if="column.summary"
57
- class="editable-table-sort-filter__item editable-table-sort-filter__filter"
103
+ class="editable-table-sort-filter__filter"
58
104
  >
59
105
  <div class="editable-table-sort-filter__filter-title">
60
106
  统计
@@ -98,16 +144,12 @@
98
144
  </template>
99
145
 
100
146
  <script setup lang="ts">
101
- import { ref } from 'vue'
147
+ import Search from './search.vue'
148
+ import Sort from './sort.vue'
149
+ import BizFilter from './bizFilter.vue'
102
150
 
103
- import BizCheckboxFilter from './BizCheckboxFilter.vue';
104
- import BizColorRadioFilter from './BizColorRadioFilter.vue';
105
- import BizDoubleDatePickerFilter from './BizDoubleDatePickerFilter.vue';
106
- import BizInputFilter from './BizInputFilter.vue';
107
- import BizMonthDayPicker from './BizMonthDayPicker.vue';
108
- import BizSortFilter from './BizSortFilter.vue';
109
- import BizRadioFilter from "./BizRadioFilter.vue";
110
- import { FilterItem, IColumnConfig } from '../../types'
151
+ import { ref } from 'vue'
152
+ import { IColumnConfig } from '../../types'
111
153
 
112
154
  defineProps<{
113
155
  headActive: boolean
@@ -115,10 +157,12 @@ defineProps<{
115
157
  tempSummaryList: string[]
116
158
  tempSortType: 'ascending' | 'descending' | ''
117
159
  tempSortProp: string
160
+ tempSearchValue: Record<string, string>
118
161
  tempFilteredValue: Record<string, string | number | number[] | string[]>
119
162
  }>()
120
163
 
121
164
  const emit = defineEmits<{
165
+ (e: 'update:tempSearchValue', key: string, value: string): void
122
166
  (e: 'update:tempFilteredValue', key: string, value: string): void
123
167
  (e: 'update:tempSummaryList', value: string[]): void
124
168
  (e: 'update:sort', type: 'ascending' | 'descending', prop: string): void
@@ -127,29 +171,8 @@ const emit = defineEmits<{
127
171
  (e: 'confirm'): void
128
172
  }>()
129
173
 
130
- // 把 filterItem.type 映射到组件
131
- const componentMap: Record<FilterItem['type'], any> = {
132
- /** 输入框 */
133
- input: BizInputFilter,
134
- /** 日期范围 */
135
- doubleDatePicker: BizDoubleDatePickerFilter,
136
- /** 单选框 */
137
- radio: BizRadioFilter,
138
- /** 复选框 */
139
- checkbox: BizCheckboxFilter,
140
- /** 月日选择器 */
141
- monthDayPicker: BizMonthDayPicker,
142
- /** 颜色选择器 */
143
- colorRadio: BizColorRadioFilter,
144
- }
145
-
146
174
  const popoverRef = ref(null as any)
147
175
 
148
- // 统一的事件派发
149
- function onUpdate(key: string, val: any) {
150
- emit('update:tempFilteredValue', key, val)
151
- }
152
-
153
176
  defineExpose({
154
177
  close: () => {
155
178
  popoverRef.value?.doClose()