diff --git a/src/apis/crafts.ts b/src/apis/crafts.ts index aab24f8..c26e4ae 100644 --- a/src/apis/crafts.ts +++ b/src/apis/crafts.ts @@ -30,5 +30,5 @@ export const craftstatus = (): Promise => http.get(`/mo export const craftstatusByHeatId = (heatId: string): Promise => http.get(`/monitor/crafts/status/${heatId}`) export const craftList = (): Promise => http.get(`/crafts/monitor/list`) export const craftRestart = (monitorId: string): Promise => http.post(`/crafts/restart`, { monitorId }) -export const craftRestore = (isRestore: boolean): Promise => http.get(`/crafts/restore${isRestore}`) +export const craftRestore = (isRestore: boolean): Promise => http.get(`/crafts/restore/${isRestore}`) export const craftRemove = (monitorId: string): Promise => http.delete(`/crafts/remove`, { params: { monitorId } }) diff --git a/src/components/craft/AddCraft/index.vue b/src/components/craft/AddCraft/index.vue index 1be228c..30f165b 100644 --- a/src/components/craft/AddCraft/index.vue +++ b/src/components/craft/AddCraft/index.vue @@ -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)) } @@ -140,9 +163,9 @@ const addStep = (data: any) => {
-
+
- {{ item.name }} + {{ item.name }}
@@ -158,7 +181,13 @@ const addStep = (data: any) => { mm - + @@ -171,7 +200,12 @@ const addStep = (data: any) => {
- + - +
- + - +
- + @@ -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; } diff --git a/src/components/home/CheckCraft/index.vue b/src/components/home/CheckCraft/index.vue index 7678a25..5b312ec 100644 --- a/src/components/home/CheckCraft/index.vue +++ b/src/components/home/CheckCraft/index.vue @@ -1,5 +1,6 @@