ReminderList.jsx 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. import React from 'react'
  2. import { Button } from 'antd'
  3. import consts from '@/consts'
  4. import { useDispatch, connect } from 'umi'
  5. import ProTable from '@ant-design/pro-table'
  6. import { queryReminderList } from '@/services/dashboard'
  7. import styles from '@/pages/Customer/Company/components/ConnectCompany/index.less'
  8. import CustomModal from '@/components/Modal/src/components/CustomModal'
  9. const ReminderList = props => {
  10. const dispatch = useDispatch()
  11. const { dataType, reminderCyclical } = props
  12. // const [state, setState] = useState({
  13. // params: { dataType, reminderCyclical }
  14. // })
  15. const clientColumns = [
  16. {
  17. title: '客户名称',
  18. dataIndex: 'clientName',
  19. width: '7%'
  20. },
  21. {
  22. title: '地区',
  23. dataIndex: 'districtName',
  24. width: '12%'
  25. },
  26. {
  27. title: '手机',
  28. dataIndex: 'telephone',
  29. width: '10%'
  30. },
  31. {
  32. title: '服务日期',
  33. dataIndex: 'serviceDate',
  34. width: '10%'
  35. },
  36. {
  37. title: '服务内容',
  38. dataIndex: 'serviceContent',
  39. width: '27%',
  40. ellipsis: true
  41. },
  42. {
  43. title: '备忘时间',
  44. dataIndex: 'memoDate',
  45. width: '10%'
  46. },
  47. {
  48. title: '备忘内容',
  49. dataIndex: 'memoContent',
  50. width: '27%',
  51. ellipsis: true
  52. }
  53. ]
  54. const customerColumns = [
  55. {
  56. title: '单位名称',
  57. dataIndex: 'companyName',
  58. width: '15%'
  59. },
  60. {
  61. title: '地区',
  62. dataIndex: 'districtName',
  63. width: '12%'
  64. },
  65. {
  66. title: '电话',
  67. dataIndex: 'phone',
  68. width: '10%'
  69. },
  70. {
  71. title: '服务日期',
  72. dataIndex: 'serviceDate',
  73. width: '10%'
  74. },
  75. {
  76. title: '服务内容',
  77. dataIndex: 'serviceContent',
  78. width: '25%',
  79. ellipsis: true
  80. },
  81. {
  82. title: '备忘时间',
  83. dataIndex: 'memoDate',
  84. width: '10%'
  85. },
  86. {
  87. title: '备忘内容',
  88. dataIndex: 'memoContent',
  89. width: '25%',
  90. ellipsis: true
  91. }
  92. ]
  93. const businessColumns = [
  94. {
  95. title: '商机名称',
  96. dataIndex: 'name',
  97. width: '15%'
  98. },
  99. {
  100. title: '单位名称',
  101. dataIndex: 'customerName',
  102. width: '15%'
  103. },
  104. {
  105. title: '服务日期',
  106. dataIndex: 'serviceDate',
  107. width: '10%'
  108. },
  109. {
  110. title: '服务内容',
  111. dataIndex: 'serviceContent',
  112. width: '25%',
  113. ellipsis: true
  114. },
  115. {
  116. title: '备忘时间',
  117. dataIndex: 'memoDate',
  118. width: '10%'
  119. },
  120. {
  121. title: '备忘内容',
  122. dataIndex: 'memoContent',
  123. width: '25%',
  124. ellipsis: true
  125. }
  126. ]
  127. const dataMap = {
  128. 0: {
  129. key: 'client',
  130. columns: clientColumns
  131. },
  132. 1: {
  133. key: 'customer',
  134. columns: customerColumns
  135. },
  136. 2: {
  137. key: 'business',
  138. columns: businessColumns
  139. }
  140. }
  141. const titleMap = {
  142. 0: { title: '客户' },
  143. 1: { title: '单位' },
  144. 2: { title: '商机' }
  145. }
  146. const closeModal = () => {
  147. dispatch({
  148. type: 'single/changeModal'
  149. })
  150. }
  151. return (
  152. <CustomModal title={titleMap[dataType].title}>
  153. <div className="mx-4">
  154. <ProTable
  155. size="small"
  156. rowKey={record => record.id}
  157. columns={dataMap[dataType].columns}
  158. params={{ dataType, reminderCyclical }}
  159. scroll={{ y: 400 }}
  160. request={async params => {
  161. const { code = -1, data } = await queryReminderList({ ...params })
  162. return {
  163. data: data[dataMap[dataType].key],
  164. success: code === consts.RET_CODE.SUCCESS,
  165. total: data.total
  166. }
  167. }}
  168. scroll={{ y: 400 }}
  169. pagination={{ defaultPageSize: 10 }}
  170. search={false}
  171. toolBarRender={false}
  172. />
  173. </div>
  174. <div className={styles.modalFooter}>
  175. <div className="text-right">
  176. <Button type="button" onClick={closeModal}>
  177. 关闭
  178. </Button>
  179. </div>
  180. </div>
  181. </CustomModal>
  182. )
  183. }
  184. export default connect(({ single }) => ({
  185. visible: single.drawer.visible
  186. }))(ReminderList)