🚸 计划表弹窗'已切换到计划模式'显示name而非uid

This commit is contained in:
MoeSnowyFox
2025-09-14 20:01:37 +08:00
parent 9d067f1c6a
commit f98a749efa

View File

@@ -383,11 +383,15 @@
</template> </template>
<!-- 计划模式显示只读文本 --> <!-- 计划模式显示只读文本 -->
<div v-if="isPlanMode" class="plan-mode-display"> <div v-if="isPlanMode" class="plan-mode-display">
<div class="plan-value">{{ <div class="plan-value">
displaySeriesNumb === '0' ? 'AUTO' : {{
displaySeriesNumb === '-1' ? '不切换' : displaySeriesNumb === '0'
displaySeriesNumb ? 'AUTO'
}}</div> : displaySeriesNumb === '-1'
? '不切换'
: displaySeriesNumb
}}
</div>
<div class="plan-source">来自计划表</div> <div class="plan-source">来自计划表</div>
</div> </div>
<!-- 固定模式显示选择框 --> <!-- 固定模式显示选择框 -->
@@ -422,7 +426,9 @@
</template> </template>
<!-- 计划模式显示只读文本 --> <!-- 计划模式显示只读文本 -->
<div v-if="isPlanMode" class="plan-mode-display"> <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 class="plan-source">来自计划表</div>
</div> </div>
<!-- 固定模式显示选择框 --> <!-- 固定模式显示选择框 -->
@@ -445,11 +451,7 @@
size="small" size="small"
@keyup.enter="addCustomStage" @keyup.enter="addCustomStage"
/> />
<a-button <a-button type="text" size="small" @click="addCustomStage">
type="text"
size="small"
@click="addCustomStage"
>
<template #icon> <template #icon>
<PlusOutlined /> <PlusOutlined />
</template> </template>
@@ -457,16 +459,25 @@
</a-button> </a-button>
</a-space> </a-space>
</template> </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('|')"> <template v-if="option.label.includes('|')">
<span>{{ option.label.split('|')[0] }}</span> <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] }} {{ option.label.split('|')[1] }}
</a-tag> </a-tag>
</template> </template>
<template v-else> <template v-else>
{{ option.label }} {{ 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> </a-tag>
</template> </template>
@@ -490,7 +501,9 @@
</template> </template>
<!-- 计划模式显示只读文本 --> <!-- 计划模式显示只读文本 -->
<div v-if="isPlanMode" class="plan-mode-display"> <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 class="plan-source">来自计划表</div>
</div> </div>
<!-- 固定模式显示选择框 --> <!-- 固定模式显示选择框 -->
@@ -513,11 +526,7 @@
size="small" size="small"
@keyup.enter="addCustomStage1" @keyup.enter="addCustomStage1"
/> />
<a-button <a-button type="text" size="small" @click="addCustomStage1">
type="text"
size="small"
@click="addCustomStage1"
>
<template #icon> <template #icon>
<PlusOutlined /> <PlusOutlined />
</template> </template>
@@ -525,16 +534,25 @@
</a-button> </a-button>
</a-space> </a-space>
</template> </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('|')"> <template v-if="option.label.includes('|')">
<span>{{ option.label.split('|')[0] }}</span> <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] }} {{ option.label.split('|')[1] }}
</a-tag> </a-tag>
</template> </template>
<template v-else> <template v-else>
{{ option.label }} {{ 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> </a-tag>
</template> </template>
@@ -556,7 +574,9 @@
</template> </template>
<!-- 计划模式显示只读文本 --> <!-- 计划模式显示只读文本 -->
<div v-if="isPlanMode" class="plan-mode-display"> <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 class="plan-source">来自计划表</div>
</div> </div>
<!-- 固定模式显示选择框 --> <!-- 固定模式显示选择框 -->
@@ -579,11 +599,7 @@
size="small" size="small"
@keyup.enter="addCustomStage2" @keyup.enter="addCustomStage2"
/> />
<a-button <a-button type="text" size="small" @click="addCustomStage2">
type="text"
size="small"
@click="addCustomStage2"
>
<template #icon> <template #icon>
<PlusOutlined /> <PlusOutlined />
</template> </template>
@@ -591,16 +607,25 @@
</a-button> </a-button>
</a-space> </a-space>
</template> </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('|')"> <template v-if="option.label.includes('|')">
<span>{{ option.label.split('|')[0] }}</span> <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] }} {{ option.label.split('|')[1] }}
</a-tag> </a-tag>
</template> </template>
<template v-else> <template v-else>
{{ option.label }} {{ 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> </a-tag>
</template> </template>
@@ -622,7 +647,9 @@
</template> </template>
<!-- 计划模式显示只读文本 --> <!-- 计划模式显示只读文本 -->
<div v-if="isPlanMode" class="plan-mode-display"> <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 class="plan-source">来自计划表</div>
</div> </div>
<!-- 固定模式显示选择框 --> <!-- 固定模式显示选择框 -->
@@ -645,11 +672,7 @@
size="small" size="small"
@keyup.enter="addCustomStage3" @keyup.enter="addCustomStage3"
/> />
<a-button <a-button type="text" size="small" @click="addCustomStage3">
type="text"
size="small"
@click="addCustomStage3"
>
<template #icon> <template #icon>
<PlusOutlined /> <PlusOutlined />
</template> </template>
@@ -657,16 +680,25 @@
</a-button> </a-button>
</a-space> </a-space>
</template> </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('|')"> <template v-if="option.label.includes('|')">
<span>{{ option.label.split('|')[0] }}</span> <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] }} {{ option.label.split('|')[1] }}
</a-tag> </a-tag>
</template> </template>
<template v-else> <template v-else>
{{ option.label }} {{ 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> </a-tag>
</template> </template>
@@ -686,7 +718,9 @@
</template> </template>
<!-- 计划模式显示只读文本 --> <!-- 计划模式显示只读文本 -->
<div v-if="isPlanMode" class="plan-mode-display"> <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 class="plan-source">来自计划表</div>
</div> </div>
<!-- 固定模式显示选择框 --> <!-- 固定模式显示选择框 -->
@@ -709,11 +743,7 @@
size="small" size="small"
@keyup.enter="addCustomStageRemain" @keyup.enter="addCustomStageRemain"
/> />
<a-button <a-button type="text" size="small" @click="addCustomStageRemain">
type="text"
size="small"
@click="addCustomStageRemain"
>
<template #icon> <template #icon>
<PlusOutlined /> <PlusOutlined />
</template> </template>
@@ -721,16 +751,25 @@
</a-button> </a-button>
</a-space> </a-space>
</template> </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('|')"> <template v-if="option.label.includes('|')">
<span>{{ option.label.split('|')[0] }}</span> <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] }} {{ option.label.split('|')[1] }}
</a-tag> </a-tag>
</template> </template>
<template v-else> <template v-else>
{{ option.label }} {{ 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> </a-tag>
</template> </template>
@@ -956,15 +995,15 @@
</template> </template>
<script setup lang="ts"> <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 { useRoute, useRouter } from 'vue-router'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { import {
ArrowLeftOutlined, ArrowLeftOutlined,
PlusOutlined,
QuestionCircleOutlined, QuestionCircleOutlined,
SaveOutlined, SaveOutlined,
SettingOutlined, SettingOutlined,
PlusOutlined,
} from '@ant-design/icons-vue' } from '@ant-design/icons-vue'
import type { FormInstance, Rule } from 'ant-design-vue/es/form' import type { FormInstance, Rule } from 'ant-design-vue/es/form'
import { useUserApi } from '@/composables/useUserApi' import { useUserApi } from '@/composables/useUserApi'
@@ -973,7 +1012,6 @@ import { usePlanApi } from '@/composables/usePlanApi'
import { useWebSocket } from '@/composables/useWebSocket' import { useWebSocket } from '@/composables/useWebSocket'
import { Service } from '@/api' import { Service } from '@/api'
import { GetStageIn } from '@/api/models/GetStageIn' import { GetStageIn } from '@/api/models/GetStageIn'
import { defineComponent } from 'vue'
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
@@ -1029,8 +1067,8 @@ const isCustomStage = (value: string) => {
if (!value || value === '' || value === '-') return false if (!value || value === '' || value === '-') return false
// 检查是否在从API加载的关卡列表中 // 检查是否在从API加载的关卡列表中
const predefinedStage = stageOptions.value.find(option => const predefinedStage = stageOptions.value.find(
option.value === value && !option.isCustom option => option.value === value && !option.isCustom
) )
return !predefinedStage return !predefinedStage
@@ -1053,11 +1091,11 @@ const displayMedicineNumb = computed({
} }
return formData.Info.MedicineNumb return formData.Info.MedicineNumb
}, },
set: (value) => { set: value => {
if (!isPlanMode.value) { if (!isPlanMode.value) {
formData.Info.MedicineNumb = value formData.Info.MedicineNumb = value
} }
} },
}) })
const displaySeriesNumb = computed({ const displaySeriesNumb = computed({
@@ -1067,11 +1105,11 @@ const displaySeriesNumb = computed({
} }
return formData.Info.SeriesNumb return formData.Info.SeriesNumb
}, },
set: (value) => { set: value => {
if (!isPlanMode.value) { if (!isPlanMode.value) {
formData.Info.SeriesNumb = value formData.Info.SeriesNumb = value
} }
} },
}) })
const displayStage = computed({ const displayStage = computed({
@@ -1081,11 +1119,11 @@ const displayStage = computed({
} }
return formData.Info.Stage return formData.Info.Stage
}, },
set: (value) => { set: value => {
if (!isPlanMode.value) { if (!isPlanMode.value) {
formData.Info.Stage = value formData.Info.Stage = value
} }
} },
}) })
const displayStage1 = computed({ const displayStage1 = computed({
@@ -1095,11 +1133,11 @@ const displayStage1 = computed({
} }
return formData.Info.Stage_1 return formData.Info.Stage_1
}, },
set: (value) => { set: value => {
if (!isPlanMode.value) { if (!isPlanMode.value) {
formData.Info.Stage_1 = value formData.Info.Stage_1 = value
} }
} },
}) })
const displayStage2 = computed({ const displayStage2 = computed({
@@ -1109,11 +1147,11 @@ const displayStage2 = computed({
} }
return formData.Info.Stage_2 return formData.Info.Stage_2
}, },
set: (value) => { set: value => {
if (!isPlanMode.value) { if (!isPlanMode.value) {
formData.Info.Stage_2 = value formData.Info.Stage_2 = value
} }
} },
}) })
const displayStage3 = computed({ const displayStage3 = computed({
@@ -1123,11 +1161,11 @@ const displayStage3 = computed({
} }
return formData.Info.Stage_3 return formData.Info.Stage_3
}, },
set: (value) => { set: value => {
if (!isPlanMode.value) { if (!isPlanMode.value) {
formData.Info.Stage_3 = value formData.Info.Stage_3 = value
} }
} },
}) })
const displayStageRemain = computed({ const displayStageRemain = computed({
@@ -1137,11 +1175,11 @@ const displayStageRemain = computed({
} }
return formData.Info.Stage_Remain return formData.Info.Stage_Remain
}, },
set: (value) => { set: value => {
if (!isPlanMode.value) { if (!isPlanMode.value) {
formData.Info.Stage_Remain = value formData.Info.Stage_Remain = value
} }
} },
}) })
// 获取计划当前配置 // 获取计划当前配置
@@ -1155,7 +1193,7 @@ const getPlanCurrentConfig = (planData: any) => {
} else if (mode === 'Weekly') { } else if (mode === 'Weekly') {
// 获取+12时区的当前时间 // 获取+12时区的当前时间
const now = new Date() 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点前算作前一天 // 如果是凌晨4点前算作前一天
if (utc12Time.getHours() < 4) { if (utc12Time.getHours() < 4) {
@@ -1169,7 +1207,7 @@ const getPlanCurrentConfig = (planData: any) => {
原始时间: now.toISOString(), 原始时间: now.toISOString(),
UTC12时间: utc12Time.toISOString(), UTC12时间: utc12Time.toISOString(),
星期: today, 星期: today,
计划数据: planData 计划数据: planData,
}) })
// 优先使用今天的配置如果没有或为空则使用ALL配置 // 优先使用今天的配置如果没有或为空则使用ALL配置
@@ -1359,7 +1397,7 @@ const loadUserData = async () => {
stageOptions.value.push({ stageOptions.value.push({
label: stageValue, label: stageValue,
value: stageValue, value: stageValue,
isCustom: true isCustom: true,
}) })
} }
} }
@@ -1389,12 +1427,12 @@ const loadUserData = async () => {
const loadStageOptions = async () => { const loadStageOptions = async () => {
try { try {
const response = await Service.getStageComboxApiInfoComboxStagePost({ const response = await Service.getStageComboxApiInfoComboxStagePost({
type: GetStageIn.type.TODAY type: GetStageIn.type.TODAY,
}) })
if (response && response.code === 200 && response.data) { if (response && response.code === 200 && response.data) {
stageOptions.value = [...response.data].map(option => ({ stageOptions.value = [...response.data].map(option => ({
...option, ...option,
isCustom: false // 明确标记从API加载的关卡为非自定义 isCustom: false, // 明确标记从API加载的关卡为非自定义
})) }))
} }
} catch (error) { } catch (error) {
@@ -1419,7 +1457,7 @@ const VNodes = defineComponent({
props: { vnodes: { type: Object, required: true } }, props: { vnodes: { type: Object, required: true } },
setup(props) { setup(props) {
return () => props.vnodes as any return () => props.vnodes as any
} },
}) })
// 选择基建配置文件 // 选择基建配置文件
@@ -1554,7 +1592,7 @@ const handleMAAConfig = async () => {
console.error(`用户 ${formData.userName} MAA配置错误:`, error) console.error(`用户 ${formData.userName} MAA配置错误:`, error)
message.error(`MAA配置连接失败: ${error}`) message.error(`MAA配置连接失败: ${error}`)
maaWebsocketId.value = null maaWebsocketId.value = null
} },
}) })
maaWebsocketId.value = subId maaWebsocketId.value = subId
@@ -1611,7 +1649,7 @@ const addStageToOptions = (stageName: string) => {
stageOptions.value.push({ stageOptions.value.push({
label: trimmedName, label: trimmedName,
value: trimmedName, value: trimmedName,
isCustom: true isCustom: true,
}) })
message.success(`自定义关卡 "${trimmedName}" 添加成功`) message.success(`自定义关卡 "${trimmedName}" 添加成功`)
@@ -1731,7 +1769,7 @@ onMounted(() => {
// 设置StageMode变化监听器 // 设置StageMode变化监听器
watch( watch(
() => formData.Info.StageMode, () => formData.Info.StageMode,
async (newStageMode) => { async newStageMode => {
if (newStageMode === 'Fixed') { if (newStageMode === 'Fixed') {
// 切换到固定模式,清除计划配置 // 切换到固定模式,清除计划配置
planModeConfig.value = null planModeConfig.value = null
@@ -1748,10 +1786,14 @@ onMounted(() => {
console.log('计划配置加载成功:', { console.log('计划配置加载成功:', {
planId: newStageMode, planId: newStageMode,
currentConfig, 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 { } else {
message.warning('计划配置加载失败,请检查计划是否存在') message.warning('计划配置加载失败,请检查计划是否存在')
planModeConfig.value = null planModeConfig.value = null