|
@ -1,9 +1,8 @@ |
|
|
<script lang="ts" setup> |
|
|
<script lang="ts" setup> |
|
|
import { getContainerList } from '@/apis/container' |
|
|
|
|
|
import { getSelfFinish, getSelfStatus } from '@/apis/self' |
|
|
import { getSelfFinish, getSelfStatus } from '@/apis/self' |
|
|
import { ElMessage } from 'element-plus' |
|
|
import { ElMessage } from 'element-plus' |
|
|
import { useHomeStore } from 'stores/homeStore' |
|
|
import { useHomeStore } from 'stores/homeStore' |
|
|
import { onMounted, onUnmounted, ref, watch } from 'vue' |
|
|
|
|
|
|
|
|
import { onMounted, onUnmounted, ref } from 'vue' |
|
|
|
|
|
|
|
|
interface SelfStatus { |
|
|
interface SelfStatus { |
|
|
name: string |
|
|
name: string |
|
@ -11,21 +10,11 @@ interface SelfStatus { |
|
|
value: string |
|
|
value: string |
|
|
type: string |
|
|
type: string |
|
|
} |
|
|
} |
|
|
const props = defineProps({ |
|
|
|
|
|
checking: Boolean, |
|
|
|
|
|
type: String, |
|
|
|
|
|
}) |
|
|
|
|
|
defineEmits(['update:checking']) |
|
|
defineEmits(['update:checking']) |
|
|
const homeStore = useHomeStore() |
|
|
const homeStore = useHomeStore() |
|
|
const visible = ref(props.checking) |
|
|
|
|
|
const chemicalList = ref<Container.ContainerItem[]>([]) |
|
|
|
|
|
|
|
|
|
|
|
const loading = ref(false) |
|
|
const loading = ref(false) |
|
|
watch(() => props.checking, (newVal) => { |
|
|
|
|
|
visible.value = newVal |
|
|
|
|
|
if (newVal) { |
|
|
|
|
|
onStartSelfTest() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
onStartSelfTest() |
|
|
onStartSelfTest() |
|
|
}) |
|
|
}) |
|
@ -34,12 +23,14 @@ onUnmounted(() => { |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
const onStartSelfTest = () => { |
|
|
const onStartSelfTest = () => { |
|
|
if (props.checking) { |
|
|
|
|
|
patrolSelfStatus() |
|
|
patrolSelfStatus() |
|
|
queryContainerList() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
const statusMap: Record<string, Record<string, string>> = { |
|
|
const statusMap: Record<string, Record<string, string>> = { |
|
|
|
|
|
doorOrigin: { |
|
|
|
|
|
name: '门', |
|
|
|
|
|
value: '', |
|
|
|
|
|
type: 'door', |
|
|
|
|
|
}, |
|
|
gantryXOrigin: { |
|
|
gantryXOrigin: { |
|
|
name: '机械臂x轴', |
|
|
name: '机械臂x轴', |
|
|
value: 'x', |
|
|
value: 'x', |
|
@ -107,7 +98,7 @@ const patrolSelfStatus = () => { |
|
|
loading.value = true |
|
|
loading.value = true |
|
|
patrolTimes.value = setInterval(() => { |
|
|
patrolTimes.value = setInterval(() => { |
|
|
querySelfStatus() |
|
|
querySelfStatus() |
|
|
}, 2000) |
|
|
|
|
|
|
|
|
}, 1000) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const deviceStatusList = ref<SelfStatus[]>([]) |
|
|
const deviceStatusList = ref<SelfStatus[]>([]) |
|
@ -115,8 +106,10 @@ const selfStateComplete = ref(false) |
|
|
const querySelfStatus = () => { |
|
|
const querySelfStatus = () => { |
|
|
const orignStatusList = [] |
|
|
const orignStatusList = [] |
|
|
getSelfStatus().then((res) => { |
|
|
getSelfStatus().then((res) => { |
|
|
|
|
|
console.log('res', res) |
|
|
loading.value = false |
|
|
loading.value = false |
|
|
if (res) { |
|
|
if (res) { |
|
|
|
|
|
try { |
|
|
const list: SelfStatus[] = [] |
|
|
const list: SelfStatus[] = [] |
|
|
const keys = Object.keys(res) |
|
|
const keys = Object.keys(res) |
|
|
keys.forEach((item) => { |
|
|
keys.forEach((item) => { |
|
@ -135,33 +128,22 @@ const querySelfStatus = () => { |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
deviceStatusList.value = list |
|
|
deviceStatusList.value = list |
|
|
|
|
|
console.log('deviceStatusList', list) |
|
|
} |
|
|
} |
|
|
}).catch(() => { |
|
|
|
|
|
loading.value = false |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
// const pumpId = ref() |
|
|
|
|
|
const queryContainerList = () => { |
|
|
|
|
|
getContainerList().then((res) => { |
|
|
|
|
|
if (res) { |
|
|
|
|
|
const list: Container.ContainerItem[] = res |
|
|
|
|
|
const solutionList: Container.ContainerItem[] = [] |
|
|
|
|
|
list.forEach((item, index) => { |
|
|
|
|
|
// 只有8种,不会多也不会少, 多的不要 |
|
|
|
|
|
if (index < 8) { |
|
|
|
|
|
solutionList.push({ |
|
|
|
|
|
...item, |
|
|
|
|
|
solutionName: `加液泵_0${index + 1}`, |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
catch (e) { |
|
|
|
|
|
console.log('error', e) |
|
|
} |
|
|
} |
|
|
}) |
|
|
|
|
|
chemicalList.value = solutionList |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
loading.value = false |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const resetOrign = (item: SelfStatus) => { |
|
|
const resetOrign = (item: SelfStatus) => { |
|
|
if (item.value === 'x' || item.value === 'y' || item.value === 'z') { |
|
|
|
|
|
|
|
|
if (item.type === 'door') { |
|
|
|
|
|
door_origin() |
|
|
|
|
|
} |
|
|
|
|
|
else if (item.value === 'x' || item.value === 'y' || item.value === 'z') { |
|
|
gantry_origin(item.value) |
|
|
gantry_origin(item.value) |
|
|
} |
|
|
} |
|
|
else if (item.type === 'liquid') { |
|
|
else if (item.type === 'liquid') { |
|
@ -175,6 +157,17 @@ const resetOrign = (item: SelfStatus) => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const door_origin = async () => { |
|
|
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
|
|
|
|
|
|
|
|
const params = { |
|
|
|
|
|
commandId: currentCommandId, |
|
|
|
|
|
command: `door_origin`, |
|
|
|
|
|
params: {}, |
|
|
|
|
|
} |
|
|
|
|
|
await homeStore.sendControl(params) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 先注释 TODO |
|
|
// 先注释 TODO |
|
|
// const currentPumpId = ref() |
|
|
// const currentPumpId = ref() |
|
|
// const onPumpChange = (value: string) => { |
|
|
// const onPumpChange = (value: string) => { |
|
@ -242,7 +235,7 @@ const onComplete = () => { |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<template> |
|
|
<template> |
|
|
<FtDialog v-model="visible" title="设备初始化" width="50%"> |
|
|
|
|
|
|
|
|
<FtDialog visible title="自检" width="50%"> |
|
|
<div v-loading="loading" class="check-main"> |
|
|
<div v-loading="loading" class="check-main"> |
|
|
<!-- <div v-if="type !== 'cancel'"> --> |
|
|
<!-- <div v-if="type !== 'cancel'"> --> |
|
|
<!-- <span style="color: red">所有电机回原点后才可操作</span> --> |
|
|
<!-- <span style="color: red">所有电机回原点后才可操作</span> --> |
|
@ -267,33 +260,13 @@ const onComplete = () => { |
|
|
</el-icon> |
|
|
</el-icon> |
|
|
</div> |
|
|
</div> |
|
|
<div v-if="!item.isOrign" style="text-align: center;"> |
|
|
<div v-if="!item.isOrign" style="text-align: center;"> |
|
|
<!-- <el-link type="primary" @click="resetOrign(item)"> --> |
|
|
|
|
|
<!-- 回原点 --> |
|
|
|
|
|
<!-- </el-link> --> |
|
|
|
|
|
<ft-button type="primary" :click-handle="() => resetOrign(item)"> |
|
|
<ft-button type="primary" :click-handle="() => resetOrign(item)"> |
|
|
回原点 |
|
|
回原点 |
|
|
</ft-button> |
|
|
</ft-button> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<!-- <div class="check-status"> |
|
|
|
|
|
<div> |
|
|
|
|
|
加液泵: |
|
|
|
|
|
<el-select v-model="pumpId" size="small" style="width:10rem" @change="onPumpChange"> |
|
|
|
|
|
<el-option v-for="item in chemicalList" :key="item.solutionId" :label="item.solutionName" :value="item.pumpId" /> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div></div> |
|
|
|
|
|
<div style="text-align: center;"> |
|
|
|
|
|
<el-link type="primary" @click="onPumpEmpty()"> |
|
|
|
|
|
排空 |
|
|
|
|
|
</el-link> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> --> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
<template #footer> |
|
|
<template #footer> |
|
|
<!-- <FtButton v-if="type === 'cancel'" @click="cancel"> --> |
|
|
|
|
|
<!-- 取消 --> |
|
|
|
|
|
<!-- </FtButton> --> |
|
|
|
|
|
<FtButton :disabled="!selfStateComplete" :click-handle="onComplete"> |
|
|
<FtButton :disabled="!selfStateComplete" :click-handle="onComplete"> |
|
|
关闭 |
|
|
关闭 |
|
|
</FtButton> |
|
|
</FtButton> |
|
|