cnhis-design-vue 2.1.126 → 2.1.127
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/CHANGELOG.md +14 -7
- package/es/affix/index.js +8 -8
- package/es/age/index.js +10 -10
- package/es/alert/index.js +8 -8
- package/es/anchor/index.js +8 -8
- package/es/auto-complete/index.js +8 -8
- package/es/avatar/index.js +8 -8
- package/es/back-top/index.js +8 -8
- package/es/badge/index.js +8 -8
- package/es/base/index.js +8 -8
- package/es/big-table/index.js +71 -71
- package/es/breadcrumb/index.js +8 -8
- package/es/button/index.js +22 -22
- package/es/calendar/index.js +8 -8
- package/es/captcha/index.js +3 -3
- package/es/card/index.js +8 -8
- package/es/card-reader-sdk/index.js +1 -1
- package/es/carousel/index.js +8 -8
- package/es/cascader/index.js +8 -8
- package/es/checkbox/index.js +9 -9
- package/es/col/index.js +8 -8
- package/es/collapse/index.js +8 -8
- package/es/color-picker/index.js +1 -1
- package/es/comment/index.js +8 -8
- package/es/config-provider/index.js +8 -8
- package/es/date-picker/index.js +8 -8
- package/es/descriptions/index.js +8 -8
- package/es/direct/index.js +16 -16
- package/es/divider/index.js +8 -8
- package/es/drag-layout/index.js +3 -3
- package/es/drawer/index.js +8 -8
- package/es/dropdown/index.js +8 -8
- package/es/editor/index.js +1 -1
- package/es/ellipsis/index.js +1 -1
- package/es/empty/index.js +8 -8
- package/es/fabric-chart/index.js +9 -9
- package/es/form/index.js +8 -8
- package/es/form-model/index.js +8 -8
- package/es/form-table/index.js +74 -74
- package/es/full-calendar/index.js +4 -4
- package/es/grid/index.js +1 -12
- package/es/index/index.js +793 -551
- package/es/input/index.js +9 -9
- package/es/input-number/index.js +8 -8
- package/es/layout/index.js +8 -8
- package/es/list/index.js +8 -8
- package/es/locale-provider/index.js +8 -8
- package/es/map/index.js +9 -9
- package/es/mentions/index.js +8 -8
- package/es/menu/index.js +8 -8
- package/es/message/index.js +8 -8
- package/es/multi-chat/index.js +76 -76
- package/es/multi-chat-client/index.js +70 -70
- package/es/multi-chat-history/index.js +4 -4
- package/es/multi-chat-record/index.js +14 -14
- package/es/multi-chat-setting/index.js +22 -22
- package/es/multi-chat-sip/index.js +1 -1
- package/es/notification/index.js +8 -8
- package/es/page-header/index.js +8 -8
- package/es/pagination/index.js +8 -8
- package/es/popconfirm/index.js +8 -8
- package/es/popover/index.js +8 -8
- package/es/progress/index.js +8 -8
- package/es/radio/index.js +9 -9
- package/es/rate/index.js +8 -8
- package/es/result/index.js +8 -8
- package/es/row/index.js +8 -8
- package/es/scale-container/index.js +9 -9
- package/es/scale-view/index.js +27 -27
- package/es/select/index.js +12 -12
- package/es/select-label/index.js +11 -11
- package/es/select-person/index.js +2 -2
- package/es/select-tag/index.js +4 -4
- package/es/shortcut-setter/index.js +10 -10
- package/es/skeleton/index.js +8 -8
- package/es/slider/index.js +8 -8
- package/es/slider-tree/index.js +9 -9
- package/es/space/index.js +8 -8
- package/es/spin/index.js +8 -8
- package/es/statistic/index.js +8 -8
- package/es/steps/index.js +8 -8
- package/es/switch/index.js +8 -8
- package/es/table-filter/index.js +431 -178
- package/es/tabs/index.js +8 -8
- package/es/tag/index.js +9 -9
- package/es/time-picker/index.js +8 -8
- package/es/timeline/index.js +8 -8
- package/es/tooltip/index.js +8 -8
- package/es/transfer/index.js +8 -8
- package/es/tree/index.js +8 -8
- package/es/tree-select/index.js +8 -8
- package/es/upload/index.js +8 -8
- package/es/verification-code/index.js +2 -2
- package/lib/cui.common.js +802 -578
- package/lib/cui.umd.js +802 -578
- package/lib/cui.umd.min.js +57 -57
- package/package.json +1 -1
- package/packages/grid/src/grid.js +0 -1
- package/packages/table-filter/src/components/render-widget/enums.js +39 -16
- package/packages/table-filter/src/components/render-widget/helpers/presetValToTimestamp.js +245 -31
- package/packages/table-filter/src/components/render-widget/index.vue +7 -4
- package/packages/table-filter/src/components/render-widget/widgetCfgMaps.js +38 -11
- package/packages/table-filter/src/mixins/mixins.js +10 -8
- package/packages/table-filter/src/mixins/renderWidget.js +2 -2
package/package.json
CHANGED
|
@@ -8,7 +8,6 @@ import 'xe-utils';
|
|
|
8
8
|
import VXETable from 'vxe-table';
|
|
9
9
|
import VXETablePluginAntd from 'vxe-table-plugin-antd';
|
|
10
10
|
import Grid from 'vxe-table/lib/grid';
|
|
11
|
-
import 'vxe-table/lib/style.css';
|
|
12
11
|
import 'vxe-table-plugin-antd/dist/style.css';
|
|
13
12
|
|
|
14
13
|
VXETable.use(VXETablePluginAntd);
|
|
@@ -17,20 +17,43 @@ export const WidgetTypeEnums = {
|
|
|
17
17
|
export const DatePresetValEnums = {
|
|
18
18
|
CUSTOM: 'CUSTOM', // 自定义输入,特殊处理
|
|
19
19
|
|
|
20
|
-
NOW: 'NOW',
|
|
21
|
-
TODAY: 'TODAY',
|
|
22
|
-
TODAY_START: 'TODAY_START',
|
|
23
|
-
TODAY_END: 'TODAY_END',
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
NOW: 'NOW', // 当前
|
|
21
|
+
TODAY: 'TODAY', // 今天
|
|
22
|
+
TODAY_START: 'TODAY_START', // 今天初
|
|
23
|
+
TODAY_END: 'TODAY_END', // 今天未
|
|
24
|
+
|
|
25
|
+
TOMORROW: 'TOMORROW', // 明天
|
|
26
|
+
TOMORROW_START: 'TOMORROW_START', // 明天初
|
|
27
|
+
TOMORROW_END: 'TOMORROW_END', // 明天未
|
|
28
|
+
|
|
29
|
+
YESTERDAY: 'YESTERDAY', // 昨天
|
|
30
|
+
YESTERDAY_START: 'YESTERDAY_START', // 昨天初
|
|
31
|
+
YESTERDAY_END: 'YESTERDAY_END', // 昨天未
|
|
32
|
+
|
|
33
|
+
THIS_WEEK: 'THIS_WEEK', // 本周
|
|
34
|
+
WEEK_START: 'THIS_WEEK_START', // 本周初
|
|
35
|
+
WEEK_END: 'THIS_WEEK_END', // 本周未
|
|
36
|
+
NEXT_WEEK: 'NEXT_WEEK', // 下周
|
|
37
|
+
LAST_WEEK: 'LAST_WEEK', // 上周
|
|
38
|
+
PAST_WEEK: 'PAST_WEEK', // 近一周(7天)
|
|
39
|
+
|
|
40
|
+
THIS_MONTH: 'THIS_MONTH', // 本月
|
|
41
|
+
MONTH_START: 'THIS_MONTH_START', // 本月初
|
|
42
|
+
MONTH_END: 'THIS_MONTH_END', // 本月未
|
|
43
|
+
NEXT_MONTH: 'NEXT_MONTH', // 下月
|
|
44
|
+
LAST_MONTH: 'LAST_MONTH', // 上月
|
|
45
|
+
PAST_MONTH: 'PAST_MONTH', // 近一个月(30天)
|
|
46
|
+
|
|
47
|
+
THIS_QUARTER: 'THIS_QUARTER', // 本季度
|
|
48
|
+
NEXT_QUARTER: 'NEXT_QUARTER', // 上季度
|
|
49
|
+
LAST_QUARTER: 'LAST_QUARTER', // 下季度
|
|
50
|
+
QUARTER_START: 'THIS_QUARTER_START', // 季度初
|
|
51
|
+
QUARTER_END: 'THIS_QUARTER_END', // 季度未
|
|
52
|
+
|
|
53
|
+
THIS_YEAR: 'THIS_YEAR', // 今年
|
|
54
|
+
YEAR_START: 'THIS_YEAR_START', // 今年初
|
|
55
|
+
YEAR_END: 'THIS_YEAR_END', // 今年未
|
|
56
|
+
NEXT_YEAR: 'NEXT_YEAR', // 明年
|
|
57
|
+
LAST_YEAR: 'LAST_YEAR', // 去年
|
|
58
|
+
PAST_HALF_YEAR: 'PAST_HALF_YEAR' // 近半年(182天)
|
|
36
59
|
};
|
|
@@ -1,68 +1,282 @@
|
|
|
1
1
|
import { DatePresetValEnums } from '../enums';
|
|
2
2
|
import moment from 'moment';
|
|
3
3
|
|
|
4
|
+
const isPastTime = type => {
|
|
5
|
+
return type === 'DATETIME_PAST';
|
|
6
|
+
};
|
|
7
|
+
const isFutureTime = type => {
|
|
8
|
+
return type === 'DATETIME_FUTURE';
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const nowTime = moment();
|
|
12
|
+
|
|
4
13
|
const Maps = new Map([
|
|
14
|
+
[DatePresetValEnums.NOW, () => moment()],
|
|
15
|
+
[DatePresetValEnums.TODAY, () => [moment().startOf('day'), moment().endOf('day')]],
|
|
16
|
+
[DatePresetValEnums.TODAY_START, () => moment().startOf('day')],
|
|
17
|
+
[DatePresetValEnums.TODAY_END, () => moment().endOf('day')],
|
|
5
18
|
[
|
|
6
|
-
DatePresetValEnums.
|
|
7
|
-
() =>
|
|
19
|
+
DatePresetValEnums.TOMORROW,
|
|
20
|
+
() => [
|
|
21
|
+
moment()
|
|
22
|
+
.add(1, 'days')
|
|
23
|
+
.startOf('day'),
|
|
24
|
+
moment()
|
|
25
|
+
.add(1, 'days')
|
|
26
|
+
.endOf('day')
|
|
27
|
+
]
|
|
8
28
|
],
|
|
9
29
|
[
|
|
10
|
-
DatePresetValEnums.
|
|
11
|
-
() =>
|
|
30
|
+
DatePresetValEnums.TOMORROW_START,
|
|
31
|
+
() =>
|
|
32
|
+
moment()
|
|
33
|
+
.add(1, 'days')
|
|
34
|
+
.startOf('day')
|
|
12
35
|
],
|
|
13
36
|
[
|
|
14
|
-
DatePresetValEnums.
|
|
15
|
-
() =>
|
|
37
|
+
DatePresetValEnums.TOMORROW_END,
|
|
38
|
+
() =>
|
|
39
|
+
moment()
|
|
40
|
+
.add(1, 'days')
|
|
41
|
+
.endOf('day')
|
|
16
42
|
],
|
|
17
43
|
[
|
|
18
|
-
DatePresetValEnums.
|
|
19
|
-
() =>
|
|
44
|
+
DatePresetValEnums.YESTERDAY,
|
|
45
|
+
() => [
|
|
46
|
+
moment()
|
|
47
|
+
.subtract(1, 'days')
|
|
48
|
+
.startOf('day'),
|
|
49
|
+
moment()
|
|
50
|
+
.subtract(1, 'days')
|
|
51
|
+
.endOf('day')
|
|
52
|
+
]
|
|
20
53
|
],
|
|
21
54
|
[
|
|
22
|
-
DatePresetValEnums.
|
|
23
|
-
() =>
|
|
55
|
+
DatePresetValEnums.YESTERDAY_START,
|
|
56
|
+
() =>
|
|
57
|
+
moment()
|
|
58
|
+
.subtract(1, 'days')
|
|
59
|
+
.startOf('day')
|
|
24
60
|
],
|
|
25
61
|
[
|
|
26
|
-
DatePresetValEnums.
|
|
27
|
-
() =>
|
|
62
|
+
DatePresetValEnums.YESTERDAY_END,
|
|
63
|
+
() =>
|
|
64
|
+
moment()
|
|
65
|
+
.subtract(1, 'days')
|
|
66
|
+
.endOf('day')
|
|
28
67
|
],
|
|
68
|
+
// week
|
|
69
|
+
[DatePresetValEnums.WEEK_START, () => moment().startOf('week')],
|
|
70
|
+
[DatePresetValEnums.WEEK_END, () => moment().endOf('week')],
|
|
71
|
+
|
|
29
72
|
[
|
|
30
|
-
DatePresetValEnums.
|
|
31
|
-
|
|
73
|
+
DatePresetValEnums.THIS_WEEK,
|
|
74
|
+
type => {
|
|
75
|
+
let start = moment().startOf('week');
|
|
76
|
+
let end = moment().endOf('week');
|
|
77
|
+
if (isPastTime(type)) {
|
|
78
|
+
end = nowTime;
|
|
79
|
+
}
|
|
80
|
+
if (isFutureTime(type)) {
|
|
81
|
+
start = nowTime;
|
|
82
|
+
}
|
|
83
|
+
return [start, end];
|
|
84
|
+
}
|
|
32
85
|
],
|
|
33
86
|
[
|
|
34
|
-
DatePresetValEnums.
|
|
35
|
-
() =>
|
|
87
|
+
DatePresetValEnums.NEXT_WEEK,
|
|
88
|
+
() => [
|
|
89
|
+
moment()
|
|
90
|
+
.add(1, 'weeks')
|
|
91
|
+
.startOf('week'),
|
|
92
|
+
moment()
|
|
93
|
+
.add(1, 'weeks')
|
|
94
|
+
.endOf('week')
|
|
95
|
+
]
|
|
36
96
|
],
|
|
37
97
|
[
|
|
38
|
-
DatePresetValEnums.
|
|
39
|
-
() =>
|
|
98
|
+
DatePresetValEnums.LAST_WEEK,
|
|
99
|
+
() => [
|
|
100
|
+
moment()
|
|
101
|
+
.subtract(1, 'weeks')
|
|
102
|
+
.startOf('week'),
|
|
103
|
+
moment()
|
|
104
|
+
.subtract(1, 'weeks')
|
|
105
|
+
.endOf('week')
|
|
106
|
+
]
|
|
40
107
|
],
|
|
41
108
|
[
|
|
42
|
-
DatePresetValEnums.
|
|
43
|
-
|
|
109
|
+
DatePresetValEnums.PAST_WEEK,
|
|
110
|
+
type => {
|
|
111
|
+
let start = moment()
|
|
112
|
+
.subtract(7, 'days')
|
|
113
|
+
.startOf('day');
|
|
114
|
+
let end = moment().endOf('day');
|
|
115
|
+
if (isPastTime(type)) {
|
|
116
|
+
end = nowTime;
|
|
117
|
+
}
|
|
118
|
+
return [start, end];
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
// month
|
|
122
|
+
[
|
|
123
|
+
DatePresetValEnums.THIS_MONTH,
|
|
124
|
+
type => {
|
|
125
|
+
let start = moment().startOf('month');
|
|
126
|
+
let end = moment().endOf('month');
|
|
127
|
+
if (isPastTime(type)) {
|
|
128
|
+
end = nowTime;
|
|
129
|
+
}
|
|
130
|
+
if (isFutureTime(type)) {
|
|
131
|
+
start = nowTime;
|
|
132
|
+
}
|
|
133
|
+
return [start, end];
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
[DatePresetValEnums.MONTH_START, () => moment().startOf('month')],
|
|
137
|
+
[DatePresetValEnums.MONTH_END, () => moment().endOf('month')],
|
|
138
|
+
[
|
|
139
|
+
DatePresetValEnums.NEXT_MONTH,
|
|
140
|
+
() => [
|
|
141
|
+
moment()
|
|
142
|
+
.add(1, 'months')
|
|
143
|
+
.startOf('month'),
|
|
144
|
+
moment()
|
|
145
|
+
.add(1, 'months')
|
|
146
|
+
.endOf('month')
|
|
147
|
+
]
|
|
148
|
+
],
|
|
149
|
+
[
|
|
150
|
+
DatePresetValEnums.LAST_MONTH,
|
|
151
|
+
() => [
|
|
152
|
+
moment()
|
|
153
|
+
.subtract(1, 'months')
|
|
154
|
+
.startOf('month'),
|
|
155
|
+
moment()
|
|
156
|
+
.subtract(1, 'months')
|
|
157
|
+
.endOf('month')
|
|
158
|
+
]
|
|
159
|
+
],
|
|
160
|
+
[
|
|
161
|
+
DatePresetValEnums.PAST_MONTH,
|
|
162
|
+
type => {
|
|
163
|
+
let start = moment()
|
|
164
|
+
.subtract(30, 'days')
|
|
165
|
+
.startOf('day');
|
|
166
|
+
let end = moment().endOf('day');
|
|
167
|
+
if (isPastTime(type)) {
|
|
168
|
+
end = nowTime;
|
|
169
|
+
}
|
|
170
|
+
return [start, end];
|
|
171
|
+
}
|
|
172
|
+
],
|
|
173
|
+
// quarter
|
|
174
|
+
[
|
|
175
|
+
DatePresetValEnums.THIS_QUARTER,
|
|
176
|
+
type => {
|
|
177
|
+
let start = moment().startOf('quarter');
|
|
178
|
+
let end = moment().endOf('quarter');
|
|
179
|
+
if (isPastTime(type)) {
|
|
180
|
+
end = nowTime;
|
|
181
|
+
}
|
|
182
|
+
if (isFutureTime(type)) {
|
|
183
|
+
start = nowTime;
|
|
184
|
+
}
|
|
185
|
+
return [start, end];
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
[
|
|
189
|
+
DatePresetValEnums.NEXT_QUARTER,
|
|
190
|
+
() => [
|
|
191
|
+
moment()
|
|
192
|
+
.add(1, 'quarters')
|
|
193
|
+
.startOf('quarter'),
|
|
194
|
+
moment()
|
|
195
|
+
.add(1, 'quarters')
|
|
196
|
+
.endOf('quarter')
|
|
197
|
+
]
|
|
44
198
|
],
|
|
45
199
|
[
|
|
46
|
-
DatePresetValEnums.
|
|
47
|
-
() =>
|
|
200
|
+
DatePresetValEnums.LAST_QUARTER,
|
|
201
|
+
() => [
|
|
202
|
+
moment()
|
|
203
|
+
.subtract(1, 'quarters')
|
|
204
|
+
.startOf('quarter'),
|
|
205
|
+
moment()
|
|
206
|
+
.subtract(1, 'quarters')
|
|
207
|
+
.endOf('quarter')
|
|
208
|
+
]
|
|
48
209
|
],
|
|
210
|
+
[DatePresetValEnums.QUARTER_START, () => moment().startOf('quarter')],
|
|
211
|
+
[DatePresetValEnums.QUARTER_END, () => moment().endOf('quarter')],
|
|
212
|
+
// year
|
|
49
213
|
[
|
|
50
|
-
DatePresetValEnums.
|
|
51
|
-
|
|
214
|
+
DatePresetValEnums.THIS_YEAR,
|
|
215
|
+
type => {
|
|
216
|
+
let start = moment().startOf('year');
|
|
217
|
+
let end = moment().endOf('year');
|
|
218
|
+
if (isPastTime(type)) {
|
|
219
|
+
end = nowTime;
|
|
220
|
+
}
|
|
221
|
+
if (isFutureTime(type)) {
|
|
222
|
+
start = nowTime;
|
|
223
|
+
}
|
|
224
|
+
return [start, end];
|
|
225
|
+
}
|
|
52
226
|
],
|
|
227
|
+
[DatePresetValEnums.YEAR_START, () => moment().startOf('year')],
|
|
228
|
+
[DatePresetValEnums.YEAR_END, () => moment().endOf('year')],
|
|
53
229
|
[
|
|
54
|
-
DatePresetValEnums.
|
|
55
|
-
() =>
|
|
230
|
+
DatePresetValEnums.NEXT_YEAR,
|
|
231
|
+
() => [
|
|
232
|
+
moment()
|
|
233
|
+
.add(1, 'years')
|
|
234
|
+
.startOf('year'),
|
|
235
|
+
moment()
|
|
236
|
+
.add(1, 'years')
|
|
237
|
+
.endOf('year')
|
|
238
|
+
]
|
|
56
239
|
],
|
|
57
240
|
[
|
|
58
|
-
DatePresetValEnums.
|
|
59
|
-
() =>
|
|
241
|
+
DatePresetValEnums.LAST_YEAR,
|
|
242
|
+
() => [
|
|
243
|
+
moment()
|
|
244
|
+
.subtract(1, 'years')
|
|
245
|
+
.startOf('year'),
|
|
246
|
+
moment()
|
|
247
|
+
.subtract(1, 'years')
|
|
248
|
+
.endOf('year')
|
|
249
|
+
]
|
|
60
250
|
],
|
|
61
|
-
|
|
251
|
+
[
|
|
252
|
+
DatePresetValEnums.PAST_HALF_YEAR,
|
|
253
|
+
type => {
|
|
254
|
+
let start = moment()
|
|
255
|
+
.subtract(182, 'days')
|
|
256
|
+
.startOf('day');
|
|
257
|
+
let end = moment().endOf('day');
|
|
258
|
+
if (isPastTime(type)) {
|
|
259
|
+
end = nowTime;
|
|
260
|
+
}
|
|
261
|
+
return [start, end];
|
|
262
|
+
}
|
|
263
|
+
]
|
|
264
|
+
]);
|
|
62
265
|
|
|
63
|
-
|
|
266
|
+
const presetValToTimestamp = (presetVal, format = 'x', openSetting) => {
|
|
64
267
|
if (!Maps.has(presetVal)) return;
|
|
65
268
|
const fun = Maps.get(presetVal);
|
|
269
|
+
const funVal = fun(openSetting);
|
|
270
|
+
|
|
271
|
+
const isX = format === 'x' || format === 'X';
|
|
272
|
+
if (funVal && Array.isArray(funVal)) {
|
|
273
|
+
return funVal.map(v => {
|
|
274
|
+
const val = v.format(format);
|
|
275
|
+
return isX ? Number(val) : val;
|
|
276
|
+
});
|
|
277
|
+
}
|
|
66
278
|
const val = fun().format(format);
|
|
67
|
-
return
|
|
279
|
+
return isX ? Number(val) : val;
|
|
68
280
|
};
|
|
281
|
+
|
|
282
|
+
export { presetValToTimestamp };
|
|
@@ -75,11 +75,11 @@ export default {
|
|
|
75
75
|
return `unset`;
|
|
76
76
|
},
|
|
77
77
|
initComponentProps(cfg) {
|
|
78
|
-
const { widgetType, alias, title, placeholder: customPlaceholder, widgetCfg, fieldType, explicitRequired } = cfg;
|
|
78
|
+
const { widgetType, alias, title, placeholder: customPlaceholder, widgetCfg, fieldType, explicitRequired, optionSetting } = cfg;
|
|
79
79
|
const { props, handlerProps } = WidgetCfgMaps.get(widgetType);
|
|
80
80
|
let Props = { ...props };
|
|
81
81
|
if (handlerProps) {
|
|
82
|
-
Props = handlerProps(Props, { ...widgetCfg, title: alias || title, fieldType, isQuick: this.isQuick, explicitRequired });
|
|
82
|
+
Props = handlerProps(Props, { ...widgetCfg, title: alias || title, fieldType, isQuick: this.isQuick, explicitRequired, optionSetting });
|
|
83
83
|
}
|
|
84
84
|
if (customPlaceholder) {
|
|
85
85
|
Props.placeholder = customPlaceholder;
|
|
@@ -107,11 +107,13 @@ export default {
|
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
const EventsBySearch = eventsBySearch.reduce((evts, item) => {
|
|
110
|
-
const { name, handler } = item;
|
|
110
|
+
const { name, handler, isDebounce } = item;
|
|
111
111
|
let eventHandler = this.search;
|
|
112
112
|
if (handler) {
|
|
113
113
|
eventHandler = (e) => {
|
|
114
|
-
|
|
114
|
+
// 搜索框需要防抖
|
|
115
|
+
let curMethod = isDebounce ? this.debounceSearch : this.search
|
|
116
|
+
handler(e, curMethod, props, cfg);
|
|
115
117
|
};
|
|
116
118
|
}
|
|
117
119
|
return {
|
|
@@ -129,6 +131,7 @@ export default {
|
|
|
129
131
|
},
|
|
130
132
|
created() {
|
|
131
133
|
this.handleWordBookSearchRender = debounce(this.handleWordBookSearchDef, 300)
|
|
134
|
+
this.debounceSearch = debounce(this.search, 300)
|
|
132
135
|
this.initComponentProps(this.cfg);
|
|
133
136
|
},
|
|
134
137
|
render() {
|
|
@@ -6,6 +6,21 @@ import { presetValToTimestamp } from './helpers/presetValToTimestamp';
|
|
|
6
6
|
|
|
7
7
|
const SetDefVal = defaultValue => defaultValue;
|
|
8
8
|
|
|
9
|
+
// 日期默认值
|
|
10
|
+
const handleDateDef = (defaultValue, defValueUnit, { format, rangeFilter, optionSetting }) => {
|
|
11
|
+
let resDate = presetValToTimestamp(defValueUnit, format, optionSetting);
|
|
12
|
+
if (rangeFilter) {
|
|
13
|
+
// 范围
|
|
14
|
+
if (!resDate) return [];
|
|
15
|
+
if (!Array.isArray(resDate)) return [resDate, resDate];
|
|
16
|
+
} else {
|
|
17
|
+
// 非范围
|
|
18
|
+
if (!resDate) return null;
|
|
19
|
+
if (resDate && Array.isArray(resDate) && resDate[0]) return resDate[0];
|
|
20
|
+
}
|
|
21
|
+
return resDate;
|
|
22
|
+
};
|
|
23
|
+
|
|
9
24
|
export const WidgetCfgMaps = new Map([
|
|
10
25
|
[
|
|
11
26
|
WidgetTypeEnums.INPUT_NUMBER,
|
|
@@ -97,9 +112,9 @@ export const WidgetCfgMaps = new Map([
|
|
|
97
112
|
const Props = { ...props, placeholder: `请选择${title}`, allowClear };
|
|
98
113
|
return Props;
|
|
99
114
|
},
|
|
100
|
-
setDefaultValue(defaultValue, defValueUnit) {
|
|
115
|
+
setDefaultValue(defaultValue, defValueUnit, { rangeFilter, optionSetting }) {
|
|
101
116
|
if (defValueUnit && defValueUnit !== DatePresetValEnums.CUSTOM) {
|
|
102
|
-
return
|
|
117
|
+
return handleDateDef(defaultValue, defValueUnit, { rangeFilter, optionSetting, format: 'YYYY-MM-DD' });
|
|
103
118
|
}
|
|
104
119
|
return defaultValue;
|
|
105
120
|
}
|
|
@@ -118,9 +133,9 @@ export const WidgetCfgMaps = new Map([
|
|
|
118
133
|
const Props = { ...props, placeholder: `请选择${title}`, allowClear };
|
|
119
134
|
return Props;
|
|
120
135
|
},
|
|
121
|
-
setDefaultValue(defaultValue, defValueUnit) {
|
|
136
|
+
setDefaultValue(defaultValue, defValueUnit, { rangeFilter, optionSetting }) {
|
|
122
137
|
if (defValueUnit && defValueUnit !== DatePresetValEnums.CUSTOM) {
|
|
123
|
-
return
|
|
138
|
+
return handleDateDef(defaultValue, defValueUnit, { rangeFilter, optionSetting, format: 'YYYY-MM-DD HH:mm:ss' });
|
|
124
139
|
}
|
|
125
140
|
return defaultValue;
|
|
126
141
|
}
|
|
@@ -171,10 +186,9 @@ export const WidgetCfgMaps = new Map([
|
|
|
171
186
|
const Props = { ...props, placeholder: [`起始${title}`, `截止${title}`], allowClear };
|
|
172
187
|
return Props;
|
|
173
188
|
},
|
|
174
|
-
setDefaultValue(defaultValue, defValueUnit) {
|
|
189
|
+
setDefaultValue(defaultValue, defValueUnit, { rangeFilter, optionSetting }) {
|
|
175
190
|
if (defValueUnit && defValueUnit !== DatePresetValEnums.CUSTOM) {
|
|
176
|
-
|
|
177
|
-
return [resDate, resDate];
|
|
191
|
+
return handleDateDef(defaultValue, defValueUnit, { rangeFilter, optionSetting, format: 'YYYY-MM-DD' });
|
|
178
192
|
}
|
|
179
193
|
if (!defaultValue || (defaultValue && !Array.isArray(defaultValue))) {
|
|
180
194
|
return [];
|
|
@@ -196,10 +210,10 @@ export const WidgetCfgMaps = new Map([
|
|
|
196
210
|
const Props = { ...props, placeholder: [`起始${title}`, `截止${title}`], allowClear };
|
|
197
211
|
return Props;
|
|
198
212
|
},
|
|
199
|
-
setDefaultValue(defaultValue, defValueUnit) {
|
|
213
|
+
setDefaultValue(defaultValue, defValueUnit, { rangeFilter, optionSetting }) {
|
|
200
214
|
if (defValueUnit && defValueUnit !== DatePresetValEnums.CUSTOM) {
|
|
201
|
-
let
|
|
202
|
-
return
|
|
215
|
+
let res = handleDateDef(defaultValue, defValueUnit, { rangeFilter, optionSetting, format: 'YYYY-MM-DD HH:mm:ss' });
|
|
216
|
+
return res;
|
|
203
217
|
}
|
|
204
218
|
if (!defaultValue || (defaultValue && !Array.isArray(defaultValue))) {
|
|
205
219
|
return [];
|
|
@@ -213,10 +227,23 @@ export const WidgetCfgMaps = new Map([
|
|
|
213
227
|
{
|
|
214
228
|
component: DateRangeQuick,
|
|
215
229
|
props: {},
|
|
216
|
-
handlerProps(props, { fieldType, explicitRequired } = {}) {
|
|
230
|
+
handlerProps(props, { fieldType, explicitRequired, title } = {}) {
|
|
217
231
|
const allowClear = explicitRequired != 1;
|
|
218
232
|
let str = fieldType === 'DATE' ? '日期' : '时间';
|
|
219
233
|
const Props = { ...props, placeholderS: `开始${str}`, placeholderE: `结束${str}`, fieldType, allowClear };
|
|
234
|
+
// 非范围类
|
|
235
|
+
if (!props.rangeFilter) {
|
|
236
|
+
const valueFormat = fieldType === 'DATE' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss';
|
|
237
|
+
const showTime = fieldType === 'DATE' ? false : { defaultValue: moment('00:00:00', 'HH:mm:ss') };
|
|
238
|
+
const placeholder = `请选择${title}`;
|
|
239
|
+
Object.assign(Props, {
|
|
240
|
+
allowClear: true,
|
|
241
|
+
valueFormat,
|
|
242
|
+
showToday: false,
|
|
243
|
+
showTime,
|
|
244
|
+
placeholder
|
|
245
|
+
});
|
|
246
|
+
}
|
|
220
247
|
return Props;
|
|
221
248
|
},
|
|
222
249
|
setDefaultValue: SetDefVal
|
|
@@ -636,14 +636,16 @@ export const outQuickSearchFn = {
|
|
|
636
636
|
if (attr === 'BIRTHDAY') {
|
|
637
637
|
this.$set(el, 'showFormat', 'MM-DD');
|
|
638
638
|
this.$set(el, 'showTime', false);
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
639
|
+
}
|
|
640
|
+
// else if (['TODAY', 'TOMORROW', 'YESTERDAY'].includes(el.explicitDefaultVal)) {
|
|
641
|
+
// // 如果外显默认是 以上三个,展示一个框,时间不可选
|
|
642
|
+
// let [v] = value;
|
|
643
|
+
// this.$set(el, 'showFormat', 'YYYY-MM-DD');
|
|
644
|
+
// this.$set(el, 'showTime', false);
|
|
645
|
+
// this.$set(el, 'com', 'DayPicker');
|
|
646
|
+
// this.$set(el, 'value', v || moment());
|
|
647
|
+
// }
|
|
648
|
+
else {
|
|
647
649
|
this.$set(el, 'showFormat', 'YYYY-MM-DD HH:mm:ss');
|
|
648
650
|
this.$set(el, 'showTime', true);
|
|
649
651
|
}
|
|
@@ -23,12 +23,12 @@ export default {
|
|
|
23
23
|
return cfg.widgetCfg?.isRender;
|
|
24
24
|
},
|
|
25
25
|
getDefValByRenderWidget(cfg) {
|
|
26
|
-
const { widgetType, defaultValue, defValueUnit } = cfg.widgetCfg || {};
|
|
26
|
+
const { widgetType, defaultValue, defValueUnit, rangeFilter } = cfg.widgetCfg || {};
|
|
27
27
|
const Widget = WidgetCfgMaps.get(widgetType);
|
|
28
28
|
let defVal;
|
|
29
29
|
if (Widget) {
|
|
30
30
|
const { setDefaultValue } = Widget;
|
|
31
|
-
if (setDefaultValue) defVal = setDefaultValue(defaultValue, defValueUnit);
|
|
31
|
+
if (setDefaultValue) defVal = setDefaultValue(defaultValue, defValueUnit, { rangeFilter, openSetting: cfg?.optionSetting });
|
|
32
32
|
}
|
|
33
33
|
return defVal;
|
|
34
34
|
},
|