diff --git a/src/pages/ledgerSalaryItemDiagram/index.tsx b/src/pages/ledgerSalaryItemDiagram/index.tsx index 38fe574..bf8afc7 100644 --- a/src/pages/ledgerSalaryItemDiagram/index.tsx +++ b/src/pages/ledgerSalaryItemDiagram/index.tsx @@ -48,18 +48,19 @@ const Index: React.FC = () => { const dataSource: any = useMemo(() => { return { rootId: "0", - nodes: [{ id: "0", text: i18n["薪资项目"] }, ..._.map(extractTree(itemsTree), o => ({ + // { id: "0", text: i18n["薪资项目"] }, + nodes: [..._.map(extractTree(itemsTree), o => ({ id: o.salaryItemId, text: o.salaryItemName, data: { ...o } }))], lines: _.map(extractTree(itemsTree), o => ({ from: o.parentId ? o.parentId : "0", to: o.salaryItemId - })) + })).filter(g => g.from !== "0") }; }, [itemsTree, i18n]); useEffect(() => { - if (!_.isEmpty(dataSource.nodes) && !_.isEmpty(dataSource.lines)) { + if (!_.isEmpty(dataSource.nodes)) { const init = showGraph(); } }, [dataSource]); @@ -103,7 +104,7 @@ const Index: React.FC = () => { const { formula: description } = formula; notification.open({ message: i18n["公式"], - duration: null, + duration: 5, description, style: { maxWidth: 600 } }); diff --git a/src/pages/salaryItemDiagram/index.tsx b/src/pages/salaryItemDiagram/index.tsx index 4b29c25..d43aed9 100644 --- a/src/pages/salaryItemDiagram/index.tsx +++ b/src/pages/salaryItemDiagram/index.tsx @@ -57,7 +57,7 @@ const index: FunctionComponent = (props) => { const { formula: description } = formula; notification.open({ message: i18n["公式"], - duration: null, + duration: 5, description, style: { maxWidth: 600 } });