fix: error num display
This commit is contained in:
@@ -136,7 +136,7 @@ func GetStatisticData() (StatisticData, error) {
|
|||||||
Select(`
|
Select(`
|
||||||
COUNT(*) AS today_total_num,
|
COUNT(*) AS today_total_num,
|
||||||
SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) AS today_succ_num,
|
SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) AS today_succ_num,
|
||||||
SUM(CASE WHEN status = 0 THEN 1 ELSE 0 END) AS today_failed_num`).
|
SUM(CASE WHEN status != 1 or status is null THEN 1 ELSE 0 END) AS today_failed_num`).
|
||||||
Where("DATE(created_on) = CURDATE()")
|
Where("DATE(created_on) = CURDATE()")
|
||||||
query.First(&statistic)
|
query.First(&statistic)
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<div class="statistic-card">
|
<div class="statistic-card">
|
||||||
<el-statistic :value="data.today_failed_num">
|
<el-statistic :value="data.today_failed_num" :value-style="formatFailedNumStyle()">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div style="display: inline-flex; align-items: center">
|
<div style="display: inline-flex; align-items: center">
|
||||||
今日发送失败数
|
今日发送失败数
|
||||||
@@ -77,8 +77,17 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const formatFailedNumStyle = () => {
|
||||||
|
let style = {};
|
||||||
|
if (state.data.today_failed_num) {
|
||||||
|
style['color'] = 'red';
|
||||||
|
}
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getStatisticData();
|
await getStatisticData();
|
||||||
|
formatFailedNumStyle();
|
||||||
initDailyChart();
|
initDailyChart();
|
||||||
initSendCateChart();
|
initSendCateChart();
|
||||||
});
|
});
|
||||||
@@ -170,7 +179,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...toRefs(state)
|
...toRefs(state), formatFailedNumStyle
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user