|
@@ -48,29 +48,29 @@
|
|
|
<view class="stat-board-content">
|
|
<view class="stat-board-content">
|
|
|
<view class="stat-item">
|
|
<view class="stat-item">
|
|
|
<view class="stat-item-label">{{ currentTabIndex === 0 ? '本月' : '全年' }}需打卡</view>
|
|
<view class="stat-item-label">{{ currentTabIndex === 0 ? '本月' : '全年' }}需打卡</view>
|
|
|
- <view class="stat-item-value">{{ statData.punchInTotalCount }}次</view>
|
|
|
|
|
|
|
+ <view class="stat-item-value">{{ statData.punchInTotalCount ? statData.punchInTotalCount : 0 }}次</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="stat-item">
|
|
<view class="stat-item">
|
|
|
<view class="stat-item-label">{{ currentTabIndex === 0 ? '本月' : '全年' }}已打卡</view>
|
|
<view class="stat-item-label">{{ currentTabIndex === 0 ? '本月' : '全年' }}已打卡</view>
|
|
|
- <view class="stat-item-value">{{ statData.punchInCount }}次</view>
|
|
|
|
|
|
|
+ <view class="stat-item-value">{{ statData.punchInCount ? statData.punchInCount : 0 }}次</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="stat-item">
|
|
<view class="stat-item">
|
|
|
<view class="stat-item-label">完成打卡</view>
|
|
<view class="stat-item-label">完成打卡</view>
|
|
|
- <view class="stat-item-value">{{ statData.punchInDoneCount }}次</view>
|
|
|
|
|
|
|
+ <view class="stat-item-value">{{ statData.punchInDoneCount ? statData.punchInDoneCount : 0 }}次</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="stat-board-content stat-mt16">
|
|
<view class="stat-board-content stat-mt16">
|
|
|
<view class="stat-item">
|
|
<view class="stat-item">
|
|
|
<view class="stat-item-label">打卡率</view>
|
|
<view class="stat-item-label">打卡率</view>
|
|
|
- <view class="stat-item-value">{{ statData.punchInRate }}%</view>
|
|
|
|
|
|
|
+ <view class="stat-item-value">{{ statData.punchInRate ? statData.punchInRate : 0 }}%</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="stat-item">
|
|
<view class="stat-item">
|
|
|
<view class="stat-item-label">完成率</view>
|
|
<view class="stat-item-label">完成率</view>
|
|
|
- <view class="stat-item-value">{{ statData.punchInDoneRate }}%</view>
|
|
|
|
|
|
|
+ <view class="stat-item-value">{{ statData.punchInDoneRate ? statData.punchInDoneRate : 0 }}%</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="stat-item">
|
|
<view class="stat-item">
|
|
|
<view class="stat-item-label">{{ currentTabIndex === 0 ? '本月' : '全年' }}获取积分数</view>
|
|
<view class="stat-item-label">{{ currentTabIndex === 0 ? '本月' : '全年' }}获取积分数</view>
|
|
|
- <view class="stat-item-value">{{ statData.points }}</view>
|
|
|
|
|
|
|
+ <view class="stat-item-value">{{ statData.points ? statData.points : 0 }}</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -81,27 +81,32 @@
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<uni-section title="打卡日志" padding="16px" type="line">
|
|
<uni-section title="打卡日志" padding="16px" type="line">
|
|
|
- <uni-list>
|
|
|
|
|
- <uni-list-item v-for="taskHistory in statData.piTaskHistoryStatVOS" :key="taskHistory.punchInDate">
|
|
|
|
|
|
|
+ <uni-list v-if="statData.piTaskHistoryVOS && statData.piTaskHistoryVOS.length > 0">
|
|
|
|
|
+ <uni-list-item v-for="taskHistory in statData.piTaskHistoryVOS" :key="taskHistory.punchInDate">
|
|
|
<template v-slot:body>
|
|
<template v-slot:body>
|
|
|
{{ taskHistory.punchInDate }}
|
|
{{ taskHistory.punchInDate }}
|
|
|
<span v-if="taskHistory.punchInResult == PUNCH_IN_RESULT.DONE"> 完成打卡</span>
|
|
<span v-if="taskHistory.punchInResult == PUNCH_IN_RESULT.DONE"> 完成打卡</span>
|
|
|
<span v-else> 未完成打卡</span>
|
|
<span v-else> 未完成打卡</span>
|
|
|
<span v-if="taskHistory.punchInMethod == PUNCH_IN_METHOD.COUNT">,打卡{{ taskHistory.countTrack }}次</span>
|
|
<span v-if="taskHistory.punchInMethod == PUNCH_IN_METHOD.COUNT">,打卡{{ taskHistory.countTrack }}次</span>
|
|
|
<span v-if="taskHistory.punchInMethod == PUNCH_IN_METHOD.TIMING">,打卡时长{{ taskHistory.timeTrack }}</span>
|
|
<span v-if="taskHistory.punchInMethod == PUNCH_IN_METHOD.TIMING">,打卡时长{{ taskHistory.timeTrack }}</span>
|
|
|
|
|
+ <span v-if="taskHistory.settleResult == SETTLE_RESULT.SETTLED">,已结算,结算积分:{{ taskHistory.settlePoints
|
|
|
|
|
+ }}</span>
|
|
|
|
|
+ <span v-if="taskHistory.settleResult == SETTLE_RESULT.NOT_SETTLED">,无需结算</span>
|
|
|
|
|
+ <span v-if="!taskHistory.settleResult">,未结算</span>
|
|
|
</template>
|
|
</template>
|
|
|
</uni-list-item>
|
|
</uni-list-item>
|
|
|
</uni-list>
|
|
</uni-list>
|
|
|
- <uni-load-more status="no-more" v-if="statData.piTaskHistoryStatVOS.length == 0" />
|
|
|
|
|
|
|
+ <uni-load-more status="no-more" v-if="!statData.piTaskHistoryVOS || statData.piTaskHistoryVOS.length == 0" />
|
|
|
</uni-section>
|
|
</uni-section>
|
|
|
|
|
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { ref } from 'vue';
|
|
import { ref } from 'vue';
|
|
|
-import { onLoad, onPullDownRefresh } from '@dcloudio/uni-app';
|
|
|
|
|
|
|
+import { onLoad, onShow, onPullDownRefresh } from '@dcloudio/uni-app';
|
|
|
import { punchInApi } from '@/apis/apis';
|
|
import { punchInApi } from '@/apis/apis';
|
|
|
import { PUNCH_IN_RESULT, PUNCH_IN_METHOD, STAT_PERIOD } from '@/common/enums';
|
|
import { PUNCH_IN_RESULT, PUNCH_IN_METHOD, STAT_PERIOD } from '@/common/enums';
|
|
|
|
|
+import { SETTLE_RESULT } from '@/common/enums';
|
|
|
|
|
|
|
|
// 属性
|
|
// 属性
|
|
|
/**
|
|
/**
|
|
@@ -144,7 +149,7 @@ const defaultStatData = {
|
|
|
punchInRate: 0,
|
|
punchInRate: 0,
|
|
|
punchInDoneRate: 0,
|
|
punchInDoneRate: 0,
|
|
|
points: 0,
|
|
points: 0,
|
|
|
- piTaskHistoryStatVOS: [],
|
|
|
|
|
|
|
+ piTaskHistoryVOS: [],
|
|
|
lineVO: {}
|
|
lineVO: {}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -245,14 +250,11 @@ const plusYear = (num) => {
|
|
|
* 加载数据
|
|
* 加载数据
|
|
|
*/
|
|
*/
|
|
|
const loadData = async () => {
|
|
const loadData = async () => {
|
|
|
- // chatLoadingType.value = 2;
|
|
|
|
|
let res = await punchInApi.queryStat({
|
|
let res = await punchInApi.queryStat({
|
|
|
"statPeriod": currentStatPeriod.value,
|
|
"statPeriod": currentStatPeriod.value,
|
|
|
"statTime": currentStatPeriod.value == STAT_PERIOD.MONTH ? currentMonth.value : currentYear.value,
|
|
"statTime": currentStatPeriod.value == STAT_PERIOD.MONTH ? currentMonth.value : currentYear.value,
|
|
|
"taskId": currentTaskId.value
|
|
"taskId": currentTaskId.value
|
|
|
});
|
|
});
|
|
|
- // chatLoadingType.value = 0;
|
|
|
|
|
- // 统计数据为空,则使用默认数据
|
|
|
|
|
statData.value = res ? res : defaultStatData;
|
|
statData.value = res ? res : defaultStatData;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -267,10 +269,16 @@ onLoad(async (e) => {
|
|
|
|
|
|
|
|
if (e.id) {
|
|
if (e.id) {
|
|
|
currentTaskId.value = e.id;
|
|
currentTaskId.value = e.id;
|
|
|
- loadData();
|
|
|
|
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
|
|
+ title: e.title
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+onShow(() => {
|
|
|
|
|
+ loadData();
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
onPullDownRefresh(() => {
|
|
onPullDownRefresh(() => {
|
|
|
loadData();
|
|
loadData();
|
|
|
uni.stopPullDownRefresh();
|
|
uni.stopPullDownRefresh();
|