|
1 | 1 | import React from "react"; |
2 | | - |
| 2 | +import {list,todo,done} from "@/api/record.ts"; |
| 3 | +import {type ActionType, type TableProps,Table} from "@flow-engine/flow-design"; |
| 4 | +import {Button, Space, Tabs,type TabsProps } from "antd"; |
3 | 5 |
|
4 | 6 | const TodoPage:React.FC = ()=>{ |
5 | 7 |
|
| 8 | + const actionAll = React.useRef<ActionType>(null); |
| 9 | + const actionTodo = React.useRef<ActionType>(null); |
| 10 | + const actionDone = React.useRef<ActionType>(null); |
| 11 | + |
| 12 | + const columns: TableProps<any>['columns'] = [ |
| 13 | + { |
| 14 | + dataIndex: 'id', |
| 15 | + title: '编号', |
| 16 | + }, |
| 17 | + { |
| 18 | + dataIndex: 'title', |
| 19 | + title: '流程名称', |
| 20 | + }, |
| 21 | + { |
| 22 | + dataIndex: 'readTime', |
| 23 | + title: '读取状态', |
| 24 | + }, |
| 25 | + { |
| 26 | + dataIndex: 'createTime', |
| 27 | + title: '创建时间', |
| 28 | + }, |
| 29 | + { |
| 30 | + dataIndex: 'currentOperatorId', |
| 31 | + title: '审批人', |
| 32 | + }, |
| 33 | + { |
| 34 | + dataIndex: 'recordState', |
| 35 | + title: '状态', |
| 36 | + }, |
| 37 | + { |
| 38 | + dataIndex: 'option', |
| 39 | + title: '操作', |
| 40 | + render: (value, record) => { |
| 41 | + return ( |
| 42 | + <Space> |
| 43 | + <a onClick={() => { |
| 44 | + |
| 45 | + }}>办理</a> |
| 46 | + </Space> |
| 47 | + ) |
| 48 | + } |
| 49 | + } |
| 50 | + ]; |
| 51 | + |
| 52 | + |
| 53 | + const items:TabsProps['items'] = [ |
| 54 | + { |
| 55 | + key:'all', |
| 56 | + label:'全部流程', |
| 57 | + children:( |
| 58 | + <Table |
| 59 | + rowKey={"id"} |
| 60 | + actionType={actionAll} |
| 61 | + columns={columns} |
| 62 | + request={(request) => { |
| 63 | + return list(request); |
| 64 | + }} |
| 65 | + /> |
| 66 | + ) |
| 67 | + }, |
| 68 | + { |
| 69 | + key:'todo', |
| 70 | + label:'我的待办', |
| 71 | + children:( |
| 72 | + <Table |
| 73 | + rowKey={"id"} |
| 74 | + actionType={actionTodo} |
| 75 | + columns={columns} |
| 76 | + request={(request) => { |
| 77 | + return todo(request); |
| 78 | + }} |
| 79 | + /> |
| 80 | + ) |
| 81 | + }, |
| 82 | + { |
| 83 | + key:'done', |
| 84 | + label:'我的已办', |
| 85 | + children:( |
| 86 | + <Table |
| 87 | + rowKey={"id"} |
| 88 | + actionType={actionDone} |
| 89 | + columns={columns} |
| 90 | + request={(request) => { |
| 91 | + return done(request); |
| 92 | + }} |
| 93 | + /> |
| 94 | + ) |
| 95 | + } |
| 96 | + ] |
| 97 | + |
6 | 98 | return ( |
7 | 99 | <div> |
8 | | - todo |
| 100 | + <Tabs |
| 101 | + items={items} |
| 102 | + centered={true} |
| 103 | + onChange={(currentKey)=>{ |
| 104 | + if(currentKey==='all'){ |
| 105 | + actionAll.current?.reload(); |
| 106 | + } |
| 107 | + if(currentKey==='done'){ |
| 108 | + actionDone.current?.reload(); |
| 109 | + } |
| 110 | + if(currentKey==='todo'){ |
| 111 | + actionTodo.current?.reload(); |
| 112 | + } |
| 113 | + }} |
| 114 | + tabBarExtraContent={{ |
| 115 | + right:( |
| 116 | + <Button |
| 117 | + key={"create"} |
| 118 | + type={'primary'} |
| 119 | + onClick={() => { |
| 120 | + |
| 121 | + }}>发起流程</Button> |
| 122 | + ) |
| 123 | + }} |
| 124 | + /> |
9 | 125 | </div> |
10 | 126 | ) |
11 | 127 | } |
|
0 commit comments