format
This commit is contained in:
parent
dc5c259336
commit
dd0f3adc79
|
@ -17,13 +17,16 @@ const item = computed(() => {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const getData = async ()=>{
|
const getData = async () => {
|
||||||
const res = await fetch(`${baseUrl}/api/sheet`)
|
const res = await fetch(`${baseUrl}/api/sheet`)
|
||||||
const result = await res.json()
|
const result = await res.json()
|
||||||
if (result.status == "success") {
|
if (result.status == "success") {
|
||||||
data.value = result.data
|
data.value = result.data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const formatNumber = (n: string) => {
|
||||||
|
return Math.ceil(parseFloat(n.replace(',', '.')))
|
||||||
|
}
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getData()
|
await getData()
|
||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
|
@ -42,11 +45,11 @@ onMounted(async () => {
|
||||||
<div class="item-wrapper">
|
<div class="item-wrapper">
|
||||||
<div class="item" v-if="item">
|
<div class="item" v-if="item">
|
||||||
{{ item.name.slice(0, 2).join(' ') }}<br />
|
{{ item.name.slice(0, 2).join(' ') }}<br />
|
||||||
{{ item.hours }} / {{ Math.ceil(parseFloat(item.calendar)) }}
|
{{ formatNumber(item.hours) }} / {{ formatNumber(item.calendar) }}
|
||||||
<strong :class="{
|
<strong :class="{
|
||||||
'high': parseInt(item.percent) >= 70,
|
'high': parseInt(item.percent) >= 70,
|
||||||
'medium': parseInt(item.percent) >= 35 && parseInt(item.percent) < 70,
|
'medium': parseInt(item.percent) >= 35 && parseInt(item.percent) < 70,
|
||||||
}">({{ item.percent }}%)</strong>
|
}">({{ formatNumber(item.percent) }}%)</strong>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
Loading…
Reference in New Issue