1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
| <template>
| <el-date-picker
| class="timestamp"
| style="width: 130px"
| @change="changeValue"
| v-model="selectValue"
| type="date"
| :placeholder="props.data.title"
| value-format="YYYY-MM-DD HH:mm:ss"
| format="YYYY-MM-DD"
| :shortcuts="shortcuts"
| :disabled-date="disabledCurrentDate"
| :clearable="false"
| :disabled="disabled"
| />
| </template>
|
| <script setup lang="ts">
| import type { PropType } from 'vue';
| import type { TimestampParam } from '../types';
| import { getRecentDate } from '/@/utils/util';
| import { disabledCurrentDate } from '/@/components/form/datepicker/constants';
| const props = defineProps({
| data: {
| type: Object as PropType<TimestampParam>,
| },
| disabled: {
| type: Boolean,
| default: false,
| },
| });
| const emit = defineEmits(['change']);
|
| const shortcuts = [
| {
| text: '今天',
| value: () => getRecentDate(0),
| },
| {
| text: '三天前',
| value: () => getRecentDate(3),
| },
| {
| text: '七天前',
| value: () => getRecentDate(7),
| },
| ];
| const selectValue = defineModel({
| type: String,
| });
| const changeValue = (val) => {
| emit('change', val);
| };
| </script>
| <style scoped lang="scss">
| .timestamp {
| width: 180px;
| }
| </style>
|
|