|
|
@ -1,17 +1,40 @@ |
|
|
|
<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 class="h-full flex flex-col bg-white rounded-2xl p-5" style="background-color: #EEF5FF;"> |
|
|
|
<div class="h-0 grow flex flex-col justify-between"> |
|
|
|
<div v-for="tubeRackSlot in tubeRackSlots" :key="tubeRackSlot.index" class="mb-2"> |
|
|
|
<div class="flex flex-row justify-between text-gray-400 px-2 py-1 rounded-t-md" style="background-color:#DCE8F7;"> |
|
|
|
<div v-if="!tubeRackSlot.isErrorSlot">A-{{ tubeRackSlot.index + 1 }}</div> |
|
|
|
<div v-else>异常处理</div> |
|
|
|
<div>目标温度:{{ tubeRackSlot.destTemperature/100 }}℃</div> |
|
|
|
</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 / 100 }}℃</p> |
|
|
|
<p class="mb-0">A - {{ tubeRackSlot.index + 1 }}</p> |
|
|
|
<div class="flex flex-row p-2 rounded-b-md" style="background-color: #E2EEFD;"> |
|
|
|
<div class="flex flex-row items-center"> |
|
|
|
<!-- 加热进度 --> |
|
|
|
<a-progress type="circle" v-if="null === tubeRackSlot.heatingStartedAt" |
|
|
|
stroke-color="#ff5b5b" |
|
|
|
:size="50" :strokeWidth="18" |
|
|
|
:percent="getTubeRackSlotHeatingProgress(tubeRackSlot)" |
|
|
|
> |
|
|
|
<template #format="percent"> |
|
|
|
<span v-if="tubeRackSlot.isHeating" style="color: #ff5b5b">{{ percent }}%</span> |
|
|
|
</template> |
|
|
|
</a-progress> |
|
|
|
<!-- 保持进度 --> |
|
|
|
<a-progress type="circle" v-else |
|
|
|
:size="50" :strokeWidth="18" |
|
|
|
strokeColor="#fa8c16" |
|
|
|
:percent="getTubeRackSlotHoldingProgress(tubeRackSlot)" |
|
|
|
> |
|
|
|
<template #format> |
|
|
|
<span class="text-xs" style="color:#fa8c16" |
|
|
|
>{{ getTubeRackSlotHoldingCountdown(tubeRackSlot) }}</span> |
|
|
|
</template> |
|
|
|
</a-progress> |
|
|
|
</div> |
|
|
|
<div class="temperature" :class="{heating:tubeRackSlot.isHeating,holding:null !== tubeRackSlot.heatingStartedAt}"> |
|
|
|
<div>{{ (tubeRackSlot.temperature / 100).toFixed(2) }}</div> |
|
|
|
<div>℃</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -29,26 +52,64 @@ const tubeRackSlots = ref([]); |
|
|
|
watch(() => props.tubeRackSlots, newValue => tubeRackSlots.value = newValue); |
|
|
|
|
|
|
|
// 获取加热进度 |
|
|
|
function getTubeRackSlotHeatingProgressCountdown(tubeRackSlot) { |
|
|
|
function getTubeRackSlotHeatingProgress(tubeRackSlot) { |
|
|
|
if ( !tubeRackSlot.isHeating ) { |
|
|
|
return `00:00`; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
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')}`; |
|
|
|
|
|
|
|
let heating = tubeRackSlot.temperature - tubeRackSlot.srcTemperature; |
|
|
|
let total = tubeRackSlot.destTemperature - tubeRackSlot.srcTemperature; |
|
|
|
return Math.round(heating / total * 100); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取加热进度 |
|
|
|
function getTubeRackSlotHeatingProgress(tubeRackSlot) { |
|
|
|
|
|
|
|
// 获取保持进度 |
|
|
|
function getTubeRackSlotHoldingProgress(tubeRackSlot) { |
|
|
|
if ( !tubeRackSlot.isHeating ) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
let duration = Date.now() / 1000 - tubeRackSlot.heatingStartedAt; |
|
|
|
let progress = duration / tubeRackSlot.heatingDuration * 100; |
|
|
|
return Math.round(progress); |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
// 获取加热进度 |
|
|
|
function getTubeRackSlotHoldingCountdown(tubeRackSlot) { |
|
|
|
if ( !tubeRackSlot.isHeating ) { |
|
|
|
return `00:00`; |
|
|
|
} |
|
|
|
|
|
|
|
let duration = tubeRackSlot.heatingDuration - (Date.now() / 1000 - tubeRackSlot.heatingStartedAt); |
|
|
|
duration = parseInt(duration); |
|
|
|
if ( duration < 0 ) { |
|
|
|
duration = 0; |
|
|
|
} |
|
|
|
let min = parseInt(duration / 60); |
|
|
|
let sec = duration % 60; |
|
|
|
return `${min.toString().padStart(2,'0')}:${sec.toString().padStart(2,'0')}`; |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
<style scoped> |
|
|
|
.temperature { |
|
|
|
display: flex; |
|
|
|
flex-direction: row; |
|
|
|
justify-content: space-between; |
|
|
|
align-items: center; |
|
|
|
font-size: 1.5rem; |
|
|
|
color: #8799AB; |
|
|
|
font-weight: bold; |
|
|
|
width: 0; |
|
|
|
flex-grow: 1; |
|
|
|
box-shadow: inset 0px 0px 14px 2px rgb(10 10 10 / 8%); |
|
|
|
margin-left: 0.5rem; |
|
|
|
border-radius: 0.5rem; |
|
|
|
padding-top: 0.25rem; |
|
|
|
padding-bottom: 0.25rem; |
|
|
|
padding-left: 1rem; |
|
|
|
padding-right: 1rem; |
|
|
|
} |
|
|
|
.temperature.heating {color: #ff5b5b;} |
|
|
|
.temperature.holding {color: #fa8c16;} |
|
|
|
</style> |