Browse Source

fix:工艺加液步骤4 加液检查

master
guoapeng 2 months ago
parent
commit
083817c944
  1. 48
      src/components/craft/AddCraft/index.vue

48
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<string, CraftTypes.StepItem> = {
}
const addStep = (data: CraftTypes.StepItem) => {
form.value.stepList?.push(data)
form.value.stepList?.push(cloneDeep(data))
}
const addLiquidForm = ref<any>({
@ -346,16 +360,20 @@ const addHandle = async () => {
<div v-if="item.method === 'addLiquid'" class="list-box">
<div v-for="(liquid, liquidIndex) in item.params?.list || []" :key="liquidIndex">
<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>
@ -568,4 +586,8 @@ const addHandle = async () => {
line-height: 100%;
}
}
.step-solution-item {
display: flex;
margin-bottom: 5px;
}
</style>
Loading…
Cancel
Save