diff --git a/src/components/craft/AddCraft/index.vue b/src/components/craft/AddCraft/index.vue index 734e735..d672ec9 100644 --- a/src/components/craft/AddCraft/index.vue +++ b/src/components/craft/AddCraft/index.vue @@ -67,9 +67,20 @@ const okHandle = async () => { if (!valid) { return } + const errs: string[] = [] // 找到第一个参数不完整的步骤 const invalidStepIndex = form.value.stepList?.findIndex( (step: any, index) => { + if (step.method === 'addLiquid') { + step.params.list.forEach((item) => { + item.solutionList.forEach((s, sIndex) => { + if (!s.volume) { + errs.push(`步骤${index + 1}: 试管${item.tubeNum}的第${sIndex + 1}个加液容量未填写`) + } + }) + }) + } + if (['startHeating', 'shaking'].includes(step.method)) { if (step.params.minutes || step.params.seconds) { step.params.second = (step.params.minutes || 0) * 60 + (step.params.seconds || 0) || undefined @@ -95,16 +106,19 @@ const okHandle = async () => { step.params.description = `拍照` break } - return !allPropertiesDefined(step.params, ['minutes', 'seconds', 'description']) + return !allPropertiesDefined(step.params, ['minutes', 'seconds', 'description', 'inTemperature']) }, ) - console.log(form.value) if (invalidStepIndex !== -1) { FtMessage.error(`步骤${(invalidStepIndex || 0) + 1}: 请填写完整参数`) return } + if (errs.length) { + FtMessage.error(errs.join('\n')) + return + } form.value.steps = JSON.stringify(form.value.stepList) form.value.oresId = oresId @@ -133,7 +147,7 @@ const stepMap: Record = { } const addStep = (data: CraftTypes.StepItem) => { - form.value.stepList?.push(data) + form.value.stepList?.push(cloneDeep(data)) } const addLiquidForm = ref({ @@ -346,16 +360,20 @@ const addHandle = async () => {
试管{{ liquid.tubeNum }} -
- 添加 - {{ solutionList.find(solution => solution.id === s.solutionId)?.name }} - {{ s.volume }} - mL - - -偏移量 - {{ s.offset }} - mL - +
+ + + + + + + + +
@@ -568,4 +586,8 @@ const addHandle = async () => { line-height: 100%; } } +.step-solution-item { + display: flex; + margin-bottom: 5px; +}