refactor: refs #6238 update getRate function and color logic
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
19aa1bf01d
commit
7393b82008
|
@ -432,9 +432,14 @@ const handleDragScroll = (event) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getKgPercentage = ({ kg, loadedKg, volumeKg }) => {
|
const getRate = ({ kg, loadedKg, volumeKg }) => {
|
||||||
return Math.round((Math.max(loadedKg || 0, volumeKg || 0) / kg) * 100);
|
return Math.round((Math.max(loadedKg || 0, volumeKg || 0) / kg) * 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getColor = (percentage) => {
|
||||||
|
if (percentage >= 100) return 'red-10';
|
||||||
|
else if (percentage >= 80 && percentage < 100) return 'deep-orange-10';
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -512,14 +517,9 @@ const getKgPercentage = ({ kg, loadedKg, volumeKg }) => {
|
||||||
>
|
>
|
||||||
<QChip
|
<QChip
|
||||||
v-if="col.name === 'percentage'"
|
v-if="col.name === 'percentage'"
|
||||||
:label="getKgPercentage(props.row) + '%'"
|
:label="getRate(props.row) + '%'"
|
||||||
class="text-left q-py-xs q-px-sm"
|
class="text-left q-py-xs q-px-sm"
|
||||||
:class="{
|
:color="getColor(getRate(props.row))"
|
||||||
'bg-red-10': getKgPercentage(props.row) >= 100,
|
|
||||||
'bg-deep-orange-10':
|
|
||||||
getKgPercentage(props.row) >= 80 &&
|
|
||||||
getKgPercentage(props.row) < 100,
|
|
||||||
}"
|
|
||||||
/>
|
/>
|
||||||
<span
|
<span
|
||||||
v-else-if="col.showValue"
|
v-else-if="col.showValue"
|
||||||
|
@ -599,6 +599,7 @@ const getKgPercentage = ({ kg, loadedKg, volumeKg }) => {
|
||||||
</QTable>
|
</QTable>
|
||||||
</QPage>
|
</QPage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.q-chip {
|
.q-chip {
|
||||||
color: var(--vn-text-color);
|
color: var(--vn-text-color);
|
||||||
|
|
Loading…
Reference in New Issue