feat(营期管理): 添加取消切换历史营期功能并优化统计模式
- 在API中添加cancelSwitchHistoryCampPeriod方法用于取消切换历史营期 - 将统计模式从'monthly'改为'month'以保持命名一致性 - 优化Calendar组件中历史营期按钮的显示逻辑 - 修复统计模式切换时checkType值的逻辑错误
This commit is contained in:
@@ -80,6 +80,11 @@ export const getHistoryCampPeriod = (params) => {
|
||||
export const switchHistoryCampPeriod = (params) => {
|
||||
return https.post('/api/v1/level_four/overview/switch_history_camp_period', params)
|
||||
}
|
||||
// 返回当前营期 /api/v1/level_four/overview/cancel_switch_history_camp_period
|
||||
export const cancelSwitchHistoryCampPeriod = (params) => {
|
||||
return https.post('/api/v1/level_four/overview/cancel_switch_history_camp_period', params)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</svg>
|
||||
结束营期
|
||||
</button>
|
||||
<button @click="showHistory" class="history-btn">
|
||||
<button v-if="!isViewingHistory" @click="showHistory" class="history-btn">
|
||||
<svg viewBox="0 0 24 24" width="16" height="16">
|
||||
<path fill="currentColor" d="M13,3A9,9 0 0,0 4,12H1L4.89,15.89L4.96,16.03L9,12H6A7,7 0 0,1 13,5A7,7 0 0,1 20,12A7,7 0 0,1 13,19C11.07,19 9.32,18.21 8.06,16.94L6.64,18.36C8.27,20 10.5,21 13,21A9,9 0 0,0 22,12A9,9 0 0,0 13,3Z"/>
|
||||
</svg>
|
||||
@@ -271,7 +271,7 @@
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useUserStore } from '@/stores/user';
|
||||
import {getCampPeriodAdmin,changeCampPeriod,getHistoryCampPeriod,switchHistoryCampPeriod} from '@/api/secondTop.js'
|
||||
import {getCampPeriodAdmin,changeCampPeriod,getHistoryCampPeriod,switchHistoryCampPeriod,cancelSwitchHistoryCampPeriod} from '@/api/secondTop.js'
|
||||
|
||||
// 响应式数据
|
||||
const currentYear = ref(new Date().getFullYear());
|
||||
@@ -582,6 +582,12 @@ const switchToHistoryPeriod = async (period) => {
|
||||
// 方法:返回当前营期
|
||||
const returnToCurrentPeriod = async () => {
|
||||
try {
|
||||
// 调用取消切换历史营期API
|
||||
await cancelSwitchHistoryCampPeriod({
|
||||
"user_name": "潘加俊",
|
||||
"user_level": "4"
|
||||
});
|
||||
|
||||
selectedHistoryPeriod.value = null;
|
||||
isViewingHistory.value = false;
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
:class="['toggle-btn', { active: statsMode === 'period' }]"
|
||||
@click="switchStatsMode('period')"
|
||||
>
|
||||
按期统计
|
||||
按期统计
|
||||
</button>
|
||||
<button
|
||||
:class="['toggle-btn', { active: statsMode === 'monthly' }]"
|
||||
@click="switchStatsMode('monthly')"
|
||||
:class="['toggle-btn', { active: statsMode === 'month' }]"
|
||||
@click="switchStatsMode('month')"
|
||||
>
|
||||
按月统计
|
||||
按月统计
|
||||
</button>
|
||||
|
||||
</div>
|
||||
@@ -118,7 +118,7 @@ import { reactive, ref } from 'vue'
|
||||
import Tooltip from '@/components/Tooltip.vue'
|
||||
|
||||
// 统计模式状态
|
||||
const statsMode = ref('monthly') // 默认按月统计
|
||||
const statsMode = ref('month') // 默认按月统计
|
||||
|
||||
// 定义emit事件
|
||||
const emit = defineEmits(['update-check-type'])
|
||||
@@ -127,7 +127,7 @@ const emit = defineEmits(['update-check-type'])
|
||||
const switchStatsMode = (mode) => {
|
||||
statsMode.value = mode
|
||||
// 向父组件发送事件,修改CheckType的值
|
||||
const checkTypeValue = mode === 'monthly' ? 'period':'month'
|
||||
const checkTypeValue = mode === 'period' ? 'period' : 'month'
|
||||
emit('update-check-type', checkTypeValue)
|
||||
console.log('切换统计模式:', mode, '发送CheckType值:', checkTypeValue)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user