Browse Source

fix:断电恢复工艺1

master
guoapeng 2 months ago
parent
commit
1f9778ec19
  1. 4
      src/apis/crafts.ts
  2. 48
      src/components/home/CheckCraft/index.vue
  3. 32
      src/layouts/default.vue
  4. 66
      src/views/home/index.vue

4
src/apis/crafts.ts

@ -28,3 +28,7 @@ export const setCraft = (params: { heatId?: string | number, craftId?: string |
export const craftstatus = (): Promise<CraftTypes.CraftState[]> => http.get(`/monitor/crafts/status`) export const craftstatus = (): Promise<CraftTypes.CraftState[]> => http.get(`/monitor/crafts/status`)
export const craftstatusByHeatId = (heatId: string): Promise<CraftTypes.CraftState> => http.get(`/monitor/crafts/status/${heatId}`) export const craftstatusByHeatId = (heatId: string): Promise<CraftTypes.CraftState> => http.get(`/monitor/crafts/status/${heatId}`)
export const craftList = (): Promise<any> => http.get(`/crafts/monitor/list`)
export const craftRestart = (monitorId: string): Promise<CraftTypes.CraftState> => http.post(`/crafts/restart`, { monitorId })
export const craftRestore = (isRestore: boolean): Promise<null> => http.get(`/crafts/restore${isRestore}`)
export const craftRemove = (monitorId: string): Promise<CraftTypes.CraftState> => http.delete(`/crafts/remove`, { params: { monitorId } })

48
src/components/home/CheckCraft/index.vue

@ -1,30 +1,24 @@
<script setup lang="ts"> <script setup lang="ts">
import { resumeCraft, stopCraft } from 'apis/crafts'
import { useSystemStore } from 'stores/systemStore'
import { craftList, craftRemove, craftRestart } from 'apis/crafts'
import { onMounted, ref } from 'vue'
const emits = defineEmits(['close']) const emits = defineEmits(['close'])
const systemStore = useSystemStore()
const tableData = computed(() => {
return systemStore.systemStatus.trays?.filter(item => item.crafts?.craft?.status === 'RESTORE').map((item) => {
return {
...item,
craftStepList: JSON.parse(item.crafts?.craft?.steps || '[]'),
currentIndex: item.crafts?.currentIndex,
}
})
const loading = ref(true)
onMounted(async () => {
tableData.value = await craftList()
loading.value = false
}) })
const resumeCraftHandle = async (heatId: string) => {
await resumeCraft({
heatId,
})
const tableData = ref<any[]>([])
const resumeCraftHandle = async (monitorId: string) => {
await craftRestart(monitorId)
} }
const stopCraftHandle = async (heatId: string) => {
await stopCraft({
heatId,
})
const stopCraftHandle = async (monitorId: string) => {
await craftRemove(monitorId)
} }
const cancel = () => { const cancel = () => {
@ -33,25 +27,21 @@ const cancel = () => {
</script> </script>
<template> <template>
<FtDialog visible title="工艺恢复" width="70%" :ok-handle="okHandle" @cancel="cancel">
<FtDialog visible :loading title="预设恢复" width="70%" :ok-handle="okHandle" @cancel="cancel">
<el-table :data="tableData"> <el-table :data="tableData">
<el-table-column label="工艺名称">
<template #default="{ row }">
<span>{{ row.crafts?.craft?.name }}</span>
</template>
</el-table-column>
<el-table-column label="预设名称" prop="craftsName" />
<el-table-column label="当前执行步骤"> <el-table-column label="当前执行步骤">
<template #default="{ row }"> <template #default="{ row }">
<span>{{ row.craftStepList?.[row.currentIndex]?.params?.description }}</span>
<span>{{ row.steps?.[row.currentstepIndex]?.params?.description }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作"> <el-table-column label="操作">
<template #default="{ row }"> <template #default="{ row }">
<ft-button type="primary" :click-handle="() => resumeCraftHandle(row.heatModuleCode)">
<ft-button type="primary" :click-handle="() => resumeCraftHandle(row.monitorId)">
恢复 恢复
</ft-button> </ft-button>
<ft-button type="danger" :click-handle="() => stopCraftHandle(row.heatModuleCode)">
停止
<ft-button type="danger" :click-handle="() => stopCraftHandle(row.monitorId)">
删除
</ft-button> </ft-button>
</template> </template>
</el-table-column> </el-table-column>

32
src/layouts/default.vue

@ -1,12 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { getContainerList } from 'apis/container' import { getContainerList } from 'apis/container'
import { craftList, craftRestore } from 'apis/crafts'
import { getSolsList } from 'apis/solution' import { getSolsList } from 'apis/solution'
import { getStatus } from 'apis/system'
import logoutIcon from 'assets/images/logout.svg' import logoutIcon from 'assets/images/logout.svg'
import Check from 'components/check/index.vue' import Check from 'components/check/index.vue'
import CheckCraft from 'components/home/CheckCraft/index.vue' import CheckCraft from 'components/home/CheckCraft/index.vue'
import Liquid from 'components/home/Liquid/index.vue' import Liquid from 'components/home/Liquid/index.vue'
import Stop from 'components/Stop/index.vue' import Stop from 'components/Stop/index.vue'
import { ElMessageBox } from 'element-plus'
import { useActivateDebug } from 'hooks/useActivateDebug' import { useActivateDebug } from 'hooks/useActivateDebug'
import { useServerTime } from 'hooks/useServerTime' import { useServerTime } from 'hooks/useServerTime'
import { isClose } from 'libs/socket' import { isClose } from 'libs/socket'
@ -28,9 +29,7 @@ watch(() => currentTime.value, () => {
watch (() => isClose.value, async (newVal) => { watch (() => isClose.value, async (newVal) => {
if (newVal) { if (newVal) {
const res = await getStatus()
systemStore.updateSystemStatus(res)
checkCraft()
await checkCraft()
} }
}) })
onMounted(async () => { onMounted(async () => {
@ -39,13 +38,30 @@ onMounted(async () => {
isCheck.value = true isCheck.value = true
return return
} }
checkCraft()
await checkCraft()
}) })
const checkCraftVisible = ref(false) const checkCraftVisible = ref(false)
const checkCraft = () => {
if (systemStore.systemStatus.trays?.some(item => item.crafts?.state === 'RESTORE')) {
checkCraftVisible.value = true
const checkCraft = async () => {
const res = await craftList()
if (res && res.length > 0) {
ElMessageBox.confirm(
'发现有异常预设, 是否处理恢复? ',
'提示',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
closeOnClickModal: false,
closeOnPressEscape: false,
type: 'warning',
customClass: 'init-message',
},
).then(async () => {
await craftRestore(true)
checkCraftVisible.value = true
}).catch(async () => {
await craftRestore(false)
})
} }
} }

66
src/views/home/index.vue

@ -1,13 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import { stopTask, trayIn, trayOut } from 'apis/home' import { stopTask, trayIn, trayOut } from 'apis/home'
import AddLiquid from 'components/home/AddLiquid/index.vue' import AddLiquid from 'components/home/AddLiquid/index.vue'
import CheckCraft from 'components/home/CheckCraft/index.vue'
import ExecuteCraft from 'components/home/ExecuteCraft/index.vue' import ExecuteCraft from 'components/home/ExecuteCraft/index.vue'
import ExtractLiquid from 'components/home/ExtractLiquid/index.vue' import ExtractLiquid from 'components/home/ExtractLiquid/index.vue'
import FillSolution from 'components/home/FillSolution/index.vue' import FillSolution from 'components/home/FillSolution/index.vue'
import SetTemperature from 'components/home/SetTemperature/index.vue' import SetTemperature from 'components/home/SetTemperature/index.vue'
import StartClean from 'components/home/StartClean/index.vue' import StartClean from 'components/home/StartClean/index.vue'
import StartExperiment from 'components/home/StartExperiment/index.vue'
import StartExperiment from 'components/home/StartExperiment/index.vue'
import Tube from 'components/home/Tube/index.vue' import Tube from 'components/home/Tube/index.vue'
import { ElMessageBox } from 'element-plus' import { ElMessageBox } from 'element-plus'
import { FtMessage } from 'libs/message' import { FtMessage } from 'libs/message'
@ -166,6 +167,8 @@ const trayInHandle = async () => {
const trayOutHandle = async () => { const trayOutHandle = async () => {
await trayOut() await trayOut()
} }
const checkCraftVisible = ref(false)
</script> </script>
<template> <template>
@ -219,9 +222,12 @@ const trayOutHandle = async () => {
<!-- 选择预设 --> <!-- 选择预设 -->
<!-- </ft-button> --> <!-- </ft-button> -->
<ft-button size="large" style="grid-column: 1 / 3; grid-row: 2 / 3;" :click-handle="executeCraftHandle">
<ft-button size="large" :click-handle="executeCraftHandle">
执行预设 执行预设
</ft-button> </ft-button>
<ft-button size="large" :click-handle="() => checkCraftVisible = true">
异常预设
</ft-button>
</div> </div>
<div style="display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr);grid-template-rows: repeat(2, 1fr)"> <div style="display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr);grid-template-rows: repeat(2, 1fr)">
<ft-button size="large" @click="cleanVisible = true"> <ft-button size="large" @click="cleanVisible = true">
@ -292,7 +298,7 @@ const trayOutHandle = async () => {
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<CheckCraft v-if="checkCraftVisible" @close="checkCraftVisible = false" />
<StartExperiment v-if="startVisible" @ok="startVisible = false" @cancel="startVisible = false" /> <StartExperiment v-if="startVisible" @ok="startVisible = false" @cancel="startVisible = false" />
<StartClean v-if="cleanVisible" @ok="cleanVisible = false" @cancel="cleanVisible = false" /> <StartClean v-if="cleanVisible" @ok="cleanVisible = false" @cancel="cleanVisible = false" />
<ExecuteCraft v-if="selectCraftVisible" @ok="selectCraftVisible = false" @cancel="selectCraftVisible = false" /> <ExecuteCraft v-if="selectCraftVisible" @ok="selectCraftVisible = false" @cancel="selectCraftVisible = false" />
@ -305,34 +311,34 @@ const trayOutHandle = async () => {
<style scoped lang="scss"> <style scoped lang="scss">
.home-page { .home-page {
.page-top{
height: 65%;
border-radius: 8px;
padding: 0 10px 10px;
display: grid;
grid-template-columns: repeat(4, 1fr); /* 创建3列等宽轨道 */
grid-template-rows: repeat(1, auto); /* 创建2行自动高度 */
gap: 10px;
justify-content: center; /* 水平居中 */
align-items: center;
.page-top{
height: 65%;
border-radius: 8px;
padding: 0 10px 10px;
display: grid;
grid-template-columns: repeat(4, 1fr); /* 创建3列等宽轨道 */
grid-template-rows: repeat(1, auto); /* 创建2行自动高度 */
gap: 10px;
justify-content: center; /* 水平居中 */
align-items: center;
}
.button-box {
height: 35%;
//display: grid;
//grid-template-columns: repeat(6, 1fr); /* 3 */
//grid-template-rows: repeat(4, 1fr); /* 2 */
//gap: 10px 20px;
.ft-button {
//width: 100px;
font-weight: bold;
margin-right: 0;
.my-button {
padding: 0 !important;
border: 3px solid #1989fa !important;
} }
.button-box {
height: 35%;
//display: grid;
//grid-template-columns: repeat(6, 1fr); /* 3 */
//grid-template-rows: repeat(4, 1fr); /* 2 */
//gap: 10px 20px;
.ft-button {
//width: 100px;
font-weight: bold;
margin-right: 0;
.my-button {
padding: 0 !important;
border: 3px solid #1989fa !important;
}
}
}
}
}
} }
</style> </style>
Loading…
Cancel
Save