diff --git a/frontend/src/components/queue/QueueItemManager.vue b/frontend/src/components/queue/QueueItemManager.vue index 13397ab..796bcf0 100644 --- a/frontend/src/components/queue/QueueItemManager.vue +++ b/frontend/src/components/queue/QueueItemManager.vue @@ -11,84 +11,49 @@ - -
- -
-
序号
-
脚本任务
-
操作
-
- - - - @@ -96,7 +61,6 @@ import { onMounted, ref, watch } from 'vue' import { message } from 'ant-design-vue' import { DeleteOutlined, PlusOutlined } from '@ant-design/icons-vue' -import draggable from 'vuedraggable' import { Service } from '@/api' // Props @@ -187,7 +151,7 @@ const updateQueueItemScript = async (record: any) => { const oldScript = record.script try { loading.value = true - + const response = await Service.updateItemApiQueueItemUpdatePost({ queueId: props.queueId, queueItemId: record.id, @@ -220,7 +184,7 @@ const updateQueueItemScript = async (record: any) => { const addQueueItem = async () => { try { loading.value = true - + // 直接创建队列项,默认ScriptId为null(未选择) const createResponse = await Service.addItemApiQueueItemAddPost({ queueId: props.queueId, @@ -262,44 +226,6 @@ const deleteQueueItem = async (itemId: string) => { } } -// 拖拽结束处理函数 -const onDragEnd = async (evt: any) => { - // 如果位置没有变化,直接返回 - if (evt.oldIndex === evt.newIndex) { - return - } - - try { - loading.value = true - - // 构造排序后的ID列表 - const sortedIds = queueItems.value.map(item => item.id) - - // 调用排序API - const response = await Service.reorderItemApiQueueItemOrderPost({ - queueId: props.queueId, - indexList: sortedIds, - }) - - if (response.code === 200) { - message.success('任务顺序已更新') - // 刷新数据以确保与服务器同步 - emit('refresh') - } else { - message.error('更新任务顺序失败: ' + (response.message || '未知错误')) - // 如果失败,刷新数据恢复原状态 - emit('refresh') - } - } catch (error: any) { - console.error('拖拽排序失败:', error) - message.error('更新任务顺序失败: ' + (error?.message || '网络错误')) - // 如果失败,刷新数据恢复原状态 - emit('refresh') - } finally { - loading.value = false - } -} - // 初始化 onMounted(() => { loadOptions() @@ -563,124 +489,6 @@ onMounted(() => { padding: 40px 0; } -/* 拖拽表格样式 */ -.draggable-table-container { - width: 100%; - border: 1px solid var(--ant-color-border); - border-radius: 6px; - overflow: hidden; -} - -.draggable-table-header { - display: flex; - background-color: var(--ant-color-fill-quaternary); - border-bottom: 1px solid var(--ant-color-border); -} - -.header-cell { - padding: 12px 16px; - font-weight: 600; - color: var(--ant-color-text); - text-align: center; - border-right: 1px solid var(--ant-color-border); -} - -.header-cell:last-child { - border-right: none; -} - -.index-cell { - width: 80px; - min-width: 80px; - max-width: 80px; -} - -.script-cell { - flex: 1; - min-width: 200px; -} - -.actions-cell { - width: 180px; - min-width: 180px; - max-width: 180px; -} - -.draggable-container { - min-height: 60px; -} - -.draggable-row { - display: flex; - align-items: center; - background: var(--ant-color-bg-container); - border-bottom: 1px solid var(--ant-color-border); - transition: all 0.2s ease; - cursor: move; -} - -.draggable-row:last-child { - border-bottom: none; -} - -.draggable-row:hover { - background-color: var(--ant-color-fill-quaternary); -} - -.draggable-row.row-dragging { - cursor: not-allowed; -} - -.row-cell { - padding: 12px 16px; - text-align: center; - border-right: 1px solid var(--ant-color-border); - display: flex; - align-items: center; - justify-content: center; -} - -.row-cell:last-child { - border-right: none; -} - -.row-cell.index-cell { - width: 80px; - min-width: 80px; - max-width: 80px; - font-weight: 500; - color: var(--ant-color-text-secondary); -} - -.row-cell.script-cell { - flex: 1; - min-width: 200px; -} - -.row-cell.actions-cell { - width: 180px; - min-width: 180px; - max-width: 180px; -} - -/* 拖拽状态样式 */ -.ghost { - opacity: 0.5; - background: var(--ant-color-primary-bg); - border: 2px dashed var(--ant-color-primary); -} - -.chosen { - background: var(--ant-color-primary-bg-hover); - transform: scale(1.02); - box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); -} - -.drag { - transform: rotate(5deg); - opacity: 0.8; -} - /* 响应式设计 */ @media (max-width: 1200px) { .queue-items-grid { @@ -696,30 +504,6 @@ onMounted(() => { .queue-item-card-item { padding: 12px; } - - .draggable-row { - flex-direction: column; - align-items: stretch; - } - - .row-cell, - .header-cell { - border-right: none; - border-bottom: 1px solid var(--ant-color-border); - } - - .row-cell:last-child, - .header-cell:last-child { - border-bottom: none; - } - - .index-cell, - .script-cell, - .actions-cell { - width: 100% !important; - min-width: auto !important; - max-width: none !important; - } } /* 标签样式 */ @@ -820,4 +604,4 @@ onMounted(() => { .script-select :deep(.ant-select-item-option-content) { font-size: 13px !important; } - + \ No newline at end of file diff --git a/frontend/src/components/queue/TimeSetManager.vue b/frontend/src/components/queue/TimeSetManager.vue index 085b48f..469ff48 100644 --- a/frontend/src/components/queue/TimeSetManager.vue +++ b/frontend/src/components/queue/TimeSetManager.vue @@ -16,78 +16,60 @@ - -
- -
-
序号
-
状态
-
执行时间
-
操作
-
- - - - - - - -
+ + + + + + @@ -95,7 +77,6 @@ import { ref, watch } from 'vue' import { message } from 'ant-design-vue' import { DeleteOutlined, PlusOutlined } from '@ant-design/icons-vue' -import draggable from 'vuedraggable' import { Service } from '@/api' import dayjs from 'dayjs' @@ -178,7 +159,7 @@ const timeSets = ref([...props.timeSets]) const processTimeSets = (rawTimeSets: any[]) => { return rawTimeSets.map(item => ({ ...item, - timeValue: parseTimeString(item.time), + timeValue: parseTimeString(item.time) })) } @@ -240,7 +221,7 @@ const addTimeSet = async () => { const updateTimeSetTime = async (timeSet: any) => { try { const timeString = formatTimeValue(timeSet.timeValue) - + const response = await Service.updateTimeSetApiQueueTimeUpdatePost({ queueId: props.queueId, timeSetId: timeSet.id, @@ -316,44 +297,6 @@ const deleteTimeSet = async (timeSetId: string) => { message.error('删除定时项失败: ' + (error?.message || '网络错误')) } } - -// 拖拽结束处理函数 -const onDragEnd = async (evt: any) => { - // 如果位置没有变化,直接返回 - if (evt.oldIndex === evt.newIndex) { - return - } - - try { - loading.value = true - - // 构造排序后的ID列表 - const sortedIds = timeSets.value.map(item => item.id) - - // 调用排序API - const response = await Service.reorderTimeSetApiQueueTimeOrderPost({ - queueId: props.queueId, - indexList: sortedIds, - }) - - if (response.code === 200) { - message.success('定时顺序已更新') - // 刷新数据以确保与服务器同步 - emit('refresh') - } else { - message.error('更新定时顺序失败: ' + (response.message || '未知错误')) - // 如果失败,刷新数据恢复原状态 - emit('refresh') - } - } catch (error: any) { - console.error('拖拽排序失败:', error) - message.error('更新定时顺序失败: ' + (error?.message || '网络错误')) - // 如果失败,刷新数据恢复原状态 - emit('refresh') - } finally { - loading.value = false - } -} @@ -1054,9 +831,7 @@ const onDragEnd = async (evt: any) => { transition: background 0.2s ease; } -[data-theme='dark'] - .ant-picker-dropdown - .ant-picker-time-panel-column::-webkit-scrollbar-thumb:hover { +[data-theme='dark'] .ant-picker-dropdown .ant-picker-time-panel-column::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.45); }