fix(frontend): 保持重新生成退出前详情
This commit is contained in:
@@ -103,7 +103,6 @@ const selectedPreviewIdsByFile = ref<Record<string, string>>({})
|
||||
const dirty = ref(false)
|
||||
const modelSubmitLoading = ref(false)
|
||||
let allowLeave = false
|
||||
|
||||
const {
|
||||
generation,
|
||||
results,
|
||||
@@ -119,7 +118,7 @@ const {
|
||||
} = useDataProcessGeneration({
|
||||
taskId,
|
||||
dirty,
|
||||
beforeGenerate: syncPreviewChanges,
|
||||
beforeGenerate: beforeStartGeneration,
|
||||
})
|
||||
const { enqueueSourceUpload, sourceUploading } = useDataProcessSourceUpload({
|
||||
taskId,
|
||||
@@ -134,7 +133,6 @@ const { enqueueSourceUpload, sourceUploading } = useDataProcessSourceUpload({
|
||||
const hasUnfinishedUploads = computed(() => uploadedFiles.value.some((file) => (
|
||||
file.status !== 'ready' || !file.sourceFileId
|
||||
)))
|
||||
|
||||
const modifiedPreviewCount = computed(() => previewItems.value.filter((item) => item.status !== 'original').length)
|
||||
const previewItemsByFile = computed(() => {
|
||||
const grouped = new Map<string, PreviewItem[]>()
|
||||
@@ -171,7 +169,6 @@ const primaryActionLabel = computed(() => {
|
||||
if (generation.status === 'failed') return '重新生成'
|
||||
return '开始生成'
|
||||
})
|
||||
|
||||
const primaryActionIcon = computed(() => {
|
||||
if (currentStepId.value === 'results') return 'fa-check'
|
||||
if (currentStepId.value === 'generate' && generation.status !== 'success') return 'fa-play'
|
||||
@@ -181,7 +178,6 @@ const primaryActionIcon = computed(() => {
|
||||
const previousStepLabel = computed(() => currentStep.value > 0
|
||||
? WIZARD_STEPS[currentStep.value - 1].title
|
||||
: '')
|
||||
|
||||
function goToStep(stepId: StepId) {
|
||||
const nextStepIndex = WIZARD_STEPS.findIndex((step) => step.id === stepId)
|
||||
if (nextStepIndex >= 0) currentStep.value = nextStepIndex
|
||||
@@ -280,24 +276,19 @@ function mapPreviewItem(item: DataProcessPreviewItem): PreviewItem {
|
||||
function previewAffectingOptions() {
|
||||
return previewAffectingOptionsFor(processType.value, structuredOptions.value, unstructuredOptions.value)
|
||||
}
|
||||
|
||||
function generationAffectingOptions() {
|
||||
return generationAffectingOptionsFor(processType.value, structuredOptions.value, unstructuredOptions.value)
|
||||
}
|
||||
|
||||
const generationOptionsSignature = computed(() => JSON.stringify(generationAffectingOptions()))
|
||||
|
||||
function buildPreviewConfigSignature() {
|
||||
return `${PREVIEW_MODEL_VERSION}:${processType.value}:${JSON.stringify(previewAffectingOptions())}`
|
||||
}
|
||||
|
||||
function buildPreviewSignature() {
|
||||
const filesSignature = uploadedFiles.value
|
||||
.map((file) => `${file.uid}:${file.name}:${file.size}:${file.checksumSha256 || file.count}`)
|
||||
.join('|')
|
||||
return `${buildPreviewConfigSignature()}:${filesSignature}`
|
||||
}
|
||||
|
||||
const {
|
||||
isRegeneration,
|
||||
originalProcessType,
|
||||
@@ -307,6 +298,9 @@ const {
|
||||
loadSource: loadRegenerationSource,
|
||||
confirmPreviewConfigChange,
|
||||
prepareRegeneration,
|
||||
confirmStartGeneration,
|
||||
returnToDetail,
|
||||
leaveWarning,
|
||||
} = useDataProcessRegeneration({
|
||||
task,
|
||||
processType,
|
||||
@@ -324,11 +318,14 @@ const {
|
||||
mapPreviewItem,
|
||||
resetDownstream,
|
||||
})
|
||||
const leaveWarningMessage = computed(() => regenerationPrepared.value
|
||||
? '仍有尚未完成的本地操作;已提交到服务端的修改不会因离开页面而撤销。'
|
||||
: '当前存在未保存修改,离开后这些修改将不会保留。')
|
||||
const leaveConfirmText = computed(() => regenerationPrepared.value ? '离开页面' : '放弃修改')
|
||||
|
||||
async function beforeStartGeneration() {
|
||||
return confirmStartGeneration(
|
||||
options => confirmDialogRef.value?.open(options) ?? Promise.resolve(false),
|
||||
syncPreviewChanges,
|
||||
)
|
||||
}
|
||||
const leaveWarningMessage = computed(() => leaveWarning(generation.status))
|
||||
const leaveConfirmText = computed(() => isRegeneration.value ? '返回详情' : '放弃修改')
|
||||
watch(
|
||||
[() => task.name, () => task.description, processType, structuredOptions, unstructuredOptions, externalSource],
|
||||
() => {
|
||||
@@ -531,9 +528,9 @@ async function nextFromModel() {
|
||||
const regenerated = await prepareRegeneration(taskPayload())
|
||||
taskId.value = String(regenerated.task.id)
|
||||
if (regenerated.preview_invalidated) {
|
||||
ElMessage.info('切分配置已变化,现有源文件将在下一步按新配置重新切分')
|
||||
ElMessage.info('切分配置已保存,后续将按新配置重新切分;点击“开始生成”前,原生成结果和已发布数据保持不变')
|
||||
} else if (regenerated.published_outputs_preserved) {
|
||||
ElMessage.info('已保留原切片;已发布的三个数据集将在重新发布前保持不变')
|
||||
ElMessage.info('重新生成配置已保存;点击“开始生成”前,原生成结果和已发布数据保持不变')
|
||||
}
|
||||
} else {
|
||||
const saved = taskId.value
|
||||
@@ -807,8 +804,7 @@ async function saveTask() {
|
||||
|
||||
async function handleCancel() {
|
||||
if (!dirty.value) {
|
||||
allowLeave = true
|
||||
router.back()
|
||||
await returnToPreviousPage()
|
||||
return
|
||||
}
|
||||
const confirmed = await confirmDialogRef.value?.open({
|
||||
@@ -819,7 +815,12 @@ async function handleCancel() {
|
||||
tone: 'danger',
|
||||
})
|
||||
if (!confirmed) return
|
||||
await returnToPreviousPage()
|
||||
}
|
||||
|
||||
async function returnToPreviousPage() {
|
||||
allowLeave = true
|
||||
if (isRegeneration.value && await returnToDetail()) return
|
||||
router.back()
|
||||
}
|
||||
|
||||
@@ -973,7 +974,7 @@ onMounted(() => {
|
||||
<el-button v-if="currentStep > 0" :disabled="previewBuilding || sourceUploading" @click="handleBack">
|
||||
<i class="fa fa-arrow-left" style="margin-right: 6px;" /> 返回:{{ previousStepLabel }}
|
||||
</el-button>
|
||||
<el-button v-else @click="handleCancel">取消</el-button>
|
||||
<el-button v-else @click="handleCancel">{{ isRegeneration ? '返回详情' : '取消' }}</el-button>
|
||||
</div>
|
||||
<div class="footer-center">
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user