瀏覽代碼

feat: 111

lanjianrong 3 年之前
父節點
當前提交
cecd04896e

+ 9 - 1
src/components/Flow/src/components/Drawer/index.tsx

@@ -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 { Actions, FlowContext } from '../../context'
 import debounce from 'lodash/debounce'
@@ -20,12 +20,19 @@ const FlowDrawer = () => {
   const { drawerConfig } = flowState
 
   const fetchRef = useRef(0)
+
   const [state, setState] = useState({
     approvalType: ApprovalType.TARGET,
     fetching: false,
     options: [],
     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 })
 
@@ -101,6 +108,7 @@ const FlowDrawer = () => {
     <Drawer
       visible={drawerConfig.visible}
       onClose={handleCancel}
+      destroyOnClose
       footer={
         <div className="flex justify-end">
           <Button onClick={handleCancel}>取消</Button>

+ 2 - 2
src/components/Flow/src/components/Edge/index.less

@@ -8,10 +8,10 @@
   justify-content: center;
   padding: 10px;
   :global(.ant-btn) {
-    box-shadow: 0 2px 4px 0 rgb(0 0 0 / 10%);
+    // box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
     transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
     &:hover {
-      box-shadow: 0 13px 27px 0 rgb(0 0 0 / 10%);
+      // box-shadow: 0 13px 27px 0 rgba(0, 0, 0, 0.1);
       transform: scale(1.3);
     }
   }

+ 1 - 1
src/components/Flow/src/components/Edge/index.tsx

@@ -38,7 +38,7 @@ const renderMenu = ({ dispatch, elements, togglePopver, id, flowInstance, sort }
     const uid = buildUUID()
     const newNode = {
       id: uid,
-      tpye: 'input',
+      type: 'input',
       // position: { x: 400, y: 0 },
       data: {}
     }

+ 1 - 1
src/components/Flow/src/context/index.tsx

@@ -46,7 +46,7 @@ const initialState: InitialState = {
   drawerConfig: {
     visible: false,
     nodeType: '',
-    nodeID: ''
+    nodeId: ''
   },
   flowInstance: null
 }