Переглянути джерело

feat: 单位管理下人员详情

outaozhen 3 роки тому
батько
коміт
9a395cb3db

+ 0 - 1
config/routes.ts

@@ -67,7 +67,6 @@
             hideInMenu: true,
             component: './Institutions/Company/List'
           },
-
           {
             path: 'detail',
             name: 'detail',

+ 34 - 0
src/pages/Institutions/Company/Detail/components/StaffDetailModal.tsx

@@ -0,0 +1,34 @@
+import { Col, Drawer, Row } from 'antd'
+import React from 'react'
+import type { ConnectProps } from 'umi'
+
+type StaffDetailModalProps = ConnectProps & {
+  visibles: boolean
+  setVisible: (visibles: boolean) => void
+  staffDetail?: API.AccountListItem[]
+}
+const StaffDetailModal: React.FC<StaffDetailModalProps> = ({
+  visibles,
+  setVisible,
+  staffDetail
+}) => {
+  return (
+    <Drawer
+      title={'人员详情'}
+      width="50vw"
+      visible={visibles}
+      onClose={() => {
+        setVisible(false)
+      }}>
+      <Row gutter={[16, 16]}>
+        {/* <Col span={24}>所属企事业单位:{staffDetail.institution.name}</Col> */}
+        <Col span={12}>账号:{staffDetail.account}</Col>
+        {/* <Col span={12}>组织架构:{staffDetail.institution.name}</Col> */}
+        <Col span={12}>姓名:{staffDetail.name}</Col>
+        <Col span={12}>手机:{staffDetail.phone}</Col>
+      </Row>
+    </Drawer>
+  )
+}
+
+export default StaffDetailModal

+ 0 - 8
src/pages/Institutions/Company/List/index.tsx

@@ -193,14 +193,6 @@ const CompanyList: React.FC<ListProps> = ({ base, dispatch, pTypeList }) => {
         reload={() => tRef.current?.reload()}
         setVisible={(visible: boolean) => setState({ ...state, visible })}
       />
-      {/* <CompanyModal
-        type={state.currentModalType}
-        defaultFormData={state.defaultFormData}
-        pTypeList={pTypeList}
-        visible={state.visible}
-        reloadTable={() => tRef.current?.reload()}
-        setVisible={(visible: boolean) => setState({ ...state, visible })}
-      /> */}
     </PageContainer>
   )
 }

+ 29 - 3
src/pages/Institutions/Staff/index.tsx

@@ -3,15 +3,16 @@ import type { ProColumnType, ActionType } from '@ant-design/pro-table'
 import { Button } from 'antd'
 import consts from '@/utils/consts'
 import { useRef, useState, useEffect } from 'react'
-import { connect } from 'umi'
+import { connect, useRequest } from 'umi'
 import type { ConnectProps } from 'umi'
 import type { InstitutionsModelState } from '../model'
 // import StaffModal, { ModalType } from './components/StaffModal'
-import { queryAcountList } from '@/services/api/institution'
+import { queryAcountList, queryAccountDetail } from '@/services/api/institution'
 import dayjs from 'dayjs'
 import StaffDrawer, { ModalType } from './components/StaffDrawer'
 import type { SchemaBaseModelState } from '@/pages/Schema/Base/model'
 import { BaseMenuEnum } from '@/pages/Schema/Base'
+import StaffDetailModal from '../Company/Detail/components/StaffDetailModal'
 
 type ListProps = ConnectProps & {
   accountTypeList: { label: string; value: string }[]
@@ -41,17 +42,37 @@ const CompanyList: React.FC<ListProps> = ({ dispatch, accountTypeList }) => {
       accountType: 1
     },
     visible: false,
+    visibles: false,
+    staffDetail: [],
+    ID: '',
     currentModalType: ModalType.ADD,
     defaultFormData: null
   })
+
   // const { run: tryDelProject } = useRequest(delProject, {
   //   manual: true,
   //   onSuccess: () => tRef.current?.reload()
   // })
+  // const { run: tryAccountDetail } = useRequest(() => queryAccountDetail(), {
+  //   manual: true,
+  //   onSuccess: result => {
+  //     setState({ ...state, staffDetail: result })
+  //   }
+  // })
+  // useEffect(() => {}, [])
   const columns: ProColumnType<API.AccountListItem>[] = [
     {
       dataIndex: 'account',
-      title: '账号'
+      title: '账号',
+      render: (name, record) => (
+        <div
+          className="text-primary cursor-pointer hover:text-hex-967bbd"
+          onClick={() => {
+            setState({ ...state, visibles: true, staffDetail: record })
+          }}>
+          {name}
+        </div>
+      )
     },
     {
       dataIndex: 'name',
@@ -165,6 +186,11 @@ const CompanyList: React.FC<ListProps> = ({ dispatch, accountTypeList }) => {
         reloadTable={() => tRef.current?.reload()}
         setVisible={(visible: boolean) => setState({ ...state, visible })}
       />
+      <StaffDetailModal
+        visibles={state.visibles}
+        setVisible={(visibles: boolean) => setState({ ...state, visibles })}
+        staffDetail={state.staffDetail}
+      />
     </div>
   )
 }

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

@@ -48,6 +48,13 @@ export async function addAccount(params: API.AcountAddParams) {
   })
 }
 
+/** 账号详情 */
+export async function queryAccountDetail() {
+  return request('/account/detail', {
+    method: 'GET'
+  })
+}
+
 /** 获取账号类型 */
 export async function getAccountTypeList() {
   return request('/account/type', {