tableConfig.tsx 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. import { Input, Typography } from "antd";
  2. import { AnyObject } from "antd/es/_util/type"
  3. import { ColumnsType } from "antd/es/table"
  4. import { businessPlanData, TIME_TYPE, welcomeContentData } from "./const";
  5. import FilterUser from "@/pages/weComTask/components/filterUser";
  6. import ShowContentTable from "./components/massSending/showContentTable";
  7. import WelcomeShowTable from "./components/welcome/welcomeShowTable";
  8. import FriendsShowTable from "./components/friends/friendsShowTable";
  9. import SelectBookLinkButton from "../../bookLink/SelectBookLinkButton";
  10. const { Title, Text, Paragraph } = Typography;
  11. export const userInheritColumns = (setContent: (data: TASK_CREATE.SetContentProps) => void): ColumnsType<AnyObject> => {
  12. return [
  13. {
  14. title: '账号',
  15. dataIndex: 'corpUserGroupName',
  16. key: 'corpUserGroupName',
  17. width: 150,
  18. render(value, record) {
  19. return <>
  20. <Title level={5} style={{ margin: 0 }}>{value}({record?.corpUserList?.[0]?.corpName})</Title>
  21. <Paragraph style={{ margin: 0 }}>客服号:{record?.corpUserList?.map(i => i.name).join('、')}</Paragraph>
  22. </>
  23. },
  24. onCell: (record) => {
  25. return { rowSpan: record.userRowSpan }
  26. }
  27. },
  28. {
  29. title: '继承信息',
  30. dataIndex: 'taskName',
  31. key: 'taskName',
  32. width: 130,
  33. render(value, record) {
  34. return <>
  35. <Title level={5} style={{ margin: 0 }}>标题:{value}</Title>
  36. {record?.bizType && <Paragraph style={{ margin: 0 }}>业务类型:{record?.bizType || '<空>'}</Paragraph>}
  37. {record?.platform && <Paragraph style={{ margin: 0 }}>书城:{record?.platform || '<空>'}</Paragraph>}
  38. {record?.templateProductId && <Paragraph style={{ margin: 0 }}>适用产品:{record?.templateProductId || '<空>'}</Paragraph>}
  39. </>
  40. },
  41. onCell: (record) => {
  42. return { rowSpan: record.userRowSpan }
  43. }
  44. },
  45. {
  46. title: '策略信息',
  47. dataIndex: 'strategyData',
  48. key: 'strategyData',
  49. width: 200,
  50. render(value, record) {
  51. return <>
  52. <Title level={5} style={{ margin: 0 }}>策略{record.strategyIndex}</Title>
  53. <Paragraph style={{ margin: 0 }}>名称:{value?.strategyName || '<空>'}</Paragraph>
  54. <Paragraph style={{ margin: 0 }}>执行类型:{TIME_TYPE[value?.timeRepeatType]}</Paragraph>
  55. {value?.sendDay && <Paragraph style={{ margin: 0 }}>执行时间:{value?.sendDay}</Paragraph>}
  56. {value?.startTime && <Paragraph style={{ margin: 0 }}>执行日期:{value?.startTime}~{value?.endTime ? value?.endTime : '长期执行'}</Paragraph>}
  57. {value?.sendTime && <Paragraph style={{ margin: 0 }}>执行时间:{value?.sendTime}</Paragraph>}
  58. {value?.repeatArray && <Paragraph style={{ margin: 0 }}>执行天数:{value?.repeatArray.join('、')}</Paragraph>}
  59. </>
  60. },
  61. onCell: (record) => {
  62. return { rowSpan: record.strategyRowSpan }
  63. }
  64. },
  65. {
  66. title: '继承对象',
  67. dataIndex: 'inheritData',
  68. key: 'inheritData',
  69. width: 200,
  70. render(value, record) {
  71. return <>
  72. <Title level={5} style={{ margin: 0 }}>转移对象{record.inheritIndex}</Title>
  73. <Paragraph style={{ margin: 0 }}>类型:{value?.transferType === 'all' ? '全部' : '指定'}</Paragraph>
  74. {value?.transferType === 'specify' && <FilterUser isSHow value={value?.transferUserDto} configType='USER_GROUP' />}
  75. </>
  76. },
  77. },
  78. {
  79. title: '继承后文本内容',
  80. dataIndex: 'transferSuccessMsg',
  81. key: 'transferSuccessMsg',
  82. width: 200,
  83. render(_, record) {
  84. return <Text>{record?.inheritData?.transferSuccessMsg || '<空>'}</Text>
  85. },
  86. },
  87. {
  88. title: '接替客户企微号',
  89. dataIndex: 'externalUser',
  90. key: 'externalUserCorpUserName',
  91. width: 100,
  92. render(_, record) {
  93. return <Input.TextArea
  94. placeholder="请输入接替客户企微号"
  95. allowClear
  96. onChange={e => setContent({
  97. msg: { corpUserName: e.target.value },
  98. index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.inheritIndex - 1],
  99. type: 'userInherit'
  100. })}
  101. />
  102. },
  103. },
  104. {
  105. title: '接替客户企微号ID',
  106. dataIndex: 'externalUser',
  107. key: 'externalUserCorpUserId',
  108. width: 100,
  109. render(_, record) {
  110. return <Input.TextArea
  111. placeholder="请输入接替客户企微号ID"
  112. allowClear
  113. onChange={e => setContent({
  114. msg: { corpUserId: e.target.value },
  115. index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.inheritIndex - 1],
  116. type: 'userInherit'
  117. })}
  118. />
  119. },
  120. }
  121. ]
  122. }
  123. /** 群发 */
  124. export const massSendingColumns = (setContent: (data: TASK_CREATE.SetContentProps) => void, bookPlatForm: TASK_CREATE.BookPlatFormProps[], bookList: TASK_CREATE.BookListProps[], previewContent: { groupMsgContent?: any[], welcomeMsgContent?: any[], externalUserTransferContent?: any[] }, platform: string): ColumnsType<AnyObject> => {
  125. return [
  126. {
  127. title: '账号',
  128. dataIndex: 'corpUserGroupName',
  129. key: 'corpUserGroupName',
  130. width: 150,
  131. render(value, record) {
  132. return <>
  133. <Title level={5} style={{ margin: 0 }}>{value}</Title>
  134. <Paragraph style={{ margin: 0 }}>公众号:{record?.corpUserList?.[0]?.mpAccountName || '--'}</Paragraph>
  135. <Paragraph style={{ margin: 0 }}>客服号:{record?.corpUserList?.map(i => i.name).join('、')}</Paragraph>
  136. </>
  137. },
  138. onCell: (record) => {
  139. return { rowSpan: record.userRowSpan }
  140. }
  141. },
  142. {
  143. title: '群发信息',
  144. dataIndex: 'groupSendName',
  145. key: 'groupSendName',
  146. width: 130,
  147. render(value, record) {
  148. return <>
  149. <Title level={5} style={{ margin: 0 }}>标题:{value}</Title>
  150. {record?.bizType && <Paragraph style={{ margin: 0 }}>业务类型:{record?.bizType === 'novel' ? '小说' : record?.bizType === 'game' ? '游戏' : '<空>'}</Paragraph>}
  151. {record?.platform && <Paragraph style={{ margin: 0 }}>书城:{record?.platform ? bookPlatForm?.find(item => item.id === record?.platform)?.platformName : '<空>'}</Paragraph>}
  152. {record?.templateProductId && <Paragraph style={{ margin: 0 }}>适用产品:{record?.templateProductId ? bookList?.find(item => item.id === record?.templateProductId)?.bookName : '<空>'}</Paragraph>}
  153. </>
  154. },
  155. onCell: (record) => {
  156. return { rowSpan: record.userRowSpan }
  157. }
  158. },
  159. {
  160. title: '策略信息',
  161. dataIndex: 'strategyData',
  162. key: 'strategyData',
  163. width: 200,
  164. render(value, record) {
  165. return <>
  166. <Title level={5} style={{ margin: 0 }}>策略{record.strategyIndex}</Title>
  167. <Paragraph style={{ margin: 0 }}>名称:{value?.strategyName || '<空>'}</Paragraph>
  168. <Paragraph style={{ margin: 0 }}>执行类型:{TIME_TYPE[value?.timeRepeatType]}</Paragraph>
  169. {value?.sendDay && <Paragraph style={{ margin: 0 }}>执行时间:{value?.sendDay}</Paragraph>}
  170. {value?.startTime && <Paragraph style={{ margin: 0 }}>执行日期:{value?.startTime}~{value?.endTime ? value?.endTime : '长期执行'}</Paragraph>}
  171. {value?.sendTime && <Paragraph style={{ margin: 0 }}>执行时间:{value?.sendTime}</Paragraph>}
  172. {value?.repeatArray && <Paragraph style={{ margin: 0 }}>执行天数:{value?.repeatArray.join('、')}</Paragraph>}
  173. </>
  174. },
  175. onCell: (record) => {
  176. return { rowSpan: record.strategyRowSpan }
  177. }
  178. },
  179. {
  180. title: '发送对象',
  181. dataIndex: 'sendData',
  182. key: 'sendData',
  183. width: 200,
  184. render(value, record) {
  185. return <>
  186. <Title level={5} style={{ margin: 0 }}>发送对象{record.sendDataIndex}</Title>
  187. <Paragraph style={{ margin: 0 }} ellipsis>名称:{value?.externalUserFilterName}</Paragraph>
  188. <Paragraph style={{ margin: 0 }}>内容发送模式:{welcomeContentData?.find(i => i.value === record?.sendMode)?.label}</Paragraph>
  189. <Paragraph style={{ margin: 0 }}>类型:{value?.externalUserType === 'all' ? '全部' : '指定'}</Paragraph>
  190. {value?.externalUserType === 'specify' && <FilterUser isSHow value={value?.externalUserFilter} configType='USER_GROUP' />}
  191. </>
  192. },
  193. onCell: (record) => {
  194. return { rowSpan: record.sendDataRowSpan }
  195. }
  196. },
  197. {
  198. title: '发送内容',
  199. dataIndex: 'content',
  200. key: 'content',
  201. width: 200,
  202. render(_, record) {
  203. return <>
  204. <ShowContentTable
  205. data={record?.content}
  206. name={<><span>内容{record.contentIndex}:</span><span dangerouslySetInnerHTML={{ __html: record.contentReactNode?.map((item) => item).join('、') }}></span></>}
  207. />
  208. </>
  209. },
  210. },
  211. {
  212. title: '图文链接',
  213. dataIndex: 'linkUrl',
  214. key: 'linkUrl',
  215. width: 250,
  216. render(_, record) {
  217. return record?.linkData?.length > 0 ? <div style={{ display: 'flex', gap: 4, alignItems: 'flex-end' }}>
  218. <Input.TextArea
  219. placeholder="请输入链接"
  220. allowClear
  221. value={previewContent?.groupMsgContent?.[record.corpUsergroupIndex]?.[record.strategyIndex - 1]?.[record.sendDataIndex - 1]?.[record.contentIndex - 1]?.linkUrl}
  222. onChange={e => {
  223. setContent({
  224. msg: { linkUrl: e.target.value },
  225. index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.sendDataIndex - 1, record.contentIndex - 1],
  226. type: 'massSending'
  227. })
  228. }}
  229. />
  230. <SelectBookLinkButton
  231. bookPlatForm={bookPlatForm}
  232. platform={platform}
  233. mpAccountId={record.corpUserList?.[0]?.mpAccountId}
  234. linkData={record.linkData}
  235. onChange={(linkStr, miniprogramAppid, miniprogramPage) => {
  236. const msg: { [x: string]: string } = { linkUrl: linkStr }
  237. if (miniprogramAppid && miniprogramPage && record?.miniProgramData?.length > 0 && !previewContent?.groupMsgContent?.[record.corpUsergroupIndex]?.[record.strategyIndex - 1]?.[record.sendDataIndex - 1]?.[record.contentIndex - 1]?.miniprogramAppid && !previewContent?.groupMsgContent?.[record.corpUsergroupIndex]?.[record.strategyIndex - 1]?.[record.sendDataIndex - 1]?.[record.contentIndex - 1]?.miniprogramPage) {
  238. msg.miniprogramAppid = miniprogramAppid
  239. msg.miniprogramPage = miniprogramPage
  240. }
  241. setContent({
  242. msg,
  243. index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.sendDataIndex - 1, record.contentIndex - 1],
  244. type: 'massSending'
  245. })
  246. }}
  247. />
  248. </div> : '--'
  249. },
  250. },
  251. {
  252. title: '小程序APPID',
  253. dataIndex: 'miniprogramAppid',
  254. key: 'miniprogramAppid',
  255. width: 200,
  256. render(_, record) {
  257. return record?.miniProgramData?.length > 0 ? <Input.TextArea
  258. placeholder="请输入小程序APPID"
  259. allowClear
  260. value={previewContent?.groupMsgContent?.[record.corpUsergroupIndex]?.[record.strategyIndex - 1]?.[record.sendDataIndex - 1]?.[record.contentIndex - 1]?.miniprogramAppid}
  261. onChange={e => setContent({
  262. msg: { miniprogramAppid: e.target.value },
  263. index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.sendDataIndex - 1, record.contentIndex - 1],
  264. type: 'massSending'
  265. })}
  266. /> : '--'
  267. },
  268. },
  269. {
  270. title: '小程序路径',
  271. dataIndex: 'miniprogramPage',
  272. key: 'miniprogramPage',
  273. width: 250,
  274. render(_, record) {
  275. return record?.miniProgramData?.length > 0 ? <div style={{ display: 'flex', gap: 4, alignItems: 'flex-end' }}>
  276. <Input.TextArea
  277. placeholder="请输入小程序路径"
  278. allowClear
  279. value={previewContent?.groupMsgContent?.[record.corpUsergroupIndex]?.[record.strategyIndex - 1]?.[record.sendDataIndex - 1]?.[record.contentIndex - 1]?.miniprogramPage}
  280. onChange={e => setContent({
  281. msg: { miniprogramPage: e.target.value },
  282. index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.sendDataIndex - 1, record.contentIndex - 1],
  283. type: 'massSending'
  284. })}
  285. />
  286. <SelectBookLinkButton
  287. bookPlatForm={bookPlatForm}
  288. platform={platform}
  289. mpAccountId={record.corpUserList?.[0]?.mpAccountId}
  290. linkData={[{
  291. msgType: "TASK_CONTENT_LINK",
  292. link: {
  293. title: record.miniProgramData?.[0]?.miniprogram?.title,
  294. picUrl: record.miniProgramData?.[0]?.miniprogram?.picUrl,
  295. desc: ''
  296. }
  297. }]}
  298. onChange={(_, miniprogramAppid, miniprogramPage) => {
  299. const msg: { [x: string]: string } = {}
  300. if (miniprogramAppid && miniprogramPage) {
  301. msg.miniprogramAppid = miniprogramAppid
  302. msg.miniprogramPage = miniprogramPage
  303. setContent({
  304. msg,
  305. index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.sendDataIndex - 1, record.contentIndex - 1],
  306. type: 'massSending'
  307. })
  308. }
  309. }}
  310. />
  311. </div> : '--'
  312. }
  313. }
  314. ]
  315. }
  316. export const highMassSendingColumns = (): ColumnsType<AnyObject> => {
  317. return [
  318. {
  319. title: '账号',
  320. dataIndex: 'corpUserName',
  321. key: 'corpUserName',
  322. width: 150,
  323. render(value, record) {
  324. return <Text>{value}({record.corpUserId})</Text>
  325. },
  326. onCell: (record) => {
  327. return { rowSpan: record.userRowSpan }
  328. }
  329. },
  330. {
  331. title: '群发信息',
  332. dataIndex: 'groupSendName',
  333. key: 'groupSendName',
  334. width: 130,
  335. render(value, record) {
  336. return <>
  337. <Title level={5} style={{ margin: 0 }}>标题:{value}</Title>
  338. {record?.bizType && <Paragraph style={{ margin: 0 }}>业务类型:{record?.bizType || '<空>'}</Paragraph>}
  339. {record?.platform && <Paragraph style={{ margin: 0 }}>书城:{record?.platform || '<空>'}</Paragraph>}
  340. {record?.templateProductId && <Paragraph style={{ margin: 0 }}>适用产品:{record?.templateProductId || '<空>'}</Paragraph>}
  341. </>
  342. },
  343. onCell: (record) => {
  344. return { rowSpan: record.userRowSpan }
  345. }
  346. },
  347. {
  348. title: '策略信息',
  349. dataIndex: 'strategyData',
  350. key: 'strategyData',
  351. width: 200,
  352. render(value, record) {
  353. return <>
  354. <Title level={5} style={{ margin: 0 }}>策略{record.strategyIndex}</Title>
  355. <Paragraph style={{ margin: 0 }}>名称:{value?.strategyName || '<空>'}</Paragraph>
  356. <Paragraph style={{ margin: 0 }}>执行类型:{TIME_TYPE[value?.timeRepeatType]}</Paragraph>
  357. {value?.sendDay && <Paragraph style={{ margin: 0 }}>执行时间:{value?.sendDay}</Paragraph>}
  358. {value?.startTime && <Paragraph style={{ margin: 0 }}>执行日期:{value?.startTime}~{value?.endTime ? value?.endTime : '长期执行'}</Paragraph>}
  359. {value?.sendTime && <Paragraph style={{ margin: 0 }}>执行时间:{value?.sendTime}</Paragraph>}
  360. {value?.repeatArray && <Paragraph style={{ margin: 0 }}>执行天数:{value?.repeatArray.join('、')}</Paragraph>}
  361. </>
  362. },
  363. onCell: (record) => {
  364. return { rowSpan: record.strategyRowSpan }
  365. }
  366. },
  367. {
  368. title: '发送对象',
  369. dataIndex: 'sendData',
  370. key: 'sendData',
  371. width: 200,
  372. render(value, record) {
  373. return <>
  374. <Title level={5} style={{ margin: 0 }}>发送对象{record.sendDataIndex}</Title>
  375. <Paragraph style={{ margin: 0 }}>内容发送模式:{welcomeContentData?.find(i => i.value === record?.sendMode)?.label}</Paragraph>
  376. <Paragraph style={{ margin: 0 }}>类型:{value?.externalUserType === 'all' ? '全部' : '指定'}</Paragraph>
  377. {value?.externalUserType === 'specify' && <FilterUser isSHow value={value?.externalUserFilter} configType='GROUP_GROUP' />}
  378. </>
  379. },
  380. onCell: (record) => {
  381. return { rowSpan: record.sendDataRowSpan }
  382. }
  383. },
  384. {
  385. title: '群发外部联系人',
  386. dataIndex: 'externalUser',
  387. key: 'externalUser',
  388. width: 200,
  389. render(value) {
  390. return <>
  391. <Title ellipsis level={5} style={{ margin: 0 }}>消息发送号外部联系人</Title>
  392. <Paragraph ellipsis={{ tooltip: true }} style={{ margin: 0 }}>{value?.externalUserId}({value?.name})</Paragraph>
  393. <Title ellipsis level={5} style={{ margin: 0 }}>群聊所在主体</Title>
  394. <Paragraph ellipsis={{ tooltip: true }} style={{ margin: 0 }}>{value?.corpId}({value?.corpName})</Paragraph>
  395. </>
  396. },
  397. },
  398. {
  399. title: '发送内容',
  400. dataIndex: 'content',
  401. key: 'content',
  402. width: 200,
  403. render(_, record) {
  404. return <WelcomeShowTable
  405. name={<><span>内容{record.contentIndex}:</span><span dangerouslySetInnerHTML={{ __html: record.contentReactNode?.map((item) => item).join('、') }}></span></>}
  406. data={record?.content}
  407. />
  408. },
  409. },
  410. {
  411. title: '图文链接',
  412. dataIndex: 'linkUrl',
  413. key: 'linkUrl',
  414. width: 200,
  415. render(_, record) {
  416. return <Paragraph style={{ margin: 0, color: '#000', fontWeight: !!record?.groupMsgContent?.linkUrl ? 'bold' : 'normal' }}>{record?.groupMsgContent?.linkUrl || '--'}</Paragraph>
  417. },
  418. },
  419. {
  420. title: '小程序APPID',
  421. dataIndex: 'miniprogramAppid',
  422. key: 'miniprogramAppid',
  423. width: 200,
  424. render(_, record) {
  425. return <Paragraph style={{ margin: 0, color: '#000', fontWeight: !!record?.groupMsgContent?.miniprogramAppid ? 'bold' : 'normal' }}>{record?.groupMsgContent?.miniprogramAppid || '--'}</Paragraph>
  426. },
  427. },
  428. {
  429. title: '小程序路径',
  430. dataIndex: 'miniprogramPage',
  431. key: 'miniprogramPage',
  432. width: 200,
  433. render(_, record) {
  434. return <Paragraph style={{ margin: 0, color: '#000', fontWeight: !!record?.groupMsgContent?.miniprogramPage ? 'bold' : 'normal' }}>{record?.groupMsgContent?.miniprogramPage || '--'}</Paragraph>
  435. },
  436. }
  437. ]
  438. }
  439. export const welcomeColumns = (bookPlatForm: TASK_CREATE.BookPlatFormProps[], bookList: TASK_CREATE.BookListProps[], setContent: (data: TASK_CREATE.SetContentProps) => void, previewContent: { groupMsgContent?: any[], welcomeMsgContent?: any[], externalUserTransferContent?: any[] }, platform: string): ColumnsType<AnyObject> => {
  440. return [
  441. {
  442. title: '账号',
  443. dataIndex: 'corpUserGroupName',
  444. key: 'corpUserGroupName',
  445. width: 150,
  446. render(value, record) {
  447. return <>
  448. <Title level={5} style={{ margin: 0 }}>{value}({record?.corpUserList?.[0]?.corpName})</Title>
  449. <Paragraph style={{ margin: 0 }}>公众号:{record?.corpUserList?.[0]?.mpAccountName || '--'}</Paragraph>
  450. <Paragraph style={{ margin: 0 }}>客服号:{record?.corpUserList?.map(i => i.name).join('、')}</Paragraph>
  451. </>
  452. },
  453. onCell: (record) => {
  454. return { rowSpan: record.rowSpan }
  455. }
  456. },
  457. {
  458. title: '欢迎语信息',
  459. dataIndex: 'welcomeName',
  460. key: 'welcomeName',
  461. width: 130,
  462. render(value, record) {
  463. return <>
  464. <Title level={5} style={{ margin: 0 }}>标题:{value}</Title>
  465. {record?.bizType && <Paragraph style={{ margin: 0 }}>业务类型:{record?.bizType === 'noval' ? '小说' : record?.bizType === 'game' ? '游戏' : '<空>'}</Paragraph>}
  466. {record?.platform && <Paragraph style={{ margin: 0 }}>书城:{record?.platform ? bookPlatForm?.find(item => item.id === record?.platform)?.platformName : '<空>'}</Paragraph>}
  467. {record?.templateProductId && <Paragraph style={{ margin: 0 }}>适用产品:{record?.templateProductId ? bookList?.find(item => item.id === record?.templateProductId)?.bookName : '<空>'}</Paragraph>}
  468. </>
  469. },
  470. onCell: (record) => {
  471. return { rowSpan: record.rowSpan }
  472. }
  473. },
  474. {
  475. title: '智能标签',
  476. dataIndex: 'welcomeMsgTagDTO',
  477. key: 'welcomeMsgTagDTO',
  478. width: 200,
  479. render(value) {
  480. return <>
  481. {value?.business && <Paragraph style={{ margin: 0 }}>业务(来源渠道):{businessPlanData.find(i => i.value === value.business)?.label || '<空>'}</Paragraph>}
  482. {value?.bookCity && <Paragraph style={{ margin: 0 }}>书城(来源渠道):{bookPlatForm.find(i => i.id === value.bookCity)?.platformName || '<空>'}</Paragraph>}
  483. {value?.product && <Paragraph style={{ margin: 0 }}>产品(来源渠道):{bookList.find(i => i.id === value.product)?.bookName || '<空>'}</Paragraph>}
  484. </>
  485. },
  486. onCell: (record) => {
  487. return { rowSpan: record.rowSpan }
  488. }
  489. },
  490. {
  491. title: '内容组发送模式',
  492. dataIndex: 'sendMode',
  493. key: 'sendMode',
  494. width: 100,
  495. align: 'center',
  496. render(value) {
  497. return <Paragraph style={{ margin: 0 }}>{welcomeContentData?.find(i => i.value === value)?.label}</Paragraph>
  498. },
  499. onCell: (record) => {
  500. return { rowSpan: record.rowSpan }
  501. }
  502. },
  503. {
  504. title: '欢迎语发送内容',
  505. dataIndex: 'sendData',
  506. key: 'sendData',
  507. width: 200,
  508. render(value, record) {
  509. return <WelcomeShowTable
  510. name={<><span>内容{record.contentIndex}:</span><span dangerouslySetInnerHTML={{ __html: record.contentReactNode?.map((item) => item).join('、') }}></span></>}
  511. data={value}
  512. />
  513. },
  514. },
  515. {
  516. title: '图文链接',
  517. dataIndex: 'linkUrl',
  518. key: 'linkUrl',
  519. width: 250,
  520. render(_, record) {
  521. return record?.linkData?.length > 0 ? <div style={{ display: 'flex', gap: 4, alignItems: 'flex-end' }}>
  522. <Input.TextArea
  523. placeholder="请输入链接"
  524. allowClear
  525. value={previewContent?.welcomeMsgContent?.[record.corpUsergroupIndex]?.[record.contentIndex - 1]?.linkUrl}
  526. onChange={e => {
  527. setContent({
  528. msg: { linkUrl: e.target.value },
  529. index: [record.corpUsergroupIndex, record.contentIndex - 1],
  530. type: 'welcome'
  531. })
  532. }}
  533. />
  534. <SelectBookLinkButton
  535. bookPlatForm={bookPlatForm}
  536. platform={platform}
  537. mpAccountId={record.corpUserList?.[0]?.mpAccountId}
  538. linkData={record.linkData.map(item => ({
  539. msgType: "TASK_CONTENT_LINK",
  540. link: {
  541. title: item.linkTitle,
  542. picUrl: item.linkPicurl,
  543. desc: item.linkDesc
  544. }
  545. }))}
  546. onChange={(linkStr, miniprogramAppid, miniprogramPage) => {
  547. const msg: { [x: string]: string } = { linkUrl: linkStr }
  548. if (miniprogramAppid && miniprogramPage && record?.miniProgramData?.length > 0 && !previewContent?.welcomeMsgContent?.[record.corpUsergroupIndex]?.[record.contentIndex - 1]?.miniprogramAppid && !previewContent?.welcomeMsgContent?.[record.corpUsergroupIndex]?.[record.contentIndex - 1]?.miniprogramPage) {
  549. msg.miniprogramAppid = miniprogramAppid
  550. msg.miniprogramPage = miniprogramPage
  551. }
  552. setContent({
  553. msg,
  554. index: [record.corpUsergroupIndex, record.contentIndex - 1],
  555. type: 'welcome'
  556. })
  557. }}
  558. />
  559. </div> : '--'
  560. },
  561. },
  562. {
  563. title: '小程序APPID',
  564. dataIndex: 'miniprogramAppid',
  565. key: 'miniprogramAppid',
  566. width: 200,
  567. render(_, record) {
  568. return record?.miniProgramData?.length > 0 ? <Input.TextArea
  569. placeholder="请输入小程序APPID"
  570. allowClear
  571. value={previewContent?.welcomeMsgContent?.[record.corpUsergroupIndex]?.[record.contentIndex - 1]?.miniprogramAppid}
  572. onChange={e => setContent({
  573. msg: { miniprogramAppid: e.target.value },
  574. index: [record.corpUsergroupIndex, record.contentIndex - 1],
  575. type: 'welcome'
  576. })}
  577. /> : '--'
  578. },
  579. },
  580. {
  581. title: '小程序路径',
  582. dataIndex: 'miniprogramPage',
  583. key: 'miniprogramPage',
  584. width: 250,
  585. render(_, record) {
  586. return record?.miniProgramData?.length > 0 ? <div style={{ display: 'flex', gap: 4, alignItems: 'flex-end' }}>
  587. <Input.TextArea
  588. placeholder="请输入小程序路径"
  589. allowClear
  590. value={previewContent?.welcomeMsgContent?.[record.corpUsergroupIndex]?.[record.contentIndex - 1]?.miniprogramPage}
  591. onChange={e => setContent({
  592. msg: { miniprogramPage: e.target.value },
  593. index: [record.corpUsergroupIndex, record.contentIndex - 1],
  594. type: 'welcome'
  595. })}
  596. />
  597. <SelectBookLinkButton
  598. bookPlatForm={bookPlatForm}
  599. platform={platform}
  600. mpAccountId={record.corpUserList?.[0]?.mpAccountId}
  601. linkData={[{
  602. msgType: "TASK_CONTENT_LINK",
  603. link: {
  604. title: record.miniProgramData?.[0]?.miniprogramTitle,
  605. picUrl: record.miniProgramData?.[0]?.miniprogramPicurl,
  606. desc: ''
  607. }
  608. }]}
  609. onChange={(_, miniprogramAppid, miniprogramPage) => {
  610. const msg: { [x: string]: string } = {}
  611. if (miniprogramAppid && miniprogramPage) {
  612. msg.miniprogramAppid = miniprogramAppid
  613. msg.miniprogramPage = miniprogramPage
  614. setContent({
  615. msg,
  616. index: [record.corpUsergroupIndex, record.contentIndex - 1],
  617. type: 'welcome'
  618. })
  619. }
  620. }}
  621. />
  622. </div> : '--'
  623. }
  624. }
  625. ]
  626. }
  627. export const friendsColumns = (): ColumnsType<AnyObject> => {
  628. return [
  629. {
  630. title: '账号',
  631. dataIndex: 'corpUserName',
  632. key: 'corpUserName',
  633. width: 150,
  634. render(value, record) {
  635. return <Text>{value}({record.corpUserId})</Text>
  636. },
  637. onCell: (record) => {
  638. return { rowSpan: record.userRowSpan }
  639. }
  640. },
  641. {
  642. title: '朋友圈信息',
  643. dataIndex: 'momentSendName',
  644. key: 'momentSendName',
  645. width: 130,
  646. render(value, record) {
  647. return <>
  648. <Title level={5} style={{ margin: 0 }}>标题:{value}</Title>
  649. {record?.bizType && <Paragraph style={{ margin: 0 }}>业务类型:{record?.bizType || '<空>'}</Paragraph>}
  650. {record?.platform && <Paragraph style={{ margin: 0 }}>书城:{record?.platform || '<空>'}</Paragraph>}
  651. {record?.templateProductId && <Paragraph style={{ margin: 0 }}>适用产品:{record?.templateProductId || '<空>'}</Paragraph>}
  652. </>
  653. },
  654. onCell: (record) => {
  655. return { rowSpan: record.userRowSpan }
  656. }
  657. },
  658. {
  659. title: '策略信息',
  660. dataIndex: 'strategyData',
  661. key: 'strategyData',
  662. width: 200,
  663. render(value, record) {
  664. return <>
  665. <Title level={5} style={{ margin: 0 }}>策略{record.strategyIndex + 1}</Title>
  666. <Paragraph style={{ margin: 0 }}>名称:{value?.strategyName || '<空>'}</Paragraph>
  667. <Paragraph style={{ margin: 0 }}>执行类型:{TIME_TYPE[value?.timeRepeatType]}</Paragraph>
  668. {value?.sendDay && <Paragraph style={{ margin: 0 }}>执行时间:{value?.sendDay}</Paragraph>}
  669. {value?.startTime && <Paragraph style={{ margin: 0 }}>执行日期:{value?.startTime}~{value?.endTime ? value?.endTime : '长期执行'}</Paragraph>}
  670. {value?.sendTime && <Paragraph style={{ margin: 0 }}>执行时间:{value?.sendTime}</Paragraph>}
  671. {value?.repeatArray && <Paragraph style={{ margin: 0 }}>执行天数:{value?.repeatArray.join('、')}</Paragraph>}
  672. </>
  673. },
  674. onCell: (record) => {
  675. return { rowSpan: record.strategyRowSpan }
  676. }
  677. },
  678. {
  679. title: '发送对象',
  680. dataIndex: 'sendData',
  681. key: 'sendData',
  682. width: 200,
  683. render(value, record) {
  684. return <>
  685. <Title level={5} style={{ margin: 0 }}>发送对象{record.sendDataIndex}</Title>
  686. <Paragraph style={{ margin: 0 }}>内容发送模式:{welcomeContentData?.find(i => i.value === record?.sendMode)?.label}</Paragraph>
  687. <Paragraph style={{ margin: 0 }} ellipsis={{ rows: 3, tooltip: true }}>企微标签:{value?.length > 0 ? value?.map(i => i.title).join('、') : '全部'}</Paragraph>
  688. </>
  689. },
  690. onCell: (record) => {
  691. return { rowSpan: record.strategyRowSpan }
  692. }
  693. },
  694. {
  695. title: '发送内容',
  696. dataIndex: 'content',
  697. key: 'content',
  698. width: 200,
  699. render(_, record) {
  700. return <>
  701. <FriendsShowTable
  702. data={record?.content}
  703. name={<><span>内容{record.contentIndex + 1}:</span><span dangerouslySetInnerHTML={{ __html: record.contentReactNode?.map((item) => item).join('、') }}></span></>}
  704. />
  705. </>
  706. },
  707. },
  708. {
  709. title: '图文链接',
  710. dataIndex: 'linkUrl',
  711. key: 'linkUrl',
  712. width: 200,
  713. render(_, record) {
  714. return <Paragraph style={{ margin: 0, color: '#000', fontWeight: !!record?.friendsContent?.linkUrl ? 'bold' : 'normal' }}>{record?.friendsContent?.linkUrl || '--'}</Paragraph>
  715. },
  716. },
  717. {
  718. title: '小程序APPID',
  719. dataIndex: 'miniprogramAppid',
  720. key: 'miniprogramAppid',
  721. width: 200,
  722. render(_, record) {
  723. return <Paragraph style={{ margin: 0, color: '#000', fontWeight: !!record?.friendsContent?.miniprogramAppid ? 'bold' : 'normal' }}>{record?.friendsContent?.miniprogramAppid || '--'}</Paragraph>
  724. },
  725. },
  726. {
  727. title: '小程序路径',
  728. dataIndex: 'miniprogramPage',
  729. key: 'miniprogramPage',
  730. width: 200,
  731. render(_, record) {
  732. return <Paragraph style={{ margin: 0, color: '#000', fontWeight: !!record?.friendsContent?.miniprogramPage ? 'bold' : 'normal' }}>{record?.friendsContent?.miniprogramPage || '--'}</Paragraph>
  733. },
  734. }
  735. ]
  736. }