|
@@ -1,4 +1,4 @@
|
|
-import { useRef, useState, useMemo, useContext } from 'react'
|
|
|
|
|
|
+import { useRef, useState, useMemo, useEffect, useContext } from 'react'
|
|
import { Button, Drawer, Radio, Select, Spin, Tag } from 'antd'
|
|
import { Button, Drawer, Radio, Select, Spin, Tag } from 'antd'
|
|
import { Actions, FlowContext } from '../../context'
|
|
import { Actions, FlowContext } from '../../context'
|
|
import debounce from 'lodash/debounce'
|
|
import debounce from 'lodash/debounce'
|
|
@@ -20,12 +20,19 @@ const FlowDrawer = () => {
|
|
const { drawerConfig } = flowState
|
|
const { drawerConfig } = flowState
|
|
|
|
|
|
const fetchRef = useRef(0)
|
|
const fetchRef = useRef(0)
|
|
|
|
+
|
|
const [state, setState] = useState({
|
|
const [state, setState] = useState({
|
|
approvalType: ApprovalType.TARGET,
|
|
approvalType: ApprovalType.TARGET,
|
|
fetching: false,
|
|
fetching: false,
|
|
options: [],
|
|
options: [],
|
|
staffOptions: []
|
|
staffOptions: []
|
|
})
|
|
})
|
|
|
|
+ useEffect(() => {
|
|
|
|
+ if (drawerConfig.nodeId && drawerConfig.visible) {
|
|
|
|
+ const defaultStaffIds = flowState.flowData.get(drawerConfig.nodeId)?.staffOptions || []
|
|
|
|
+ setState({ ...state, staffOptions: defaultStaffIds })
|
|
|
|
+ }
|
|
|
|
+ }, [drawerConfig])
|
|
|
|
|
|
const handleCancel = () => dispatch({ type: Actions.CLOSE_MODAL })
|
|
const handleCancel = () => dispatch({ type: Actions.CLOSE_MODAL })
|
|
|
|
|
|
@@ -101,6 +108,7 @@ const FlowDrawer = () => {
|
|
<Drawer
|
|
<Drawer
|
|
visible={drawerConfig.visible}
|
|
visible={drawerConfig.visible}
|
|
onClose={handleCancel}
|
|
onClose={handleCancel}
|
|
|
|
+ destroyOnClose
|
|
footer={
|
|
footer={
|
|
<div className="flex justify-end">
|
|
<div className="flex justify-end">
|
|
<Button onClick={handleCancel}>取消</Button>
|
|
<Button onClick={handleCancel}>取消</Button>
|