|
@ -67,9 +67,20 @@ const okHandle = async () => { |
|
|
if (!valid) { |
|
|
if (!valid) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
const errs: string[] = [] |
|
|
// 找到第一个参数不完整的步骤 |
|
|
// 找到第一个参数不完整的步骤 |
|
|
const invalidStepIndex = form.value.stepList?.findIndex( |
|
|
const invalidStepIndex = form.value.stepList?.findIndex( |
|
|
(step: any, index) => { |
|
|
(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 (['startHeating', 'shaking'].includes(step.method)) { |
|
|
if (step.params.minutes || step.params.seconds) { |
|
|
if (step.params.minutes || step.params.seconds) { |
|
|
step.params.second = (step.params.minutes || 0) * 60 + (step.params.seconds || 0) || undefined |
|
|
step.params.second = (step.params.minutes || 0) * 60 + (step.params.seconds || 0) || undefined |
|
@ -95,16 +106,19 @@ const okHandle = async () => { |
|
|
step.params.description = `拍照` |
|
|
step.params.description = `拍照` |
|
|
break |
|
|
break |
|
|
} |
|
|
} |
|
|
return !allPropertiesDefined(step.params, ['minutes', 'seconds', 'description']) |
|
|
|
|
|
|
|
|
return !allPropertiesDefined(step.params, ['minutes', 'seconds', 'description', 'inTemperature']) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
) |
|
|
) |
|
|
console.log(form.value) |
|
|
|
|
|
|
|
|
|
|
|
if (invalidStepIndex !== -1) { |
|
|
if (invalidStepIndex !== -1) { |
|
|
FtMessage.error(`步骤${(invalidStepIndex || 0) + 1}: 请填写完整参数`) |
|
|
FtMessage.error(`步骤${(invalidStepIndex || 0) + 1}: 请填写完整参数`) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
if (errs.length) { |
|
|
|
|
|
FtMessage.error(errs.join('\n')) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
form.value.steps = JSON.stringify(form.value.stepList) |
|
|
form.value.steps = JSON.stringify(form.value.stepList) |
|
|
form.value.oresId = oresId |
|
|
form.value.oresId = oresId |
|
@ -133,7 +147,7 @@ const stepMap: Record<string, CraftTypes.StepItem> = { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const addStep = (data: CraftTypes.StepItem) => { |
|
|
const addStep = (data: CraftTypes.StepItem) => { |
|
|
form.value.stepList?.push(data) |
|
|
|
|
|
|
|
|
form.value.stepList?.push(cloneDeep(data)) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const addLiquidForm = ref<any>({ |
|
|
const addLiquidForm = ref<any>({ |
|
@ -346,16 +360,20 @@ const addHandle = async () => { |
|
|
<div v-if="item.method === 'addLiquid'" class="list-box"> |
|
|
<div v-if="item.method === 'addLiquid'" class="list-box"> |
|
|
<div v-for="(liquid, liquidIndex) in item.params?.list || []" :key="liquidIndex"> |
|
|
<div v-for="(liquid, liquidIndex) in item.params?.list || []" :key="liquidIndex"> |
|
|
<span>试管{{ liquid.tubeNum }} </span> |
|
|
<span>试管{{ liquid.tubeNum }} </span> |
|
|
<div v-for="(s, sIndex) in liquid.solutionList" :key="sIndex"> |
|
|
|
|
|
<span>添加</span> |
|
|
|
|
|
<span>{{ solutionList.find(solution => solution.id === s.solutionId)?.name }}</span> |
|
|
|
|
|
<span>{{ s.volume }}</span> |
|
|
|
|
|
<span>mL</span> |
|
|
|
|
|
<span v-if="s.offset"> |
|
|
|
|
|
<span>-偏移量</span> |
|
|
|
|
|
<span>{{ s.offset }}</span> |
|
|
|
|
|
<span>mL</span> |
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
<div v-for="(s, sIndex) in liquid.solutionList" :key="sIndex" class="step-solution-item"> |
|
|
|
|
|
<el-select v-model="s.solutionId" size="small" style="width: 100%" placeholder="溶液"> |
|
|
|
|
|
<el-option v-for="item in solutionList" :key="item.id" :label="item.name" :value="item.id" /> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
<el-input v-model.number="s.volume" size="small" type="number" style="width: 100%" placeholder="容量"> |
|
|
|
|
|
<template #append> |
|
|
|
|
|
mL |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-input> |
|
|
|
|
|
<el-input v-model.number="s.offset" size="small" type="number" style="width: 100%" placeholder="偏移量"> |
|
|
|
|
|
<template #append> |
|
|
|
|
|
mL |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-input> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
@ -568,4 +586,8 @@ const addHandle = async () => { |
|
|
line-height: 100%; |
|
|
line-height: 100%; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
.step-solution-item { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
margin-bottom: 5px; |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |