| | |
| | | v-model="taskData" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | :disabled-date="disabledDate" |
| | | /> |
| | | </div> |
| | | <div class="item">任务时间: |
| | | <!-- <el-time-picker |
| | | <el-time-picker |
| | | v-model="searchForm.execute_time_arr" |
| | | placeholder="选择时间" |
| | | format="HH:mm" |
| | | value-format="HH:mm"/> --> |
| | | value-format="HH:mm"/> |
| | | </div> |
| | | <div class="item">选择航线: |
| | | <el-select |
| | |
| | | }); |
| | | const isShowAddTask = defineModel('show'); |
| | | |
| | | // 禁用当天之前的日期 |
| | | const disabledDate = (time) => { |
| | | return time.getTime() < Date.now() - 8.64e7; // 86400000 = 24 * 60 * 60 * 1000 |
| | | }; |
| | | |
| | | // 获取航线列表数据 |
| | | const routeOptions = ref([]); |
| | | const getRouteList = async () => { |
| | |
| | | }); |
| | | return; |
| | | } |
| | | // 检查任务时间 |
| | | if (searchForm.execute_time_arr) { |
| | | const now = new Date(); |
| | | const today = now.toDateString(); |
| | | const selectedDate = new Date(taskData.value).toDateString(); |
| | | |
| | | if (today === selectedDate) { |
| | | const [hours, minutes] = searchForm.execute_time_arr.split(':'); |
| | | const selectedTime = new Date(); |
| | | selectedTime.setHours(parseInt(hours), parseInt(minutes)); |
| | | |
| | | if (selectedTime < now) { |
| | | ElMessage({ |
| | | message: '任务时间不能小于当前时间', |
| | | type: 'warning' |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | searchForm.begin_time = `${taskData.value} 00:00:00`; |
| | | searchForm.end_time = `${taskData.value} 23:59:59`; |
| | | |