diff --git a/src/app.vue b/src/app.vue index 096fda3..5263ecf 100644 --- a/src/app.vue +++ b/src/app.vue @@ -8,6 +8,7 @@ const systemStore = useSystemStore() onMounted(async () => { const res = await getStatus() console.log(res) + console.log(systemStore.systemStatus) systemStore.updateSystemStatus(res) startProgress() }) diff --git a/src/components/SavePosition/index.vue b/src/components/SavePosition/index.vue index e1d99dd..7fa5c06 100644 --- a/src/components/SavePosition/index.vue +++ b/src/components/SavePosition/index.vue @@ -46,7 +46,7 @@ const cancel = () => { +import type { CheckboxValueType } from 'element-plus' import { getContainerList } from 'apis/container' import { getSolsList } from 'apis/solution' +import { FtMessage } from 'libs/message' import { useHomeStore } from 'stores/homeStore' import { useSolutionStore } from 'stores/useSolutionStore' import { onMounted, ref } from 'vue' @@ -17,35 +19,10 @@ onMounted(() => { const containerList = ref([]) const queryContainerList = async () => { - containerList.value = await getContainerList() + const res = await getContainerList() + containerList.value = res.filter(item => item.type === 0) } -const form = ref({ - list: [], -}) -const formRef = ref() - -const okHandle = async () => { - try { - const valid = await formRef.value.validate() - if (!valid) { - return - } - currentCommandId = Date.now().toString() - const params = { - commandId: currentCommandId, - command: 'filled_solution_start', - params: { - ...form.value, - }, - } - await homeStore.sendControl(params) - emits('ok') - } - catch (error) { - console.log(error) - } -} const cancel = () => { emits('cancel') } @@ -66,47 +43,78 @@ const querySolutionList = async () => { } } -const filled_solution_start = async (id: number) => { +const filled_solution_start = async () => { + if (!checkedList.value.length) { + FtMessage.warning('请选择要预充的溶液') + return + } currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, command: 'filled_solution_start', params: { - list: [id], + list: checkedList.value, }, } await homeStore.sendControl(params) } -const filled_solution_stop = async (id: number) => { +const filled_solution_stop = async () => { + if (!checkedList.value.length) { + FtMessage.warning('请选择要停止预充的溶液') + return + } currentCommandId = Date.now().toString() const params = { commandId: currentCommandId, command: 'filled_solution_stop', params: { - list: [id], + list: checkedList.value, }, } await homeStore.sendControl(params) } + +const checkAll = ref(false) +const isIndeterminate = ref(false) +const checkedList = ref([]) + +const handleCheckAllChange = (val: CheckboxValueType) => { + checkedList.value = val ? containerList.value.map((item: Container.ContainerItem) => item.id) : [] + isIndeterminate.value = false +} + +const handleCheckedCitiesChange = (value: CheckboxValueType[]) => { + console.log(value) + const checkedCount = value.length + checkAll.value = checkedCount === containerList.value.length + isIndeterminate.value = checkedCount > 0 && checkedCount < containerList.value.length +}