Browse Source

fix: 工艺状态

feature/three
guoapeng 3 months ago
parent
commit
f2bc826bab
  1. 2
      .env.prod
  2. 72
      src/components/home/Tube/index.vue
  3. 59
      src/stores/systemStore.ts
  4. 9
      src/types/system.d.ts

2
.env.prod

@ -3,5 +3,5 @@
FT_NODE_ENV=prod FT_NODE_ENV=prod
FT_WS_URL=ws://192.168.8.168:8080/ws FT_WS_URL=ws://192.168.8.168:8080/ws
FT_PROXY=http://192.168.8.88:8080
FT_PROXY=http://192.168.8.168:8080
FT_API_BASE=/api FT_API_BASE=/api

72
src/components/home/Tube/index.vue

@ -1,5 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import errorIcon from 'assets/images/error.svg'
import ingIcon from 'assets/images/ing.svg'
import successIcon from 'assets/images/success.svg'
import waitIcon from 'assets/images/wait.svg'
import { useHomeStore } from 'stores/homeStore' import { useHomeStore } from 'stores/homeStore'
import { useSystemStore } from 'stores/systemStore'
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
const props = withDefaults(defineProps<{ data: System.HeatArea }>(), { const props = withDefaults(defineProps<{ data: System.HeatArea }>(), {
@ -7,14 +12,16 @@ const props = withDefaults(defineProps<{ data: System.HeatArea }>(), {
moduleCode: 'heat_module_01', moduleCode: 'heat_module_01',
trayStatus: 0, trayStatus: 0,
heating: false, heating: false,
capStatus: false,
capExist: false,
temperature: 0, temperature: 0,
targetTemperature: 0,
}), }),
}) })
const emits = defineEmits(['selectChange', 'setTemperature']) const emits = defineEmits(['selectChange', 'setTemperature'])
const homeStore = useHomeStore() const homeStore = useHomeStore()
const systemStore = useSystemStore()
const mousedownHandle = (e: Event) => { const mousedownHandle = (e: Event) => {
let event let event
if ('touches' in e) { if ('touches' in e) {
@ -39,6 +46,10 @@ const hearInfo = computed(() => {
return homeStore.heatAreaList.find(item => item.value === props.data.moduleCode) return homeStore.heatAreaList.find(item => item.value === props.data.moduleCode)
}) })
const craft = computed(() => {
return systemStore.systemStatus.tray.find(item => item.heatModuleId === props.data.moduleCode)?.crafts
})
const setTemperature = () => { const setTemperature = () => {
emits('setTemperature', props.data.moduleCode) emits('setTemperature', props.data.moduleCode)
} }
@ -50,12 +61,26 @@ defineExpose({
<template> <template>
<div class="tube" :class="{ 'tube-active': hearInfo?.selected, 'tube-shadow': data.trayStatus === 2 }"> <div class="tube" :class="{ 'tube-active': hearInfo?.selected, 'tube-shadow': data.trayStatus === 2 }">
<!-- <div -->
<!-- class="status" :class="{ 'status-success': false, 'status-wait': false, 'status-error': false, 'status-ing': false, -->
<!-- }" -->
<!-- > -->
<!-- <span>工艺执行中</span> -->
<!-- </div> -->
<div
v-if="data.trayStatus !== 0 && craft?.state"
class="status" :class="{
'status-success': false,
'status-wait': craft?.state === 'READY',
'status-error': craft?.state === 'ERROR',
'status-ing': craft?.state === 'RUNNING',
}"
>
<img v-if="craft?.state === 'FINISHED'" :src="successIcon" alt="">
<img v-if="craft?.state === 'RUNNING'" :src="ingIcon" alt="">
<img v-if="craft?.state === 'READY'" :src="waitIcon" alt="">
<img v-if="craft?.state === 'ERROR'" :src="errorIcon" alt="">
<span class="status-name">{{ craft?.craft?.name || ' ' }}</span>
<span v-if="craft?.state === 'RUNNING'" class="status-text">工艺执行中</span>
<span v-if="craft?.state === 'READY'" class="status-text">工艺等待执行</span>
<span v-if="craft?.state === 'ERROR'" class="status-text">工艺执行错误</span>
<span v-if="craft?.state === 'FINISHED'" class="status-text">工艺执行成功</span>
</div>
<div class="header"> <div class="header">
<span>{{ hearInfo?.label }}</span> <span>{{ hearInfo?.label }}</span>
<span v-show="data.trayStatus === 0">空置</span> <span v-show="data.trayStatus === 0">空置</span>
@ -117,6 +142,39 @@ defineExpose({
height: 100%; height: 100%;
background: rgba(255,255,255,0.9); background: rgba(255,255,255,0.9);
z-index: 1; z-index: 1;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
border-radius: 10px;
img {
width: 50px;
margin: 30px 0 10px;
}
.status-name {
font-size: 14px;
margin: 10px 0 10px;
}
.status-text {
font-size: 16px;
font-weight: 700;
}
}
.status-wait {
background: rgba(242,235,231, 0.9);
border: 1px solid #EE8223;
color: #EE8223;
}
.status-error {
background: rgba(232,212,222, 0.9);
border: 1px solid #DF1515;
color: #DF1515;
}
.status-ing {
background: rgba(205,223,255, 0.9);
border: 1px solid #3E3A39;
color: #3E3A39;
} }
.header { .header {
display: flex; display: flex;

59
src/stores/systemStore.ts

@ -77,7 +77,7 @@ export const useSystemStore = defineStore('system', {
heatModule: [ heatModule: [
{ {
moduleCode: 'heat_module_01', moduleCode: 'heat_module_01',
trayStatus: 0,
trayStatus: 1,
heating: false, heating: false,
capExist: false, capExist: false,
temperature: 0, temperature: 0,
@ -101,7 +101,7 @@ export const useSystemStore = defineStore('system', {
}, },
{ {
moduleCode: 'heat_module_04', moduleCode: 'heat_module_04',
trayStatus: 0,
trayStatus: 2,
heating: false, heating: false,
capExist: false, capExist: false,
temperature: 0, temperature: 0,
@ -109,7 +109,7 @@ export const useSystemStore = defineStore('system', {
}, },
{ {
moduleCode: 'heat_module_05', moduleCode: 'heat_module_05',
trayStatus: 0,
trayStatus: 1,
heating: false, heating: false,
capExist: false, capExist: false,
temperature: 0, temperature: 0,
@ -124,7 +124,58 @@ export const useSystemStore = defineStore('system', {
targetTemperature: 0, targetTemperature: 0,
}, },
], ],
tray: [],
tray: [
{
uuid: '',
heatModuleId: 'heat_module_01',
inSolutionArea: false,
inHeatModule: true,
tubes: [
{
addSolution: true,
exists: true,
},
],
crafts: {
state: 'READY',
},
},
{
uuid: '',
heatModuleId: 'heat_module_02',
inSolutionArea: false,
inHeatModule: true,
tubes: [
{
addSolution: true,
exists: true,
},
],
crafts: {
state: 'RUNNING',
craft: {
id: 1,
name: '菱锌矿硫酸溶解法',
steps: '',
},
},
},
{
uuid: '',
heatModuleId: 'heat_module_03',
inSolutionArea: false,
inHeatModule: true,
tubes: [
{
addSolution: true,
exists: true,
},
],
crafts: {
state: 'ERROR',
},
},
],
}, },
systemUser: { systemUser: {
username: '', username: '',

9
src/types/system.d.ts

@ -1,4 +1,6 @@
declare namespace System { declare namespace System {
import Craft = CraftTypes.Craft
interface SystemStore { interface SystemStore {
systemStatus: SystemStatus systemStatus: SystemStatus
systemList: Socket.NotificationData[] systemList: Socket.NotificationData[]
@ -29,14 +31,21 @@ declare namespace System {
tray: Tray[] tray: Tray[]
} }
interface Tray { interface Tray {
uuid: string
heatModuleId: 'heat_module_01' | 'heat_module_02' | 'heat_module_03' | 'heat_module_04' | 'heat_module_05' | 'heat_module_06' heatModuleId: 'heat_module_01' | 'heat_module_02' | 'heat_module_03' | 'heat_module_04' | 'heat_module_05' | 'heat_module_06'
inSolutionArea: boolean inSolutionArea: boolean
inHeatModule: boolean
tubes: [ tubes: [
{ {
addSolution: boolean addSolution: boolean
exists: boolean exists: boolean
}, },
] ]
crafts: {
state: 'READY' | 'RUNNING' | 'PAUSED' | 'STOPPED' | 'ERROR' | 'FINISHED'
craft?: CraftTypes.Craft
currentIndex?: number
}
} }
interface HeatArea { interface HeatArea {
moduleCode: 'heat_module_01' | 'heat_module_02' | 'heat_module_03' | 'heat_module_04' | 'heat_module_05' | 'heat_module_06' moduleCode: 'heat_module_01' | 'heat_module_02' | 'heat_module_03' | 'heat_module_04' | 'heat_module_05' | 'heat_module_06'

Loading…
Cancel
Save