Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
This commit is contained in:
@@ -63,8 +63,6 @@ export const useNotifyStore = defineStore(
|
|||||||
|
|
||||||
watch(data, (message) => {
|
watch(data, (message) => {
|
||||||
if (!message) return
|
if (!message) return
|
||||||
console.log(`接收到消息: ${message}`)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 尝试解析JSON
|
// 尝试解析JSON
|
||||||
const obj = JSON.parse(message)
|
const obj = JSON.parse(message)
|
||||||
|
@@ -19,11 +19,12 @@ import {
|
|||||||
getStatisticsCurrDay,
|
getStatisticsCurrDay,
|
||||||
getStatistics,
|
getStatistics,
|
||||||
} from '#/api/analytics/index';
|
} from '#/api/analytics/index';
|
||||||
|
import { getVisitorList } from '#/api/property/resident/passRecordManagement';
|
||||||
const overviewItems = ref<any[]>([
|
const overviewItems = ref<any[]>([
|
||||||
{
|
{
|
||||||
icon: SvgCardIcon,
|
icon: SvgCardIcon,
|
||||||
title: '今日访客量',
|
title: '今日通行量',
|
||||||
totalTitle: '总访客量',
|
totalTitle: '总通行量',
|
||||||
totalValue: 0,
|
totalValue: 0,
|
||||||
value: 0,
|
value: 0,
|
||||||
},
|
},
|
||||||
@@ -73,6 +74,37 @@ const handleDateChange = (date: any) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 通行量
|
||||||
|
async function getPersonCount() {
|
||||||
|
const date = new Date();
|
||||||
|
const nowDate = date
|
||||||
|
.toLocaleDateString('zh-CN', {
|
||||||
|
year: 'numeric',
|
||||||
|
month: '2-digit',
|
||||||
|
day: '2-digit',
|
||||||
|
})
|
||||||
|
.replace(/\//g, '-');
|
||||||
|
|
||||||
|
const historyData = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
begTime: '2025-09-01',
|
||||||
|
endTime: nowDate,
|
||||||
|
};
|
||||||
|
|
||||||
|
const todayData = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
begTime: nowDate,
|
||||||
|
endTime: nowDate,
|
||||||
|
};
|
||||||
|
|
||||||
|
const historyTotal = await getVisitorList(historyData);
|
||||||
|
const todayTotal = await getVisitorList(todayData);
|
||||||
|
overviewItems.value[0].totalValue = historyTotal.total;
|
||||||
|
overviewItems.value[0].value = todayTotal.total;
|
||||||
|
}
|
||||||
|
|
||||||
// 工单数量
|
// 工单数量
|
||||||
async function getIndex() {
|
async function getIndex() {
|
||||||
const res = await getIndexCount();
|
const res = await getIndexCount();
|
||||||
@@ -146,6 +178,7 @@ async function getStatisticsCount() {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getIndex();
|
getIndex();
|
||||||
getCarCount();
|
getCarCount();
|
||||||
|
getPersonCount();
|
||||||
getStatisticsCurrDayCount();
|
getStatisticsCurrDayCount();
|
||||||
getStatisticsCount();
|
getStatisticsCount();
|
||||||
});
|
});
|
||||||
|
@@ -19,18 +19,15 @@ onMounted(() => {
|
|||||||
() => notifyStore.sseList,
|
() => notifyStore.sseList,
|
||||||
(val) => {
|
(val) => {
|
||||||
const latestMessage = val[val.length - 1];
|
const latestMessage = val[val.length - 1];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 尝试解析消息内容
|
// 尝试解析消息内容
|
||||||
const parsedMessage = JSON.parse(latestMessage);
|
const parsedMessage = JSON.parse(latestMessage);
|
||||||
console.log('收到sse消息:', parsedMessage);
|
|
||||||
if (parsedMessage.type === 'meter') {
|
if (parsedMessage.type === 'meter') {
|
||||||
// 根据消息内容执行相应操作
|
// 根据消息内容执行相应操作
|
||||||
handleSSEMessage(parsedMessage);
|
handleSSEMessage(parsedMessage);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('收到非JSON消息:', latestMessage);
|
console.log('收到非JSON消息:', latestMessage);
|
||||||
// 处理非JSON格式消息
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ deep: true },
|
{ deep: true },
|
||||||
|
Reference in New Issue
Block a user