Explorar el Código

feat: 组织架构列表

outaozhen hace 3 años
padre
commit
34b783646c

+ 1 - 1
config/routes.ts

@@ -60,7 +60,7 @@
       },
       {
         path: 'company/companyname',
-        name: 'companyName',
+        name: 'companyname',
         hideInMenu: true,
         component: './Institutions/Company/CompanyName'
       },

+ 2 - 1
src/locales/zh-CN/menu.ts

@@ -19,5 +19,6 @@ export default {
   'menu.project.management': '项目管理',
   'menu.institutions': '企事业单位',
   'menu.institutions.company': '单位管理',
-  'menu.institutions.staff': '人员管理'
+  'menu.institutions.staff': '人员管理',
+  'menu.institutions.companyname': '单位详情'
 }

+ 41 - 2
src/pages/Institutions/Company/CompanyName/components/Organization.tsx

@@ -1,9 +1,48 @@
-import React from 'react'
+import { Table } from 'antd'
+import React, { useState, useEffect } from 'react'
+import { useRequest } from 'umi'
+import { queryOrganizationalStructureList } from '@/services/api/institution'
 
 const Organization = () => {
+  const [state, setState] = useState({
+    organizationList: []
+  })
+
+  const columns: ColumnType<API.OrganizationalStructureListItem>[] = [
+    {
+      title: '组织名称',
+      dataIndex: 'name',
+      key: 'name'
+    },
+    {
+      title: '包含人员',
+      dataIndex: 'accountTotal',
+      key: 'accountTotal'
+    },
+    {
+      title: '操作',
+      dataIndex: 'operate',
+      key: 'operate'
+    }
+  ]
+  const { run: tryOrganizationList } = useRequest(
+    (id: string) => queryOrganizationalStructureList({ id }),
+    {
+      manual: true,
+      onSuccess: result => {
+        setState({ ...state, organizationList: result })
+      }
+    }
+  )
+  useEffect(() => {
+    if (state.id) {
+      tryOrganizationList(state.id)
+    }
+  }, [])
   return (
     <div>
-      <span>组织架构</span>
+      {/* <span>组织架构</span> */}
+      <Table<API.OrganizationalStructureListItem> columns={columns} />
     </div>
   )
 }

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

@@ -28,6 +28,7 @@ const CompanyList: React.FC<ListProps> = ({ dispatch, pTypeList }) => {
     params: {
       search: null
     },
+    structureType: 1,
     visible: false,
     currentModalType: ModalType.ADD,
     defaultFormData: null
@@ -48,7 +49,9 @@ const CompanyList: React.FC<ListProps> = ({ dispatch, pTypeList }) => {
       dataIndex: 'name',
       title: '企事业单位名称',
       render: (name, record) => (
-        <span onClick={() => showName(record.id)} className="text-primary cursor-pointer">
+        <span
+          onClick={() => showName(record.id, state.structureType)}
+          className="text-primary cursor-pointer">
           {name}
         </span>
       )

+ 10 - 0
src/services/api/institution.ts

@@ -54,3 +54,13 @@ export async function queryAccountTypeList() {
     method: 'GET'
   })
 }
+
+/** 组织架构列表 */
+export async function queryOrganizationalStructureList(
+  params: API.OrganizationalStructureListParams
+) {
+  return request('/OrganizationalStructure/list', {
+    method: 'POST',
+    data: params
+  })
+}

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

@@ -129,4 +129,22 @@ declare namespace API {
     value: number
     name: string
   }
+
+  type OrganizationalStructureListParams = {
+    structureType: string
+    dataID: string
+  }
+
+  type OrganizationalStructureListItem = {
+    structureType: number
+    dataID: string
+    name: string
+    parentID: string
+    ID: string
+    accountTotal: number
+    sort: number
+    id: string
+    children: OrganizationalStructureListItem[]
+    isLeaf: boolean
+  }
 }