|
1 | 1 | import React, {useContext} from "react";
|
| 2 | +import FlowButton from "@/components/flow/components/FlowButton"; |
2 | 3 | import {FlowViewReactContext} from "@/components/flow/view";
|
3 |
| -import {useSelector} from "react-redux"; |
4 |
| -import {FlowReduxState} from "@/components/flow/store/FlowSlice"; |
5 |
| -import {Button} from "antd"; |
6 | 4 |
|
7 | 5 | interface FlowHeaderProps{
|
8 | 6 | setVisible:(visible:boolean)=>void;
|
9 | 7 | }
|
10 | 8 |
|
11 |
| -const FlowHeader:React.FC<FlowHeaderProps> = (props) => { |
| 9 | +// 流程详情header头信息 |
| 10 | +const FlowHeader:React.FC<FlowHeaderProps> = (props)=>{ |
12 | 11 | const flowViewReactContext = useContext(FlowViewReactContext);
|
| 12 | + const flowRecordContext = flowViewReactContext?.flowRecordContext; |
| 13 | + const currentNode = flowRecordContext?.getCurrentNode(); |
13 | 14 |
|
14 |
| - const flowRecordContext = flowViewReactContext?.flowRecordContext; |
15 |
| - |
16 |
| - const flowButtonClickContext = flowViewReactContext?.flowButtonClickContext; |
17 |
| - |
18 |
| - const buttons = flowRecordContext?.getFlowButtons()||[]; |
19 |
| - const requestLoading = useSelector((state: FlowReduxState) => state.flow.requestLoading); |
20 |
| - const contentHiddenVisible = useSelector((state: FlowReduxState) => state.flow.contentHiddenVisible); |
21 |
| - |
22 |
| - const style = contentHiddenVisible ? {"display":"none"} : {}; |
23 |
| - |
24 |
| - if(flowRecordContext?.isEditable()){ |
25 |
| - return ( |
26 |
| - <div className={"flow-view-header"} style={style}> |
27 |
| - {buttons.map((item) => { |
28 |
| - const style = item.style && JSON.parse(item.style) || {}; |
29 |
| - return ( |
30 |
| - <Button |
31 |
| - loading={requestLoading} |
32 |
| - key={item.id} |
33 |
| - className={"flow-view-header-button"} |
34 |
| - style={{ |
35 |
| - ...style |
36 |
| - }} |
37 |
| - onClick={() => { |
38 |
| - flowButtonClickContext?.handlerClick(item); |
39 |
| - }} |
40 |
| - >{item.name}</Button> |
41 |
| - ) |
42 |
| - })} |
43 |
| - |
44 |
| - <Button |
45 |
| - color={"default"} |
46 |
| - className={"flow-view-header-button"} |
47 |
| - onClick={() => { |
48 |
| - props.setVisible(false); |
49 |
| - }} |
50 |
| - > |
51 |
| - 关闭 |
52 |
| - </Button> |
53 |
| - |
| 15 | + return ( |
| 16 | + <div className={"flow-header"}> |
| 17 | + <div className={"flow-header-left"}> |
| 18 | + {currentNode && currentNode.name} |
54 | 19 | </div>
|
55 |
| - ) |
56 |
| - }else { |
57 |
| - return ( |
58 |
| - <div className={"flow-view-header"} style={style}> |
59 |
| - <Button |
60 |
| - loading={requestLoading} |
61 |
| - style={{ |
62 |
| - marginLeft:'15%', |
63 |
| - marginRight:'15%' |
64 |
| - }} |
65 |
| - className={"flow-view-header-button"} |
66 |
| - onClick={() => { |
67 |
| - props.setVisible(false); |
68 |
| - }} |
69 |
| - >关闭</Button> |
| 20 | + <div className={"flow-header-right"}> |
| 21 | + <FlowButton setVisible={props.setVisible}/> |
70 | 22 | </div>
|
71 |
| - ) |
72 |
| - } |
| 23 | + </div> |
| 24 | + ) |
73 | 25 | }
|
74 | 26 |
|
75 | 27 | export default FlowHeader;
|
0 commit comments