3 changed files with 84 additions and 47 deletions
-
30src/web/src/pages/main/Page.vue
-
47src/web/src/pages/main/contents/Operation.vue
-
54src/web/src/pages/main/contents/OperationTubeRackTemperature.vue
@ -0,0 +1,54 @@ |
|||||
|
<template> |
||||
|
<div class="h-full flex flex-col bg-white rounded-2xl p-5"> |
||||
|
<div class="h-0 grow"> |
||||
|
<div v-for="tubeRackSlot in tubeRackSlots" :key="tubeRackSlot.index" class="bg-gray-100 mb-2 flex flex-row p-2 rounded-2xl"> |
||||
|
<div class="flex flex-row items-center"> |
||||
|
<a-progress type="circle" status="exception" :size="50" :strokeWidth="18" :percent="getTubeRackSlotHeatingProgress(tubeRackSlot)" > |
||||
|
<template #format> |
||||
|
<span class="text-red-400 text-xs">{{ getTubeRackSlotHeatingProgressCountdown(tubeRackSlot) }}</span> |
||||
|
</template> |
||||
|
</a-progress> |
||||
|
</div> |
||||
|
<div class="ml-2 bg-amber-500 rounded-2xl py-2 px-4 text-white w-0 grow text-center"> |
||||
|
<p class="mb-0 text-2xl">{{ tubeRackSlot.temperature || '---' }}℃</p> |
||||
|
<p class="mb-0">A - {{ tubeRackSlot.index + 1 }}</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
<script setup> |
||||
|
import { ref, watch } from 'vue'; |
||||
|
/** @var {Object} */ |
||||
|
const props = defineProps({ |
||||
|
tubeRackSlots: Array, |
||||
|
}); |
||||
|
/** @var {Object} */ |
||||
|
const tubeRackSlots = ref([]); |
||||
|
// watch props tubeRackSlots |
||||
|
watch(() => props.tubeRackSlots, newValue => tubeRackSlots.value = newValue); |
||||
|
|
||||
|
// 获取加热进度 |
||||
|
function getTubeRackSlotHeatingProgressCountdown(tubeRackSlot) { |
||||
|
if ( !tubeRackSlot.isHeating ) { |
||||
|
return `00:00`; |
||||
|
} |
||||
|
|
||||
|
let duration = tubeRackSlot.heatingDuration - (Date.now() / 1000 - tubeRackSlot.heatingStartedAt); |
||||
|
duration = parseInt(duration); |
||||
|
let min = parseInt(duration / 60); |
||||
|
let sec = duration % 60; |
||||
|
return `${min.toString().padStart(2,'0')}:${sec.toString().padStart(2,'0')}`; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
// 获取加热进度 |
||||
|
function getTubeRackSlotHeatingProgress(tubeRackSlot) { |
||||
|
if ( !tubeRackSlot.isHeating ) { |
||||
|
return 0; |
||||
|
} |
||||
|
let duration = Date.now() / 1000 - tubeRackSlot.heatingStartedAt; |
||||
|
let progress = duration / tubeRackSlot.heatingDuration * 100; |
||||
|
return Math.round(progress); |
||||
|
} |
||||
|
</script> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue