|
|
@ -5,6 +5,7 @@ import { getSolsList } from 'apis/solution' |
|
|
|
import emptyIcon from 'assets/images/empty.svg' |
|
|
|
import { FtMessage } from 'libs/message' |
|
|
|
import { allPropertiesDefined } from 'libs/utils' |
|
|
|
import { cloneDeep } from 'lodash' |
|
|
|
import { onMounted, ref } from 'vue' |
|
|
|
import { useRoute } from 'vue-router' |
|
|
|
|
|
|
@ -41,9 +42,7 @@ const form = ref({ |
|
|
|
const formRef = ref() |
|
|
|
|
|
|
|
const rules = { |
|
|
|
name: [ |
|
|
|
{ required: true, trigger: 'blur', message: '请输入预设名称' }, |
|
|
|
], |
|
|
|
name: [{ required: true, trigger: 'blur', message: '请输入预设名称' }], |
|
|
|
} |
|
|
|
|
|
|
|
const okHandle = async () => { |
|
|
@ -53,41 +52,38 @@ const okHandle = async () => { |
|
|
|
return |
|
|
|
} |
|
|
|
// 找到第一个参数不完整的步骤 |
|
|
|
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 |
|
|
|
} |
|
|
|
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 |
|
|
|
} |
|
|
|
step.params.description = `${index}.` |
|
|
|
switch (step.method) { |
|
|
|
case 'clean': |
|
|
|
step.params.description += `针头高度${step.params.height}mm, 加${step.params.volume}ml水清洗${step.params.cycle}次` |
|
|
|
break |
|
|
|
case 'addLiquid': |
|
|
|
step.params.description += `添加${solutionList.value.find(s => s.id === containerList.value.find(c => c.id === step.params.containerId)?.solutionId)?.name}-${step.params.volume}ml` |
|
|
|
break |
|
|
|
case 'reduceLiquid': |
|
|
|
step.params.description += `针头高度${step.params.height}mm抽取液体` |
|
|
|
break |
|
|
|
case 'preHeat': |
|
|
|
step.params.description += `预热到${step.params.temperature}度` |
|
|
|
break |
|
|
|
case 'heat': |
|
|
|
step.params.description += `加热: ${step.params.temperature}度, 保持${step.params.minutes || 0}分${step.params.seconds || 0}秒` |
|
|
|
break |
|
|
|
case 'dry': |
|
|
|
step.params.description += `烘干: ${step.params.temperature}度, 保持${step.params.minutes || 0}分${step.params.seconds || 0}秒` |
|
|
|
break |
|
|
|
case 'anneal': |
|
|
|
step.params.description += `退火: ${step.params.temperature}度, 保持${step.params.minutes || 0}分${step.params.seconds || 0}秒` |
|
|
|
break |
|
|
|
} |
|
|
|
return !allPropertiesDefined(step.params, ['minutes', 'seconds', 'description']) |
|
|
|
}, |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
step.params.description = `${index}.` |
|
|
|
switch (step.method) { |
|
|
|
case 'clean': |
|
|
|
step.params.description += `针头高度${step.params.height}mm, 加${step.params.volume}ml水清洗${step.params.cycle}次` |
|
|
|
break |
|
|
|
case 'addLiquid': |
|
|
|
step.params.description += `添加${solutionList.value.find(s => s.id === containerList.value.find(c => c.id === step.params.containerId)?.solutionId)?.name}-${step.params.volume}ml` |
|
|
|
break |
|
|
|
case 'reduceLiquid': |
|
|
|
step.params.description += `针头高度${step.params.height}mm抽取液体` |
|
|
|
break |
|
|
|
case 'preHeat': |
|
|
|
step.params.description += `预热到${step.params.temperature}度` |
|
|
|
break |
|
|
|
case 'heat': |
|
|
|
step.params.description += `加热: ${step.params.temperature}度, 保持${step.params.minutes || 0}分${step.params.seconds || 0}秒` |
|
|
|
break |
|
|
|
case 'dry': |
|
|
|
step.params.description += `烘干: ${step.params.temperature}度, 保持${step.params.minutes || 0}分${step.params.seconds || 0}秒` |
|
|
|
break |
|
|
|
case 'anneal': |
|
|
|
step.params.description += `退火: ${step.params.temperature}度, 保持${step.params.minutes || 0}分${step.params.seconds || 0}秒` |
|
|
|
break |
|
|
|
} |
|
|
|
return !allPropertiesDefined(step.params, ['minutes', 'seconds', 'description']) |
|
|
|
}) |
|
|
|
console.log(form.value) |
|
|
|
|
|
|
|
if (invalidStepIndex !== -1) { |
|
|
@ -116,16 +112,43 @@ const cancel = () => { |
|
|
|
|
|
|
|
const stepMap = { |
|
|
|
preHeat: { name: '预热', method: 'preHeat', params: { temperature: undefined, description: undefined } }, |
|
|
|
addLiquid: { name: '加液', method: 'addLiquid', params: { volume: undefined, containerId: undefined, description: undefined } }, |
|
|
|
heat: { name: '加热', method: 'heat', params: { temperature: undefined, time: undefined, description: undefined, minutes: undefined, seconds: undefined } }, |
|
|
|
addLiquid: { |
|
|
|
name: '加液', |
|
|
|
method: 'addLiquid', |
|
|
|
params: { volume: undefined, containerId: undefined, description: undefined }, |
|
|
|
}, |
|
|
|
heat: { |
|
|
|
name: '加热', |
|
|
|
method: 'heat', |
|
|
|
params: { temperature: undefined, time: undefined, description: undefined, minutes: undefined, seconds: undefined }, |
|
|
|
}, |
|
|
|
reduceLiquid: { name: '抽液', method: 'reduceLiquid', params: { height: undefined, description: undefined } }, |
|
|
|
clean: { name: '清洗', method: 'clean', params: { cycle: undefined, height: undefined, volume: 2, description: undefined } }, |
|
|
|
dry: { name: '烘干', method: 'dry', params: { temperature: undefined, time: undefined, description: undefined, minutes: undefined, seconds: undefined } }, |
|
|
|
anneal: { name: '退火', method: 'anneal', params: { temperature: undefined, feedTemperature: undefined, time: undefined, description: undefined, minutes: undefined, seconds: undefined } }, |
|
|
|
clean: { |
|
|
|
name: '清洗', |
|
|
|
method: 'clean', |
|
|
|
params: { cycle: undefined, height: undefined, volume: 2, description: undefined }, |
|
|
|
}, |
|
|
|
dry: { |
|
|
|
name: '烘干', |
|
|
|
method: 'dry', |
|
|
|
params: { temperature: undefined, time: undefined, description: undefined, minutes: undefined, seconds: undefined }, |
|
|
|
}, |
|
|
|
anneal: { |
|
|
|
name: '退火', |
|
|
|
method: 'anneal', |
|
|
|
params: { |
|
|
|
temperature: undefined, |
|
|
|
feedTemperature: undefined, |
|
|
|
time: undefined, |
|
|
|
description: undefined, |
|
|
|
minutes: undefined, |
|
|
|
seconds: undefined, |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
const addStep = (data: any) => { |
|
|
|
form.value.stepList.push(data) |
|
|
|
form.value.stepList.push(cloneDeep(data)) |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
@ -140,9 +163,9 @@ const addStep = (data: any) => { |
|
|
|
<el-form-item label="步骤列表"> |
|
|
|
<div class="button-content"> |
|
|
|
<el-tag v-for="item in stepMap" :key="item" size="large" @click="() => addStep(item)"> |
|
|
|
<div style="display: flex;align-items: center;justify-content: space-around;width: 100%;"> |
|
|
|
<div style="display: flex; align-items: center; justify-content: space-around; width: 100%"> |
|
|
|
<el-icon><Plus /></el-icon> |
|
|
|
<span> {{ item.name }}</span> |
|
|
|
<span> {{ item.name }}</span> |
|
|
|
</div> |
|
|
|
</el-tag> |
|
|
|
</div> |
|
|
@ -158,7 +181,13 @@ const addStep = (data: any) => { |
|
|
|
mm |
|
|
|
</template> |
|
|
|
</el-input> |
|
|
|
<el-input v-model.number="item.params.volume" style="width: 100px" type="number" size="small" placeholder="请输入加水量"> |
|
|
|
<el-input |
|
|
|
v-model.number="item.params.volume" |
|
|
|
style="width: 100px" |
|
|
|
type="number" |
|
|
|
size="small" |
|
|
|
placeholder="请输入加水量" |
|
|
|
> |
|
|
|
<template #append> |
|
|
|
ml |
|
|
|
</template> |
|
|
@ -171,7 +200,12 @@ const addStep = (data: any) => { |
|
|
|
</template> |
|
|
|
<template v-else-if="item.method === 'addLiquid'"> |
|
|
|
<el-select v-model="item.params.containerId" size="small" placeholder="请选择溶液"> |
|
|
|
<el-option v-for="c in containerList" :key="c.id" :label="solutionList.find(s => s.id === c.solutionId)?.name" :value="c.id" /> |
|
|
|
<el-option |
|
|
|
v-for="c in containerList" |
|
|
|
:key="c.id" |
|
|
|
:label="solutionList.find(s => s.id === c.solutionId)?.name" |
|
|
|
:value="c.id" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
<el-input v-model.number="item.params.volume" type="number" size="small" placeholder="请输入容量"> |
|
|
|
<template #append> |
|
|
@ -187,7 +221,12 @@ const addStep = (data: any) => { |
|
|
|
</el-input> |
|
|
|
</template> |
|
|
|
<template v-else-if="item.method === 'preHeat'"> |
|
|
|
<el-input v-model.number="item.params.temperature" type="number" size="small" placeholder="请输入温度"> |
|
|
|
<el-input |
|
|
|
v-model.number="item.params.temperature" |
|
|
|
type="number" |
|
|
|
size="small" |
|
|
|
placeholder="请输入温度" |
|
|
|
> |
|
|
|
<template #append> |
|
|
|
℃ |
|
|
|
</template> |
|
|
@ -199,40 +238,74 @@ const addStep = (data: any) => { |
|
|
|
℃ |
|
|
|
</template> |
|
|
|
</el-input> |
|
|
|
<el-select v-model="item.params.minutes" style="width: 70px" clearable size="small" placeholder="请选择"> |
|
|
|
<el-select |
|
|
|
v-model="item.params.minutes" |
|
|
|
style="width: 70px" |
|
|
|
clearable |
|
|
|
size="small" |
|
|
|
placeholder="请选择" |
|
|
|
> |
|
|
|
<el-option v-for="i in 60" :key="i" :label="i" :value="i" /> |
|
|
|
</el-select> |
|
|
|
<span class="unit-text">分</span> |
|
|
|
<el-select v-model="item.params.seconds" style="width: 70px" clearable size="small" placeholder="请选择"> |
|
|
|
<el-select |
|
|
|
v-model="item.params.seconds" |
|
|
|
style="width: 70px" |
|
|
|
clearable |
|
|
|
size="small" |
|
|
|
placeholder="请选择" |
|
|
|
> |
|
|
|
<el-option v-for="i in 60" :key="i" :label="i" :value="i" /> |
|
|
|
</el-select> |
|
|
|
<span class="unit-text">秒</span> |
|
|
|
</template> |
|
|
|
<div v-else-if="['anneal'].includes(item.method)" class="info-box"> |
|
|
|
<div> |
|
|
|
<el-input v-model.number="item.params.temperature" type="number" size="small" placeholder="退火温度"> |
|
|
|
<el-input |
|
|
|
v-model.number="item.params.temperature" |
|
|
|
type="number" |
|
|
|
size="small" |
|
|
|
placeholder="退火温度" |
|
|
|
> |
|
|
|
<template #append> |
|
|
|
℃ |
|
|
|
</template> |
|
|
|
</el-input> |
|
|
|
<el-input v-model.number="item.params.feedTemperature" type="number" size="small" placeholder="下料温度"> |
|
|
|
<el-input |
|
|
|
v-model.number="item.params.feedTemperature" |
|
|
|
type="number" |
|
|
|
size="small" |
|
|
|
placeholder="下料温度" |
|
|
|
> |
|
|
|
<template #append> |
|
|
|
℃ |
|
|
|
</template> |
|
|
|
</el-input> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<el-select v-model="item.params.minutes" style="width: 70px" clearable size="small" placeholder="请选择"> |
|
|
|
<el-select |
|
|
|
v-model="item.params.minutes" |
|
|
|
style="width: 70px" |
|
|
|
clearable |
|
|
|
size="small" |
|
|
|
placeholder="请选择" |
|
|
|
> |
|
|
|
<el-option v-for="i in 60" :key="i" :label="i" :value="i" /> |
|
|
|
</el-select> |
|
|
|
<span class="unit-text">分</span> |
|
|
|
<el-select v-model="item.params.seconds" style="width: 70px" clearable size="small" placeholder="请选择"> |
|
|
|
<el-select |
|
|
|
v-model="item.params.seconds" |
|
|
|
style="width: 70px" |
|
|
|
clearable |
|
|
|
size="small" |
|
|
|
placeholder="请选择" |
|
|
|
> |
|
|
|
<el-option v-for="i in 60" :key="i" :label="i" :value="i" /> |
|
|
|
</el-select> |
|
|
|
<span class="unit-text">秒</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<el-icon style="margin-left: auto;" @click="() => form.stepList.splice(index, 1)"> |
|
|
|
<el-icon style="margin-left: auto" @click="() => form.stepList.splice(index, 1)"> |
|
|
|
<Close /> |
|
|
|
</el-icon> |
|
|
|
</el-form-item> |
|
|
@ -269,7 +342,7 @@ const addStep = (data: any) => { |
|
|
|
width: 100%; |
|
|
|
display: grid; |
|
|
|
grid-template-columns: repeat(2, 1fr); /* 创建3列等宽轨道 */ |
|
|
|
grid-template-rows: repeat(4, auto); /* 创建2行自动高度 */ |
|
|
|
grid-template-rows: repeat(4, auto); /* 创建2行自动高度 */ |
|
|
|
gap: 20px; |
|
|
|
} |
|
|
|
:deep(.el-tag__content) { |
|
|
@ -296,12 +369,13 @@ const addStep = (data: any) => { |
|
|
|
height: 25px; |
|
|
|
line-height: 25px; |
|
|
|
} |
|
|
|
:deep(.el-form-item__content) { |
|
|
|
:deep(.el-form-item__content) { |
|
|
|
width: 100%; |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
|
|
|
|
.el-input, .el-select { |
|
|
|
.el-input, |
|
|
|
.el-select { |
|
|
|
width: 120px; |
|
|
|
margin: 0 5px; |
|
|
|
} |
|
|
|