|
|
@ -1,4 +1,5 @@ |
|
|
|
<script setup lang="ts"> |
|
|
|
import { getContainerList } from 'apis/container' |
|
|
|
import { getSolsList } from 'apis/solution' |
|
|
|
import { socket } from 'libs/socket' |
|
|
|
import { useHomeStore } from 'stores/homeStore' |
|
|
@ -10,8 +11,9 @@ const emits = defineEmits(['ok', 'cancel']) |
|
|
|
const homeStore = useHomeStore() |
|
|
|
const systemStore = useSystemStore() |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
getSols() |
|
|
|
onMounted(async () => { |
|
|
|
await getSols() |
|
|
|
await queryContainerList() |
|
|
|
socket.init(receiveMessage, 'cmd_debug') |
|
|
|
socket.init(receiveMessage, 'cmd_response') |
|
|
|
}) |
|
|
@ -21,6 +23,10 @@ onUnmounted(() => { |
|
|
|
socket.unregisterCallback(receiveMessage, 'cmd_response') |
|
|
|
}) |
|
|
|
|
|
|
|
const queryContainerList = async () => { |
|
|
|
containerList.value = await getContainerList() |
|
|
|
} |
|
|
|
|
|
|
|
let currentCommandId = '' |
|
|
|
const receiveMessage = (data: Socket.cmdData) => { |
|
|
|
data.commandId === currentCommandId && systemStore.pushSystemList(data) |
|
|
@ -28,7 +34,7 @@ const receiveMessage = (data: Socket.cmdData) => { |
|
|
|
|
|
|
|
const form = ref<{ |
|
|
|
columns?: number[] |
|
|
|
solutionId?: number |
|
|
|
containerId?: number |
|
|
|
volume?: number |
|
|
|
}>({}) |
|
|
|
const formRef = ref() |
|
|
@ -46,7 +52,7 @@ const rules = { |
|
|
|
columns: [ |
|
|
|
{ required: true, message: '请选择试管', trigger: 'change', validator: validateHandle }, |
|
|
|
], |
|
|
|
solutionId: [ |
|
|
|
containerId: [ |
|
|
|
{ required: true, message: '请选择溶液', trigger: 'change' }, |
|
|
|
], |
|
|
|
volume: [ |
|
|
@ -78,6 +84,7 @@ const cancel = () => { |
|
|
|
} |
|
|
|
|
|
|
|
const solsList = ref<Solution.SolutionItem[]>([]) |
|
|
|
const containerList = ref<Container.ContainerItem[]>([]) |
|
|
|
|
|
|
|
const getSols = async () => { |
|
|
|
const res = await getSolsList() |
|
|
@ -109,18 +116,6 @@ const mousedownHandle = async (index: number) => { |
|
|
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="auto"> |
|
|
|
<el-form-item label="选择试管" prop="columns"> |
|
|
|
<div class="tube-item"> |
|
|
|
<!-- <div --> |
|
|
|
<!-- v-for="item in 5" --> |
|
|
|
<!-- :key="item" --> |
|
|
|
<!-- class="tube-line" --> |
|
|
|
<!-- :class="{ 'tube-line-active': selectedColumns[item - 1], 'tube-line-disable': !tubes.find(tu => tu.columnNum === item)?.exists }" --> |
|
|
|
|
|
|
|
<!-- @click.prevent="() => mousedownHandle(item)" --> |
|
|
|
<!-- @touch.prevent="() => mousedownHandle(item)" --> |
|
|
|
<!-- > --> |
|
|
|
<!-- <span v-for="i in 8" :key="i" class="tube-line-inner" /> --> |
|
|
|
<!-- </div> --> |
|
|
|
|
|
|
|
<div |
|
|
|
v-for="item in 5" |
|
|
|
:key="item" |
|
|
@ -135,8 +130,8 @@ const mousedownHandle = async (index: number) => { |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="选择溶液" prop="solutionId"> |
|
|
|
<el-select v-model="form.solutionId" placeholder="请选择溶液"> |
|
|
|
<el-option v-for="item in solsList" :key="item.id" :label="item.name" :value="item.id" /> |
|
|
|
<el-select v-model="form.containerId" placeholder="请选择溶液"> |
|
|
|
<el-option v-for="item in containerList.filter(i => i.type === 0)" :key="item.id" :label="solsList.find(s => s.id === item.solutionId)?.name" :value="item.id" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="容量" prop="volume"> |
|
|
|