88 WorkflowSelectModal
99} from "@flow-engine/flow-design" ;
1010import { Button , Space , Tabs , type TabsProps } from "antd" ;
11+ import dayjs from "dayjs" ;
1112
1213const TodoPage : React . FC = ( ) => {
1314
@@ -18,10 +19,12 @@ const TodoPage: React.FC = () => {
1819 const [ selectVisible , setSelectVisible ] = React . useState ( false ) ;
1920 const [ approvalVisible , setApprovalVisible ] = React . useState ( false ) ;
2021 const [ workflowCode , setWorkflowCode ] = React . useState < string > ( '' ) ;
22+ const [ currentRecordId , setCurrentRecordId ] = React . useState < string > ( '' ) ;
23+ const [ currentTab , setCurrentTab ] = React . useState < string > ( 'all' ) ;
2124
2225 const columns : TableProps < any > [ 'columns' ] = [
2326 {
24- dataIndex : 'id ' ,
27+ dataIndex : 'recordId ' ,
2528 title : '编号' ,
2629 } ,
2730 {
@@ -31,28 +34,45 @@ const TodoPage: React.FC = () => {
3134 {
3235 dataIndex : 'readTime' ,
3336 title : '读取状态' ,
37+ render : ( text , record ) => {
38+ return text ? '已读' : '未读' ;
39+ }
3440 } ,
3541 {
3642 dataIndex : 'createTime' ,
3743 title : '创建时间' ,
44+ render : ( text , record ) => {
45+ return dayjs ( text ) . format ( 'YYYY-MM-DD HH:mm:ss' ) ;
46+ }
3847 } ,
3948 {
4049 dataIndex : 'currentOperatorId' ,
4150 title : '审批人' ,
51+ hidden : true ,
52+ } ,
53+ {
54+ dataIndex : 'currentOperatorName' ,
55+ title : '审批人' ,
4256 } ,
4357 {
4458 dataIndex : 'recordState' ,
4559 title : '状态' ,
60+ render : ( text , record ) => {
61+ return text ? '已办' : '待办' ;
62+ }
4663 } ,
4764 {
4865 dataIndex : 'option' ,
4966 title : '操作' ,
5067 render : ( value , record ) => {
5168 return (
5269 < Space >
53- < a onClick = { ( ) => {
54-
55- } } > 办理</ a >
70+ < a
71+ onClick = { ( ) => {
72+ setCurrentRecordId ( record . recordId ) ;
73+ setApprovalVisible ( true ) ;
74+ } }
75+ > 办理</ a >
5676 </ Space >
5777 )
5878 }
@@ -104,21 +124,29 @@ const TodoPage: React.FC = () => {
104124 }
105125 ] ;
106126
127+ const reloadCurrentTab = ( ) => {
128+ if ( currentTab === 'all' ) {
129+ actionAll . current ?. reload ( ) ;
130+ }
131+ if ( currentTab === 'done' ) {
132+ actionDone . current ?. reload ( ) ;
133+ }
134+ if ( currentTab === 'todo' ) {
135+ actionTodo . current ?. reload ( ) ;
136+ }
137+ }
138+
139+ React . useEffect ( ( ) => {
140+ reloadCurrentTab ( ) ;
141+ } , [ currentTab ] ) ;
142+
107143 return (
108144 < div >
109145 < Tabs
110146 items = { items }
111147 centered = { true }
112148 onChange = { ( currentKey ) => {
113- if ( currentKey === 'all' ) {
114- actionAll . current ?. reload ( ) ;
115- }
116- if ( currentKey === 'done' ) {
117- actionDone . current ?. reload ( ) ;
118- }
119- if ( currentKey === 'todo' ) {
120- actionTodo . current ?. reload ( ) ;
121- }
149+ setCurrentTab ( currentKey ) ;
122150 } }
123151 tabBarExtraContent = { {
124152 right : (
@@ -147,8 +175,10 @@ const TodoPage: React.FC = () => {
147175 < ApprovalPanelDrawer
148176 workflowCode = { workflowCode }
149177 open = { approvalVisible }
178+ recordId = { currentRecordId }
150179 onClose = { ( ) => {
151180 setApprovalVisible ( false ) ;
181+ reloadCurrentTab ( ) ;
152182 } }
153183 />
154184 </ div >
0 commit comments