ReminderList.jsx 5.2 KB

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