2022-08-29 18:16:07 +08:00
|
|
|
<template>
|
|
|
|
<div class="de-date-pick">
|
|
|
|
<el-date-picker
|
|
|
|
:value="value"
|
|
|
|
size="small"
|
|
|
|
:disabled="disabled"
|
|
|
|
type="daterange"
|
|
|
|
range-separator="-"
|
|
|
|
:start-placeholder="$t('commons.date.start_date')"
|
|
|
|
:end-placeholder="$t('commons.date.end_date')"
|
2022-10-11 15:09:32 +08:00
|
|
|
@input="handleChange"
|
|
|
|
/>
|
|
|
|
<svg-icon
|
|
|
|
icon-class="icon_calendar_outlined"
|
|
|
|
class="calendar-outlined"
|
|
|
|
/>
|
2022-08-29 18:16:07 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2022-10-11 15:09:32 +08:00
|
|
|
name: 'DeDatePick',
|
2022-08-29 18:16:07 +08:00
|
|
|
props: {
|
|
|
|
disabled: Boolean,
|
2022-10-11 15:09:32 +08:00
|
|
|
value: Array
|
2022-08-29 18:16:07 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleChange(val) {
|
2022-11-28 17:21:40 +08:00
|
|
|
const [ pre, next ] = val
|
|
|
|
this.$emit('input', [pre, next ? new Date(+new Date(next) + (23 * 3600 + 59 * 61) * 1000) : ''])
|
2022-10-11 15:09:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-08-29 18:16:07 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.de-date-pick {
|
|
|
|
width: 256px;
|
|
|
|
position: relative;
|
|
|
|
.el-input__icon {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
.el-range-input {
|
|
|
|
text-align: left;
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-date-editor {
|
|
|
|
padding-left: 12px;
|
2022-10-27 16:34:56 +08:00
|
|
|
width: 100% !important;
|
2022-08-29 18:16:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.calendar-outlined {
|
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
|
|
|
transform: translateY(-50%);
|
|
|
|
right: 13px;
|
|
|
|
}
|
|
|
|
}
|
2022-10-11 15:09:32 +08:00
|
|
|
</style>
|