@lx-frontend/wrap-element-ui 1.0.15 → 1.0.16-beta.0
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/README.md +2 -2
- package/package.json +8 -4
- package/src/components/EditableTable/bizHooks/useColumnHeaderOperation.ts +112 -185
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizCheckboxFilter.vue +40 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizColorRadioFilter.vue +56 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizDoubleDatePickerFilter.vue +91 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizInputFilter.vue +26 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizMonthDayPicker.helper.ts +131 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizMonthDayPicker.vue +115 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizRadioFilter.vue +39 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover/{sort.vue → BizSortFilter.vue} +2 -2
- package/src/components/EditableTable/features/bizTableHeaderPopover/index.vue +59 -85
- package/src/components/EditableTable/index.less +26 -11
- package/src/components/EditableTable/index.vue +17 -42
- package/src/components/EditableTable/types/index.ts +61 -48
- package/src/components/EditableTable/features/bizTableHeaderPopover/bizFilter.vue +0 -62
- package/src/components/EditableTable/features/bizTableHeaderPopover/search.vue +0 -74
package/src/components/EditableTable/features/bizTableHeaderPopover/BizMonthDayPicker.helper.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
|
|
3
|
+
// 月份配置 - 月份对应的天数
|
|
4
|
+
const monthConfig = [
|
|
5
|
+
{ month: 1, day: 31 },
|
|
6
|
+
{ month: 2, day: 29 },
|
|
7
|
+
{ month: 3, day: 31 },
|
|
8
|
+
{ month: 4, day: 30 },
|
|
9
|
+
{ month: 5, day: 31 },
|
|
10
|
+
{ month: 6, day: 30 },
|
|
11
|
+
{ month: 7, day: 31 },
|
|
12
|
+
{ month: 8, day: 31 },
|
|
13
|
+
{ month: 9, day: 30 },
|
|
14
|
+
{ month: 10, day: 31 },
|
|
15
|
+
{ month: 11, day: 30 },
|
|
16
|
+
{ month: 12, day: 31 },
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 组装极联选择组件默认选项
|
|
21
|
+
* example: [
|
|
22
|
+
* {
|
|
23
|
+
* value: '1',
|
|
24
|
+
* label: '1月',
|
|
25
|
+
* children: [
|
|
26
|
+
* { value: '1', label: '1日' },
|
|
27
|
+
* ... // 1月份的每一天
|
|
28
|
+
* ]
|
|
29
|
+
* },
|
|
30
|
+
* ... // 其他月份的选项
|
|
31
|
+
* ]
|
|
32
|
+
*/
|
|
33
|
+
export function getMonthDayPickerDefaultOptions() {
|
|
34
|
+
return monthConfig.map(
|
|
35
|
+
(item) => ({
|
|
36
|
+
value: item.month.toString(),
|
|
37
|
+
label: `${ item.month }月`,
|
|
38
|
+
children: Array.from(
|
|
39
|
+
{ length: item.day },
|
|
40
|
+
(_, i) => (
|
|
41
|
+
{ value: `${ i + 1 }`, label: `${ i + 1 }日` }
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
})
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 组装日期范围级联选择组件禁用选项
|
|
50
|
+
* @param date 日期 - 级联选择组件值
|
|
51
|
+
* @param isStartDate 区分传递的date是 开始日期 / 结束日期
|
|
52
|
+
* @param digits 时间范围 n个月
|
|
53
|
+
*/
|
|
54
|
+
export function disableOutOfRangeOptions({
|
|
55
|
+
date = [],
|
|
56
|
+
isStartDate = false,
|
|
57
|
+
digits = 3
|
|
58
|
+
}: { date: string[], isStartDate?: boolean, digits: number }) {
|
|
59
|
+
// 写死一个闰年年份 仅用于比较时间
|
|
60
|
+
// 如果非闰年 dayjs('year-02-29') 会输出 year-3-1 导致日期范围选择器出错
|
|
61
|
+
const year = 2024;
|
|
62
|
+
const baseMonthDay = 30;
|
|
63
|
+
const options = getMonthDayPickerDefaultOptions();
|
|
64
|
+
|
|
65
|
+
return options.map(
|
|
66
|
+
(month) => {
|
|
67
|
+
const children = month.children.map(
|
|
68
|
+
(day) => {
|
|
69
|
+
// 组装日期 - 当前这个选项对应的完整日期
|
|
70
|
+
const currentDate = dayjs([year, month.value, day.value].join('-'));
|
|
71
|
+
|
|
72
|
+
// 是否需要禁用当前日期
|
|
73
|
+
let disabled = false;
|
|
74
|
+
|
|
75
|
+
// 如果有传入日期,则判断是否在禁用日期范围内
|
|
76
|
+
if (date.length > 0) {
|
|
77
|
+
// 组装日期 - 传入日期对应的完整日期
|
|
78
|
+
const baseDate = dayjs([year, ...date].join('-'));
|
|
79
|
+
|
|
80
|
+
// 如果是开始时间,则结束时间范围为 baseDate + digits
|
|
81
|
+
// 如果是结束时间,则开始时间范围为 baseDate - digits
|
|
82
|
+
if (isStartDate) {
|
|
83
|
+
const maxDate = baseDate.add(digits * baseMonthDay - 1, 'day');
|
|
84
|
+
// 推算时间范围超过12月31号,结束时间可选年初时间
|
|
85
|
+
if (maxDate.year() > year) {
|
|
86
|
+
disabled = currentDate.isAfter(maxDate.subtract(366, 'day'), 'day') && currentDate.isBefore(baseDate, 'day');
|
|
87
|
+
} else {
|
|
88
|
+
disabled = currentDate.isAfter(maxDate, 'day') || currentDate.isBefore(baseDate, 'day');
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
const minDate = baseDate.subtract(digits * baseMonthDay - 1, 'day');
|
|
92
|
+
// 推算时间范围在1月1号前,开始时间可选年末时间
|
|
93
|
+
if (minDate.year() < year) {
|
|
94
|
+
disabled = currentDate.isBefore(minDate.add(366, 'day'), 'day') && currentDate.isAfter(baseDate, 'day');
|
|
95
|
+
} else {
|
|
96
|
+
disabled = currentDate.isBefore(minDate, 'day') || currentDate.isAfter(baseDate, 'day');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
...day,
|
|
103
|
+
disabled
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
// 如果当前月份每天都是禁用日期,则整个月份禁用
|
|
109
|
+
const disabled = children.every((day) => day.disabled);
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
...month,
|
|
113
|
+
disabled,
|
|
114
|
+
children
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* 格式化月日级联选择组件值 MM-dd
|
|
122
|
+
* @param date 日期 - 级联选择组件值
|
|
123
|
+
* @returns 格式化后的日期字符串
|
|
124
|
+
*/
|
|
125
|
+
export function formatMonthDayPickerValue(date: string[]) {
|
|
126
|
+
return date
|
|
127
|
+
.map(
|
|
128
|
+
(str) => str.padStart(2, '0')
|
|
129
|
+
)
|
|
130
|
+
.join('-');
|
|
131
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<!-- 月/日选择器 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div class="editable-table-sort-filter__sort">
|
|
4
|
+
<div class="editable-table-sort-filter__search-title">
|
|
5
|
+
{{ config.label || '筛选' }}
|
|
6
|
+
</div>
|
|
7
|
+
<div class="editable-table-sort-filter__date-picker-content">
|
|
8
|
+
<el-cascader
|
|
9
|
+
clearable
|
|
10
|
+
:value="startDate"
|
|
11
|
+
separator=""
|
|
12
|
+
size="small"
|
|
13
|
+
placeholder="开始日期"
|
|
14
|
+
popper-class="month-day-picker"
|
|
15
|
+
:options="startDateOptions"
|
|
16
|
+
@change="value => handleDateChange(config.prop[0], value)"
|
|
17
|
+
/>
|
|
18
|
+
<el-cascader
|
|
19
|
+
clearable
|
|
20
|
+
:value="endDate"
|
|
21
|
+
separator=""
|
|
22
|
+
size="small"
|
|
23
|
+
placeholder="结束日期"
|
|
24
|
+
popper-class="month-day-picker"
|
|
25
|
+
:options="endDateOptions"
|
|
26
|
+
@change="value => handleDateChange(config.prop[1], value)"
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
<script setup lang="ts">
|
|
32
|
+
import {
|
|
33
|
+
disableOutOfRangeOptions, formatMonthDayPickerValue,
|
|
34
|
+
getMonthDayPickerDefaultOptions
|
|
35
|
+
} from './BizMonthDayPicker.helper';
|
|
36
|
+
import { computed, toRefs } from 'vue';
|
|
37
|
+
import { IFilterMonthDayPicker } from '../../types';
|
|
38
|
+
|
|
39
|
+
const props = defineProps<{
|
|
40
|
+
config: IFilterMonthDayPicker
|
|
41
|
+
tempFilteredValue: Record<string, string>
|
|
42
|
+
}>()
|
|
43
|
+
const { config, tempFilteredValue } = toRefs(props)
|
|
44
|
+
|
|
45
|
+
const emit = defineEmits<{
|
|
46
|
+
(e: 'update:tempFilteredValue', key: string, value: string): void
|
|
47
|
+
}>()
|
|
48
|
+
|
|
49
|
+
const formatDate = (date: string) => {
|
|
50
|
+
if (date) {
|
|
51
|
+
return date
|
|
52
|
+
.split('-')
|
|
53
|
+
// 01 -> 1
|
|
54
|
+
.map(
|
|
55
|
+
(v) => String(Number(v))
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return []
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const startDate = computed(() => {
|
|
63
|
+
const { prop } = config.value;
|
|
64
|
+
return formatDate(tempFilteredValue.value[prop[0]]);
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
const endDate = computed(() => {
|
|
68
|
+
const { prop } = config.value;
|
|
69
|
+
return formatDate(tempFilteredValue.value[prop[1]]);
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
// 开始日期范围限制
|
|
73
|
+
const startDateOptions = computed(
|
|
74
|
+
() => {
|
|
75
|
+
if (endDate.value.length === 0) {
|
|
76
|
+
return getMonthDayPickerDefaultOptions();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return disableOutOfRangeOptions({
|
|
80
|
+
date: endDate.value,
|
|
81
|
+
isStartDate: false,
|
|
82
|
+
digits: config.value.limit
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
// 结束日期范围限制
|
|
88
|
+
const endDateOptions = computed(
|
|
89
|
+
() => {
|
|
90
|
+
if (startDate.value.length === 0) {
|
|
91
|
+
return getMonthDayPickerDefaultOptions();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return disableOutOfRangeOptions({
|
|
95
|
+
date: startDate.value,
|
|
96
|
+
isStartDate: true,
|
|
97
|
+
digits: config.value.limit
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* 选择时间更改统一回调
|
|
104
|
+
*/
|
|
105
|
+
const handleDateChange = (key: string, value: string[]) => {
|
|
106
|
+
const currentValue = value.length === 0
|
|
107
|
+
? ''
|
|
108
|
+
: formatMonthDayPickerValue(value)
|
|
109
|
+
emit('update:tempFilteredValue', key, currentValue);
|
|
110
|
+
}
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<style scoped lang="less">
|
|
114
|
+
|
|
115
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<!-- 单选框 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div class="editable-table-sort-filter__filter">
|
|
4
|
+
<div class="editable-table-sort-filter__filter-title">
|
|
5
|
+
{{ config.label || '筛选' }}
|
|
6
|
+
</div>
|
|
7
|
+
<el-radio-group
|
|
8
|
+
style="display: flex;flex-direction: column;gap: 6px;"
|
|
9
|
+
:value="tempFilteredValue[config.prop]"
|
|
10
|
+
@input="val => emit('update:tempFilteredValue', config.prop, val)"
|
|
11
|
+
>
|
|
12
|
+
<el-radio
|
|
13
|
+
v-for="item in config.options"
|
|
14
|
+
:key="item.value"
|
|
15
|
+
:label="item.value"
|
|
16
|
+
:title="item.text"
|
|
17
|
+
>
|
|
18
|
+
{{ item.text }}
|
|
19
|
+
</el-radio>
|
|
20
|
+
</el-radio-group>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script setup lang="ts">
|
|
25
|
+
import { IFilterSelect } from '../../types';
|
|
26
|
+
|
|
27
|
+
defineProps<{
|
|
28
|
+
config: IFilterSelect
|
|
29
|
+
tempFilteredValue: Record<string, string>
|
|
30
|
+
}>()
|
|
31
|
+
|
|
32
|
+
const emit = defineEmits<{
|
|
33
|
+
(e: 'update:tempFilteredValue', key: string, value: string): void
|
|
34
|
+
}>()
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<style scoped lang="less">
|
|
38
|
+
|
|
39
|
+
</style>
|
package/src/components/EditableTable/features/bizTableHeaderPopover/{sort.vue → BizSortFilter.vue}
RENAMED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
:key="item.prop"
|
|
6
6
|
>
|
|
7
7
|
<div class="editable-table-sort-filter__sort-title">
|
|
8
|
-
{{ item.label }}
|
|
8
|
+
{{ item.label || '排序' }}
|
|
9
9
|
</div>
|
|
10
10
|
<div class="editable-table-sort-filter__sort-btns">
|
|
11
11
|
<el-button
|
|
@@ -47,4 +47,4 @@ const sortConfigs = computed(() => {
|
|
|
47
47
|
if (Array.isArray(props.column._sortable)) return props.column._sortable
|
|
48
48
|
return [{ ...props.column, label: '排序' }]
|
|
49
49
|
})
|
|
50
|
-
</script>
|
|
50
|
+
</script>
|
|
@@ -9,98 +9,49 @@
|
|
|
9
9
|
@show="() => emit('popover-show')"
|
|
10
10
|
>
|
|
11
11
|
<template slot="reference">
|
|
12
|
-
<slot
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
>
|
|
21
|
-
{{ column.label }}
|
|
22
|
-
<div :class="['editable-table__sort-icon', headActive && 'editable-table__sort-icon--active']" />
|
|
23
|
-
</span>
|
|
12
|
+
<slot name="custom">
|
|
13
|
+
<!-- 筛选中,或排序中,高亮 -->
|
|
14
|
+
<span
|
|
15
|
+
:class="['editable-table__sort-reference', headActive && 'editable-table__sort-reference--active']"
|
|
16
|
+
>
|
|
17
|
+
{{ column.label }}
|
|
18
|
+
<div :class="['editable-table__sort-icon', headActive && 'editable-table__sort-icon--active']" />
|
|
19
|
+
</span>
|
|
20
|
+
</slot>
|
|
24
21
|
</template>
|
|
25
22
|
<div class="editable-table-sort-filter">
|
|
26
23
|
<div class="editable-table-sort-filter__column-title">
|
|
27
24
|
{{ column.label }}
|
|
28
25
|
</div>
|
|
29
26
|
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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>
|
|
27
|
+
<div class="editable-table-sort-filter__item">
|
|
28
|
+
<BizSortFilter
|
|
29
|
+
v-if="column.isColumnSortable"
|
|
30
|
+
:column="column"
|
|
31
|
+
:temp-sort-prop="tempSortProp"
|
|
32
|
+
:temp-sort-type="tempSortType"
|
|
33
|
+
@update:sort="(type, prop) => emit('update:sort', type, prop)"
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
54
36
|
|
|
55
|
-
<
|
|
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>
|
|
37
|
+
<template v-if="column.filters">
|
|
62
38
|
<div
|
|
63
|
-
|
|
64
|
-
|
|
39
|
+
v-for="(filterItem, index) in column.filters"
|
|
40
|
+
:key="index"
|
|
41
|
+
class="editable-table-sort-filter__item editable-table__filter-group__filter"
|
|
65
42
|
>
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
:
|
|
69
|
-
value
|
|
70
|
-
|
|
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="结束日期"
|
|
43
|
+
<component
|
|
44
|
+
:is="componentMap[filterItem.type]"
|
|
45
|
+
:config="filterItem"
|
|
46
|
+
:temp-filtered-value="tempFilteredValue"
|
|
47
|
+
@update:tempFilteredValue="onUpdate"
|
|
83
48
|
/>
|
|
84
49
|
</div>
|
|
85
|
-
</
|
|
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>
|
|
50
|
+
</template>
|
|
100
51
|
|
|
101
52
|
<div
|
|
102
53
|
v-if="column.summary"
|
|
103
|
-
class="editable-table-sort-filter__filter"
|
|
54
|
+
class="editable-table-sort-filter__item editable-table-sort-filter__filter"
|
|
104
55
|
>
|
|
105
56
|
<div class="editable-table-sort-filter__filter-title">
|
|
106
57
|
统计
|
|
@@ -144,12 +95,16 @@
|
|
|
144
95
|
</template>
|
|
145
96
|
|
|
146
97
|
<script setup lang="ts">
|
|
147
|
-
import Search from './search.vue'
|
|
148
|
-
import Sort from './sort.vue'
|
|
149
|
-
import BizFilter from './bizFilter.vue'
|
|
150
|
-
|
|
151
98
|
import { ref } from 'vue'
|
|
152
|
-
|
|
99
|
+
|
|
100
|
+
import BizCheckboxFilter from './BizCheckboxFilter.vue';
|
|
101
|
+
import BizColorRadioFilter from './BizColorRadioFilter.vue';
|
|
102
|
+
import BizDoubleDatePickerFilter from './BizDoubleDatePickerFilter.vue';
|
|
103
|
+
import BizInputFilter from './BizInputFilter.vue';
|
|
104
|
+
import BizMonthDayPicker from './BizMonthDayPicker.vue';
|
|
105
|
+
import BizSortFilter from './BizSortFilter.vue';
|
|
106
|
+
import BizRadioFilter from "./BizRadioFilter.vue";
|
|
107
|
+
import { FilterItem, IColumnConfig } from '../../types'
|
|
153
108
|
|
|
154
109
|
defineProps<{
|
|
155
110
|
headActive: boolean
|
|
@@ -157,12 +112,10 @@ defineProps<{
|
|
|
157
112
|
tempSummaryList: string[]
|
|
158
113
|
tempSortType: 'ascending' | 'descending' | ''
|
|
159
114
|
tempSortProp: string
|
|
160
|
-
tempSearchValue: Record<string, string>
|
|
161
115
|
tempFilteredValue: Record<string, string | number | number[] | string[]>
|
|
162
116
|
}>()
|
|
163
117
|
|
|
164
118
|
const emit = defineEmits<{
|
|
165
|
-
(e: 'update:tempSearchValue', key: string, value: string): void
|
|
166
119
|
(e: 'update:tempFilteredValue', key: string, value: string): void
|
|
167
120
|
(e: 'update:tempSummaryList', value: string[]): void
|
|
168
121
|
(e: 'update:sort', type: 'ascending' | 'descending', prop: string): void
|
|
@@ -171,8 +124,29 @@ const emit = defineEmits<{
|
|
|
171
124
|
(e: 'confirm'): void
|
|
172
125
|
}>()
|
|
173
126
|
|
|
127
|
+
// 把 filterItem.type 映射到组件
|
|
128
|
+
const componentMap: Record<FilterItem['type'], any> = {
|
|
129
|
+
/** 输入框 */
|
|
130
|
+
input: BizInputFilter,
|
|
131
|
+
/** 日期范围 */
|
|
132
|
+
doubleDatePicker: BizDoubleDatePickerFilter,
|
|
133
|
+
/** 单选框 */
|
|
134
|
+
radio: BizRadioFilter,
|
|
135
|
+
/** 复选框 */
|
|
136
|
+
checkbox: BizCheckboxFilter,
|
|
137
|
+
/** 月日选择器 */
|
|
138
|
+
monthDayPicker: BizMonthDayPicker,
|
|
139
|
+
/** 颜色选择器 */
|
|
140
|
+
colorRadio: BizColorRadioFilter,
|
|
141
|
+
}
|
|
142
|
+
|
|
174
143
|
const popoverRef = ref(null as any)
|
|
175
144
|
|
|
145
|
+
// 统一的事件派发
|
|
146
|
+
function onUpdate(key: string, val: any) {
|
|
147
|
+
emit('update:tempFilteredValue', key, val)
|
|
148
|
+
}
|
|
149
|
+
|
|
176
150
|
defineExpose({
|
|
177
151
|
close: () => {
|
|
178
152
|
popoverRef.value?.doClose()
|
|
@@ -387,9 +387,28 @@
|
|
|
387
387
|
border-bottom: 1px solid #d6dbe3;
|
|
388
388
|
}
|
|
389
389
|
|
|
390
|
+
&__item {
|
|
391
|
+
margin-top: 14px;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
&__date-picker-content {
|
|
395
|
+
display: flex;
|
|
396
|
+
flex-direction: column;
|
|
397
|
+
gap: 12px;
|
|
398
|
+
|
|
399
|
+
.el-date-editor.el-input,
|
|
400
|
+
.el-date-editor.el-input__inner {
|
|
401
|
+
width: 100%;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
390
405
|
&__filter,
|
|
391
406
|
&__search {
|
|
392
|
-
padding: 14px;
|
|
407
|
+
padding: 0 14px;
|
|
408
|
+
|
|
409
|
+
.el-select {
|
|
410
|
+
width: 100%;
|
|
411
|
+
}
|
|
393
412
|
|
|
394
413
|
.el-radio {
|
|
395
414
|
width: 100%;
|
|
@@ -422,7 +441,6 @@
|
|
|
422
441
|
}
|
|
423
442
|
|
|
424
443
|
&__filter {
|
|
425
|
-
padding-top: 0;
|
|
426
444
|
|
|
427
445
|
.el-radio-group,
|
|
428
446
|
.el-checkbox-group {
|
|
@@ -433,10 +451,9 @@
|
|
|
433
451
|
}
|
|
434
452
|
|
|
435
453
|
&__sort {
|
|
436
|
-
padding: 14px;
|
|
454
|
+
padding: 0 14px;
|
|
437
455
|
display: flex;
|
|
438
456
|
flex-direction: column;
|
|
439
|
-
gap: 8px;
|
|
440
457
|
}
|
|
441
458
|
|
|
442
459
|
&__filter-title,
|
|
@@ -454,22 +471,19 @@
|
|
|
454
471
|
height: 32px;
|
|
455
472
|
}
|
|
456
473
|
}
|
|
474
|
+
|
|
457
475
|
&__date-range {
|
|
458
476
|
display: flex;
|
|
459
477
|
flex-direction: column;
|
|
460
478
|
gap: 12px;
|
|
461
479
|
|
|
462
|
-
.el-date-editor.el-input,
|
|
480
|
+
.el-date-editor.el-input,
|
|
481
|
+
.el-date-editor.el-input__inner {
|
|
463
482
|
width: 100%;
|
|
464
483
|
}
|
|
465
484
|
}
|
|
466
485
|
}
|
|
467
486
|
|
|
468
|
-
&__filter-title {
|
|
469
|
-
border-top: 1px solid #f3f3f3;
|
|
470
|
-
padding-top: 14px;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
487
|
&__sort-btns {
|
|
474
488
|
display: flex;
|
|
475
489
|
justify-content: space-between;
|
|
@@ -543,6 +557,7 @@
|
|
|
543
557
|
justify-content: flex-end;
|
|
544
558
|
align-items: center;
|
|
545
559
|
padding: 0 15px;
|
|
560
|
+
margin-top: 14px;
|
|
546
561
|
}
|
|
547
562
|
|
|
548
563
|
&__reset-btn,
|
|
@@ -802,4 +817,4 @@
|
|
|
802
817
|
&::before {
|
|
803
818
|
bottom: -4px;
|
|
804
819
|
}
|
|
805
|
-
}
|
|
820
|
+
}
|