|
@ -1,6 +1,7 @@ |
|
|
<script lang="ts" setup> |
|
|
<script lang="ts" setup> |
|
|
import { getContainerList } from '@/apis/container' |
|
|
import { getContainerList } from '@/apis/container' |
|
|
import { getSelfStatus } from '@/apis/self' |
|
|
|
|
|
|
|
|
import { getSelfFinish, getSelfStatus } from '@/apis/self' |
|
|
|
|
|
import { ElMessage } from 'element-plus' |
|
|
import { useHomeStore } from 'stores/homeStore' |
|
|
import { useHomeStore } from 'stores/homeStore' |
|
|
import { onMounted, ref, watch } from 'vue' |
|
|
import { onMounted, ref, watch } from 'vue' |
|
|
|
|
|
|
|
@ -12,18 +13,29 @@ interface SelfStatus { |
|
|
} |
|
|
} |
|
|
const props = defineProps({ |
|
|
const props = defineProps({ |
|
|
checking: Boolean, |
|
|
checking: Boolean, |
|
|
|
|
|
type: String, |
|
|
}) |
|
|
}) |
|
|
const emits = defineEmits(['update:checking']) |
|
|
const emits = defineEmits(['update:checking']) |
|
|
const homeStore = useHomeStore() |
|
|
const homeStore = useHomeStore() |
|
|
const visible = ref(props.checking) |
|
|
const visible = ref(props.checking) |
|
|
const chemicalList = ref<Container.ContainerItem[]>([]) |
|
|
const chemicalList = ref<Container.ContainerItem[]>([]) |
|
|
|
|
|
const loading = ref(false) |
|
|
watch(() => props.checking, (newVal) => { |
|
|
watch(() => props.checking, (newVal) => { |
|
|
visible.value = newVal |
|
|
visible.value = newVal |
|
|
|
|
|
if (newVal) { |
|
|
|
|
|
onStartSelfTest() |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
querySelfStatus() |
|
|
|
|
|
queryContainerList() |
|
|
|
|
|
|
|
|
onStartSelfTest() |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const onStartSelfTest = () => { |
|
|
|
|
|
if (props.checking) { |
|
|
|
|
|
patrolSelfStatus() |
|
|
|
|
|
queryContainerList() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
const statusMap: Record<string, Record<string, string>> = { |
|
|
const statusMap: Record<string, Record<string, string>> = { |
|
|
gantryXOrigin: { |
|
|
gantryXOrigin: { |
|
|
name: '机械臂x轴', |
|
|
name: '机械臂x轴', |
|
@ -86,21 +98,43 @@ const statusMap: Record<string, Record<string, string>> = { |
|
|
type: 'heat', |
|
|
type: 'heat', |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const patrolTimes = ref() |
|
|
|
|
|
const patrolSelfStatus = () => { |
|
|
|
|
|
loading.value = true |
|
|
|
|
|
patrolTimes.value = setInterval(() => { |
|
|
|
|
|
querySelfStatus() |
|
|
|
|
|
}, 2000) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const deviceStatusList = ref<SelfStatus[]>([]) |
|
|
const deviceStatusList = ref<SelfStatus[]>([]) |
|
|
|
|
|
const selfStateComplete = ref(false) |
|
|
const querySelfStatus = () => { |
|
|
const querySelfStatus = () => { |
|
|
|
|
|
const orignStatusList = [] |
|
|
getSelfStatus().then((res) => { |
|
|
getSelfStatus().then((res) => { |
|
|
|
|
|
loading.value = false |
|
|
if (res) { |
|
|
if (res) { |
|
|
const list: SelfStatus[] = [] |
|
|
const list: SelfStatus[] = [] |
|
|
Object.keys(res).forEach((item) => { |
|
|
|
|
|
|
|
|
const keys = Object.keys(res) |
|
|
|
|
|
keys.forEach((item) => { |
|
|
list.push({ |
|
|
list.push({ |
|
|
name: statusMap[item].name, |
|
|
name: statusMap[item].name, |
|
|
isOrign: res[item], |
|
|
isOrign: res[item], |
|
|
value: statusMap[item].value, |
|
|
value: statusMap[item].value, |
|
|
type: statusMap[item].type, |
|
|
type: statusMap[item].type, |
|
|
}) |
|
|
}) |
|
|
|
|
|
if (res[item]) { |
|
|
|
|
|
orignStatusList.push(item) |
|
|
|
|
|
} |
|
|
|
|
|
if (orignStatusList.length === keys.length) { |
|
|
|
|
|
clearInterval(patrolTimes.value) |
|
|
|
|
|
selfStateComplete.value = true |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
deviceStatusList.value = list |
|
|
deviceStatusList.value = list |
|
|
} |
|
|
} |
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
loading.value = false |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
// const pumpId = ref() |
|
|
// const pumpId = ref() |
|
@ -127,7 +161,7 @@ const resetOrign = (item: SelfStatus) => { |
|
|
if (item.value === 'x' || item.value === 'y' || item.value === 'z') { |
|
|
if (item.value === 'x' || item.value === 'y' || item.value === 'z') { |
|
|
gantry_origin(item.value) |
|
|
gantry_origin(item.value) |
|
|
} |
|
|
} |
|
|
else if (item.type === 'liquied') { |
|
|
|
|
|
|
|
|
else if (item.type === 'liquid') { |
|
|
dual_robot_joint_origin(item.value) |
|
|
dual_robot_joint_origin(item.value) |
|
|
} |
|
|
} |
|
|
else if (item.type === 'heat') { |
|
|
else if (item.type === 'heat') { |
|
@ -195,6 +229,13 @@ const tray_lifting_origin = async (heatId: string) => { |
|
|
await homeStore.sendControl(params) |
|
|
await homeStore.sendControl(params) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const onComplete = () => { |
|
|
|
|
|
getSelfFinish().then(() => { |
|
|
|
|
|
ElMessage.success('自检完成') |
|
|
|
|
|
visible.value = false |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const cancel = () => { |
|
|
const cancel = () => { |
|
|
emits('update:checking', false) |
|
|
emits('update:checking', false) |
|
|
visible.value = false |
|
|
visible.value = false |
|
@ -203,7 +244,10 @@ const cancel = () => { |
|
|
|
|
|
|
|
|
<template> |
|
|
<template> |
|
|
<FtDialog v-model="visible" title="设备初始化" width="50%"> |
|
|
<FtDialog v-model="visible" title="设备初始化" width="50%"> |
|
|
<div class="check-main"> |
|
|
|
|
|
|
|
|
<div v-loading="loading" class="check-main"> |
|
|
|
|
|
<div v-if="type !== 'cancel'"> |
|
|
|
|
|
<span style="color: red">所有电机回原点后才可操作</span> |
|
|
|
|
|
</div> |
|
|
<div class="check-status"> |
|
|
<div class="check-status"> |
|
|
<h3>名称</h3> |
|
|
<h3>名称</h3> |
|
|
<h3>是否在原点</h3> |
|
|
<h3>是否在原点</h3> |
|
@ -223,7 +267,7 @@ const cancel = () => { |
|
|
<Select /> |
|
|
<Select /> |
|
|
</el-icon> |
|
|
</el-icon> |
|
|
</div> |
|
|
</div> |
|
|
<div style="text-align: center;"> |
|
|
|
|
|
|
|
|
<div v-if="!item.isOrign" style="text-align: center;"> |
|
|
<el-link type="primary" @click="resetOrign(item)"> |
|
|
<el-link type="primary" @click="resetOrign(item)"> |
|
|
回原点 |
|
|
回原点 |
|
|
</el-link> |
|
|
</el-link> |
|
@ -245,9 +289,12 @@ const cancel = () => { |
|
|
</div> --> |
|
|
</div> --> |
|
|
</div> |
|
|
</div> |
|
|
<template #footer> |
|
|
<template #footer> |
|
|
<FtButton @click="cancel"> |
|
|
|
|
|
|
|
|
<FtButton v-if="type === 'cancel'" @click="cancel"> |
|
|
取消 |
|
|
取消 |
|
|
</FtButton> |
|
|
</FtButton> |
|
|
|
|
|
<FtButton v-if="selfStateComplete" @click="onComplete"> |
|
|
|
|
|
自检完成 |
|
|
|
|
|
</FtButton> |
|
|
</template> |
|
|
</template> |
|
|
</FtDialog> |
|
|
</FtDialog> |
|
|
</template> |
|
|
</template> |
|
|