dataease/frontend/src/components/deCustomCm/DeDatePick.vue

60 lines
1.1 KiB
Vue
Raw Normal View History

<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"
/>
</div>
</template>
<script>
export default {
2022-10-11 15:09:32 +08:00
name: 'DeDatePick',
props: {
disabled: Boolean,
2022-10-11 15:09:32 +08:00
value: Array
},
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
}
}
}
</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;
}
.calendar-outlined {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 13px;
}
}
2022-10-11 15:09:32 +08:00
</style>