diff --git a/apps/web-antd/src/views/aiot/device/roi/components/WorkingHoursEditor.vue b/apps/web-antd/src/views/aiot/device/roi/components/WorkingHoursEditor.vue index a0869b270..cd28ad3f6 100644 --- a/apps/web-antd/src/views/aiot/device/roi/components/WorkingHoursEditor.vue +++ b/apps/web-antd/src/views/aiot/device/roi/components/WorkingHoursEditor.vue @@ -7,10 +7,7 @@ import { message, Space, Tag, - TimePicker, } from 'ant-design-vue'; -import type { Dayjs } from 'dayjs'; -import dayjs from 'dayjs'; interface WorkingHourPeriod { start: string; // "HH:mm" 格式 @@ -30,8 +27,8 @@ const emit = defineEmits<{ }>(); // 当前编辑的时间段 -const startTime = ref(null); -const endTime = ref(null); +const startTime = ref(''); +const endTime = ref(''); // 正在编辑的时间段索引 const editingIndex = ref(null); @@ -85,8 +82,8 @@ function addPeriod() { } const newPeriod: WorkingHourPeriod = { - start: startTime.value.format('HH:mm'), - end: endTime.value.format('HH:mm'), + start: startTime.value, + end: endTime.value, }; // 校验:结束时间必须晚于开始时间 @@ -132,22 +129,22 @@ function addPeriod() { message.success('时间段已添加'); } - startTime.value = null; - endTime.value = null; + startTime.value = ''; + endTime.value = ''; } // 编辑时间段 function editPeriod(index: number) { const period = periods.value[index]; - startTime.value = dayjs(period.start, 'HH:mm'); - endTime.value = dayjs(period.end, 'HH:mm'); + startTime.value = period.start; + endTime.value = period.end; editingIndex.value = index; } // 取消编辑 function cancelEdit() { - startTime.value = null; - endTime.value = null; + startTime.value = ''; + endTime.value = ''; editingIndex.value = null; } @@ -229,20 +226,18 @@ function getDuration(period: WorkingHourPeriod): string {
- -