|
@ -1,6 +1,8 @@ |
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import { getContainerList } from 'apis/container' |
|
|
import { getContainerList } from 'apis/container' |
|
|
|
|
|
import { getSolsList } from 'apis/solution' |
|
|
import { useHomeStore } from 'stores/homeStore' |
|
|
import { useHomeStore } from 'stores/homeStore' |
|
|
|
|
|
import { useSolutionStore } from 'stores/useSolutionStore' |
|
|
import { onMounted, ref } from 'vue' |
|
|
import { onMounted, ref } from 'vue' |
|
|
|
|
|
|
|
|
const emits = defineEmits(['ok', 'cancel']) |
|
|
const emits = defineEmits(['ok', 'cancel']) |
|
@ -9,6 +11,7 @@ const homeStore = useHomeStore() |
|
|
let currentCommandId = '' |
|
|
let currentCommandId = '' |
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
queryContainerList() |
|
|
queryContainerList() |
|
|
|
|
|
querySolutionList() |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
const containerList = ref<Container.ContainerItem[]>([]) |
|
|
const containerList = ref<Container.ContainerItem[]>([]) |
|
@ -22,12 +25,6 @@ const form = ref({ |
|
|
}) |
|
|
}) |
|
|
const formRef = ref() |
|
|
const formRef = ref() |
|
|
|
|
|
|
|
|
const rules = { |
|
|
|
|
|
list: [ |
|
|
|
|
|
{ required: true, message: '请选择容器', trigger: 'change' }, |
|
|
|
|
|
], |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const okHandle = async () => { |
|
|
const okHandle = async () => { |
|
|
try { |
|
|
try { |
|
|
const valid = await formRef.value.validate() |
|
|
const valid = await formRef.value.validate() |
|
@ -37,7 +34,7 @@ const okHandle = async () => { |
|
|
currentCommandId = Date.now().toString() |
|
|
currentCommandId = Date.now().toString() |
|
|
const params = { |
|
|
const params = { |
|
|
commandId: currentCommandId, |
|
|
commandId: currentCommandId, |
|
|
command: 'filled_solution', |
|
|
|
|
|
|
|
|
command: 'filled_solution_start', |
|
|
params: { |
|
|
params: { |
|
|
...form.value, |
|
|
...form.value, |
|
|
}, |
|
|
}, |
|
@ -52,22 +49,76 @@ const okHandle = async () => { |
|
|
const cancel = () => { |
|
|
const cancel = () => { |
|
|
emits('cancel') |
|
|
emits('cancel') |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const solutionList = ref<Solution.SolutionItem[]>([]) |
|
|
|
|
|
const solutionMap = ref<Record<string | number, string>>({}) |
|
|
|
|
|
const solutionStore = useSolutionStore() |
|
|
|
|
|
const querySolutionList = async () => { |
|
|
|
|
|
const res = await getSolsList() |
|
|
|
|
|
if (res && res.list) { |
|
|
|
|
|
solutionList.value = res.list |
|
|
|
|
|
solutionList.value.forEach((item) => { |
|
|
|
|
|
if (item.id) { |
|
|
|
|
|
solutionMap.value[item.id] = item.name |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
solutionStore.updateSolution(res.list) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const filled_solution_start = async (id: number) => { |
|
|
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
|
|
const params = { |
|
|
|
|
|
commandId: currentCommandId, |
|
|
|
|
|
command: 'filled_solution_start', |
|
|
|
|
|
params: { |
|
|
|
|
|
list: [id], |
|
|
|
|
|
}, |
|
|
|
|
|
} |
|
|
|
|
|
await homeStore.sendControl(params) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const filled_solution_stop = async (id: number) => { |
|
|
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
|
|
const params = { |
|
|
|
|
|
commandId: currentCommandId, |
|
|
|
|
|
command: 'filled_solution_stop', |
|
|
|
|
|
params: { |
|
|
|
|
|
list: [id], |
|
|
|
|
|
}, |
|
|
|
|
|
} |
|
|
|
|
|
await homeStore.sendControl(params) |
|
|
|
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<template> |
|
|
<template> |
|
|
<FtDialog visible title="预充管路" width="40%" :ok-handle="okHandle" @cancel="cancel"> |
|
|
<FtDialog visible title="预充管路" width="40%" :ok-handle="okHandle" @cancel="cancel"> |
|
|
<el-form ref="formRef" label-width="auto" :model="form" :rules="rules"> |
|
|
|
|
|
<el-form-item label="容器" prop="list"> |
|
|
|
|
|
<el-select v-model="form.list" placeholder="请选择容器" multiple> |
|
|
|
|
|
<el-option v-for="item in containerList.filter(item => item.type === 0)" :key="item.id" :label="item.solutionName" :value="item.id" /> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-form> |
|
|
|
|
|
|
|
|
<div> |
|
|
|
|
|
<div v-for="item in containerList.filter((item) => item.type === 0)" :key="item.id" class="item-box"> |
|
|
|
|
|
<span>{{ solutionMap[item.solutionId] }}</span> |
|
|
|
|
|
<div> |
|
|
|
|
|
<ft-button type="primary" :click-handle="() => filled_solution_start(item.id)"> |
|
|
|
|
|
开始预充 |
|
|
|
|
|
</ft-button> |
|
|
|
|
|
<ft-button type="primary" :click-handle="() => filled_solution_stop(item.id)"> |
|
|
|
|
|
停止 |
|
|
|
|
|
</ft-button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<template #footer> |
|
|
|
|
|
<ft-button @click="cancel"> |
|
|
|
|
|
关闭 |
|
|
|
|
|
</ft-button> |
|
|
|
|
|
</template> |
|
|
</FtDialog> |
|
|
</FtDialog> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
<style scoped lang="scss"> |
|
|
.el-tag { |
|
|
|
|
|
margin-right: 5px; |
|
|
|
|
|
|
|
|
.item-box { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
justify-content: space-between; |
|
|
|
|
|
padding: 5px; |
|
|
} |
|
|
} |
|
|
</style> |
|
|
</style> |