tableConfig.tsx 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. import { Badge, Popover, Space, Typography } from "antd";
  2. import { AnyObject } from "antd/es/_util/type"
  3. import { ColumnsType } from "antd/es/table"
  4. import { businessPlanData, TIME_TYPE } from "../../businessPlan/create/const";
  5. import FilterUserTooltip from "@/pages/weComTask/components/filterUser/filterUserTooltip";
  6. import { QuestionCircleFilled } from "@ant-design/icons";
  7. const { Paragraph, Title, Text } = Typography;
  8. export const PreviewColumns = (bookPlatForm: TASK_CREATE.BookPlatFormProps[], bookList: TASK_CREATE.BookListProps[]): ColumnsType<AnyObject> => {
  9. return [
  10. {
  11. title: '企微号信息',
  12. dataIndex: 'corpUser',
  13. key: 'corpName',
  14. width: 150,
  15. fixed: 'left',
  16. render(value) {
  17. return <>
  18. <Title level={5} style={{ margin: 0 }}>{value?.corpName || '--'}</Title>
  19. <Paragraph style={{ margin: 0 }}>{value?.name || '--'}</Paragraph>
  20. </>
  21. }
  22. },
  23. {
  24. title: '基础信息',
  25. dataIndex: 'taskName',
  26. key: 'taskName',
  27. width: 130,
  28. render(value, record) {
  29. return <>
  30. <Title level={5} style={{ margin: 0 }}>标题:{value}</Title>
  31. {record?.bizType && <Paragraph style={{ margin: 0 }}>业务类型:{record?.bizType === 'novel' ? '小说' : record?.bizType === 'game' ? '游戏' : '<空>'}</Paragraph>}
  32. {record?.platform && <Paragraph style={{ margin: 0 }}>书城:{record?.platform ? bookPlatForm?.find(item => item.id === record?.platform)?.platformName : '<空>'}</Paragraph>}
  33. {record?.templateProductId && <Paragraph style={{ margin: 0 }}>适用产品:{record?.templateProductId ? bookList?.find(item => item.id === record?.templateProductId)?.bookName : '<空>'}</Paragraph>}
  34. </>
  35. }
  36. },
  37. {
  38. title: '群主号',
  39. dataIndex: 'corpUserChat',
  40. key: 'corpUserChat',
  41. width: 130,
  42. render(value) {
  43. return value.map((item, index) => <Paragraph style={{ margin: 0 }} key={index}>{item.label}</Paragraph>)
  44. }
  45. },
  46. {
  47. title: '机器人客服号',
  48. dataIndex: 'robotCorpUsers',
  49. key: 'robotCorpUsers',
  50. width: 130,
  51. render(value) {
  52. return value?.length > 0 ? value?.map((item, index) => <Paragraph style={{ margin: 0 }} key={index}>{item.name}({item.corpName})</Paragraph>) : '--'
  53. }
  54. },
  55. {
  56. title: '策略信息',
  57. dataIndex: 'strategyData',
  58. key: 'strategyData',
  59. width: 200,
  60. render(_, record) {
  61. return <>
  62. <Title level={5} style={{ margin: 0 }}>策略{record.strategyIndex + 1}</Title>
  63. <Paragraph style={{ margin: 0 }}>名称:{record?.strategyName || '<空>'}</Paragraph>
  64. <Paragraph style={{ margin: 0 }}>执行类型:{TIME_TYPE[record?.timeRepeatType]}</Paragraph>
  65. {record?.sendDay && <Paragraph style={{ margin: 0 }}>执行时间:{record?.sendDay}</Paragraph>}
  66. {record?.startTime && <Paragraph style={{ margin: 0 }}>执行日期:{record?.startTime}~{record?.endTime ? record?.endTime : '长期执行'}</Paragraph>}
  67. {record?.sendTime && <Paragraph style={{ margin: 0 }}>执行时间:{record?.sendTime}</Paragraph>}
  68. {record?.repeatArray && <Paragraph style={{ margin: 0 }}>执行天数:{record?.repeatArray.join('、')}</Paragraph>}
  69. </>
  70. }
  71. },
  72. {
  73. title: '群名称',
  74. dataIndex: 'groupObjectName',
  75. key: 'groupObjectName',
  76. width: 120,
  77. ellipsis: true,
  78. fixed: 'left'
  79. },
  80. {
  81. title: '是否开启已有旧群聊补缺',
  82. dataIndex: 'isRepair',
  83. key: 'isRepair',
  84. width: 150,
  85. ellipsis: true,
  86. render(value, record, index) {
  87. return value ? <Space>
  88. <Badge status="success" text="开启" />
  89. <span>近{record.repairTimes}天</span>
  90. </Space> : <Badge status="error" text="关闭" />
  91. },
  92. },
  93. {
  94. title: '进群对象',
  95. dataIndex: 'externalUserFilter',
  96. key: 'externalUserFilter',
  97. width: 90,
  98. align: 'center',
  99. render(value) {
  100. return value ? <div style={{ display: 'flex', alignItems: 'center' }}>
  101. <div style={{ flex: '1 0', overflow: 'hidden' }}>
  102. <Text ellipsis>指定</Text>
  103. </div>
  104. <Popover
  105. placement="right"
  106. styles={{ body: { maxWidth: 350, maxHeight: 350, overflow: 'hidden', overflowY: 'auto' } }}
  107. mouseEnterDelay={0.5}
  108. content={<FilterUserTooltip
  109. bookCityList={bookPlatForm?.map(item => ({ label: item.platformName, value: item.platformKey }))}
  110. configName={value?.configName}
  111. data={value?.configContent}
  112. />}
  113. >
  114. <a style={{ color: '#000' }}><QuestionCircleFilled /></a>
  115. </Popover>
  116. </div> : '全部'
  117. },
  118. },
  119. {
  120. title: '群递增起始编号',
  121. dataIndex: 'groupIndex',
  122. key: 'groupIndex',
  123. width: 60,
  124. align: 'center'
  125. },
  126. {
  127. title: '群固定人数',
  128. dataIndex: 'groupUserCount',
  129. key: 'groupUserCount',
  130. width: 50,
  131. align: 'center'
  132. },
  133. {
  134. title: '邀请客户进群完毕后客服号是否退群',
  135. dataIndex: 'autoOutGroup',
  136. key: 'autoOutGroup',
  137. width: 85,
  138. align: 'center',
  139. render(value) {
  140. return value ? <span style={{ color: '#1890ff' }}>是</span> : <span style={{ color: 'red' }}>否</span>
  141. },
  142. },
  143. {
  144. title: '是否排除已在群的客户',
  145. dataIndex: 'excludeInGroup',
  146. key: 'excludeInGroup',
  147. width: 60,
  148. align: 'center',
  149. render(value) {
  150. return value ? <span style={{ color: '#1890ff' }}>是</span> : <span style={{ color: 'red' }}>否</span>
  151. },
  152. },
  153. {
  154. title: '拉群完成后自动删除拉群标签',
  155. dataIndex: 'excludeInGroup',
  156. key: 'excludeInGroup',
  157. width: 70,
  158. align: 'center',
  159. render(value) {
  160. return value ? <span style={{ color: '#1890ff' }}>是</span> : <span style={{ color: 'red' }}>否</span>
  161. },
  162. },
  163. {
  164. title: '群聊关联公众号',
  165. dataIndex: 'weChatAppid',
  166. key: 'weChatAppid',
  167. width: 100,
  168. align: 'center',
  169. render(value) {
  170. return value || '--'
  171. },
  172. },
  173. {
  174. title: '拉群完成后群聊备注',
  175. dataIndex: 'remark',
  176. key: 'remark',
  177. width: 140,
  178. render(value) {
  179. return value || '--'
  180. },
  181. },
  182. {
  183. title: '拉群完成后群聊智能标签',
  184. dataIndex: 'tagDTO',
  185. key: 'tagDTO',
  186. width: 200,
  187. render(value) {
  188. return value && Object.keys(value)?.length > 0 ?
  189. <Paragraph ellipsis style={{ margin: 0 }}>{Object.keys(value).map(key => {
  190. if (key === 'business' && value[key]) {
  191. return `业务(来源渠道):${businessPlanData.find(i => i.value === value.business)?.label || '<空>'}`
  192. } else if (key === 'bookCity' && value[key]) {
  193. return `书城(来源渠道):${bookPlatForm.find(i => i.id === value.bookCity)?.platformName || '<空>'}`
  194. } else if (key === 'product' && value[key]) {
  195. return `产品(来源渠道):${bookList.find(i => i.id === value.product)?.bookName || '<空>'}`
  196. }
  197. return ''
  198. }).join('、')}</Paragraph> : '--'
  199. },
  200. },
  201. {
  202. title: '建群成功发送内容',
  203. dataIndex: 'groupSendMsg',
  204. key: 'groupSendMsg',
  205. width: 140,
  206. render(value) {
  207. return value ? value : '--'
  208. },
  209. },
  210. ]
  211. }