You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.1 KiB
80 lines
2.1 KiB
<template>
|
|
<view class="padding">
|
|
<!-- 日期组件 -->
|
|
<date-selector @change="getData" />
|
|
<!-- 健康上报组件 -->
|
|
<health-data />
|
|
<!-- 校园轨迹组件 -->
|
|
<location-map />
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapActions } from 'vuex';
|
|
import DateSelector from './components/date-selector';
|
|
import HealthData from './components/health-data';
|
|
import LocationMap from './components/location-map';
|
|
|
|
export default {
|
|
name: 'Statistics',
|
|
components: { DateSelector, LocationMap, HealthData },
|
|
|
|
onLoad() {
|
|
// 初始加载今天的数据
|
|
const start = this.$moment().format('YYYY-MM-DD');
|
|
const end = this.$moment().format('YYYY-MM-DD');
|
|
this.getData(start, end);
|
|
},
|
|
|
|
methods: {
|
|
...mapActions('statistics', ['getSchoolSigns', 'getSchoolSignsNumber']),
|
|
/**
|
|
* 获取数据
|
|
* @param {string} start 开始时间 yy-mm-dd
|
|
* @param {string} end 截止时间 yy-mm-dd
|
|
*/
|
|
getData(start, end) {
|
|
const startTime =
|
|
this.$moment(start)
|
|
.startOf('day')
|
|
.format('x') - 0;
|
|
const endTime =
|
|
this.$moment(end)
|
|
.endOf('day')
|
|
.format('x') - 0;
|
|
// 获取校园打卡的数据
|
|
this.getSchoolSignsData(startTime, endTime);
|
|
// 获取健康上报数目数据
|
|
this.getSchoolSignsNumberData(startTime, endTime);
|
|
},
|
|
|
|
/**
|
|
* 获取校园打卡的数据
|
|
* @param {number} startTime 开始时间
|
|
* @param {number} endTime 截止时间
|
|
*/
|
|
getSchoolSignsData(startTime, endTime) {
|
|
try {
|
|
const params = { param: { startTime, endTime } };
|
|
this.getSchoolSigns(params);
|
|
} catch (error) {
|
|
console.log('getSchoolSignsData error: ', error);
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 获取健康上报的数目数据
|
|
* @param {number} startTime 开始时间
|
|
* @param {number} endTime 截止时间
|
|
*/
|
|
getSchoolSignsNumberData(startTime, endTime) {
|
|
try {
|
|
const params = { param: { startTime, endTime } };
|
|
this.getSchoolSignsNumber(params);
|
|
} catch (error) {
|
|
console.log('getSchoolSignsNumberData error: ', error);
|
|
}
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|