tableConfig.tsx 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. import { Popconfirm, Popover, Space, Typography } from "antd";
  2. import { AnyObject } from "antd/es/_util/type";
  3. import { ColumnsType } from "antd/es/table";
  4. import style from '../../businessPlan/taskList/index.less'
  5. import { QuestionCircleFilled } from '@ant-design/icons';
  6. import PreviewStrategy from "../create/components/strategy/previewStrategy";
  7. import PreviewGroupUser from "../create/components/groupUser/previewGroupUser";
  8. import { getPullGroupData } from "../create/const";
  9. const { Text, Paragraph } = Typography;
  10. const taskListColumns = (
  11. bookPlatForm: TASK_CREATE.BookPlatFormProps[],
  12. bookList: TASK_CREATE.BookListProps[],
  13. handleLog: (data: any) => void,
  14. handleCopy: (data: any, isCopy: boolean) => void,
  15. handleDel: (data: any, type: 'del' | 'cancel' | 'open') => void,
  16. ): ColumnsType<AnyObject> => {
  17. return [
  18. {
  19. title: '操作',
  20. dataIndex: 'cz',
  21. key: 'cz',
  22. width: 160,
  23. render(_, record) {
  24. return <Space>
  25. {record?.status === 1 ? <Popconfirm
  26. title="确定暂停?"
  27. onConfirm={() => { handleDel({ projectIds: [record.id] }, 'cancel') }}
  28. >
  29. <a style={{ color: 'orange' }}>暂停任务</a>
  30. </Popconfirm> : record?.status === 3 ? <Popconfirm
  31. title="确定启用?"
  32. onConfirm={() => { handleDel({ projectIds: [record.id] }, 'open') }}
  33. >
  34. <a style={{ color: '#87d068' }}>启用任务</a>
  35. </Popconfirm> : undefined}
  36. <a onClick={() => handleCopy(record, true)}>复制</a>
  37. <a onClick={() => handleCopy(record, false)}>编辑</a>
  38. <a onClick={() => handleLog(record)}>详情</a>
  39. <Popconfirm
  40. title="确定删除?"
  41. onConfirm={() => { handleDel({ projectIds: [record.id] }, 'del') }}
  42. >
  43. <a style={{ color: 'red' }}>删除</a>
  44. </Popconfirm>
  45. </Space>
  46. },
  47. },
  48. {
  49. title: '任务名称',
  50. dataIndex: 'taskName',
  51. key: 'taskName',
  52. width: 120,
  53. ellipsis: true
  54. },
  55. {
  56. title: '基础信息',
  57. dataIndex: 'bizType',
  58. key: 'bizType',
  59. width: 180,
  60. render: (_, record) => {
  61. return <Paragraph style={{ margin: 0 }} ellipsis={{ tooltip: true }}>
  62. 业务类型:{record?.bizType === 'novel' ? '小说' : '<空>'}-书城:{record?.platformName || '<空>'}-适用产品:{record?.templateProductName || '<空>'}
  63. </Paragraph>
  64. }
  65. },
  66. {
  67. title: '群主号',
  68. dataIndex: 'corpChatUserList',
  69. key: 'corpChatUserList',
  70. width: 130,
  71. render(value) {
  72. return <Paragraph style={{ margin: 0 }} ellipsis={{ tooltip: true }}>{value.map((item) => item.name + `(${item.corpName})`).join('、')}</Paragraph>
  73. }
  74. },
  75. {
  76. title: '机器人客服号',
  77. dataIndex: 'corpRobots',
  78. key: 'corpRobots',
  79. width: 130,
  80. render(value) {
  81. return <Paragraph style={{ margin: 0 }} ellipsis={{ tooltip: true }}>{value.map((item) => item.corpUserName + `(${item.corpName})`).join('、')}</Paragraph>
  82. }
  83. },
  84. {
  85. title: '客服号',
  86. dataIndex: 'corpUsers',
  87. key: 'corpUsers',
  88. width: 150,
  89. render(value) {
  90. return <Paragraph style={{ margin: 0 }} ellipsis={{ tooltip: true }}>{value.map((item) => item.corpUserName + `(${item.corpName})`).join('、')}</Paragraph>
  91. }
  92. },
  93. {
  94. title: '群聊创建配置预览',
  95. dataIndex: 'strategyList',
  96. key: 'strategyList',
  97. width: 150,
  98. ellipsis: true,
  99. render: (_, record) => {
  100. if (record?.strategyList?.length > 0) {
  101. const data = getPullGroupData(record?.strategyList || [])
  102. return <div className={style.nameBox}>
  103. <Popover
  104. placement="left"
  105. content={<div>
  106. <PreviewStrategy strategyDTO={{
  107. strategyList: record?.strategyList
  108. }} />
  109. </div>}
  110. styles={{ body: { width: 300, overflow: 'hidden', overflowY: 'auto', maxHeight: 400 } }}
  111. >
  112. <a>策略 <QuestionCircleFilled /></a>
  113. </Popover>
  114. <Popover
  115. placement="left"
  116. content={<div>
  117. <PreviewGroupUser
  118. strategyList={data?.strategyList || []}
  119. bookList={bookList}
  120. bookPlatForm={bookPlatForm}
  121. />
  122. </div>}
  123. styles={{ body: { width: 700, overflow: 'hidden', overflowY: 'auto', maxHeight: 400 } }}
  124. >
  125. <a>群配置 <QuestionCircleFilled /></a>
  126. </Popover>
  127. </div>
  128. }
  129. return <Text type="danger">当前没有欢迎语配置</Text>
  130. }
  131. },
  132. {
  133. title: '创建时间',
  134. dataIndex: 'createTime',
  135. key: 'createTime',
  136. align: 'center',
  137. width: 125,
  138. ellipsis: true
  139. },
  140. {
  141. title: '拉群任务数量',
  142. dataIndex: 'corpPullGroupTaskCount',
  143. key: 'corpPullGroupTaskCount',
  144. width: 100,
  145. align: 'center',
  146. render(value) {
  147. return value
  148. },
  149. },
  150. ]
  151. }
  152. export default taskListColumns