diff --git a/src/components/craft/AddCraft/index.vue b/src/components/craft/AddCraft/index.vue index 57e0f87..446e899 100644 --- a/src/components/craft/AddCraft/index.vue +++ b/src/components/craft/AddCraft/index.vue @@ -52,11 +52,21 @@ const okHandle = async () => { return } // 找到第一个参数不完整的步骤 + const errorMsg: string[] = [] const invalidStepIndex = form.value.stepList.findIndex((step: any, index) => { if (['heat', 'dry', 'anneal'].includes(step.method)) { if (step.params.minutes || step.params.seconds) { step.params.time = (step.params.minutes || 0) * 60 + (step.params.seconds || 0) || undefined } + if (step.params.temperature > 400 && step.method === 'anneal') { + errorMsg.push(`步骤${index + 1}: 退火温度不能超过400度`) + } + if (step.params.temperature > 200 && step.method === 'heat') { + errorMsg.push(`步骤${index + 1}: 加热温度不能超过400度`) + } + if (step.params.temperature > 200 && step.method === 'dry') { + errorMsg.push(`步骤${index + 1}: 烘干温度不能超过400度`) + } } step.params.description = `${index + 1}.` switch (step.method) { @@ -93,6 +103,10 @@ const okHandle = async () => { FtMessage.error(`步骤${invalidStepIndex + 1}: 请填写完整参数`) return } + if (errorMsg.length) { + FtMessage.error(errorMsg.join('; ')) + return + } form.value.steps = JSON.stringify(form.value.stepList) form.value.oresId = oresId @@ -232,7 +246,7 @@ const addStep = (data: any) => {