index.jsx 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import BasicTable from '@/components/Table'
  2. import consts from '@/consts'
  3. import { queryStaff } from '@/services/staff'
  4. import { PageContainer } from '@ant-design/pro-layout'
  5. import React, { useState } from 'react'
  6. import RoleMenu from '../Employee/components/RoleMenu'
  7. const AddressBook = () => {
  8. const [state, setState] = useState({
  9. params: { id: '0' }
  10. })
  11. const onSelect = id => {
  12. setState({ ...state, params: { id } })
  13. }
  14. const columns = [
  15. {
  16. title: '工号',
  17. dataIndex: 'jobNumber',
  18. search: false,
  19. width: 100
  20. },
  21. {
  22. title: '姓名',
  23. dataIndex: 'username',
  24. search: false,
  25. width: 80
  26. },
  27. {
  28. title: '手机',
  29. dataIndex: 'telephone',
  30. search: false,
  31. width: 120
  32. },
  33. {
  34. title: 'QQ',
  35. dataIndex: 'qq',
  36. search: false,
  37. width: 150
  38. },
  39. {
  40. title: '部门',
  41. dataIndex: 'departmentName',
  42. search: false,
  43. width: 70
  44. },
  45. {
  46. title: '岗位',
  47. dataIndex: 'position',
  48. search: false,
  49. width: 100
  50. },
  51. {
  52. title: '生日',
  53. dataIndex: 'birthday',
  54. search: false,
  55. width: 150
  56. },
  57. {
  58. title: '入职时间',
  59. dataIndex: 'hiredate',
  60. search: false,
  61. width: 150
  62. }
  63. ]
  64. return (
  65. <PageContainer title={false} breadcrumb={false}>
  66. <div className="h-full w-full flex flex-row">
  67. <RoleMenu onSelect={onSelect} showType={false} />
  68. <div style={{ width: 'calc(100% - 12rem)' }}>
  69. <div className="ml-6 shadow-hex-3e2c5a">
  70. {state.params.id && (
  71. <BasicTable
  72. mainMenuType="hr"
  73. columnStateType="ADDRESSBOOK"
  74. params={{ departmentId: state.params.id }}
  75. rowKey={record => record.id}
  76. columns={columns}
  77. request={async params => {
  78. const { code = -1, data: { list = [], total = 0 } = { list: [], total: 0 } } =
  79. await queryStaff({ ...params })
  80. return {
  81. data: list,
  82. success: code === consts.RET_CODE.SUCCESS,
  83. total
  84. }
  85. }}
  86. search={false}
  87. />
  88. )}
  89. </div>
  90. </div>
  91. </div>
  92. </PageContainer>
  93. )
  94. }
  95. export default AddressBook