Просмотр исходного кода

feat: 单位下的人员管理

outaozhen 3 лет назад
Родитель
Сommit
a3f5077060

+ 1 - 0
src/pages/Institutions/Company/Detail/components/Organization.tsx

@@ -166,6 +166,7 @@ const Organization: React.FC<OrganizationProps> = ({ dataID, structureType }) =>
           columns={columns}
           dataSource={state.organizationList}
           defaultExpandAllRows={true}
+          indentSize={25}
           search={false}
           pagination={false}
           toolbar={{

+ 76 - 3
src/pages/Institutions/Company/Detail/components/Staff.tsx

@@ -1,9 +1,82 @@
-import React from 'react'
+import ProTable from '@ant-design/pro-table'
+import React, { useState, useRef } from 'react'
+import { Button } from 'antd'
+import consts from '@/utils/consts'
+import { history } from 'umi'
+import { queryAcountList } from '@/services/api/institution'
 
-const Staff = () => {
+type ListProps = ConnectProps & {
+  accountType: API.AccountType[]
+}
+const Staff: React.FC<ListProps> = ({ dataID }) => {
+  const tRef = useRef<ActionType>(null)
+  const [state, setState] = useState({
+    params: {
+      search: null,
+      accountType: 1,
+      dataID
+    }
+  })
+  const columns = [
+    {
+      dataIndex: 'account',
+      title: '帐号'
+    },
+    {
+      dataIndex: 'name',
+      title: '姓名'
+    },
+    {
+      dataIndex: 'institution',
+      title: '组织架构'
+    },
+    {
+      dataIndex: 'phone',
+      title: '手机'
+    },
+    {
+      dataIndex: 'createdTime',
+      title: '创建时间'
+    },
+    {
+      dataIndex: 'created',
+      title: '创建人'
+    }
+  ]
   return (
     <div>
-      <span>人员管理</span>
+      <ProTable<API.AccountListItem>
+        rowKey="ID"
+        params={state.params}
+        actionRef={tRef}
+        columns={columns}
+        search={false}
+        request={async (params, filter, sorter) => {
+          const { code = -1, data: { items = [], totle = 0 } = {} } = await queryAcountList({
+            ...params,
+            ...filter,
+            ...sorter
+          })
+          return {
+            data: items,
+            success: code === consts.RET_CODE.SUCCESS,
+            totle
+          }
+        }}
+        toolbar={{
+          search: {
+            onSearch: val => setState({ ...state, params: { ...state.params, search: val } })
+          },
+          actions: [
+            <Button
+              onClick={() => {
+                history.push('/institutions/company/add')
+              }}>
+              添加人员
+            </Button>
+          ]
+        }}
+      />
     </div>
   )
 }

+ 1 - 1
src/pages/Institutions/Company/Detail/index.tsx

@@ -69,7 +69,7 @@ const CompanyDetail: React.FC<CompanyDetailProps> = ({ location }) => {
     const { selectKey } = initConfig
     switch (selectKey) {
       case TabEnum.STAFF:
-        return <Staff />
+        return <Staff dataID={dataID} />
       case TabEnum.ORGANIZATION:
         return <Organization dataID={dataID} structureType={structureType} />
       case TabEnum.ROLE:

+ 1 - 0
src/services/api/typings.d.ts

@@ -101,6 +101,7 @@ declare namespace API {
     created: string
     createdID: string
     id: string
+    dataID: string
   }
 
   type AccountListParams = BasicPageParams & {