|
@ -1,5 +1,5 @@ |
|
|
<script lang="ts" setup> |
|
|
<script lang="ts" setup> |
|
|
import type { Craft, StepCmd, StepStruct, TransferRightType } from './craftType' |
|
|
|
|
|
|
|
|
import type { Craft, StepCmd, StepStruct, TubeSolStruct } from './craftType' |
|
|
import { ElMessage } from 'element-plus' |
|
|
import { ElMessage } from 'element-plus' |
|
|
import { ref } from 'vue' |
|
|
import { ref } from 'vue' |
|
|
import { StepCmdDescMap } from './craftType' |
|
|
import { StepCmdDescMap } from './craftType' |
|
@ -13,7 +13,6 @@ const emit = defineEmits<{ |
|
|
const visible = ref(false) |
|
|
const visible = ref(false) |
|
|
const stepStructs = ref<StepStruct[]>([]) |
|
|
const stepStructs = ref<StepStruct[]>([]) |
|
|
const craftObj = ref<Craft>({}) |
|
|
const craftObj = ref<Craft>({}) |
|
|
const transferRight = ref<TransferRightType | null>(null) |
|
|
|
|
|
|
|
|
|
|
|
const stepCmds: StepCmd[] = [ |
|
|
const stepCmds: StepCmd[] = [ |
|
|
// 'upTray', |
|
|
// 'upTray', |
|
@ -38,11 +37,23 @@ const closeDialog = () => { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const editDialog = (craftInfo: Craft) => { |
|
|
const editDialog = (craftInfo: Craft) => { |
|
|
console.log('craftInfo---', craftInfo) |
|
|
|
|
|
craftObj.value = { ...craftInfo } |
|
|
craftObj.value = { ...craftInfo } |
|
|
if (craftInfo && craftInfo.steps) { |
|
|
if (craftInfo && craftInfo.steps) { |
|
|
const step = JSON.parse(craftInfo.steps) |
|
|
const step = JSON.parse(craftInfo.steps) |
|
|
console.log('step---', step) |
|
|
|
|
|
|
|
|
/* eslint-disable no-debugger */ |
|
|
|
|
|
if (step && step.length) { |
|
|
|
|
|
step.forEach((item: StepStruct) => { |
|
|
|
|
|
if (item.method === 'addLiquid') { |
|
|
|
|
|
const list = item.params.tubeSolList |
|
|
|
|
|
if (list && list.length === 16 && item.params.tubeSolList) { |
|
|
|
|
|
item.params.tubeSolList = [{ |
|
|
|
|
|
tubeNum: 0, |
|
|
|
|
|
addLiquidList: item.params.tubeSolList[0].addLiquidList, |
|
|
|
|
|
}] |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
stepStructs.value = step |
|
|
stepStructs.value = step |
|
|
} |
|
|
} |
|
|
openDialog() |
|
|
openDialog() |
|
@ -53,8 +64,28 @@ function onConfirm() { |
|
|
ElMessage.warning('请输入工艺名称') |
|
|
ElMessage.warning('请输入工艺名称') |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (const step of stepStructs.value) { |
|
|
|
|
|
if (step.method === 'addLiquid') { |
|
|
|
|
|
const list = step.params.tubeSolList |
|
|
|
|
|
if (list && list.length) { |
|
|
|
|
|
list.forEach((item) => { |
|
|
|
|
|
const tubeNum = item.tubeNum |
|
|
|
|
|
if (tubeNum === 0) { |
|
|
|
|
|
const tubeSolList: TubeSolStruct[] = [] |
|
|
|
|
|
for (let index = 0; index < 16; index++) { |
|
|
|
|
|
tubeSolList.push({ |
|
|
|
|
|
tubeNum: index + 1, |
|
|
|
|
|
addLiquidList: item.addLiquidList, |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
step.params.tubeSolList = tubeSolList |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
craftObj.value.steps = JSON.stringify(stepStructs.value) |
|
|
craftObj.value.steps = JSON.stringify(stepStructs.value) |
|
|
console.log('craftObj-22--', craftObj.value) |
|
|
|
|
|
emit('ok', craftObj.value) |
|
|
emit('ok', craftObj.value) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -65,7 +96,7 @@ function addStep(step: StepCmd) { |
|
|
method: step, |
|
|
method: step, |
|
|
params: { |
|
|
params: { |
|
|
tubeSolList: [{ |
|
|
tubeSolList: [{ |
|
|
tubeNum: 1, |
|
|
|
|
|
|
|
|
tubeNum: 0, |
|
|
addLiquidList: [{ |
|
|
addLiquidList: [{ |
|
|
solId: 1, |
|
|
solId: 1, |
|
|
volume: 10, |
|
|
volume: 10, |
|
@ -112,10 +143,6 @@ function onStepItemDel(order: number) { |
|
|
|
|
|
|
|
|
function transferChange(stepData: StepStruct, order: number) { |
|
|
function transferChange(stepData: StepStruct, order: number) { |
|
|
console.log('order === ', stepStructs.value, stepData, order) |
|
|
console.log('order === ', stepStructs.value, stepData, order) |
|
|
// if (order) { |
|
|
|
|
|
// stepStructs.value[order - 1] = stepData |
|
|
|
|
|
// } |
|
|
|
|
|
// console.log('stepStructs.value==1===', stepStructs.value) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
defineExpose({ |
|
|
defineExpose({ |
|
@ -126,7 +153,7 @@ defineExpose({ |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<template> |
|
|
<template> |
|
|
<el-dialog v-model="visible" title="添加工艺" style="width:70vw; height:65vh"> |
|
|
|
|
|
|
|
|
<el-dialog v-model="visible" title="添加工艺" style="width:70vw; height:70vh"> |
|
|
<div> |
|
|
<div> |
|
|
<div class="mt-5 mb-8 flex items-center"> |
|
|
<div class="mt-5 mb-8 flex items-center"> |
|
|
<label class="font-medium mr-4">工艺名称:</label> |
|
|
<label class="font-medium mr-4">工艺名称:</label> |
|
@ -152,7 +179,7 @@ defineExpose({ |
|
|
<TransferLeft v-for="cmd in stepCmds" :key="cmd" :title="StepCmdDescMap[cmd]" @click="addStep(cmd)" /> |
|
|
<TransferLeft v-for="cmd in stepCmds" :key="cmd" :title="StepCmdDescMap[cmd]" @click="addStep(cmd)" /> |
|
|
</div> |
|
|
</div> |
|
|
<div v-if="stepStructs && stepStructs.length" class="transfer-right"> |
|
|
<div v-if="stepStructs && stepStructs.length" class="transfer-right"> |
|
|
<TransferRight v-for="(step, idx) in stepStructs" ref="transferRight" :key="idx" :order="idx + 1" :step="step" @del="onStepItemDel" @transfer-change="transferChange" /> |
|
|
|
|
|
|
|
|
<TransferRight v-for="(step, idx) in stepStructs" :key="idx" :order="idx + 1" :step="step" type="add" @del="onStepItemDel" @transfer-change="transferChange" /> |
|
|
</div> |
|
|
</div> |
|
|
<div v-else> |
|
|
<div v-else> |
|
|
<el-empty description="description"> |
|
|
<el-empty description="description"> |
|
|