Merge branch 'feature/refactor' of github.com:AUTO-MAS-Project/AUTO-MAS into feature/refactor

This commit is contained in:
DLmaster361
2025-09-14 21:44:13 +08:00
2 changed files with 909 additions and 868 deletions

View File

@@ -397,11 +397,15 @@
</template>
<!-- 计划模式显示只读文本 -->
<div v-if="isPlanMode" class="plan-mode-display">
<div class="plan-value">{{
displaySeriesNumb === '0' ? 'AUTO' :
displaySeriesNumb === '-1' ? '不切换' :
displaySeriesNumb
}}</div>
<div class="plan-value">
{{
displaySeriesNumb === '0'
? 'AUTO'
: displaySeriesNumb === '-1'
? '不切换'
: displaySeriesNumb
}}
</div>
<div class="plan-source">来自计划表</div>
</div>
<!-- 固定模式显示选择框 -->
@@ -436,7 +440,9 @@
</template>
<!-- 计划模式显示只读文本 -->
<div v-if="isPlanMode" class="plan-mode-display">
<div class="plan-value">{{ displayStage === '-' ? '当前/上次' : (displayStage || '不选择') }}</div>
<div class="plan-value">
{{ displayStage === '-' ? '当前/上次' : displayStage || '不选择' }}
</div>
<div class="plan-source">来自计划表</div>
</div>
<!-- 固定模式显示选择框 -->
@@ -459,11 +465,7 @@
size="small"
@keyup.enter="addCustomStage"
/>
<a-button
type="text"
size="small"
@click="addCustomStage"
>
<a-button type="text" size="small" @click="addCustomStage">
<template #icon>
<PlusOutlined />
</template>
@@ -471,16 +473,25 @@
</a-button>
</a-space>
</template>
<a-select-option v-for="option in stageOptions" :key="option.value" :value="option.value">
<a-select-option
v-for="option in stageOptions"
:key="option.value"
:value="option.value"
>
<template v-if="option.label.includes('|')">
<span>{{ option.label.split('|')[0] }}</span>
<a-tag color="green" size="small" style="margin-left: 8px;">
<a-tag color="green" size="small" style="margin-left: 8px">
{{ option.label.split('|')[1] }}
</a-tag>
</template>
<template v-else>
{{ option.label }}
<a-tag v-if="isCustomStage(option.value)" color="blue" size="small" style="margin-left: 8px;">
<a-tag
v-if="isCustomStage(option.value)"
color="blue"
size="small"
style="margin-left: 8px"
>
自定义
</a-tag>
</template>
@@ -504,7 +515,9 @@
</template>
<!-- 计划模式显示只读文本 -->
<div v-if="isPlanMode" class="plan-mode-display">
<div class="plan-value">{{ displayStage1 === '-' ? '当前/上次' : (displayStage1 || '不选择') }}</div>
<div class="plan-value">
{{ displayStage1 === '-' ? '当前/上次' : displayStage1 || '不选择' }}
</div>
<div class="plan-source">来自计划表</div>
</div>
<!-- 固定模式显示选择框 -->
@@ -527,11 +540,7 @@
size="small"
@keyup.enter="addCustomStage1"
/>
<a-button
type="text"
size="small"
@click="addCustomStage1"
>
<a-button type="text" size="small" @click="addCustomStage1">
<template #icon>
<PlusOutlined />
</template>
@@ -539,16 +548,25 @@
</a-button>
</a-space>
</template>
<a-select-option v-for="option in stageOptions" :key="option.value" :value="option.value">
<a-select-option
v-for="option in stageOptions"
:key="option.value"
:value="option.value"
>
<template v-if="option.label.includes('|')">
<span>{{ option.label.split('|')[0] }}</span>
<a-tag color="green" size="small" style="margin-left: 8px;">
<a-tag color="green" size="small" style="margin-left: 8px">
{{ option.label.split('|')[1] }}
</a-tag>
</template>
<template v-else>
{{ option.label }}
<a-tag v-if="isCustomStage(option.value)" color="blue" size="small" style="margin-left: 8px;">
<a-tag
v-if="isCustomStage(option.value)"
color="blue"
size="small"
style="margin-left: 8px"
>
自定义
</a-tag>
</template>
@@ -570,7 +588,9 @@
</template>
<!-- 计划模式显示只读文本 -->
<div v-if="isPlanMode" class="plan-mode-display">
<div class="plan-value">{{ displayStage2 === '-' ? '当前/上次' : (displayStage2 || '不选择') }}</div>
<div class="plan-value">
{{ displayStage2 === '-' ? '当前/上次' : displayStage2 || '不选择' }}
</div>
<div class="plan-source">来自计划表</div>
</div>
<!-- 固定模式显示选择框 -->
@@ -593,11 +613,7 @@
size="small"
@keyup.enter="addCustomStage2"
/>
<a-button
type="text"
size="small"
@click="addCustomStage2"
>
<a-button type="text" size="small" @click="addCustomStage2">
<template #icon>
<PlusOutlined />
</template>
@@ -605,16 +621,25 @@
</a-button>
</a-space>
</template>
<a-select-option v-for="option in stageOptions" :key="option.value" :value="option.value">
<a-select-option
v-for="option in stageOptions"
:key="option.value"
:value="option.value"
>
<template v-if="option.label.includes('|')">
<span>{{ option.label.split('|')[0] }}</span>
<a-tag color="green" size="small" style="margin-left: 8px;">
<a-tag color="green" size="small" style="margin-left: 8px">
{{ option.label.split('|')[1] }}
</a-tag>
</template>
<template v-else>
{{ option.label }}
<a-tag v-if="isCustomStage(option.value)" color="blue" size="small" style="margin-left: 8px;">
<a-tag
v-if="isCustomStage(option.value)"
color="blue"
size="small"
style="margin-left: 8px"
>
自定义
</a-tag>
</template>
@@ -636,7 +661,9 @@
</template>
<!-- 计划模式显示只读文本 -->
<div v-if="isPlanMode" class="plan-mode-display">
<div class="plan-value">{{ displayStage3 === '-' ? '当前/上次' : (displayStage3 || '不选择') }}</div>
<div class="plan-value">
{{ displayStage3 === '-' ? '当前/上次' : displayStage3 || '不选择' }}
</div>
<div class="plan-source">来自计划表</div>
</div>
<!-- 固定模式显示选择框 -->
@@ -659,11 +686,7 @@
size="small"
@keyup.enter="addCustomStage3"
/>
<a-button
type="text"
size="small"
@click="addCustomStage3"
>
<a-button type="text" size="small" @click="addCustomStage3">
<template #icon>
<PlusOutlined />
</template>
@@ -671,16 +694,25 @@
</a-button>
</a-space>
</template>
<a-select-option v-for="option in stageOptions" :key="option.value" :value="option.value">
<a-select-option
v-for="option in stageOptions"
:key="option.value"
:value="option.value"
>
<template v-if="option.label.includes('|')">
<span>{{ option.label.split('|')[0] }}</span>
<a-tag color="green" size="small" style="margin-left: 8px;">
<a-tag color="green" size="small" style="margin-left: 8px">
{{ option.label.split('|')[1] }}
</a-tag>
</template>
<template v-else>
{{ option.label }}
<a-tag v-if="isCustomStage(option.value)" color="blue" size="small" style="margin-left: 8px;">
<a-tag
v-if="isCustomStage(option.value)"
color="blue"
size="small"
style="margin-left: 8px"
>
自定义
</a-tag>
</template>
@@ -700,7 +732,9 @@
</template>
<!-- 计划模式显示只读文本 -->
<div v-if="isPlanMode" class="plan-mode-display">
<div class="plan-value">{{ displayStageRemain === '-' ? '不选择' : (displayStageRemain || '不选择') }}</div>
<div class="plan-value">
{{ displayStageRemain === '-' ? '不选择' : displayStageRemain || '不选择' }}
</div>
<div class="plan-source">来自计划表</div>
</div>
<!-- 固定模式显示选择框 -->
@@ -723,11 +757,7 @@
size="small"
@keyup.enter="addCustomStageRemain"
/>
<a-button
type="text"
size="small"
@click="addCustomStageRemain"
>
<a-button type="text" size="small" @click="addCustomStageRemain">
<template #icon>
<PlusOutlined />
</template>
@@ -735,16 +765,25 @@
</a-button>
</a-space>
</template>
<a-select-option v-for="option in stageRemainOptions" :key="option.value" :value="option.value">
<a-select-option
v-for="option in stageRemainOptions"
:key="option.value"
:value="option.value"
>
<template v-if="option.label.includes('|')">
<span>{{ option.label.split('|')[0] }}</span>
<a-tag color="green" size="small" style="margin-left: 8px;">
<a-tag color="green" size="small" style="margin-left: 8px">
{{ option.label.split('|')[1] }}
</a-tag>
</template>
<template v-else>
{{ option.label }}
<a-tag v-if="isCustomStage(option.value)" color="blue" size="small" style="margin-left: 8px;">
<a-tag
v-if="isCustomStage(option.value)"
color="blue"
size="small"
style="margin-left: 8px"
>
自定义
</a-tag>
</template>
@@ -970,15 +1009,15 @@
</template>
<script setup lang="ts">
import { computed, nextTick, onMounted, reactive, ref, watch } from 'vue'
import { computed, defineComponent, nextTick, onMounted, reactive, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { message } from 'ant-design-vue'
import {
ArrowLeftOutlined,
PlusOutlined,
QuestionCircleOutlined,
SaveOutlined,
SettingOutlined,
PlusOutlined,
} from '@ant-design/icons-vue'
import type { FormInstance, Rule } from 'ant-design-vue/es/form'
import { useUserApi } from '@/composables/useUserApi'
@@ -1044,8 +1083,8 @@ const isCustomStage = (value: string) => {
if (!value || value === '' || value === '-') return false
// 检查是否在从API加载的关卡列表中
const predefinedStage = stageOptions.value.find(option =>
option.value === value && !option.isCustom
const predefinedStage = stageOptions.value.find(
option => option.value === value && !option.isCustom
)
return !predefinedStage
@@ -1068,11 +1107,11 @@ const displayMedicineNumb = computed({
}
return formData.Info.MedicineNumb
},
set: (value) => {
set: value => {
if (!isPlanMode.value) {
formData.Info.MedicineNumb = value
}
}
},
})
const displaySeriesNumb = computed({
@@ -1082,11 +1121,11 @@ const displaySeriesNumb = computed({
}
return formData.Info.SeriesNumb
},
set: (value) => {
set: value => {
if (!isPlanMode.value) {
formData.Info.SeriesNumb = value
}
}
},
})
const displayStage = computed({
@@ -1096,11 +1135,11 @@ const displayStage = computed({
}
return formData.Info.Stage
},
set: (value) => {
set: value => {
if (!isPlanMode.value) {
formData.Info.Stage = value
}
}
},
})
const displayStage1 = computed({
@@ -1110,11 +1149,11 @@ const displayStage1 = computed({
}
return formData.Info.Stage_1
},
set: (value) => {
set: value => {
if (!isPlanMode.value) {
formData.Info.Stage_1 = value
}
}
},
})
const displayStage2 = computed({
@@ -1124,11 +1163,11 @@ const displayStage2 = computed({
}
return formData.Info.Stage_2
},
set: (value) => {
set: value => {
if (!isPlanMode.value) {
formData.Info.Stage_2 = value
}
}
},
})
const displayStage3 = computed({
@@ -1138,11 +1177,11 @@ const displayStage3 = computed({
}
return formData.Info.Stage_3
},
set: (value) => {
set: value => {
if (!isPlanMode.value) {
formData.Info.Stage_3 = value
}
}
},
})
const displayStageRemain = computed({
@@ -1152,11 +1191,11 @@ const displayStageRemain = computed({
}
return formData.Info.Stage_Remain
},
set: (value) => {
set: value => {
if (!isPlanMode.value) {
formData.Info.Stage_Remain = value
}
}
},
})
// 获取计划当前配置
@@ -1170,7 +1209,7 @@ const getPlanCurrentConfig = (planData: any) => {
} else if (mode === 'Weekly') {
// 获取+12时区的当前时间
const now = new Date()
const utc12Time = new Date(now.getTime() + (12 * 60 * 60 * 1000))
const utc12Time = new Date(now.getTime() + 12 * 60 * 60 * 1000)
// 如果是凌晨4点前算作前一天
if (utc12Time.getHours() < 4) {
@@ -1184,7 +1223,7 @@ const getPlanCurrentConfig = (planData: any) => {
原始时间: now.toISOString(),
UTC12时间: utc12Time.toISOString(),
星期: today,
计划数据: planData
计划数据: planData,
})
// 优先使用今天的配置如果没有或为空则使用ALL配置
@@ -1374,7 +1413,7 @@ const loadUserData = async () => {
stageOptions.value.push({
label: stageValue,
value: stageValue,
isCustom: true
isCustom: true,
})
}
}
@@ -1404,12 +1443,12 @@ const loadUserData = async () => {
const loadStageOptions = async () => {
try {
const response = await Service.getStageComboxApiInfoComboxStagePost({
type: GetStageIn.type.TODAY
type: GetStageIn.type.TODAY,
})
if (response && response.code === 200 && response.data) {
stageOptions.value = [...response.data].map(option => ({
...option,
isCustom: false // 明确标记从API加载的关卡为非自定义
isCustom: false, // 明确标记从API加载的关卡为非自定义
}))
}
} catch (error) {
@@ -1434,7 +1473,7 @@ const VNodes = defineComponent({
props: { vnodes: { type: Object, required: true } },
setup(props) {
return () => props.vnodes as any
}
},
})
// 选择基建配置文件
@@ -1685,7 +1724,7 @@ const addStageToOptions = (stageName: string) => {
stageOptions.value.push({
label: trimmedName,
value: trimmedName,
isCustom: true
isCustom: true,
})
message.success(`自定义关卡 "${trimmedName}" 添加成功`)
@@ -1805,7 +1844,7 @@ onMounted(() => {
// 设置StageMode变化监听器
watch(
() => formData.Info.StageMode,
async (newStageMode) => {
async newStageMode => {
if (newStageMode === 'Fixed') {
// 切换到固定模式,清除计划配置
planModeConfig.value = null
@@ -1822,10 +1861,14 @@ onMounted(() => {
console.log('计划配置加载成功:', {
planId: newStageMode,
currentConfig,
planModeConfigValue: planModeConfig.value
planModeConfigValue: planModeConfig.value,
})
message.success(`已切换到计划模式:${newStageMode}`)
// 从stageModeOptions中查找对应的计划名称
const planOption = stageModeOptions.value.find(option => option.value === newStageMode)
const planName = planOption ? planOption.label : newStageMode
message.success(`已切换到计划模式:${planName}`)
} else {
message.warning('计划配置加载失败,请检查计划是否存在')
planModeConfig.value = null

View File

@@ -11,8 +11,6 @@ import { useUpdateChecker } from '@/composables/useUpdateChecker'
import { Service, type VersionOut } from '@/api'
import UpdateModal from '@/components/UpdateModal.vue'
import { mirrorManager } from '@/utils/mirrorManager'
import { request } from '@/api/core/request'
import { OpenAPI } from '@/api'
// 引入拆分后的 Tab 组件
import TabBasic from './TabBasic.vue'
@@ -243,7 +241,7 @@ const testingNotify = ref(false)
const testNotify = async () => {
testingNotify.value = true
try {
const res: any = await request<any>(OpenAPI, { method: 'POST', url: '/api/setting/test_notify' })
const res = await Service.testNotifyApiSettingTestNotifyPost()
if (res?.code && res.code !== 200) message.warning(res?.message || '测试通知发送结果未知')
else message.success('测试通知已发送')
} catch (e) {