销售首页显示自己申报项目的审批进度(阶段+当前审批人)

This commit is contained in:
freedakgmail
2026-06-14 09:49:50 +08:00
parent 026652e4e3
commit b43452f981
+32 -4
View File
@@ -170,8 +170,8 @@ export function Dashboard(): JSX.Element {
} else {
setDrafts([]);
}
// 审批人指派风控/管理层待办过滤用)
if (role === '风控' || role === '管理层') {
// 审批人指派风控/管理层用于待办过滤;销售用于查看自己项目的审批进度
if (role === '风控' || role === '管理层' || role === '商务/销售') {
fetchAssignments().then(setAssignments).catch(() => setAssignments({}));
} else {
setAssignments({});
@@ -323,6 +323,34 @@ export function Dashboard(): JSX.Element {
const todoCount = summary.byStatus[TODO_STATUS[role] ?? ''] ?? 0;
const isSales = role === '商务/销售';
// 销售首页:为自己的项目显示审批进度(阶段 + 当前审批人)。
const approvalProgressCol: TableColumn<AssessmentListItem> = {
key: 'progress',
header: '审批进度',
render: (r) => {
const a = assignments[r.id];
const stage = (() => {
switch (r.status) {
case 'draft': return { text: '待申报(草稿)', sub: '尚未报送,点「查看」进入后申报', color: '#64748B' };
case 'pending_risk_review': return { text: '风控审核中', sub: a?.riskReviewerName ? `审批人:${a.riskReviewerName}` : '待分配风控', color: '#B45309' };
case 'risk_reviewed':
case 'pending_management_approval': return { text: '管理层审批中', sub: a?.managerName ? `审批人:${a.managerName}` : '待分配管理层', color: '#4F46E5' };
case 'approved': return { text: '已通过 ✓', sub: '审批完成', color: '#15803D' };
case 'rejected': return { text: '已驳回', sub: '请修改后重新提交', color: '#BE123C' };
case 'abandoned': return { text: '已放弃', sub: '流程终止', color: '#475569' };
default: return { text: r.status, sub: '', color: colorVar('color.text.secondary') };
}
})();
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: 2, minWidth: 120 }}>
<span style={{ ...typographyStyle('caption'), fontWeight: 700, color: stage.color }}>{stage.text}</span>
{stage.sub && <span style={{ ...typographyStyle('caption'), color: colorVar('color.text.secondary'), fontSize: '11px' }}>{stage.sub}</span>}
</div>
);
},
};
const historyColumns = isSales ? [...columns.slice(0, -1), approvalProgressCol, columns[columns.length - 1]!] : columns;
const summaryItems = [
{ label: isSales ? '我的评估' : '全部评估', value: summary.total, tone: colorVar('color.brand.primary') },
{ label: isSales ? '被驳回(待处理)' : '我的待办', value: todoCount, tone: colorVar('color.risk.high') },
@@ -599,7 +627,7 @@ export function Dashboard(): JSX.Element {
<Card
title={
<div style={{ display: 'flex', flexDirection: 'column', gap: `${space(1)}px` }}>
<span></span>
<span>{isSales ? '我的申报 · 审批进度' : '评估历史'}</span>
<span style={{ ...typographyStyle('caption'), color: colorVar('color.text.secondary'), fontWeight: 400 }}>
· {total}
</span>
@@ -690,7 +718,7 @@ export function Dashboard(): JSX.Element {
) : (
<>
<Table
columns={columns}
columns={historyColumns}
data={items}
getRowKey={(row) => row.id}
caption="全部评估记录列表"