index.jsx 2.2 KB

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