log.tsx 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. import { useAjax } from '@/Hook/useAjax';
  2. import { getProjectLogListApi } from '@/pages/weComTask/API/businessPlan/create';
  3. import { Card, Drawer, Popover, Spin, Table, Tabs, Tag, Typography } from 'antd';
  4. import React, { useEffect, useState } from 'react';
  5. import { STATUS_ZJ, TIME_TYPE_ZJ } from '../../businessPlan/create/const';
  6. import PreviewTime from '@/pages/weComTask/components/previewTime';
  7. import FilterUserTooltip from '@/pages/weComTask/components/filterUser/filterUserTooltip';
  8. import { QuestionCircleFilled } from '@ant-design/icons';
  9. import style from '../../businessPlan/taskList/index.less'
  10. import useNewToken from '@/Hook/useNewToken';
  11. import LookMsg from '@/pages/weComTask/components/previewMsg/lookMsg';
  12. import { getMsgData } from '../../businessPlan/create/components/massSending/showContent';
  13. import MomentsXfCorpTabls from './momentsXfCorpTabls';
  14. import MomentsTaskNotes from './momentsTaskNotes';
  15. const { Text } = Typography;
  16. interface Props {
  17. data: any,
  18. bookPlatForm: TASK_CREATE.BookPlatFormProps[]
  19. bookList: TASK_CREATE.BookListProps[]
  20. visible?: boolean,
  21. onClose?: () => void,
  22. }
  23. /**
  24. * 任务日志
  25. * @param param0
  26. * @returns
  27. */
  28. const Log: React.FC<Props> = ({ data, bookPlatForm, bookList, visible, onClose }) => {
  29. /******************************************************/
  30. const [previewData, setPreviewData] = useState<{ momentsTaskVOList?: any[] }>({})
  31. const getProjectLogList = useAjax((params) => getProjectLogListApi(params))
  32. /******************************************************/
  33. useEffect(() => {
  34. console.log(data.id)
  35. getProjectLogList.run(data.id).then(res => {
  36. if (res?.data) {
  37. setPreviewData(res.data)
  38. }
  39. })
  40. }, [])
  41. return <Drawer
  42. title={<strong>{data.projectName} 任务详情</strong>}
  43. onClose={onClose}
  44. open={visible}
  45. width={1400}
  46. styles={{ body: { paddingTop: 5 } }}
  47. >
  48. <Table
  49. dataSource={previewData?.momentsTaskVOList || []}
  50. columns={[
  51. {
  52. title: '任务名称',
  53. dataIndex: 'momentJobTitle',
  54. key: 'momentJobTitle',
  55. width: 100,
  56. ellipsis: true,
  57. align: 'center'
  58. },
  59. {
  60. title: '企业ID',
  61. dataIndex: 'corpId',
  62. key: 'corpId',
  63. width: 100,
  64. ellipsis: true,
  65. align: 'center'
  66. },
  67. {
  68. title: '客服号',
  69. dataIndex: 'corpMomentVisibleCorpUserVOList',
  70. key: 'corpMomentVisibleCorpUserVOList',
  71. width: 100,
  72. ellipsis: true,
  73. align: 'center',
  74. render(value) {
  75. return value?.map(item => item?.relationName)?.join('、')
  76. },
  77. },
  78. {
  79. title: '状态',
  80. dataIndex: 'jobStatus',
  81. key: 'jobStatus',
  82. width: 100,
  83. ellipsis: true,
  84. align: 'center',
  85. render(value) {
  86. return STATUS_ZJ[value] || '--'
  87. },
  88. },
  89. {
  90. title: '执行时间',
  91. dataIndex: 'timeRepeatType',
  92. key: 'timeRepeatType',
  93. width: 100,
  94. ellipsis: true,
  95. align: 'center',
  96. render(value, records: any) {
  97. return <>
  98. {TIME_TYPE_ZJ[value] || '--'}
  99. {value !== 'TIME_TYPE_SINGLE_TIMELY' && <Popover
  100. placement="left"
  101. content={<div>
  102. <PreviewTime
  103. {...records}
  104. />
  105. </div>}
  106. styles={{ body: { width: 300, overflow: 'hidden', overflowY: 'auto', maxHeight: 400 } }}
  107. >
  108. <a style={{ color: '#000' }}><QuestionCircleFilled /></a>
  109. </Popover>}
  110. </>
  111. },
  112. },
  113. {
  114. title: '发送对象',
  115. dataIndex: 'externalUserFilter',
  116. key: 'externalUserFilter',
  117. width: 100,
  118. align: 'center',
  119. render(value) {
  120. return value ? <div className={style.nameBox}>
  121. <div>
  122. <Text ellipsis>指定</Text>
  123. </div>
  124. <Popover
  125. placement="right"
  126. styles={{ body: { maxWidth: 350, maxHeight: 350, overflow: 'hidden', overflowY: 'auto' } }}
  127. mouseEnterDelay={0.5}
  128. content={<FilterUserTooltip
  129. bookCityList={bookPlatForm?.map(item => ({ label: item.platformName, value: item.platformKey }))}
  130. configName={value?.configName}
  131. data={value}
  132. />}
  133. >
  134. <a style={{ color: '#000' }}><QuestionCircleFilled /></a>
  135. </Popover>
  136. </div> : '全部'
  137. },
  138. },
  139. {
  140. title: '创建人',
  141. dataIndex: 'createUserName',
  142. key: 'createUserName',
  143. width: 100,
  144. ellipsis: true,
  145. align: 'center'
  146. },
  147. {
  148. title: '创建时间',
  149. dataIndex: 'createTime',
  150. key: 'createTime',
  151. width: 135,
  152. ellipsis: true,
  153. align: 'center'
  154. },
  155. ]}
  156. scroll={{ x: 1000, y: 700 }}
  157. rowKey={'id'}
  158. size='small'
  159. bordered
  160. loading={getProjectLogList.loading}
  161. pagination={{
  162. total: previewData?.momentsTaskVOList?.length || 0,
  163. showTotal: (total) => <Tag color="cyan">总共{total}数据</Tag>,
  164. showSizeChanger: true,
  165. showLessItems: true,
  166. defaultPageSize: 20
  167. }}
  168. expandable={{
  169. fixed: 'left',
  170. expandRowByClick: true,
  171. expandedRowRender: (record) => <ExpandedRow record={record} />
  172. }}
  173. />
  174. </Drawer>
  175. };
  176. export const ExpandedRow: React.FC<{ record: any }> = ({ record }) => {
  177. const { corpMomentContentList, id, corpId } = record
  178. const { token } = useNewToken()
  179. const [activeKey, setActiveKey] = useState<string>('2')
  180. return <div style={{ display: 'flex', gap: 10, maxHeight: 450 }}>
  181. <div style={{ width: 320, maxHeight: 450, overflow: 'hidden', overflowY: 'auto' }}>
  182. <PreviewTime
  183. {...record}
  184. />
  185. <h2>群发内容</h2>
  186. {corpMomentContentList?.map((item, index) => <div key={index} style={{ marginTop: 5, backgroundColor: '#d9d9d9', borderRadius: 6, padding: '10px 10px 16px' }}>
  187. <h3 style={{ marginTop: 0, textAlign: 'center' }}>内容{index + 1}</h3>
  188. <LookMsg data={getMsgData(item, token)} />
  189. </div>)}
  190. </div>
  191. <div style={{ flex: 1, overflow: 'hidden', display: 'flex', flexDirection: 'column', gap: 10, height: '100%' }}>
  192. <Tabs
  193. destroyInactiveTabPane={false}
  194. onChange={(key) => {
  195. setActiveKey(key)
  196. }}
  197. activeKey={activeKey}
  198. type="card"
  199. className="aaa"
  200. items={[
  201. {
  202. key: '2',
  203. label: '下发企微号',
  204. children: <Card styles={{ body: { maxHeight: 400 } }}>
  205. {activeKey == '2' && <MomentsXfCorpTabls data={record} />}
  206. </Card>
  207. },
  208. {
  209. key: '4',
  210. label: '群发记录',
  211. children: <Card styles={{ body: { minHeight: 400 } }}>
  212. {activeKey == '4' && <MomentsTaskNotes data={record} />}
  213. </Card>
  214. }
  215. ]}
  216. />
  217. </div>
  218. </div>
  219. }
  220. export default Log;