2025-06-10 15:12:17 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<page-meta :page-font-size="fontValue+'px'" :root-font-size="fontValue+'px'"></page-meta>
|
|
|
|
|
|
<view class="page-container">
|
|
|
|
|
|
<view style="width:94%;margin: 20px auto;background: #FFF;border-radius: 20px;">
|
|
|
|
|
|
<view style="width: 92%;margin:10px auto;display: flex;justify-content: space-between;align-items: center;border-bottom: 2px solid #f5f5f5;padding: 10px;align-items: center;">
|
|
|
|
|
|
<view style="font-size: 32rpx;font-weight: bold;">今日客流统计</view>
|
|
|
|
|
|
<view style="font-size: 24rpx;color:#999999;">更新时间:{{flowData.updateTime}}</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view style="width: 92%;margin:10px auto;padding: 10px;font-size: 28rpx;">
|
|
|
|
|
|
<view style="width: 100%;margin:10px auto;display: flex;align-items: center;">
|
2025-06-10 16:58:02 +08:00
|
|
|
|
<view style="font-weight: bold;width: 35%;">拥挤程度:</view>
|
|
|
|
|
|
<view class="gl" v-if="personRate<=66" :class="{ 'gl-green': personRate>0 }"></view>
|
|
|
|
|
|
<view class="gl" v-else :class="{ 'gl-red': personRate>0 }"></view>
|
|
|
|
|
|
|
|
|
|
|
|
<view class="gl" v-if="personRate<=66" :class="{ 'gl-green': personRate>33 }"></view>
|
|
|
|
|
|
<view class="gl" v-else :class="{ 'gl-red': personRate>33 }"></view>
|
|
|
|
|
|
|
|
|
|
|
|
<view class="gl" v-if="personRate<=66"></view>
|
|
|
|
|
|
<view class="gl" v-else :class="{ 'gl-red':personRate>66 }"></view>
|
|
|
|
|
|
|
|
|
|
|
|
<view v-if="personRate<=66&&personRate>=0" style="color:#00aa00;">畅通</view>
|
|
|
|
|
|
<view v-if="personRate>66" style="color:#ff6633;">拥挤</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view style="width: 100%;margin:10px auto;display: flex;align-items: center;">
|
|
|
|
|
|
<view style="font-weight: bold;width: 35%;">当前人数:</view>
|
2025-06-10 15:12:17 +08:00
|
|
|
|
<view>{{flowData.presentNum}}</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view style="width: 100%;margin:10px auto;display: flex;align-items: center;">
|
2025-06-10 16:58:02 +08:00
|
|
|
|
<view style="font-weight: bold;width: 35%;">进场人数:</view>
|
2025-06-10 15:12:17 +08:00
|
|
|
|
<view>{{flowData.enters}}</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view style="width: 100%;margin:10px auto;display: flex;align-items: center;">
|
2025-06-10 16:58:02 +08:00
|
|
|
|
<view style="font-weight: bold;width: 35%;">出场人数:</view>
|
2025-06-10 15:12:17 +08:00
|
|
|
|
<view>{{flowData.exits}}</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view style="width: 100%;margin:10px auto;display: flex;align-items: center;">
|
2025-06-10 16:58:02 +08:00
|
|
|
|
<view style="font-weight: bold;width: 35%;">最大容纳人数:</view>
|
2025-06-10 15:12:17 +08:00
|
|
|
|
<view>{{flowData.capacity}}</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view style="width: 100%;margin:10px auto;display: flex;align-items: center;">
|
2025-06-10 16:58:02 +08:00
|
|
|
|
<view style="font-weight: bold;width: 35%;">峰值人数:</view>
|
2025-06-10 15:12:17 +08:00
|
|
|
|
<view>{{flowData.presentFlowVOList[0].peakNum}}</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<view style="width:94%;margin: 20px auto;background: #FFF;border-radius: 20px;padding-bottom: 20px;">
|
|
|
|
|
|
<view style="width: 92%;margin:10px auto;display: flex;justify-content: space-between;align-items: center;border-bottom: 2px solid #f5f5f5;padding: 10px;align-items: center;">
|
|
|
|
|
|
<view style="font-size: 32rpx;font-weight: bold;">今日客流趋势</view>
|
|
|
|
|
|
<view style="font-size: 24rpx;color:#999999;">单位:人</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view style="width: 92%;margin:10px auto;padding: 10px;font-size: 28rpx;height: 45vh;">
|
|
|
|
|
|
<qiun-data-charts
|
|
|
|
|
|
type="line"
|
2025-06-10 17:22:18 +08:00
|
|
|
|
:opts="opts" ontouch
|
2025-06-10 15:12:17 +08:00
|
|
|
|
:chartData="chartData"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import { queryPassengerNumApi } from '@/api/passenger/index.js'
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
fontValue:uni.getStorageSync('fontSize') || 8,
|
|
|
|
|
|
dateList:[],
|
|
|
|
|
|
canteenItem:{},
|
|
|
|
|
|
flowData:{
|
|
|
|
|
|
"presentFlowVOList": [
|
|
|
|
|
|
{
|
|
|
|
|
|
"date": "2025-06-10",
|
|
|
|
|
|
"presentList": [
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"39",
|
|
|
|
|
|
"13",
|
|
|
|
|
|
"9",
|
2025-06-10 17:22:18 +08:00
|
|
|
|
"9",
|
|
|
|
|
|
"101",
|
|
|
|
|
|
"19",
|
|
|
|
|
|
"23",
|
|
|
|
|
|
"20",
|
|
|
|
|
|
"20",
|
|
|
|
|
|
"20",
|
|
|
|
|
|
"20"
|
2025-06-10 15:12:17 +08:00
|
|
|
|
],
|
|
|
|
|
|
"enterList": [
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"110",
|
|
|
|
|
|
"193",
|
|
|
|
|
|
"218",
|
2025-06-10 17:22:18 +08:00
|
|
|
|
"218",
|
|
|
|
|
|
"432",
|
|
|
|
|
|
"471",
|
|
|
|
|
|
"491",
|
|
|
|
|
|
"493",
|
|
|
|
|
|
"493",
|
|
|
|
|
|
"493",
|
|
|
|
|
|
"493"
|
2025-06-10 15:12:17 +08:00
|
|
|
|
],
|
|
|
|
|
|
"exitList": [
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"0",
|
|
|
|
|
|
"71",
|
|
|
|
|
|
"180",
|
|
|
|
|
|
"209",
|
2025-06-10 17:22:18 +08:00
|
|
|
|
"209",
|
|
|
|
|
|
"331",
|
|
|
|
|
|
"452",
|
|
|
|
|
|
"468",
|
|
|
|
|
|
"473",
|
|
|
|
|
|
"473",
|
|
|
|
|
|
"473",
|
|
|
|
|
|
"473"
|
2025-06-10 15:12:17 +08:00
|
|
|
|
],
|
2025-06-10 17:22:18 +08:00
|
|
|
|
"peakNum": "101"
|
2025-06-10 15:12:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
],
|
2025-06-10 17:22:18 +08:00
|
|
|
|
"updateTime": "2025-06-10 17:05:19",
|
|
|
|
|
|
"presentNum": 20,
|
|
|
|
|
|
"enters": 493,
|
|
|
|
|
|
"exits": 473,
|
|
|
|
|
|
"capacity": 300
|
2025-06-10 15:12:17 +08:00
|
|
|
|
},
|
2025-06-10 16:58:02 +08:00
|
|
|
|
personRate:0,
|
2025-06-10 15:12:17 +08:00
|
|
|
|
chartData:{},
|
|
|
|
|
|
opts: {
|
|
|
|
|
|
color: ["#1890FF","#91CB74","#FAC858","#EE6666","#73C0DE","#3CA272","#FC8452","#9A60B4","#ea7ccc"],
|
2025-06-10 17:22:18 +08:00
|
|
|
|
padding: [10,0,0,0],
|
2025-06-10 15:12:17 +08:00
|
|
|
|
enableScroll: false,
|
|
|
|
|
|
legend: {},
|
2025-06-10 17:22:18 +08:00
|
|
|
|
enableScroll: true,
|
|
|
|
|
|
|
2025-06-10 15:12:17 +08:00
|
|
|
|
xAxis: {
|
2025-06-10 17:22:18 +08:00
|
|
|
|
disableGrid: true,
|
|
|
|
|
|
itemCount: 8,
|
2025-06-10 15:12:17 +08:00
|
|
|
|
},
|
|
|
|
|
|
yAxis: {
|
|
|
|
|
|
gridType: "dash",
|
|
|
|
|
|
dashLength: 2
|
|
|
|
|
|
},
|
|
|
|
|
|
extra: {
|
|
|
|
|
|
line: {
|
|
|
|
|
|
type: "curve",
|
|
|
|
|
|
width: 2,
|
|
|
|
|
|
activeType: "hollow"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
|
options = JSON.parse(options.params)
|
|
|
|
|
|
this.canteenItem = options
|
|
|
|
|
|
console.log(this.canteenItem)
|
2025-06-10 16:58:02 +08:00
|
|
|
|
this.dateList = this.getRecentWeekDates()
|
2025-06-10 15:12:17 +08:00
|
|
|
|
},
|
2025-06-10 16:58:02 +08:00
|
|
|
|
onReady() {
|
2025-06-10 17:22:18 +08:00
|
|
|
|
// this.initChart();
|
2025-06-10 15:12:17 +08:00
|
|
|
|
this.queryNowPresentNum();
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
getRecentWeekDates() {
|
|
|
|
|
|
let currentDate = new Date(); // 获取当前日期
|
|
|
|
|
|
let weekDates = [];
|
|
|
|
|
|
// for (let i = 0; i < 1; i++) {
|
|
|
|
|
|
let day = currentDate.getDate();
|
|
|
|
|
|
let month = currentDate.getMonth() + 1; // 月份是从0开始计数的,所以要+1
|
|
|
|
|
|
let year = currentDate.getFullYear();
|
|
|
|
|
|
//日期
|
|
|
|
|
|
let formattedDate2 = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
|
|
|
|
|
|
weekDates.push(formattedDate2);
|
|
|
|
|
|
// currentDate.setDate(currentDate.getDate() + 1); // 获取前一天的日期
|
|
|
|
|
|
// }
|
|
|
|
|
|
return weekDates;
|
|
|
|
|
|
},
|
|
|
|
|
|
async queryNowPresentNum() {
|
|
|
|
|
|
try {
|
|
|
|
|
|
let param = {
|
|
|
|
|
|
"canteenId":this.canteenItem.canteenId,
|
|
|
|
|
|
"periods":1,
|
2025-06-10 16:58:02 +08:00
|
|
|
|
"presentDate":this.dateList
|
2025-06-10 15:12:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
const res = await queryPassengerNumApi(param)
|
|
|
|
|
|
console.log('?? ~ getList ~ res:', res)
|
2025-06-10 16:58:02 +08:00
|
|
|
|
this.flowData = res.data;
|
|
|
|
|
|
if(this.flowData.presentNum&&this.flowData.presentNum>0){
|
|
|
|
|
|
this.personRate = Number(((this.flowData.presentNum/this.flowData.capacity)*100).toFixed(2))
|
|
|
|
|
|
}
|
|
|
|
|
|
this.initChart()
|
2025-06-10 15:12:17 +08:00
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.log(error)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
initChart(){
|
|
|
|
|
|
if(this.flowData.presentFlowVOList&&this.flowData.presentFlowVOList.length>0){
|
|
|
|
|
|
let xData = []
|
|
|
|
|
|
let line1=[]
|
|
|
|
|
|
let line2=[]
|
2025-06-10 15:51:20 +08:00
|
|
|
|
let xIndex = 0
|
|
|
|
|
|
let index1 = this.flowData.presentFlowVOList[0].enterList.findIndex(v=>Number(v)>0)
|
|
|
|
|
|
let index2 = this.flowData.presentFlowVOList[0].exitList.findIndex(v=>Number(v)>0)
|
|
|
|
|
|
console.log(index1)
|
|
|
|
|
|
console.log(index2)
|
|
|
|
|
|
if(index1<=index2){
|
|
|
|
|
|
this.flowData.presentFlowVOList[0].enterList.forEach((item,index)=>{
|
|
|
|
|
|
if(index>=index1){
|
|
|
|
|
|
xData.push((index+1)+"点")
|
|
|
|
|
|
line1.push(this.flowData.presentFlowVOList[0].enterList[index])
|
|
|
|
|
|
line2.push(this.flowData.presentFlowVOList[0].exitList[index])
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}else{
|
|
|
|
|
|
this.flowData.presentFlowVOList[0].exitList.forEach((item,index)=>{
|
|
|
|
|
|
if(index>=index2){
|
|
|
|
|
|
xData.push((index+1)+"点")
|
|
|
|
|
|
line1.push(this.flowData.presentFlowVOList[0].enterList[index])
|
|
|
|
|
|
line2.push(this.flowData.presentFlowVOList[0].exitList[index])
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2025-06-10 15:12:17 +08:00
|
|
|
|
console.log(xData)
|
2025-06-10 16:58:02 +08:00
|
|
|
|
console.log(line1)
|
|
|
|
|
|
console.log(line2)
|
2025-06-10 15:12:17 +08:00
|
|
|
|
var lineData = {
|
|
|
|
|
|
categories: xData,
|
|
|
|
|
|
series: [
|
|
|
|
|
|
{
|
|
|
|
|
|
name: "进场人数",
|
|
|
|
|
|
// lineType: "dash",
|
|
|
|
|
|
data: line1
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
name: "出场人数",
|
|
|
|
|
|
data: line2
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
};
|
|
|
|
|
|
}else{
|
|
|
|
|
|
var lineData = {
|
|
|
|
|
|
categories: ["8点","9点","10点","11点","12点","13点","14点","15点","16点","17点","18点","19点","20点"],
|
|
|
|
|
|
series: [
|
|
|
|
|
|
{
|
|
|
|
|
|
name: "进场人数",
|
|
|
|
|
|
// lineType: "dash",
|
|
|
|
|
|
data: [0,0,0,0,0,0,0,0,0,0,0,0,0]
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
name: "出场人数",
|
|
|
|
|
|
data: [0,0,0,0,0,0,0,0,0,0,0,0,0]
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
this.chartData = JSON.parse(JSON.stringify(lineData));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.page-container {
|
2025-06-17 16:19:23 +08:00
|
|
|
|
height: 96vh;
|
|
|
|
|
|
overflow-y: auto;
|
2025-06-10 15:12:17 +08:00
|
|
|
|
background-color: #f5f5f5;
|
|
|
|
|
|
padding: 20rpx;
|
|
|
|
|
|
}
|
2025-06-10 16:58:02 +08:00
|
|
|
|
.gl{
|
|
|
|
|
|
height: 5px;
|
|
|
|
|
|
width:40px;
|
|
|
|
|
|
background-color: #ccc;
|
|
|
|
|
|
margin-right: 4px;
|
|
|
|
|
|
border-radius:4px;
|
|
|
|
|
|
&.gl-red{
|
|
|
|
|
|
background-color: #ff6633;
|
|
|
|
|
|
}
|
|
|
|
|
|
&.gl-green{
|
|
|
|
|
|
background-color: #00aa00;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-06-10 15:12:17 +08:00
|
|
|
|
</style>
|