ReminderList.jsx 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. import consts from '@/consts'
  2. import ProTable from '@ant-design/pro-table'
  3. import { queryReminderList } from '@/services/dashboard'
  4. import { useModal } from '@/components/ModalStore'
  5. import { Modal } from 'antd'
  6. const ReminderList = props => {
  7. const { dataType, reminderCyclical, ...resetModalProps } = props
  8. const dispatchModal = useModal()
  9. const clientColumns = [
  10. {
  11. title: '客户名称',
  12. dataIndex: 'clientName',
  13. ellipsis: true,
  14. width: '10%',
  15. render: (clientName, record) => (
  16. <span
  17. onClick={() => dispatchModal('D_CLIENT_DETAIL', { dataId: record.id })}
  18. className="text-primary cursor-pointer hover:text-hex-967bbd"
  19. >
  20. {clientName}
  21. </span>
  22. )
  23. },
  24. {
  25. title: '单位名称',
  26. dataIndex: 'companyName',
  27. width: '15%',
  28. ellipsis: true,
  29. render: (companyName, record) => (
  30. <span
  31. onClick={() =>
  32. dispatchModal('D_COMPANY_DETAIL', {
  33. dataId: record.companyId,
  34. orderIds: state.orderIds
  35. })
  36. }
  37. className="text-primary cursor-pointer hover:text-hex-967bbd"
  38. >
  39. {companyName}
  40. </span>
  41. )
  42. },
  43. {
  44. title: '地区',
  45. dataIndex: 'districtName',
  46. ellipsis: true,
  47. width: '15%',
  48. renderText: text => text?.replaceAll(' / ', ' , ')
  49. },
  50. {
  51. title: '手机',
  52. dataIndex: 'telephone',
  53. ellipsis: true,
  54. width: '10%'
  55. },
  56. {
  57. title: '服务日期',
  58. dataIndex: 'serviceDate',
  59. ellipsis: true,
  60. width: '8%'
  61. },
  62. {
  63. title: '服务内容',
  64. dataIndex: 'serviceContent',
  65. width: '26%',
  66. ellipsis: true
  67. },
  68. {
  69. title: '备忘时间',
  70. dataIndex: 'memoDate',
  71. width: '10%',
  72. ellipsis: true
  73. },
  74. {
  75. title: '备忘内容',
  76. dataIndex: 'memoContent',
  77. width: '27%',
  78. ellipsis: true
  79. }
  80. ]
  81. const customerColumns = [
  82. {
  83. title: '单位名称',
  84. dataIndex: 'companyName',
  85. width: '15%',
  86. ellipsis: true,
  87. render: (companyName, record) => (
  88. <span
  89. onClick={() => dispatchModal('D_COMPANY_DETAIL', { dataId: record.id })}
  90. className="text-primary cursor-pointer hover:text-[#967bbd]"
  91. >
  92. {companyName}
  93. </span>
  94. )
  95. },
  96. {
  97. title: '地区',
  98. dataIndex: 'districtName',
  99. width: '15%',
  100. ellipsis: true,
  101. renderText: text => text?.replaceAll(' / ', ' , ')
  102. },
  103. {
  104. title: '电话',
  105. dataIndex: 'phone',
  106. width: '10%',
  107. ellipsis: true
  108. },
  109. {
  110. title: '服务日期',
  111. dataIndex: 'serviceDate',
  112. width: '8%',
  113. ellipsis: true
  114. },
  115. {
  116. title: '服务内容',
  117. dataIndex: 'serviceContent',
  118. width: '24%',
  119. ellipsis: true
  120. },
  121. {
  122. title: '备忘时间',
  123. dataIndex: 'memoDate',
  124. width: '10%',
  125. ellipsis: true
  126. },
  127. {
  128. title: '备忘内容',
  129. dataIndex: 'memoContent',
  130. width: '22%',
  131. ellipsis: true
  132. }
  133. ]
  134. const businessColumns = [
  135. {
  136. title: '商机名称',
  137. dataIndex: 'name',
  138. width: '15%',
  139. ellipsis: true,
  140. render: (text, record) => (
  141. <span
  142. onClick={() =>
  143. dispatchModal('D_BUSINESS_DETAIL', { dataId: record.id, orderIds: state.orderIds })
  144. }
  145. className="text-primary cursor-pointer hover:text-[#967bbd]"
  146. >
  147. {text}
  148. </span>
  149. )
  150. },
  151. {
  152. title: '单位名称',
  153. dataIndex: 'customerName',
  154. width: '15%',
  155. ellipsis: true
  156. },
  157. {
  158. title: '服务日期',
  159. dataIndex: 'serviceDate',
  160. width: '8%',
  161. ellipsis: true
  162. },
  163. {
  164. title: '服务内容',
  165. dataIndex: 'serviceContent',
  166. width: '27%',
  167. ellipsis: true
  168. },
  169. {
  170. title: '备忘时间',
  171. dataIndex: 'memoDate',
  172. width: '10%',
  173. ellipsis: true
  174. },
  175. {
  176. title: '备忘内容',
  177. dataIndex: 'memoContent',
  178. width: '25%',
  179. ellipsis: true
  180. }
  181. ]
  182. const dataMap = {
  183. 0: {
  184. key: 'client',
  185. columns: clientColumns
  186. },
  187. 1: {
  188. key: 'customer',
  189. columns: customerColumns
  190. },
  191. 2: {
  192. key: 'business',
  193. columns: businessColumns
  194. }
  195. }
  196. const titleMap = {
  197. 0: { title: '客户' },
  198. 1: { title: '单位' },
  199. 2: { title: '商机' }
  200. }
  201. return (
  202. <Modal {...resetModalProps} title={titleMap[dataType].title} width="90vw" footer={false}>
  203. <div className="mx-4">
  204. <ProTable
  205. size="small"
  206. rowKey={record => record.id}
  207. columns={dataMap[dataType].columns}
  208. params={{ dataType, reminderCyclical }}
  209. request={async params => {
  210. const { code = -1, data } = await queryReminderList({ ...params })
  211. return {
  212. data: data[dataMap[dataType].key],
  213. success: code === consts.RET_CODE.SUCCESS,
  214. total: data.total
  215. }
  216. }}
  217. scroll={{ y: 400 }}
  218. pagination={{ defaultPageSize: 10 }}
  219. search={false}
  220. toolBarRender={false}
  221. />
  222. </div>
  223. </Modal>
  224. )
  225. }
  226. export default ReminderList