|
@@ -37,14 +37,16 @@ const OrganizationModal: React.FC<OrganizationModalProps> = ({
|
|
|
defaultFormData,
|
|
|
treeSource,
|
|
|
accountTotal,
|
|
|
+ delName,
|
|
|
reload
|
|
|
}) => {
|
|
|
- console.log(treeSource)
|
|
|
const ref = useRef<FormInstance>(null)
|
|
|
const [state, setState] = useState({
|
|
|
organizationList: []
|
|
|
})
|
|
|
|
|
|
+ const { TreeNode } = TreeSelect
|
|
|
+
|
|
|
const titleTypeEunm = {
|
|
|
1: {
|
|
|
key: 'ADD',
|
|
@@ -135,6 +137,32 @@ const OrganizationModal: React.FC<OrganizationModalProps> = ({
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+ const onChange = () => {
|
|
|
+ if (!state.organizationList?.length) {
|
|
|
+ tryOrganizationList()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const onNodeChange = (value, labelList) => {
|
|
|
+ onChange(value, { value, label: labelList[0] })
|
|
|
+ }
|
|
|
+ const renderTreeNodes = data =>
|
|
|
+ data.map(item => {
|
|
|
+ if (item.ID === delName) {
|
|
|
+ console.log('我是ID')
|
|
|
+ }
|
|
|
+ if (item.children) {
|
|
|
+ item.disabled = true
|
|
|
+ return (
|
|
|
+ <TreeNode {...item} disabled={item.disabled}>
|
|
|
+ {renderTreeNodes(item.children)}
|
|
|
+ </TreeNode>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ return <TreeNode {...item} />
|
|
|
+ })
|
|
|
+
|
|
|
return (
|
|
|
<Modal
|
|
|
width="35vw"
|
|
@@ -174,12 +202,22 @@ const OrganizationModal: React.FC<OrganizationModalProps> = ({
|
|
|
<div>
|
|
|
<p>请设置包含人员至新的组织架构中:</p>
|
|
|
<Form.Item label="目标架构" name="moveID">
|
|
|
- <TreeSelect
|
|
|
+ {treeSource?.length && (
|
|
|
+ <TreeSelect
|
|
|
+ style={{ width: '100%' }}
|
|
|
+ placeholder="请选择目标架构"
|
|
|
+ treeDefaultExpandAll
|
|
|
+ treeNodeFilterProp="label"
|
|
|
+ onChange={(value, labelList, extra) => onNodeChange(value, labelList, extra)}>
|
|
|
+ {renderTreeNodes(treeSource)}
|
|
|
+ </TreeSelect>
|
|
|
+ )}
|
|
|
+ {/* <TreeSelect
|
|
|
style={{ width: '100%' }}
|
|
|
placeholder="请选择目标架构"
|
|
|
treeDefaultExpandAll
|
|
|
treeData={treeSource}
|
|
|
- />
|
|
|
+ /> */}
|
|
|
</Form.Item>
|
|
|
</div>
|
|
|
) : null}
|