|
@@ -16,19 +16,20 @@ import {
|
|
|
moveSortOrganizationalStructure
|
|
|
} from '@/services/api/institution'
|
|
|
import OrganizationModal from './OrganizationModal'
|
|
|
+import { ModalType } from '@/utils/enum'
|
|
|
|
|
|
type OrganizationProps = {
|
|
|
dataID: string
|
|
|
structureType: string
|
|
|
}
|
|
|
|
|
|
-export enum OrganizationModalEnum {
|
|
|
- ADD = 1,
|
|
|
- ADDITEM = 2,
|
|
|
- RENAME = 3,
|
|
|
- DEL = 4,
|
|
|
- MOVE = 5
|
|
|
-}
|
|
|
+// export enum OrganizationModalEnum {
|
|
|
+// ADD = 1,
|
|
|
+// ADDITEM = 2,
|
|
|
+// RENAME = 3,
|
|
|
+// DEL = 4,
|
|
|
+// MOVE = 5
|
|
|
+// }
|
|
|
|
|
|
const Organization: React.FC<OrganizationProps> = ({ dataID, structureType }) => {
|
|
|
const tRef = useRef<ActionType>(null)
|
|
@@ -38,7 +39,8 @@ const Organization: React.FC<OrganizationProps> = ({ dataID, structureType }) =>
|
|
|
expandTreeIds: [],
|
|
|
defaultFormData: null,
|
|
|
parentID: '',
|
|
|
- modalType: OrganizationModalEnum.ADD,
|
|
|
+ currentModalType: ModalType.ADD,
|
|
|
+ typeEum: '1',
|
|
|
accountTotal: null
|
|
|
})
|
|
|
|
|
@@ -98,8 +100,7 @@ const Organization: React.FC<OrganizationProps> = ({ dataID, structureType }) =>
|
|
|
title="确认上移吗?"
|
|
|
okText="确认"
|
|
|
cancelText="取消"
|
|
|
- onConfirm={() => tryMoveOrganization({ ID: record.ID, operation: 'up' })}
|
|
|
- >
|
|
|
+ onConfirm={() => tryMoveOrganization({ ID: record.ID, operation: 'up' })}>
|
|
|
<Tooltip placement="top" title="上移">
|
|
|
<ArrowUpOutlined />
|
|
|
</Tooltip>
|
|
@@ -112,8 +113,7 @@ const Organization: React.FC<OrganizationProps> = ({ dataID, structureType }) =>
|
|
|
title="确认下移吗?"
|
|
|
okText="确认"
|
|
|
cancelText="取消"
|
|
|
- onConfirm={() => tryMoveOrganization({ ID: record.ID, operation: 'down' })}
|
|
|
- >
|
|
|
+ onConfirm={() => tryMoveOrganization({ ID: record.ID, operation: 'down' })}>
|
|
|
<Tooltip placement="top" title="下移">
|
|
|
<ArrowDownOutlined />
|
|
|
</Tooltip>
|
|
@@ -128,10 +128,10 @@ const Organization: React.FC<OrganizationProps> = ({ dataID, structureType }) =>
|
|
|
...state,
|
|
|
visible: true,
|
|
|
defaultFormData: record,
|
|
|
- modalType: OrganizationModalEnum.MOVE
|
|
|
+ currentModalType: ModalType.MOVE,
|
|
|
+ typeEum: ModalType.MOVE
|
|
|
})
|
|
|
- }}
|
|
|
- >
|
|
|
+ }}>
|
|
|
<Tooltip placement="top" title="移动">
|
|
|
<SwapOutlined />
|
|
|
</Tooltip>
|
|
@@ -149,10 +149,10 @@ const Organization: React.FC<OrganizationProps> = ({ dataID, structureType }) =>
|
|
|
structureType: structureType,
|
|
|
parentID: record.ID
|
|
|
},
|
|
|
- modalType: OrganizationModalEnum.ADDITEM
|
|
|
+ currentModalType: ModalType.ADD,
|
|
|
+ typeEum: ModalType.ADDITEM
|
|
|
})
|
|
|
- }}
|
|
|
- >
|
|
|
+ }}>
|
|
|
<Tooltip placement="top" title="添加子项">
|
|
|
<PlusSquareOutlined />
|
|
|
</Tooltip>
|
|
@@ -164,10 +164,10 @@ const Organization: React.FC<OrganizationProps> = ({ dataID, structureType }) =>
|
|
|
...state,
|
|
|
visible: true,
|
|
|
defaultFormData: record,
|
|
|
- modalType: OrganizationModalEnum.RENAME
|
|
|
+ currentModalType: ModalType.UPDATE,
|
|
|
+ typeEum: ModalType.UPDATE
|
|
|
})
|
|
|
- }}
|
|
|
- >
|
|
|
+ }}>
|
|
|
<Tooltip placement="top" title="重命名">
|
|
|
<EditOutlined />
|
|
|
</Tooltip>
|
|
@@ -181,7 +181,8 @@ const Organization: React.FC<OrganizationProps> = ({ dataID, structureType }) =>
|
|
|
...state,
|
|
|
visible: true,
|
|
|
defaultFormData: record,
|
|
|
- modalType: OrganizationModalEnum.DEL,
|
|
|
+ currentModalType: ModalType.DEL,
|
|
|
+ typeEum: ModalType.DEL,
|
|
|
accountTotal: record.accountTotal
|
|
|
})
|
|
|
}}
|
|
@@ -229,22 +230,23 @@ const Organization: React.FC<OrganizationProps> = ({ dataID, structureType }) =>
|
|
|
setState({
|
|
|
...state,
|
|
|
visible: true,
|
|
|
- modalType: OrganizationModalEnum.ADD,
|
|
|
+ currentModalType: ModalType.ADD,
|
|
|
+ typeEum: ModalType.ADD,
|
|
|
defaultFormData: {
|
|
|
dataID: dataID,
|
|
|
structureType: structureType,
|
|
|
parentID: state.parentID
|
|
|
}
|
|
|
})
|
|
|
- }
|
|
|
- >
|
|
|
+ }>
|
|
|
添加组织
|
|
|
</Button>
|
|
|
]
|
|
|
}}
|
|
|
/>
|
|
|
<OrganizationModal
|
|
|
- type={state.modalType}
|
|
|
+ type={state.currentModalType}
|
|
|
+ typeEum={state.typeEum}
|
|
|
visible={state.visible}
|
|
|
setVisible={(visible: boolean) => setState({ ...state, visible })}
|
|
|
reload={() => {
|