feat(workbench): 添加待确认tab并调整绩效管理页面标题
This commit is contained in:
@@ -131,7 +131,8 @@ const mainTabs: Array<{ key: WorkbenchTodoMainTab; label: string }> = [
|
||||
{ key: 'task', label: '任务' },
|
||||
{ key: 'ticket', label: '工单' },
|
||||
{ key: 'personal', label: '我的事项' },
|
||||
{ key: 'approval', label: '待审批' }
|
||||
{ key: 'approval', label: '待审批' },
|
||||
{ key: 'confirm', label: '待确认' }
|
||||
];
|
||||
|
||||
const deadlineFilters: Array<{ key: Exclude<WorkbenchTodoDeadlineFilter, null>; label: string }> = [
|
||||
@@ -144,9 +145,11 @@ const approvalBizTabs: Array<{ key: ApprovalBizType; label: string }> = [
|
||||
{ key: 'weekly', label: '周报' },
|
||||
{ key: 'monthly', label: '月报' },
|
||||
{ key: 'project', label: '项目半月报' },
|
||||
{ key: 'performance', label: '我的绩效' },
|
||||
{ key: 'overtime_application', label: '业务学习' }
|
||||
];
|
||||
const confirmBizTabs: Array<{ key: Extract<ApprovalBizType, 'performance'>; label: string }> = [
|
||||
{ key: 'performance', label: '绩效表' }
|
||||
];
|
||||
|
||||
const hasWorkReportApprovePermission = computed(() => hasButtonPermission('project:work-report:approve'));
|
||||
const hasOvertimeApprovePermission = computed(() => hasButtonPermission('project:overtime-application:approve'));
|
||||
@@ -154,6 +157,14 @@ const hasPerformanceApprovePermission = computed(
|
||||
() =>
|
||||
hasButtonPermission(PerformancePermission.SheetConfirm) && hasButtonPermission(PerformancePermission.SheetReject)
|
||||
);
|
||||
const visibleMainTabs = computed(() =>
|
||||
mainTabs.filter(tab => {
|
||||
if (tab.key === 'confirm') {
|
||||
return hasPerformanceApprovePermission.value;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
);
|
||||
const visibleApprovalBizTabs = computed(() =>
|
||||
approvalBizTabs.filter(tab => {
|
||||
if (tab.key === 'performance') {
|
||||
@@ -167,6 +178,7 @@ const visibleApprovalBizTabs = computed(() =>
|
||||
return hasWorkReportApprovePermission.value;
|
||||
})
|
||||
);
|
||||
const visibleConfirmBizTabs = computed(() => (hasPerformanceApprovePermission.value ? confirmBizTabs : []));
|
||||
|
||||
const myTaskItems = ref<WorkbenchTodoItem[]>([]);
|
||||
// 保留任务原始行,供操作图标按 availableActions 渲染并取 projectId / executionId 调状态变更接口
|
||||
@@ -233,7 +245,7 @@ function getApprovalCategoryLabel(bizType: ApprovalBizType) {
|
||||
if (bizType === 'weekly') return '周报';
|
||||
if (bizType === 'monthly') return '月报';
|
||||
if (bizType === 'project') return '项目半月报';
|
||||
if (bizType === 'performance') return '我的绩效';
|
||||
if (bizType === 'performance') return '绩效表';
|
||||
if (bizType === 'overtime_application') return '业务学习';
|
||||
return '待审批';
|
||||
}
|
||||
@@ -549,7 +561,8 @@ const tabCounts = computed(() => {
|
||||
task: 0,
|
||||
ticket: 0,
|
||||
personal: 0,
|
||||
approval: 0
|
||||
approval: 0,
|
||||
confirm: 0
|
||||
};
|
||||
mergedItems.value.forEach(item => {
|
||||
counts[item.category] += 1;
|
||||
@@ -563,7 +576,8 @@ const tabOverdueCount = computed(() => {
|
||||
task: 0,
|
||||
ticket: 0,
|
||||
personal: 0,
|
||||
approval: 0
|
||||
approval: 0,
|
||||
confirm: 0
|
||||
};
|
||||
mergedItems.value.forEach(item => {
|
||||
if (!isWorkbenchTodoOverdue(item)) return;
|
||||
@@ -580,6 +594,10 @@ const filteredItems = computed(() => {
|
||||
return itemsInTab.value.filter(item => item.approvalBizType === activeApprovalBizType.value);
|
||||
}
|
||||
|
||||
if (activeTab.value === 'confirm') {
|
||||
return itemsInTab.value.filter(item => item.approvalBizType === 'performance');
|
||||
}
|
||||
|
||||
return filterWorkbenchTodoItemsByDeadline(itemsInTab.value, activeDeadlineFilter.value);
|
||||
});
|
||||
|
||||
@@ -650,11 +668,26 @@ watch(
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
watch(
|
||||
visibleMainTabs,
|
||||
tabs => {
|
||||
if (!tabs.some(tab => tab.key === activeTab.value)) {
|
||||
activeTab.value = tabs[0]?.key ?? 'all';
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
function handleSelectTab(key: WorkbenchTodoMainTab) {
|
||||
if (key === 'confirm' && !hasPerformanceApprovePermission.value) return;
|
||||
if (activeTab.value === key) return;
|
||||
activeTab.value = key;
|
||||
if (key === 'approval') activeDeadlineFilter.value = null;
|
||||
activeDeadlineFilter.value = null;
|
||||
if (key === 'confirm') {
|
||||
activeApprovalBizType.value = 'performance';
|
||||
} else if (key === 'approval' && activeApprovalBizType.value === 'performance') {
|
||||
activeApprovalBizType.value = visibleApprovalBizTabs.value[0]?.key ?? 'weekly';
|
||||
}
|
||||
if (key !== 'task' && activeSort.value === 'priority') {
|
||||
activeSort.value = 'deadline';
|
||||
}
|
||||
@@ -1015,12 +1048,12 @@ async function loadPerformanceApprovalItems() {
|
||||
performanceApprovalItems.value = buildWorkbenchTodoItems(
|
||||
data.list.map(item => ({
|
||||
id: `performance-${item.id}`,
|
||||
category: 'approval',
|
||||
categoryLabel: '我的绩效',
|
||||
title: `${item.periodMonth} 绩效待确认`,
|
||||
category: 'confirm',
|
||||
categoryLabel: '绩效表',
|
||||
title: `${item.periodMonth} 绩效表待确认`,
|
||||
createdTime: item.sentTime || item.createTime || item.updateTime || '',
|
||||
deadline: item.sentTime || item.createTime || item.updateTime || null,
|
||||
source: `我的绩效 · ${item.managerName || '--'}`,
|
||||
source: `绩效表 · ${item.managerName || '--'}`,
|
||||
priority: 'mid',
|
||||
approvalBizType: 'performance',
|
||||
approvalBizId: item.id
|
||||
@@ -1124,7 +1157,7 @@ onActivated(refresh);
|
||||
<div class="workbench-todo__tabs">
|
||||
<div class="workbench-todo__tabs-group">
|
||||
<ElTooltip
|
||||
v-for="tab in mainTabs"
|
||||
v-for="tab in visibleMainTabs"
|
||||
:key="tab.key"
|
||||
:content="`已逾期 ${tabOverdueCount[tab.key]} 项,建议尽快处理`"
|
||||
:disabled="tabOverdueCount[tab.key] === 0"
|
||||
@@ -1151,7 +1184,7 @@ onActivated(refresh);
|
||||
</div>
|
||||
|
||||
<div class="workbench-todo__filters">
|
||||
<div v-if="activeTab !== 'approval'" class="workbench-todo__filters-left">
|
||||
<div v-if="activeTab !== 'approval' && activeTab !== 'confirm'" class="workbench-todo__filters-left">
|
||||
<button
|
||||
v-for="filter in deadlineFilters"
|
||||
:key="filter.key"
|
||||
@@ -1163,7 +1196,7 @@ onActivated(refresh);
|
||||
{{ filter.label }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-else class="workbench-todo__filters-left">
|
||||
<div v-else-if="activeTab === 'approval'" class="workbench-todo__filters-left">
|
||||
<button
|
||||
v-for="tab in visibleApprovalBizTabs"
|
||||
:key="tab.key"
|
||||
@@ -1176,6 +1209,19 @@ onActivated(refresh);
|
||||
<span class="workbench-todo__filter-count">{{ approvalBizTabCounts[tab.key] }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div v-else class="workbench-todo__filters-left">
|
||||
<button
|
||||
v-for="tab in visibleConfirmBizTabs"
|
||||
:key="tab.key"
|
||||
type="button"
|
||||
class="workbench-todo__filter"
|
||||
:class="{ 'workbench-todo__filter--active': activeApprovalBizType === tab.key }"
|
||||
@click="handleSelectApprovalBizType(tab.key)"
|
||||
>
|
||||
{{ tab.label }}
|
||||
<span class="workbench-todo__filter-count">{{ approvalBizTabCounts[tab.key] }}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<ElDropdown trigger="click" placement="bottom-end" @command="handleSelectSort">
|
||||
<span class="workbench-todo__sort">
|
||||
|
||||
Reference in New Issue
Block a user