tableConfig.tsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. import { Popover, Space, Typography } from "antd";
  2. import { AnyObject } from "antd/es/_util/type";
  3. import { ColumnsType } from "antd/es/table";
  4. import style from './index.less'
  5. import { QuestionCircleFilled } from '@ant-design/icons';
  6. import { restoreGroupData, restoreMomentData, restoreUserInheritData } from "../create/const";
  7. import PreviewUserInherit from "../create/components/userInherit/previewUserlnherit";
  8. import PreviewMassSendingStrategy from "../create/components/massSending/previewMassSendingStrategy";
  9. import ShowContent from "../create/components/massSending/showContent";
  10. import PreviewWelcome from "../create/components/welcome/previewWelcome";
  11. import PreviewFriendsStrategy from "../create/components/friends/previewFriendsStrategy";
  12. import ShowFriendsContent from "../create/components/friends/showFriendsContent";
  13. const { Text, Paragraph } = Typography;
  14. const taskListColumns = (
  15. bookPlatForm: any[],
  16. bookList: any[],
  17. handleLog: (data: any) => void,
  18. ): ColumnsType<AnyObject> => {
  19. return [
  20. {
  21. title: '操作',
  22. dataIndex: 'cz',
  23. key: 'cz',
  24. width: 120,
  25. render(_, record) {
  26. return <Space>
  27. <a onClick={() => handleLog(record)}>详情</a>
  28. </Space>
  29. },
  30. },
  31. {
  32. title: '任务名称',
  33. dataIndex: 'projectName',
  34. key: 'projectName',
  35. width: 120,
  36. ellipsis: true
  37. },
  38. {
  39. title: '基础信息',
  40. dataIndex: 'bizType',
  41. key: 'bizType',
  42. width: 180,
  43. render: (_, record) => {
  44. return <Paragraph style={{ margin: 0 }} ellipsis={{ tooltip: true }}>
  45. 业务类型:{record?.bizType === 'novel' ? '小说' : '<空>'}-书城:{record?.platformName || '<空>'}-适用产品:{record?.templateProductName || '<空>'}
  46. </Paragraph>
  47. }
  48. },
  49. {
  50. title: '欢迎语配置',
  51. dataIndex: 'welcomeMsgTemplateDTO',
  52. key: 'welcomeMsgTemplateDTO',
  53. width: 150,
  54. ellipsis: true,
  55. render: (_, record) => {
  56. return record?.welcomeMsgTemplateDTO && Object.keys(record?.welcomeMsgTemplateDTO)?.length > 0 ? <div className={style.nameBox}>
  57. <div>
  58. <Text ellipsis>{record?.welcomeMsgTemplateDTO?.welcomeName || '<空>'}</Text>
  59. </div>
  60. <Popover
  61. placement="left"
  62. content={<div>
  63. <PreviewWelcome
  64. welcomeMsgTemplateDTO={record?.welcomeMsgTemplateDTO}
  65. bookList={bookList}
  66. bookPlatForm={bookPlatForm}
  67. />
  68. </div>}
  69. styles={{ body: { width: 300, overflow: 'hidden', overflowY: 'auto', maxHeight: 400 } }}
  70. >
  71. <a><QuestionCircleFilled /></a>
  72. </Popover>
  73. </div> : <Text type="danger">当前没有欢迎语配置</Text>
  74. }
  75. },
  76. // {
  77. // title: '朋友圈配置',
  78. // dataIndex: 'momentCreateDTO',
  79. // key: 'momentCreateDTO',
  80. // width: 150,
  81. // ellipsis: true,
  82. // render: (value) => {
  83. // if (value && Object.keys(value)?.length > 0) {
  84. // const data = restoreMomentData(value)
  85. // return <div className={style.nameBox}>
  86. // <div>
  87. // <Text ellipsis>{value?.momentSendName || '<空>'}</Text>
  88. // </div>
  89. // <Popover
  90. // placement="left"
  91. // content={<div>
  92. // <PreviewFriendsStrategy friendsStrategy={data?.friendsStrategy} />
  93. // </div>}
  94. // styles={{ body: { width: 360, overflow: 'hidden', overflowY: 'auto', maxHeight: 400 } }}
  95. // >
  96. // <a><QuestionCircleFilled /></a>
  97. // </Popover>
  98. // <Popover
  99. // placement="left"
  100. // content={<div>
  101. // <ShowFriendsContent
  102. // strategySettings={data?.friendsStrategy?.strategySettings}
  103. // friendsContent={data?.friendsContent}
  104. // />
  105. // </div>}
  106. // styles={{ body: { width: 360, overflow: 'hidden', overflowY: 'auto', maxHeight: 400 } }}
  107. // >
  108. // <a><QuestionCircleFilled /></a>
  109. // </Popover>
  110. // </div>
  111. // }
  112. // return <Text type="danger">当前没有朋友圈配置</Text>
  113. // }
  114. // },
  115. {
  116. title: '群发配置',
  117. dataIndex: 'groupSendTaskAddDTO',
  118. key: 'groupSendTaskAddDTO',
  119. width: 170,
  120. ellipsis: true,
  121. render: (value) => {
  122. if (value && Object.keys(value)?.length > 0) {
  123. const data = restoreGroupData(value)
  124. return <div className={style.nameBox}>
  125. <div>
  126. <Text ellipsis>{value?.groupSendName || '<空>'}</Text>
  127. </div>
  128. <Popover
  129. placement="left"
  130. content={<div>
  131. <PreviewMassSendingStrategy
  132. massSendingStrategy={data.massSendingStrategy}
  133. />
  134. </div>}
  135. styles={{ body: { width: 360, overflow: 'hidden', overflowY: 'auto', maxHeight: 400 } }}
  136. >
  137. <a><QuestionCircleFilled /></a>
  138. </Popover>
  139. <Popover
  140. placement="left"
  141. content={<div>
  142. <ShowContent
  143. strategySettings={data?.massSendingStrategy?.strategySettings}
  144. massSendingContent={data?.massSendingContent}
  145. />
  146. </div>}
  147. styles={{ body: { width: 360, overflow: 'hidden', overflowY: 'auto', maxHeight: 400 } }}
  148. >
  149. <a><QuestionCircleFilled /></a>
  150. </Popover>
  151. </div>
  152. }
  153. return <Text type="danger">当前没有群发配置</Text>
  154. }
  155. },
  156. // {
  157. // title: '高级群发配置',
  158. // dataIndex: 'messageSendTaskAddDTO',
  159. // key: 'messageSendTaskAddDTO',
  160. // width: 170,
  161. // ellipsis: true,
  162. // render: (value, record) => {
  163. // if (value && Object.keys(value)?.length > 0) {
  164. // const data = restoreGroupData(value, 'GROUP_GROUP')
  165. // console.log('data', record.projectName, data)
  166. // return <div className={style.nameBox}>
  167. // <div>
  168. // <Text ellipsis>{value?.groupSendName || '<空>'}</Text>
  169. // </div>
  170. // <Popover
  171. // placement="left"
  172. // content={<div>
  173. // <PreviewMassSendingStrategy
  174. // massSendingStrategy={data.massSendingStrategy}
  175. // configType='GROUP_GROUP'
  176. // />
  177. // </div>}
  178. // styles={{ body: { width: 360, overflow: 'hidden', overflowY: 'auto', maxHeight: 400 } }}
  179. // >
  180. // <a><QuestionCircleFilled /></a>
  181. // </Popover>
  182. // <Popover
  183. // placement="left"
  184. // content={<div>
  185. // <ShowContent
  186. // strategySettings={data?.massSendingStrategy?.strategySettings}
  187. // massSendingContent={data?.massSendingContent}
  188. // type="highQf"
  189. // />
  190. // </div>}
  191. // styles={{ body: { width: 360, overflow: 'hidden', overflowY: 'auto', maxHeight: 400 } }}
  192. // >
  193. // <a><QuestionCircleFilled /></a>
  194. // </Popover>
  195. // </div>
  196. // }
  197. // return <Text type="danger">当前没有群发配置</Text>
  198. // }
  199. // },
  200. {
  201. title: '客户继承配置',
  202. dataIndex: 'externalUserTransferTasksDTO',
  203. key: 'externalUserTransferTasksDTO',
  204. width: 150,
  205. ellipsis: true,
  206. render: (value) => {
  207. if (value && Object.keys(value)?.length > 0) {
  208. const data = restoreUserInheritData(value)
  209. return <div className={style.nameBox}>
  210. <div>
  211. <Text ellipsis>{value?.taskName || '<空>'}</Text>
  212. </div>
  213. <Popover
  214. placement="left"
  215. content={<div>
  216. <PreviewUserInherit
  217. userInherit={data}
  218. />
  219. </div>}
  220. styles={{ body: { width: 360, overflow: 'hidden', overflowY: 'auto', maxHeight: 400 } }}
  221. >
  222. <a><QuestionCircleFilled /></a>
  223. </Popover>
  224. </div>
  225. }
  226. return <Text type="danger">当前没有客户继承配置</Text>
  227. }
  228. },
  229. {
  230. title: '创建时间',
  231. dataIndex: 'createTime',
  232. key: 'createTime',
  233. align: 'center',
  234. width: 125,
  235. ellipsis: true
  236. },
  237. ]
  238. }
  239. export default taskListColumns