feat:营养分析-报表

This commit is contained in:
dzc committed 2025-10-28 10:17:35 +08:00
1 parent 83024f6e03
commit 17939088d6
5 files changed
+43 -23

No files matched your search

+12 -1
View File
@@ -76,4 +76,15 @@ export const external = (data) => {
method: 'post',
data,
})
}
}
/**
* 营养分析报表
*/
export const nutritionReport = (data) => {
return service({
url: 'hard/panel-nutrition/report',
method: 'post',
data,
})
}
+1 -1
View File
@@ -54,7 +54,7 @@ service.interceptors.response.use(
}
);
const ignoreUrl = ["/admin/user/info", "/auth/token/check_token"]
const ignoreUrl = ["/auth/token/check_token"]
function isIgnoreUrl(url) {
return ignoreUrl.some(item => url.includes(item))
+12 -1
View File
@@ -64,4 +64,15 @@ export const mchPayCountTop = (data) => {
method: 'post',
data,
})
}
}
/**
* 当天超市购买次数趋势统计
*/
export const todayTrend = (data) => {
return service({
url: 'hard/panel-shop/today-trend',
method: 'post',
data,
})
}
+2 -2
View File
@@ -58,7 +58,7 @@
<script setup>
import { onMounted, onBeforeUnmount, useTemplateRef, reactive } from "vue";
import { canteenApi } from "@/api/index"
import { nutritionApi } from "@/api/index"
import { displayPrice } from "@/utils/format-money"
import { TABLE } from "@/constant/table-constant"
@@ -76,7 +76,7 @@ onMounted(() => {
// 食堂报表
const getDataList = async () => {
try {
const { code, data } = await canteenApi.canteenReport({ ...state.queryParams })
const { code, data } = await nutritionApi.nutritionReport({ ...state.queryParams })
console.log("食堂报表:", data);
state.dataList = data
} catch (error) {
+16 -18
View File
@@ -10,10 +10,9 @@
<AsideBlock>
<template #header>
<span>各商户购买次数趋势统计(近7日)</span>
<span>当天超市购买次数趋势统计</span>
</template>
<DeviceOnlineLineChart :data="timerObj.deviceOfflineRate.data.list"
:labels="timerObj.deviceOfflineRate.data.labels" />
<DeviceOnlineLineChart :data="timerObj.todayTrend.data.list" :labels="timerObj.todayTrend.data.labels" />
</AsideBlock>
<AsideBlock>
@@ -118,8 +117,8 @@ const timerObj = reactive({
dateRangeType: "YESTERDAY",
},
},
// 设备在线率趋势
deviceOfflineRate: {
// 当天超市购买次数趋势统计
todayTrend: {
initial: null,
interval: 10 * 1000,
data: {
@@ -158,13 +157,12 @@ const timerObj = reactive({
});
onMounted(() => {
// getDeviceStatusData();
// getDeviceOnlineData();
getAreaCameraTotalData();
getAlarmData();
getAlarmListData();
getTopTotalData();
getNotification();
getTodayTrend();
});
onBeforeUnmount(() => {
@@ -211,26 +209,26 @@ const changeQueryDate = (e) => {
shopReportRef.value?.refresh(e)
}
// 设备在线率趋势 (近7日)
const getDeviceOnlineData = async () => {
timerObj.deviceOfflineRate.initial = simplePoll(async () => {
// 当天超市购买次数趋势统计
const getTodayTrend = async () => {
timerObj.todayTrend.initial = simplePoll(async () => {
try {
const { code, data } = await deviceApi.deviceOfflineRate({ ...timerObj.deviceOfflineRate.queryParams });
const { code, data } = await shopApi.todayTrend({ ...timerObj.todayTrend.queryParams });
if (code != 0) throw new Error("code!=0");
console.log("设备在线率趋势:", data);
console.log("当天超市购买次数趋势统计:", data);
if (!data) {
return;
}
timerObj.deviceOfflineRate.data.list = data.map((v) => {
return v.onlineDeviceTotalRate;
timerObj.todayTrend.data.list = data.map((v) => {
return v.buyCount ?? 0;
});
timerObj.deviceOfflineRate.data.labels = data.map((v) => {
return v.recordTime;
timerObj.todayTrend.data.labels = data.map((v) => {
return v.hourType;
});
} catch (error) {
console.error("|设备在线率趋势|意外的错误:", error);
console.error("|当天超市购买次数趋势统计|意外的错误:", error);
}
}, timerObj.deviceOfflineRate.interval);
}, timerObj.todayTrend.interval);
};
// 今日消费次数排行(top5)