Commit 5e45934bb7fc66a008c2c7bbd0ca51de33d0ba47

Authored by 王强
1 parent 2c4740ba

fix(ehr): 优化 角色组 人员组织架构树 交互

src/pages/ehr/RoleManagementGroup/components/RoleStaffTree.tsx
1 1 import React, { useEffect, useRef, useState } from 'react';
2 2 import { useStore } from '../index';
3   -import Tree, { RawNodeDatum, Point } from 'react-d3-tree';
  3 +import type { Point } from 'react-d3-tree';
  4 +import Tree from 'react-d3-tree';
4 5 import { getRoleStaffTreeApi } from '../api';
5 6 import { Empty, Spin, Modal, Button, Row, Divider } from 'antd';
6 7 import useInitial from '@/hooks/useInitail';
7 8 import DetailItem from '@/pages/ehr/Authentication/Settings/components/DetailItem';
8 9  
9 10 export default function RoleStaffTree() {
10   - const { current, setCurrent } = useStore();
  11 + const { current } = useStore();
11 12 const treeInitital = useInitial(getRoleStaffTreeApi, {}, current?.id ?? -1);
12 13 const treeContainer = useRef<HTMLDivElement | null>(null);
13   - const [translate, setTranslate] = useState<Point>({ x: 200, y: 50 });
  14 + const [translate, setTranslate] = useState<Point>({ x: 200, y: 20 });
14 15 const [dimensions, setDataimensions] = useState<{ width: number; height: number }>();
15 16  
16 17 const [modalInfo, setModalInfo] = useState<{ open: boolean; data?: RoleManagementGrooup.RoleStaffTreeVO }>({ open: false });
... ... @@ -18,8 +19,8 @@ export default function RoleStaffTree() {
18 19 useEffect(() => {
19 20 if (treeContainer.current) {
20 21 const rect = treeContainer.current.getBoundingClientRect();
21   - setTranslate({ x: rect.width / 2, y: 200 });
22   - setDataimensions({ width: rect.width, height: rect.height });
  22 + setTranslate({ x: rect.width / 2, y: 20 });
  23 + setDataimensions({ width: rect.width, height: 20 });
23 24 }
24 25 }, [treeContainer.current]);
25 26  
... ...