| | |
| | | </div> |
| | | <div class="item">任务时间: |
| | | <el-time-picker |
| | | v-model="searchForm.execute_time_arr" |
| | | v-model="timeSlot" |
| | | placeholder="选择时间" |
| | | format="HH:mm" |
| | | value-format="HH:mm"/> |
| | |
| | | // 添加子组件引用 |
| | | const taskTableRef = ref(null); |
| | | const taskData = ref(''); |
| | | const timeSlot = ref(''); |
| | | const searchForm = reactive({ |
| | | name: '', |
| | | ai_types: [], |
| | |
| | | return; |
| | | } |
| | | // 检查任务时间 |
| | | if (searchForm.execute_time_arr) { |
| | | if (timeSlot.value) { |
| | | 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 [hours, minutes] = timeSlot.value.split(':'); |
| | | const selectedTime = new Date(); |
| | | selectedTime.setHours(parseInt(hours), parseInt(minutes)); |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | if (searchForm.dock_sns.length === 0) { |
| | | ElMessage({ |
| | | message: '请选择机场', |
| | | type: 'warning' |
| | | }); |
| | | return; |
| | | } |
| | | searchForm.begin_time = `${taskData.value} 00:00:00`; |
| | | searchForm.end_time = `${taskData.value} 23:59:59`; |
| | | |
| | | searchForm.execute_time_arr = timeSlot.value ? [timeSlot.value] : []; |
| | | createTask(searchForm).then((res) => { |
| | | if (res.data.code === 0) { |
| | | ElMessage.success('任务创建成功'); |
| | | // 关闭当前窗口,刷新任务管理列表 |
| | | isShowAddTask.value = false; |
| | | // 清除数据 |
| | | cancel(); |
| | | emit('refresh'); |
| | | } |
| | | }); |
| | |
| | | searchForm.file_id = ''; |
| | | searchForm.begin_time = ''; |
| | | searchForm.end_time = ''; |
| | | searchForm.execute_time_arr = ''; |
| | | timeSlot.value = ''; |
| | | searchForm.remark = ''; |
| | | searchForm.dock_sns = []; |
| | | rangDate.value = []; |