feat(approval): ApprovalBar→ApprovalDrawer 抽屉重设计;e2e/artifacts 不入库
- 新增 ApprovalDrawer(业务表单+轨迹+动态按钮),删除旧 ApprovalBar - approval.ts 增审批上下文接口;Dialog/TodoPage 接线 - .gitignore 排除 e2e/artifacts 测试重跑产物(取消跟踪 72 张截图) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,7 @@ import { fetchTodo, type TodoItem } from '../api/todo';
|
||||
import { fetchDone, type DoneItem } from '../api/done';
|
||||
import { Pagination } from '../components/ui/Pagination';
|
||||
import { Icon } from '../components/ui/Icon';
|
||||
import { ApprovalBar } from '../components/ApprovalBar';
|
||||
import { ApprovalDrawer } from '../components/ApprovalDrawer';
|
||||
|
||||
const PAGE_SIZE = 20;
|
||||
|
||||
@@ -39,8 +39,8 @@ function TodoList({ onRefresh }: { onRefresh?: () => void }) {
|
||||
const [error, setError] = useState('');
|
||||
const [keyword, setKeyword] = useState('');
|
||||
const [page, setPage] = useState(1);
|
||||
// 当前展开办理的 taskId(null = 收起)
|
||||
const [expandedTaskId, setExpandedTaskId] = useState<string | null>(null);
|
||||
// 当前办理的待办项(null = 抽屉关闭)
|
||||
const [activeItem, setActiveItem] = useState<TodoItem | null>(null);
|
||||
|
||||
const load = useCallback(() => {
|
||||
let alive = true;
|
||||
@@ -152,15 +152,13 @@ function TodoList({ onRefresh }: { onRefresh?: () => void }) {
|
||||
) : (
|
||||
pageItems.map((it, idx) => {
|
||||
const taskId = it.taskId ?? String(idx);
|
||||
const isExpanded = expandedTaskId === taskId;
|
||||
return (
|
||||
<>
|
||||
<tr
|
||||
key={taskId}
|
||||
data-testid={`todo-row-${taskId}`}
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={() => openBusiness(it)}
|
||||
>
|
||||
<tr
|
||||
key={taskId}
|
||||
data-testid={`todo-row-${taskId}`}
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={() => openBusiness(it)}
|
||||
>
|
||||
<td>
|
||||
<span className="tag tag-info">
|
||||
{it.businessTable ? String(it.businessTable).slice(0, 8) : '待办'}
|
||||
@@ -198,31 +196,13 @@ function TodoList({ onRefresh }: { onRefresh?: () => void }) {
|
||||
data-testid={`btn-approve-${taskId}`}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setExpandedTaskId(isExpanded ? null : taskId);
|
||||
if (it.taskId) setActiveItem(it);
|
||||
}}
|
||||
>
|
||||
{isExpanded ? '收起' : '办理'}
|
||||
办理
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{isExpanded && it.taskId && (
|
||||
<tr key={`${taskId}-bar`} data-testid={`approval-row-${taskId}`}>
|
||||
<td colSpan={5} style={{ padding: 0, background: 'var(--bg-2)' }}>
|
||||
<ApprovalBar
|
||||
taskId={it.taskId}
|
||||
processInstanceId={it.processInstanceId as string | undefined}
|
||||
businessKey={it.businessKey}
|
||||
tableName={it.businessTable as string | undefined}
|
||||
onCompleted={() => {
|
||||
setExpandedTaskId(null);
|
||||
load();
|
||||
if (onRefresh) onRefresh();
|
||||
}}
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
</>
|
||||
</tr>
|
||||
);
|
||||
})
|
||||
)}
|
||||
@@ -234,6 +214,24 @@ function TodoList({ onRefresh }: { onRefresh?: () => void }) {
|
||||
{!loading && !unavailable && !error && filtered.length > PAGE_SIZE && (
|
||||
<Pagination total={filtered.length} page={safePage} pageSize={PAGE_SIZE} onPage={setPage} />
|
||||
)}
|
||||
|
||||
{/* 审批办理抽屉(WfTemplate 数据驱动:业务单据 + 轨迹 + 动态按钮) */}
|
||||
{activeItem?.taskId && (
|
||||
<ApprovalDrawer
|
||||
taskId={activeItem.taskId}
|
||||
taskName={activeItem.taskName as string | undefined}
|
||||
processInstanceId={activeItem.processInstanceId as string | undefined}
|
||||
businessKey={activeItem.businessKey}
|
||||
businessTable={activeItem.businessTable as string | undefined}
|
||||
businessSummary={activeItem.businessSummary}
|
||||
onClose={() => setActiveItem(null)}
|
||||
onCompleted={() => {
|
||||
setActiveItem(null);
|
||||
load();
|
||||
if (onRefresh) onRefresh();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user