wsj
3 days ago 0d9778720a5258876079d02bb8603dd202e6b1a8
src/pages/system/departments/index.tsx
@@ -1,12 +1,11 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import type { Key } from 'react';
import { PlusOutlined } from '@ant-design/icons';
import { ProTable } from '@ant-design/pro-components';
import type { ActionType } from '@ant-design/pro-components';
import { App as AntdApp, Button } from 'antd';
import { App as AntdApp } from 'antd';
import { createDepartmentColumns } from './columns';
import DepartmentFormDrawer from './components/DepartmentFormDrawer';
import { deleteOrg, getLeaderOptions, getOrgTree, toggleOrgStatus } from './server';
import { deleteOrg, getLeaderOptions, getOrgTree, toggleOrgStatus } from './service';
import type { DepartmentListQuery, OrgVO } from './types';
import { collectOrgIds, filterOrgTree } from './utils';
@@ -26,7 +25,7 @@
    const loadLeaders = async () => {
      try {
        const result = await getLeaderOptions();
        const result = await getLeaderOptions({ page: 1, size: 200 });
        if (!active) return;
        setLeaderOptions(
@@ -59,13 +58,6 @@
    const data = filterOrgTree(list, params);
    return { data, total: data.length, success: true };
  }, []);
  const openCreateRoot = useCallback(() => {
    setActiveOrg(null);
    setParentId(undefined);
    setFormMode('create');
    setFormOpen(true);
  }, []);
  const openCreateChild = useCallback((record: OrgVO) => {
@@ -155,11 +147,6 @@
          expandedRowKeys,
          onExpandedRowsChange: (keys) => setExpandedRowKeys([...keys]),
        }}
        toolBarRender={() => [
          <Button key="create" type="primary" icon={<PlusOutlined />} onClick={openCreateRoot}>
            新增部门
          </Button>,
        ]}
        request={fetchDepartments}
      />
@@ -169,7 +156,6 @@
        record={activeOrg}
        parentId={parentId}
        orgTree={orgTree}
        leaderOptions={leaderOptions}
        onClose={closeForm}
        onSuccess={handleFormSuccess}
      />