lw-cdp-ui 1.0.19 → 1.0.21
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 +5 -5
- package/dist/components/lwForm/index.vue +312 -312
- package/dist/components/lwIconSelect/iconSelect.js +288 -288
- package/dist/components/lwIconSelect/index.vue +142 -142
- package/dist/components/lwLayout/components/NavMenu.vue +36 -36
- package/dist/components/lwLayout/components/aside.vue +291 -295
- package/dist/components/lwLayout/components/bu.vue +72 -70
- package/dist/components/lwLayout/components/iframeView.vue +57 -57
- package/dist/components/lwLayout/components/lang.vue +76 -76
- package/dist/components/lwLayout/components/setting.vue +80 -80
- package/dist/components/lwLayout/components/sideM.vue +137 -136
- package/dist/components/lwLayout/components/tags.vue +329 -329
- package/dist/components/lwLayout/components/topbar.vue +70 -70
- package/dist/components/lwLayout/components/userbar.vue +210 -209
- package/dist/components/lwLayout/index.vue +399 -398
- package/dist/components/lwLogin/index.vue +446 -383
- package/dist/components/lwSearch/date/date.vue +110 -110
- package/dist/components/lwSearch/dateRange/dateRange.vue +110 -110
- package/dist/components/lwSearch/dates/dates.vue +366 -366
- package/dist/components/lwSearch/index.vue +636 -636
- package/dist/components/lwSearch/input/input.vue +54 -54
- package/dist/components/lwSearch/locale/en-us.js +10 -10
- package/dist/components/lwSearch/locale/zh-cn.js +10 -10
- package/dist/components/lwSearch/select/select.vue +57 -57
- package/dist/components/lwSvgIcon/index.vue +28 -28
- package/dist/components/lwTable/index.js +425 -425
- package/dist/components/lwTable/index.scss +229 -229
- package/dist/components/lwTable/index.vue +225 -226
- package/dist/components/lwTable/locale/en-US.js +26 -26
- package/dist/components/lwTable/locale/zh-CN.js +26 -26
- package/dist/components/lwTable/useFullscreen.js +73 -73
- package/dist/components/lwTableSelect/index.vue +254 -254
- package/dist/components/lwTableSelect/tableSelect.js +23 -23
- package/dist/components/lwUpload/index.vue +365 -365
- package/dist/en-US-YCjgxjEt.js.map +1 -1
- package/dist/en-us-CziFtIQi.js.map +1 -1
- package/dist/lw-cdp-ui.esm.js +1484 -1459
- package/dist/lw-cdp-ui.esm.js.map +1 -1
- package/dist/lw-cdp-ui.umd.js +9 -9
- package/dist/lw-cdp-ui.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/zh-CN-BdDNsX4e.js.map +1 -1
- package/dist/zh-cn-DJpQp_O7.js.map +1 -1
- package/package.json +45 -45
|
@@ -1,366 +1,366 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="dates-container">
|
|
3
|
-
<!-- 输入框 -->
|
|
4
|
-
<el-input
|
|
5
|
-
class="default-input"
|
|
6
|
-
size="small"
|
|
7
|
-
type="text"
|
|
8
|
-
:disabled="item.disabled"
|
|
9
|
-
:placeholder="item.placeholder || '请选择'"
|
|
10
|
-
clearable
|
|
11
|
-
:model-value="displayValue"
|
|
12
|
-
@clear="handleClear"
|
|
13
|
-
@click="togglePanel"
|
|
14
|
-
style="width: 100%"
|
|
15
|
-
>
|
|
16
|
-
<template #suffix>
|
|
17
|
-
<el-icon><el-icon-calendar /></el-icon>
|
|
18
|
-
</template>
|
|
19
|
-
</el-input>
|
|
20
|
-
|
|
21
|
-
<!-- 日期选择面板 -->
|
|
22
|
-
<div v-show="isPanelShow" class="dates-panel">
|
|
23
|
-
<el-tabs v-model="activeName" class="dates-panel-tabs" @tab-click="handleTabClick">
|
|
24
|
-
<!-- 单日选择 -->
|
|
25
|
-
<el-tab-pane label="单日" name="single">
|
|
26
|
-
<div class="panel-label">
|
|
27
|
-
<span>单日</span>
|
|
28
|
-
<el-date-picker
|
|
29
|
-
size="small"
|
|
30
|
-
:type="item.singleType || 'date'"
|
|
31
|
-
:disabled="item.disabled"
|
|
32
|
-
:format="item.format || 'yyyy-MM-dd'"
|
|
33
|
-
:value-format="item.valueFormat || 'yyyy-MM-dd'"
|
|
34
|
-
:placeholder="item.placeholder || $t('lwSearch.please_select')"
|
|
35
|
-
:shortcuts="shortcuts"
|
|
36
|
-
v-model="value"
|
|
37
|
-
:clearable="false"
|
|
38
|
-
@blur="pickerBlur"
|
|
39
|
-
@change="pickerChange"
|
|
40
|
-
ref="singlePicker"
|
|
41
|
-
:popper-class="'single-picker single-picker-' + item.prop"
|
|
42
|
-
/>
|
|
43
|
-
<teleport v-if="isSidebarShow && activeName === 'single'" :to="'.single-picker-' + item.prop + ' .el-picker-panel__sidebar'">
|
|
44
|
-
<div class="dates-side">
|
|
45
|
-
<div class="sidebar-title">所选时间列表</div>
|
|
46
|
-
<div class="sidebar-list">
|
|
47
|
-
<div class="item" v-for="(date, index) in value" :key="index">
|
|
48
|
-
<div class="text">{{ date }}</div>
|
|
49
|
-
<div class="button" @click="deleteSingleDate(index)">
|
|
50
|
-
<el-icon><Close /></el-icon>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
</teleport>
|
|
56
|
-
</div>
|
|
57
|
-
</el-tab-pane>
|
|
58
|
-
|
|
59
|
-
<!-- 日期范围选择 -->
|
|
60
|
-
<el-tab-pane label="日期范围" name="range">
|
|
61
|
-
<div class="panel-label">
|
|
62
|
-
<span>日期范围</span>
|
|
63
|
-
<el-date-picker
|
|
64
|
-
size="small"
|
|
65
|
-
:type="item.rangeType || 'daterange'"
|
|
66
|
-
:disabled="item.disabled"
|
|
67
|
-
:format="item.format || 'yyyy-MM-dd'"
|
|
68
|
-
:value-format="item.valueFormat || 'yyyy-MM-dd'"
|
|
69
|
-
:placeholder="item.placeholder || $t('lwSearch.please_select')"
|
|
70
|
-
:unlink-panels="item.unlinkPanels ?? false"
|
|
71
|
-
:shortcuts="shortcuts"
|
|
72
|
-
v-model="value"
|
|
73
|
-
:clearable="false"
|
|
74
|
-
@blur="pickerBlur"
|
|
75
|
-
@change="pickerChange"
|
|
76
|
-
ref="rangePicker"
|
|
77
|
-
:popper-class="'range-picker range-picker-' + item.prop"
|
|
78
|
-
/>
|
|
79
|
-
<teleport v-if="isSidebarShow && activeName === 'range'" :to="'.range-picker-' + item.prop + ' .el-picker-panel__sidebar'">
|
|
80
|
-
<div class="dates-side-top">
|
|
81
|
-
<div class="sidebar-list">
|
|
82
|
-
<div class="item" v-show="value.length === 2">
|
|
83
|
-
<div class="text">{{ value[0] }}~{{ value[1] }}</div>
|
|
84
|
-
<div class="button" @click="handleClear">
|
|
85
|
-
<el-icon><el-icon-close /></el-icon>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
|
-
</div>
|
|
90
|
-
</teleport>
|
|
91
|
-
</div>
|
|
92
|
-
</el-tab-pane>
|
|
93
|
-
</el-tabs>
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
</template>
|
|
97
|
-
|
|
98
|
-
<script>
|
|
99
|
-
import { computed, nextTick, reactive, ref, toRefs, watch } from 'vue'
|
|
100
|
-
|
|
101
|
-
export default {
|
|
102
|
-
emits: ["update:modelValue", "change"],
|
|
103
|
-
name: "Date",
|
|
104
|
-
props: {
|
|
105
|
-
disabled: {
|
|
106
|
-
type: Boolean,
|
|
107
|
-
default: false
|
|
108
|
-
},
|
|
109
|
-
modelValue: {
|
|
110
|
-
type: [String, Array],
|
|
111
|
-
default: ""
|
|
112
|
-
},
|
|
113
|
-
item: {
|
|
114
|
-
type: Object,
|
|
115
|
-
default: () => ({})
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
setup(props, context) {
|
|
119
|
-
const state = reactive({
|
|
120
|
-
isSidebarShow: false,
|
|
121
|
-
activeName: "single",
|
|
122
|
-
isPanelShow: false,
|
|
123
|
-
value: [],
|
|
124
|
-
shortcuts: [{ text: "", value: "" }]
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
// 监听 modelValue 变化
|
|
128
|
-
watch(
|
|
129
|
-
() => props.modelValue,
|
|
130
|
-
(newVal) => {
|
|
131
|
-
if (newVal) {
|
|
132
|
-
state.activeName = Array.isArray(newVal) ? "range" : "single"
|
|
133
|
-
state.value = Array.isArray(newVal) ? newVal : newVal.split(",")
|
|
134
|
-
} else {
|
|
135
|
-
state.value = []
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
{ deep: true }
|
|
139
|
-
)
|
|
140
|
-
|
|
141
|
-
// 监听 value 变化并更新父组件
|
|
142
|
-
watch(
|
|
143
|
-
() => state.value,
|
|
144
|
-
(newVal) => {
|
|
145
|
-
const formattedValue = state.activeName === 'single' ? newVal.join(",") : newVal
|
|
146
|
-
if (formattedValue !== props.modelValue) {
|
|
147
|
-
context.emit("update:modelValue", formattedValue)
|
|
148
|
-
context.emit("change", formattedValue)
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
{ deep: true, immediate: true }
|
|
152
|
-
)
|
|
153
|
-
|
|
154
|
-
const displayValue = computed(() => state.value.join(","))
|
|
155
|
-
|
|
156
|
-
const togglePanel = () => {
|
|
157
|
-
state.isPanelShow = !state.isPanelShow
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const handleTabClick = () => {
|
|
161
|
-
nextTick(() => {
|
|
162
|
-
state.isSidebarShow = true
|
|
163
|
-
})
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const pickerChange = () => {
|
|
167
|
-
nextTick(() => {
|
|
168
|
-
state.isPanelShow = false
|
|
169
|
-
})
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const deleteSingleDate = (index) => {
|
|
173
|
-
state.value.splice(index, 1)
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const pickerBlur = () => {
|
|
177
|
-
state.isSidebarShow = false
|
|
178
|
-
nextTick(() => {
|
|
179
|
-
state.isPanelShow = false
|
|
180
|
-
})
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
const handleClear = () => {
|
|
184
|
-
state.value = []
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return {
|
|
188
|
-
...toRefs(state),
|
|
189
|
-
togglePanel,
|
|
190
|
-
handleTabClick,
|
|
191
|
-
pickerChange,
|
|
192
|
-
deleteSingleDate,
|
|
193
|
-
pickerBlur,
|
|
194
|
-
handleClear,
|
|
195
|
-
displayValue
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
</script>
|
|
200
|
-
|
|
201
|
-
<style lang="scss">
|
|
202
|
-
.dates-container {
|
|
203
|
-
position: relative;
|
|
204
|
-
.default-input {
|
|
205
|
-
cursor: pointer;
|
|
206
|
-
.el-input__inner {
|
|
207
|
-
cursor: pointer;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
.dates-panel {
|
|
211
|
-
position: absolute;
|
|
212
|
-
top: 35px;
|
|
213
|
-
background: #ffffff;
|
|
214
|
-
width: 100%;
|
|
215
|
-
min-width: max-content;
|
|
216
|
-
z-index: 9;
|
|
217
|
-
.panel-label {
|
|
218
|
-
width: 60px;
|
|
219
|
-
height: 40px;
|
|
220
|
-
position: relative;
|
|
221
|
-
& > span {
|
|
222
|
-
width: 100%;
|
|
223
|
-
height: 40px;
|
|
224
|
-
display: inline-block;
|
|
225
|
-
text-align: center;
|
|
226
|
-
}
|
|
227
|
-
.el-date-editor {
|
|
228
|
-
width: 100%;
|
|
229
|
-
height: 40px;
|
|
230
|
-
position: absolute;
|
|
231
|
-
left: 0;
|
|
232
|
-
top: 0;
|
|
233
|
-
opacity: 0;
|
|
234
|
-
cursor: pointer;
|
|
235
|
-
.el-input__inner {
|
|
236
|
-
width: 100%;
|
|
237
|
-
height: 40px;
|
|
238
|
-
cursor: pointer;
|
|
239
|
-
}
|
|
240
|
-
.el-input__prefix {
|
|
241
|
-
display: none;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
.single-picker {
|
|
248
|
-
.el-picker-panel [slot=sidebar]+.el-picker-panel__body, .el-picker-panel__sidebar+.el-picker-panel__body {
|
|
249
|
-
margin: 0 160px 0 0;
|
|
250
|
-
}
|
|
251
|
-
.el-picker-panel [slot=sidebar], .el-picker-panel__sidebar {
|
|
252
|
-
right: 0;
|
|
253
|
-
border-left: 1px solid var(--el-datepicker-inner-border-color);
|
|
254
|
-
width: 160px;
|
|
255
|
-
}
|
|
256
|
-
.el-date-picker.has-sidebar {
|
|
257
|
-
width: 488px;
|
|
258
|
-
}
|
|
259
|
-
.dates-side {
|
|
260
|
-
box-sizing: border-box;
|
|
261
|
-
padding: 0 10px;
|
|
262
|
-
width: 100%;
|
|
263
|
-
.sidebar-title {
|
|
264
|
-
font-size: 14px;
|
|
265
|
-
color: var(--el-text-color-regular);
|
|
266
|
-
margin-bottom: 5px;
|
|
267
|
-
}
|
|
268
|
-
.sidebar-list {
|
|
269
|
-
width: 100%;
|
|
270
|
-
.item {
|
|
271
|
-
width: 100%;
|
|
272
|
-
height: 30px;
|
|
273
|
-
display: flex;
|
|
274
|
-
align-items: center;
|
|
275
|
-
justify-content: space-between;
|
|
276
|
-
box-sizing: border-box;
|
|
277
|
-
padding: 2px 10px;
|
|
278
|
-
background: #155752;
|
|
279
|
-
margin-bottom: 2px;
|
|
280
|
-
.text {
|
|
281
|
-
font-size: 12px;
|
|
282
|
-
color: #ffffff;
|
|
283
|
-
}
|
|
284
|
-
.button {
|
|
285
|
-
width: 16px;
|
|
286
|
-
height: 16px;
|
|
287
|
-
border: 1px solid #cccccc;
|
|
288
|
-
border-radius: 100%;
|
|
289
|
-
display: flex;
|
|
290
|
-
align-items: center;
|
|
291
|
-
justify-content: center;
|
|
292
|
-
cursor: pointer;
|
|
293
|
-
&:hover {
|
|
294
|
-
border-color: #ffffff;
|
|
295
|
-
.el-icon--close {
|
|
296
|
-
color: #ffffff;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
.el-icon--close {
|
|
300
|
-
font-size: 12px;
|
|
301
|
-
color: #cccccc;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
.range-picker {
|
|
309
|
-
.el-picker-panel [slot=sidebar]+.el-picker-panel__body, .el-picker-panel__sidebar+.el-picker-panel__body {
|
|
310
|
-
margin: 40px 0 0 0;
|
|
311
|
-
}
|
|
312
|
-
.el-picker-panel [slot=sidebar], .el-picker-panel__sidebar {
|
|
313
|
-
bottom: unset;
|
|
314
|
-
border-bottom: 1px solid var(--el-datepicker-inner-border-color);
|
|
315
|
-
width: 100%;
|
|
316
|
-
height: 40px;
|
|
317
|
-
}
|
|
318
|
-
.el-date-range-picker.has-sidebar {
|
|
319
|
-
width: 646px;
|
|
320
|
-
}
|
|
321
|
-
.dates-side-top {
|
|
322
|
-
box-sizing: border-box;
|
|
323
|
-
padding: 0 10px;
|
|
324
|
-
width: max-content;
|
|
325
|
-
.sidebar-list {
|
|
326
|
-
width: 100%;
|
|
327
|
-
.item {
|
|
328
|
-
width: 100%;
|
|
329
|
-
height: 30px;
|
|
330
|
-
display: flex;
|
|
331
|
-
align-items: center;
|
|
332
|
-
justify-content: space-between;
|
|
333
|
-
box-sizing: border-box;
|
|
334
|
-
padding: 2px 10px;
|
|
335
|
-
background: #155752;
|
|
336
|
-
margin-bottom: 2px;
|
|
337
|
-
.text {
|
|
338
|
-
font-size: 12px;
|
|
339
|
-
color: #ffffff;
|
|
340
|
-
padding-right: 10px;
|
|
341
|
-
}
|
|
342
|
-
.button {
|
|
343
|
-
width: 16px;
|
|
344
|
-
height: 16px;
|
|
345
|
-
border: 1px solid #cccccc;
|
|
346
|
-
border-radius: 100%;
|
|
347
|
-
display: flex;
|
|
348
|
-
align-items: center;
|
|
349
|
-
justify-content: center;
|
|
350
|
-
cursor: pointer;
|
|
351
|
-
&:hover {
|
|
352
|
-
border-color: #ffffff;
|
|
353
|
-
.el-icon--close {
|
|
354
|
-
color: #ffffff;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
.el-icon--close {
|
|
358
|
-
font-size: 12px;
|
|
359
|
-
color: #cccccc;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dates-container">
|
|
3
|
+
<!-- 输入框 -->
|
|
4
|
+
<el-input
|
|
5
|
+
class="default-input"
|
|
6
|
+
size="small"
|
|
7
|
+
type="text"
|
|
8
|
+
:disabled="item.disabled"
|
|
9
|
+
:placeholder="item.placeholder || '请选择'"
|
|
10
|
+
clearable
|
|
11
|
+
:model-value="displayValue"
|
|
12
|
+
@clear="handleClear"
|
|
13
|
+
@click="togglePanel"
|
|
14
|
+
style="width: 100%"
|
|
15
|
+
>
|
|
16
|
+
<template #suffix>
|
|
17
|
+
<el-icon><el-icon-calendar /></el-icon>
|
|
18
|
+
</template>
|
|
19
|
+
</el-input>
|
|
20
|
+
|
|
21
|
+
<!-- 日期选择面板 -->
|
|
22
|
+
<div v-show="isPanelShow" class="dates-panel">
|
|
23
|
+
<el-tabs v-model="activeName" class="dates-panel-tabs" @tab-click="handleTabClick">
|
|
24
|
+
<!-- 单日选择 -->
|
|
25
|
+
<el-tab-pane label="单日" name="single">
|
|
26
|
+
<div class="panel-label">
|
|
27
|
+
<span>单日</span>
|
|
28
|
+
<el-date-picker
|
|
29
|
+
size="small"
|
|
30
|
+
:type="item.singleType || 'date'"
|
|
31
|
+
:disabled="item.disabled"
|
|
32
|
+
:format="item.format || 'yyyy-MM-dd'"
|
|
33
|
+
:value-format="item.valueFormat || 'yyyy-MM-dd'"
|
|
34
|
+
:placeholder="item.placeholder || $t('lwSearch.please_select')"
|
|
35
|
+
:shortcuts="shortcuts"
|
|
36
|
+
v-model="value"
|
|
37
|
+
:clearable="false"
|
|
38
|
+
@blur="pickerBlur"
|
|
39
|
+
@change="pickerChange"
|
|
40
|
+
ref="singlePicker"
|
|
41
|
+
:popper-class="'single-picker single-picker-' + item.prop"
|
|
42
|
+
/>
|
|
43
|
+
<teleport v-if="isSidebarShow && activeName === 'single'" :to="'.single-picker-' + item.prop + ' .el-picker-panel__sidebar'">
|
|
44
|
+
<div class="dates-side">
|
|
45
|
+
<div class="sidebar-title">所选时间列表</div>
|
|
46
|
+
<div class="sidebar-list">
|
|
47
|
+
<div class="item" v-for="(date, index) in value" :key="index">
|
|
48
|
+
<div class="text">{{ date }}</div>
|
|
49
|
+
<div class="button" @click="deleteSingleDate(index)">
|
|
50
|
+
<el-icon><Close /></el-icon>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</teleport>
|
|
56
|
+
</div>
|
|
57
|
+
</el-tab-pane>
|
|
58
|
+
|
|
59
|
+
<!-- 日期范围选择 -->
|
|
60
|
+
<el-tab-pane label="日期范围" name="range">
|
|
61
|
+
<div class="panel-label">
|
|
62
|
+
<span>日期范围</span>
|
|
63
|
+
<el-date-picker
|
|
64
|
+
size="small"
|
|
65
|
+
:type="item.rangeType || 'daterange'"
|
|
66
|
+
:disabled="item.disabled"
|
|
67
|
+
:format="item.format || 'yyyy-MM-dd'"
|
|
68
|
+
:value-format="item.valueFormat || 'yyyy-MM-dd'"
|
|
69
|
+
:placeholder="item.placeholder || $t('lwSearch.please_select')"
|
|
70
|
+
:unlink-panels="item.unlinkPanels ?? false"
|
|
71
|
+
:shortcuts="shortcuts"
|
|
72
|
+
v-model="value"
|
|
73
|
+
:clearable="false"
|
|
74
|
+
@blur="pickerBlur"
|
|
75
|
+
@change="pickerChange"
|
|
76
|
+
ref="rangePicker"
|
|
77
|
+
:popper-class="'range-picker range-picker-' + item.prop"
|
|
78
|
+
/>
|
|
79
|
+
<teleport v-if="isSidebarShow && activeName === 'range'" :to="'.range-picker-' + item.prop + ' .el-picker-panel__sidebar'">
|
|
80
|
+
<div class="dates-side-top">
|
|
81
|
+
<div class="sidebar-list">
|
|
82
|
+
<div class="item" v-show="value.length === 2">
|
|
83
|
+
<div class="text">{{ value[0] }}~{{ value[1] }}</div>
|
|
84
|
+
<div class="button" @click="handleClear">
|
|
85
|
+
<el-icon><el-icon-close /></el-icon>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</teleport>
|
|
91
|
+
</div>
|
|
92
|
+
</el-tab-pane>
|
|
93
|
+
</el-tabs>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</template>
|
|
97
|
+
|
|
98
|
+
<script>
|
|
99
|
+
import { computed, nextTick, reactive, ref, toRefs, watch } from 'vue'
|
|
100
|
+
|
|
101
|
+
export default {
|
|
102
|
+
emits: ["update:modelValue", "change"],
|
|
103
|
+
name: "Date",
|
|
104
|
+
props: {
|
|
105
|
+
disabled: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
default: false
|
|
108
|
+
},
|
|
109
|
+
modelValue: {
|
|
110
|
+
type: [String, Array],
|
|
111
|
+
default: ""
|
|
112
|
+
},
|
|
113
|
+
item: {
|
|
114
|
+
type: Object,
|
|
115
|
+
default: () => ({})
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
setup(props, context) {
|
|
119
|
+
const state = reactive({
|
|
120
|
+
isSidebarShow: false,
|
|
121
|
+
activeName: "single",
|
|
122
|
+
isPanelShow: false,
|
|
123
|
+
value: [],
|
|
124
|
+
shortcuts: [{ text: "", value: "" }]
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
// 监听 modelValue 变化
|
|
128
|
+
watch(
|
|
129
|
+
() => props.modelValue,
|
|
130
|
+
(newVal) => {
|
|
131
|
+
if (newVal) {
|
|
132
|
+
state.activeName = Array.isArray(newVal) ? "range" : "single"
|
|
133
|
+
state.value = Array.isArray(newVal) ? newVal : newVal.split(",")
|
|
134
|
+
} else {
|
|
135
|
+
state.value = []
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{ deep: true }
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
// 监听 value 变化并更新父组件
|
|
142
|
+
watch(
|
|
143
|
+
() => state.value,
|
|
144
|
+
(newVal) => {
|
|
145
|
+
const formattedValue = state.activeName === 'single' ? newVal.join(",") : newVal
|
|
146
|
+
if (formattedValue !== props.modelValue) {
|
|
147
|
+
context.emit("update:modelValue", formattedValue)
|
|
148
|
+
context.emit("change", formattedValue)
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
{ deep: true, immediate: true }
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
const displayValue = computed(() => state.value.join(","))
|
|
155
|
+
|
|
156
|
+
const togglePanel = () => {
|
|
157
|
+
state.isPanelShow = !state.isPanelShow
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const handleTabClick = () => {
|
|
161
|
+
nextTick(() => {
|
|
162
|
+
state.isSidebarShow = true
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const pickerChange = () => {
|
|
167
|
+
nextTick(() => {
|
|
168
|
+
state.isPanelShow = false
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const deleteSingleDate = (index) => {
|
|
173
|
+
state.value.splice(index, 1)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const pickerBlur = () => {
|
|
177
|
+
state.isSidebarShow = false
|
|
178
|
+
nextTick(() => {
|
|
179
|
+
state.isPanelShow = false
|
|
180
|
+
})
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const handleClear = () => {
|
|
184
|
+
state.value = []
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return {
|
|
188
|
+
...toRefs(state),
|
|
189
|
+
togglePanel,
|
|
190
|
+
handleTabClick,
|
|
191
|
+
pickerChange,
|
|
192
|
+
deleteSingleDate,
|
|
193
|
+
pickerBlur,
|
|
194
|
+
handleClear,
|
|
195
|
+
displayValue
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
</script>
|
|
200
|
+
|
|
201
|
+
<style lang="scss">
|
|
202
|
+
.dates-container {
|
|
203
|
+
position: relative;
|
|
204
|
+
.default-input {
|
|
205
|
+
cursor: pointer;
|
|
206
|
+
.el-input__inner {
|
|
207
|
+
cursor: pointer;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
.dates-panel {
|
|
211
|
+
position: absolute;
|
|
212
|
+
top: 35px;
|
|
213
|
+
background: #ffffff;
|
|
214
|
+
width: 100%;
|
|
215
|
+
min-width: max-content;
|
|
216
|
+
z-index: 9;
|
|
217
|
+
.panel-label {
|
|
218
|
+
width: 60px;
|
|
219
|
+
height: 40px;
|
|
220
|
+
position: relative;
|
|
221
|
+
& > span {
|
|
222
|
+
width: 100%;
|
|
223
|
+
height: 40px;
|
|
224
|
+
display: inline-block;
|
|
225
|
+
text-align: center;
|
|
226
|
+
}
|
|
227
|
+
.el-date-editor {
|
|
228
|
+
width: 100%;
|
|
229
|
+
height: 40px;
|
|
230
|
+
position: absolute;
|
|
231
|
+
left: 0;
|
|
232
|
+
top: 0;
|
|
233
|
+
opacity: 0;
|
|
234
|
+
cursor: pointer;
|
|
235
|
+
.el-input__inner {
|
|
236
|
+
width: 100%;
|
|
237
|
+
height: 40px;
|
|
238
|
+
cursor: pointer;
|
|
239
|
+
}
|
|
240
|
+
.el-input__prefix {
|
|
241
|
+
display: none;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
.single-picker {
|
|
248
|
+
.el-picker-panel [slot=sidebar]+.el-picker-panel__body, .el-picker-panel__sidebar+.el-picker-panel__body {
|
|
249
|
+
margin: 0 160px 0 0;
|
|
250
|
+
}
|
|
251
|
+
.el-picker-panel [slot=sidebar], .el-picker-panel__sidebar {
|
|
252
|
+
right: 0;
|
|
253
|
+
border-left: 1px solid var(--el-datepicker-inner-border-color);
|
|
254
|
+
width: 160px;
|
|
255
|
+
}
|
|
256
|
+
.el-date-picker.has-sidebar {
|
|
257
|
+
width: 488px;
|
|
258
|
+
}
|
|
259
|
+
.dates-side {
|
|
260
|
+
box-sizing: border-box;
|
|
261
|
+
padding: 0 10px;
|
|
262
|
+
width: 100%;
|
|
263
|
+
.sidebar-title {
|
|
264
|
+
font-size: 14px;
|
|
265
|
+
color: var(--el-text-color-regular);
|
|
266
|
+
margin-bottom: 5px;
|
|
267
|
+
}
|
|
268
|
+
.sidebar-list {
|
|
269
|
+
width: 100%;
|
|
270
|
+
.item {
|
|
271
|
+
width: 100%;
|
|
272
|
+
height: 30px;
|
|
273
|
+
display: flex;
|
|
274
|
+
align-items: center;
|
|
275
|
+
justify-content: space-between;
|
|
276
|
+
box-sizing: border-box;
|
|
277
|
+
padding: 2px 10px;
|
|
278
|
+
background: #155752;
|
|
279
|
+
margin-bottom: 2px;
|
|
280
|
+
.text {
|
|
281
|
+
font-size: 12px;
|
|
282
|
+
color: #ffffff;
|
|
283
|
+
}
|
|
284
|
+
.button {
|
|
285
|
+
width: 16px;
|
|
286
|
+
height: 16px;
|
|
287
|
+
border: 1px solid #cccccc;
|
|
288
|
+
border-radius: 100%;
|
|
289
|
+
display: flex;
|
|
290
|
+
align-items: center;
|
|
291
|
+
justify-content: center;
|
|
292
|
+
cursor: pointer;
|
|
293
|
+
&:hover {
|
|
294
|
+
border-color: #ffffff;
|
|
295
|
+
.el-icon--close {
|
|
296
|
+
color: #ffffff;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
.el-icon--close {
|
|
300
|
+
font-size: 12px;
|
|
301
|
+
color: #cccccc;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
.range-picker {
|
|
309
|
+
.el-picker-panel [slot=sidebar]+.el-picker-panel__body, .el-picker-panel__sidebar+.el-picker-panel__body {
|
|
310
|
+
margin: 40px 0 0 0;
|
|
311
|
+
}
|
|
312
|
+
.el-picker-panel [slot=sidebar], .el-picker-panel__sidebar {
|
|
313
|
+
bottom: unset;
|
|
314
|
+
border-bottom: 1px solid var(--el-datepicker-inner-border-color);
|
|
315
|
+
width: 100%;
|
|
316
|
+
height: 40px;
|
|
317
|
+
}
|
|
318
|
+
.el-date-range-picker.has-sidebar {
|
|
319
|
+
width: 646px;
|
|
320
|
+
}
|
|
321
|
+
.dates-side-top {
|
|
322
|
+
box-sizing: border-box;
|
|
323
|
+
padding: 0 10px;
|
|
324
|
+
width: max-content;
|
|
325
|
+
.sidebar-list {
|
|
326
|
+
width: 100%;
|
|
327
|
+
.item {
|
|
328
|
+
width: 100%;
|
|
329
|
+
height: 30px;
|
|
330
|
+
display: flex;
|
|
331
|
+
align-items: center;
|
|
332
|
+
justify-content: space-between;
|
|
333
|
+
box-sizing: border-box;
|
|
334
|
+
padding: 2px 10px;
|
|
335
|
+
background: #155752;
|
|
336
|
+
margin-bottom: 2px;
|
|
337
|
+
.text {
|
|
338
|
+
font-size: 12px;
|
|
339
|
+
color: #ffffff;
|
|
340
|
+
padding-right: 10px;
|
|
341
|
+
}
|
|
342
|
+
.button {
|
|
343
|
+
width: 16px;
|
|
344
|
+
height: 16px;
|
|
345
|
+
border: 1px solid #cccccc;
|
|
346
|
+
border-radius: 100%;
|
|
347
|
+
display: flex;
|
|
348
|
+
align-items: center;
|
|
349
|
+
justify-content: center;
|
|
350
|
+
cursor: pointer;
|
|
351
|
+
&:hover {
|
|
352
|
+
border-color: #ffffff;
|
|
353
|
+
.el-icon--close {
|
|
354
|
+
color: #ffffff;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
.el-icon--close {
|
|
358
|
+
font-size: 12px;
|
|
359
|
+
color: #cccccc;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
</style>
|