fix(web-admin): allow finish production task without step or IO gates
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
f110f92040
commit
139164c7d2
1 file changed
-60
@@ -2260,38 +2260,6 @@ export function useTaskStepEditor() {
|
||||
}
|
||||
}
|
||||
|
||||
function validateTaskIoRowsComplete(): string | null {
|
||||
const invalidInput = taskInputs.value.find(
|
||||
(row) =>
|
||||
!row.inputType ||
|
||||
(!(row.inputId || '').trim() &&
|
||||
!(row.inputCode || '').trim() &&
|
||||
!(row.inputName || '').trim())
|
||||
)
|
||||
if (invalidInput) {
|
||||
return '原材料存在未填完整的行,请补全类型与编码/名称后保存'
|
||||
}
|
||||
const invalidOutput = taskOutputs.value.find(
|
||||
(row) => !(row.outputName || '').trim() || !(row.outputBarcode || '').trim()
|
||||
)
|
||||
if (invalidOutput) {
|
||||
return '产出存在未填完整的行,请补全输出名称与条码后保存'
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
function validateAllStepsComplete(): string | null {
|
||||
if (!stepList.value.length) return null
|
||||
const pending = stepList.value.filter((s) => s.stepStatus !== 'ywc')
|
||||
if (!pending.length) return null
|
||||
const preview = pending
|
||||
.slice(0, 3)
|
||||
.map((s) => s.processName || '未命名步骤')
|
||||
.join('、')
|
||||
const suffix = pending.length > 3 ? ` 等 ${pending.length} 个步骤` : ''
|
||||
return `尚有未完成的工艺步骤(${preview}${suffix}),请完成全部步骤后再完成任务`
|
||||
}
|
||||
|
||||
const completeConclusionVisible = ref(false)
|
||||
const completeConclusionIsEdit = ref(false)
|
||||
const completeConclusionInitial = reactive({ conclusion: '', remark: '' })
|
||||
@@ -2306,34 +2274,6 @@ export function useTaskStepEditor() {
|
||||
completeConclusionInitial.conclusion =
|
||||
(taskDetail.value as { conclusion?: string }).conclusion || ''
|
||||
completeConclusionInitial.remark = taskDetail.value.remark || ''
|
||||
if (!isCompleted) {
|
||||
const ioErr = validateTaskIoRowsComplete()
|
||||
if (ioErr) {
|
||||
await ElMessageBox.alert(ioErr, '无法完成任务', { type: 'warning' })
|
||||
return
|
||||
}
|
||||
const stepErr = validateAllStepsComplete()
|
||||
if (stepErr) {
|
||||
await ElMessageBox.alert(stepErr, '无法完成任务', { type: 'warning' })
|
||||
return
|
||||
}
|
||||
const missingSlotCount = outputsMissingStorageSlotCount.value
|
||||
if (missingSlotCount > 0) {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`尚有 ${missingSlotCount} 份产出未分配储物格位置,完成后可在「产出(细胞产品)」中编辑补全。是否继续完成任务?`,
|
||||
'储物格未分配',
|
||||
{
|
||||
type: 'warning',
|
||||
confirmButtonText: '继续完成',
|
||||
cancelButtonText: '返回补全'
|
||||
}
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
completeConclusionVisible.value = true
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user