Browse Source

fix:自检bug修复;样式修复

master
guoapeng 4 months ago
parent
commit
8dd07abaa6
  1. 3
      src/apis/system.ts
  2. 95
      src/components/home/Check/index.vue
  3. 6
      src/views/clean/index.vue
  4. 6
      src/views/log/index.vue
  5. 1
      src/views/point/index.vue
  6. 1
      src/views/spray/index.vue
  7. 2
      src/views/spraySet/index.vue

3
src/apis/system.ts

@ -11,5 +11,6 @@ export const control = (params: any) => http.post('/function', params)
export const debugControl = (params: any) => http.post('/function/debug', params) export const debugControl = (params: any) => http.post('/function/debug', params)
export const getDeviceStatus = () => http.get('/device-status/') export const getDeviceStatus = () => http.get('/device-status/')
export const getDeviceSelfTest = () => http.get('/self-test/')
export const getDeviceSelfTest = () => http.get('/self-test/status')
export const deviceSelfTestFinish = () => http.post('/self-test/finish')
export const getSprayStatus = () => http.get('/spray-task/status') export const getSprayStatus = () => http.get('/spray-task/status')

95
src/components/home/Check/index.vue

@ -1,10 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { getDeviceSelfTest } from 'apis/system'
import { deviceSelfTestFinish, getDeviceSelfTest } from 'apis/system'
import FtDialog from 'components/common/FTDialog/index.vue' import FtDialog from 'components/common/FTDialog/index.vue'
import { FtMessage } from 'libs/message' import { FtMessage } from 'libs/message'
import { socket } from 'libs/socket' import { socket } from 'libs/socket'
import { sendControl } from 'libs/utils' import { sendControl } from 'libs/utils'
import { nextTick, onMounted, ref } from 'vue'
import { onMounted, ref, watch } from 'vue'
const emits = defineEmits(['ok', 'cancel']) const emits = defineEmits(['ok', 'cancel'])
@ -28,9 +28,9 @@ onMounted(async () => {
const change = async () => { const change = async () => {
let num = 0 let num = 0
await nextTick(() => {
buttonCloseRef.value?.setLoading(true)
})
// await nextTick(() => {
// buttonCloseRef.value?.setLoading(true)
// })
status.value = await getDeviceSelfTest() status.value = await getDeviceSelfTest()
const interval = async () => { const interval = async () => {
@ -41,51 +41,62 @@ const change = async () => {
} }
} }
await interval() await interval()
buttonCloseRef.value?.setLoading(false)
closeVisible.value = false
// buttonCloseRef.value?.setLoading(false)
} }
const receiveMessage = (data: any) => { const receiveMessage = (data: any) => {
if (data.cmdId === cmdId) {
if (data.status === 'success') {
for (let i = 0; i < checkList.value.length; i++) {
checkList.value[i].result = 'padding'
setTimeout(() => {
checkList.value[i].result = 'success'
}, 500)
if (data.status === 'success') {
for (const cmdIdsKey in cmdIds) {
if (data.cmdId === cmdIds[cmdIdsKey]) {
checkList.value[cmdIdsKey].result = 'success'
} }
buttonRef.value.setLoading(false)
closeVisible.value = true
} }
else if (data.status === 'fail') {
FtMessage.error('自检失败')
change()
buttonRef.value.setLoading(false)
closeVisible.value = false
}
if (data.status === 'finish') {
for (const cmdIdsKey in cmdIds) {
if (data.cmdId === cmdIds[cmdIdsKey]) {
toHomeButtonRefs.value[cmdIdsKey].setLoading(false)
}
} }
} }
} }
const cancel = () => {
const cancel = async () => {
await deviceSelfTestFinish()
emits('cancel') emits('cancel')
} }
let cmdId = '' let cmdId = ''
const motorXYZOrigin = async () => {
buttonRef.value.setLoading(true)
// const motorXYZOrigin = async () => {
// buttonRef.value.setLoading(true)
// cmdId = Date.now().toString()
// const params = {
// cmdCode: 'device_self_test',
// cmdId,
// params: {},
// }
//
// await sendControl(params)
// }
const cmdIds: any = {}
const toHomeButtonRefs = ref()
const toHome = async (index: number) => {
cmdId = Date.now().toString() cmdId = Date.now().toString()
cmdIds[index] = cmdId
const params = { const params = {
cmdCode: 'device_self_test',
cmdCode: ['motor_x_to_home', 'motor_y_to_home', 'motor_z_to_home'][index],
cmdId, cmdId,
params: {}, params: {},
} }
toHomeButtonRefs.value[index].setLoading(true)
await sendControl(params) await sendControl(params)
} }
const checkList = ref<any>([]) const checkList = ref<any>([])
const buttonRef = ref()
const buttonCloseRef = ref()
// const buttonRef = ref()
const closeVisible = ref(true) const closeVisible = ref(true)
@ -119,11 +130,17 @@ const addTextToCheckList = async (text: string, id: number) => {
}, Math.random() * 100) // }, Math.random() * 100) //
}) })
} }
watch(() => checkList.value, () => {
if (checkList.value.every(item => item.result === 'success')) {
closeVisible.value = false
}
}, { deep: true })
</script> </script>
<template> <template>
<FtDialog visible title="自检" width="40%" @ok="okHandle" @cancel="cancel"> <FtDialog visible title="自检" width="40%" @ok="okHandle" @cancel="cancel">
<div v-for="item in checkList" :key="item.id" class="mask-box">
<div v-for="(item, index) in checkList" :key="item.id" class="mask-box">
<el-tag> {{ item.title }}</el-tag> <el-tag> {{ item.title }}</el-tag>
<el-icon v-show="item.result === 'success'" color="green"> <el-icon v-show="item.result === 'success'" color="green">
<SuccessFilled /> <SuccessFilled />
@ -134,14 +151,17 @@ const addTextToCheckList = async (text: string, id: number) => {
<el-icon v-show="item.result === 'padding'" color="gray" class="el-icon--loading"> <el-icon v-show="item.result === 'padding'" color="gray" class="el-icon--loading">
<Loading /> <Loading />
</el-icon> </el-icon>
<ft-button ref="toHomeButtonRefs" class="check-button" type="primary" :disabled="item.result === 'success'" @click="() => toHome(index)">
回原点
</ft-button>
</div> </div>
<template #footer> <template #footer>
<ft-button v-if="closeVisible" ref="buttonCloseRef" @click="cancel">
<ft-button :disabled="closeVisible" @click="cancel">
关闭 关闭
</ft-button> </ft-button>
<ft-button v-else ref="buttonRef" type="primary" @click="motorXYZOrigin">
回原点
</ft-button>
<!-- <ft-button v-else ref="buttonRef" type="primary" @click="motorXYZOrigin"> -->
<!-- 回原点 -->
<!-- </ft-button> -->
</template> </template>
</FtDialog> </FtDialog>
</template> </template>
@ -153,7 +173,7 @@ const addTextToCheckList = async (text: string, id: number) => {
align-items: center; align-items: center;
margin-bottom: 40px; margin-bottom: 40px;
.el-tag { .el-tag {
margin-right: 20px;
margin-right: 20px;
width: 100%; width: 100%;
} }
} }
@ -174,4 +194,11 @@ const addTextToCheckList = async (text: string, id: number) => {
:deep(.el-tag) { :deep(.el-tag) {
padding: 30px 0; padding: 30px 0;
} }
:deep(.check-button) {
margin-left: 10px;
.my-button {
width: 230px;
}
}
</style> </style>

6
src/views/clean/index.vue

@ -117,7 +117,11 @@ const syringePipelineWashStop = async () => {
> >
清洗喷嘴管路 清洗喷嘴管路
</ft-button> </ft-button>
<ft-button class="button-style" :click-handle="syringePipelineWashStop" :disabled="!systemStore.systemStatus.cleaningSyringePipeline || !systemStore.systemStatus.cleaningNozzlePipeline">
<ft-button
class="button-style"
:click-handle="syringePipelineWashStop"
:disabled="!systemStore.systemStatus.cleaningSyringePipeline && !systemStore.systemStatus.cleaningNozzlePipeline"
>
结束清洗 结束清洗
</ft-button> </ft-button>
</div> </div>

6
src/views/log/index.vue

@ -97,8 +97,8 @@ const delHandle = async () => {
</el-col> </el-col>
</el-row> </el-row>
<div class="table-box"> <div class="table-box">
<el-table v-loading="loading" :data="tableData" header-row-class-name="table-header" height="100%" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table v-loading="loading" show-overflow-tooltip :data="tableData" header-row-class-name="table-header" height="100%" @selection-change="handleSelectionChange">
<el-table-column type="selection" />
<el-table-column prop="matrixName" label="基质名称"> <el-table-column prop="matrixName" label="基质名称">
<template #default="scope"> <template #default="scope">
<div class="scope-box"> <div class="scope-box">
@ -108,7 +108,7 @@ const delHandle = async () => {
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="name" label="工艺名称">
<el-table-column prop="name" label="工艺名称" width="100">
<template #default="scope"> <template #default="scope">
<div class="scope-box"> <div class="scope-box">
<div> <div>

1
src/views/point/index.vue

@ -99,6 +99,7 @@ const editHandle = () => {
<div class="table-box"> <div class="table-box">
<el-table v-loading="loading" :data="tableData" header-row-class-name="table-header" height="100%" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="tableData" header-row-class-name="table-header" height="100%" @selection-change="handleSelectionChange">
<el-table-column v-if="systemStore.isDebug" type="selection" width="55" /> <el-table-column v-if="systemStore.isDebug" type="selection" width="55" />
<el-table-column v-if="!systemStore.isDebug" width="35" label="" />
<el-table-column prop="pointName" label="坐标名称" /> <el-table-column prop="pointName" label="坐标名称" />
<el-table-column prop="pointCode" label="坐标code" /> <el-table-column prop="pointCode" label="坐标code" />
<el-table-column prop="x" label="x" /> <el-table-column prop="x" label="x" />

1
src/views/spray/index.vue

@ -597,6 +597,7 @@ const addCraft = () => {
display: flex; display: flex;
align-items: center; align-items: center;
margin-left: 40px; margin-left: 40px;
height: 100px;
.voltage-input { .voltage-input {
width: 280px; width: 280px;
} }

2
src/views/spraySet/index.vue

@ -241,7 +241,7 @@ const dehumidifierStop = async () => {
> >
清洗喷嘴管路 清洗喷嘴管路
</ft-button> </ft-button>
<ft-button :click-handle="pipelineWashStop" :disabled="!systemStore.systemStatus.cleaningSyringePipeline || !systemStore.systemStatus.cleaningNozzlePipeline">
<ft-button :click-handle="pipelineWashStop" :disabled="!systemStore.systemStatus.cleaningSyringePipeline && !systemStore.systemStatus.cleaningNozzlePipeline">
停止清洗 停止清洗
</ft-button> </ft-button>
</div> </div>

Loading…
Cancel
Save