tableConfig.tsx 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  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[], previewContent: { groupMsgContent?: any[], welcomeMsgContent?: any[], externalUserTransferContent?: any[] }): 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 }}>公众号ID:{record?.corpUserList?.[0]?.mpAccountId || '--'}</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 || '<空>'}</Paragraph>}
  151. {record?.platform && <Paragraph style={{ margin: 0 }}>书城:{record?.platform || '<空>'}</Paragraph>}
  152. {record?.templateProductId && <Paragraph style={{ margin: 0 }}>适用产品:{record?.templateProductId || '<空>'}</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 }}>内容发送模式:{welcomeContentData?.find(i => i.value === record?.sendMode)?.label}</Paragraph>
  188. <Paragraph style={{ margin: 0 }}>类型:{value?.externalUserType === 'all' ? '全部' : '指定'}</Paragraph>
  189. {value?.externalUserType === 'specify' && <FilterUser isSHow value={value?.externalUserFilter} configType='USER_GROUP' />}
  190. </>
  191. },
  192. onCell: (record) => {
  193. return { rowSpan: record.sendDataRowSpan }
  194. }
  195. },
  196. {
  197. title: '发送内容',
  198. dataIndex: 'content',
  199. key: 'content',
  200. width: 200,
  201. render(_, record) {
  202. return <>
  203. <ShowContentTable
  204. data={record?.content}
  205. name={<><span>内容{record.contentIndex}:</span><span dangerouslySetInnerHTML={{ __html: record.contentReactNode?.map((item) => item).join('、') }}></span></>}
  206. />
  207. </>
  208. },
  209. },
  210. {
  211. title: '图文链接',
  212. dataIndex: 'linkUrl',
  213. key: 'linkUrl',
  214. width: 250,
  215. render(_, record) {
  216. return record?.linkData?.length > 0 ? <div style={{ display: 'flex', gap: 4, alignItems: 'flex-end' }}>
  217. <Input.TextArea
  218. placeholder="请输入链接"
  219. allowClear
  220. value={previewContent?.groupMsgContent?.[record.corpUsergroupIndex]?.[record.strategyIndex - 1]?.[record.sendDataIndex - 1]?.[record.contentIndex - 1]?.linkUrl}
  221. onChange={e => {
  222. setContent({
  223. msg: { linkUrl: e.target.value },
  224. index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.sendDataIndex - 1, record.contentIndex - 1],
  225. type: 'massSending'
  226. })
  227. }}
  228. />
  229. <SelectBookLinkButton
  230. bookPlatForm={bookPlatForm}
  231. mpAccountId={record.corpUserList?.[0]?.mpAccountId}
  232. linkData={record.linkData}
  233. onChange={(linkStr, miniprogramAppid, miniprogramPage) => {
  234. const msg: { [x: string]: string } = { linkUrl: linkStr }
  235. 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) {
  236. msg.miniprogramAppid = miniprogramAppid
  237. msg.miniprogramPage = miniprogramPage
  238. }
  239. setContent({
  240. msg,
  241. index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.sendDataIndex - 1, record.contentIndex - 1],
  242. type: 'massSending'
  243. })
  244. }}
  245. />
  246. </div> : '--'
  247. },
  248. },
  249. {
  250. title: '小程序APPID',
  251. dataIndex: 'miniprogramAppid',
  252. key: 'miniprogramAppid',
  253. width: 200,
  254. render(_, record) {
  255. return record?.miniProgramData?.length > 0 ? <Input.TextArea
  256. placeholder="请输入小程序APPID"
  257. allowClear
  258. value={previewContent?.groupMsgContent?.[record.corpUsergroupIndex]?.[record.strategyIndex - 1]?.[record.sendDataIndex - 1]?.[record.contentIndex - 1]?.miniprogramAppid}
  259. onChange={e => setContent({
  260. msg: { miniprogramAppid: e.target.value },
  261. index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.sendDataIndex - 1, record.contentIndex - 1],
  262. type: 'massSending'
  263. })}
  264. /> : '--'
  265. },
  266. },
  267. {
  268. title: '小程序路径',
  269. dataIndex: 'miniprogramPage',
  270. key: 'miniprogramPage',
  271. width: 250,
  272. render(_, record) {
  273. return record?.miniProgramData?.length > 0 ? <div style={{ display: 'flex', gap: 4, alignItems: 'flex-end' }}>
  274. <Input.TextArea
  275. placeholder="请输入小程序路径"
  276. allowClear
  277. value={previewContent?.groupMsgContent?.[record.corpUsergroupIndex]?.[record.strategyIndex - 1]?.[record.sendDataIndex - 1]?.[record.contentIndex - 1]?.miniprogramPage}
  278. onChange={e => setContent({
  279. msg: { miniprogramPage: e.target.value },
  280. index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.sendDataIndex - 1, record.contentIndex - 1],
  281. type: 'massSending'
  282. })}
  283. />
  284. <SelectBookLinkButton
  285. bookPlatForm={bookPlatForm}
  286. mpAccountId={record.corpUserList?.[0]?.mpAccountId}
  287. linkData={[{
  288. msgType: "TASK_CONTENT_LINK",
  289. link: {
  290. title: record.miniProgramData?.[0]?.miniprogram?.title,
  291. picUrl: record.miniProgramData?.[0]?.miniprogram?.picUrl,
  292. desc: ''
  293. }
  294. }]}
  295. onChange={(_, miniprogramAppid, miniprogramPage) => {
  296. const msg: { [x: string]: string } = {}
  297. if (miniprogramAppid && miniprogramPage) {
  298. msg.miniprogramAppid = miniprogramAppid
  299. msg.miniprogramPage = miniprogramPage
  300. setContent({
  301. msg,
  302. index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.sendDataIndex - 1, record.contentIndex - 1],
  303. type: 'massSending'
  304. })
  305. }
  306. }}
  307. />
  308. </div> : '--'
  309. }
  310. }
  311. ]
  312. }
  313. export const highMassSendingColumns = (): ColumnsType<AnyObject> => {
  314. return [
  315. {
  316. title: '账号',
  317. dataIndex: 'corpUserName',
  318. key: 'corpUserName',
  319. width: 150,
  320. render(value, record) {
  321. return <Text>{value}({record.corpUserId})</Text>
  322. },
  323. onCell: (record) => {
  324. return { rowSpan: record.userRowSpan }
  325. }
  326. },
  327. {
  328. title: '群发信息',
  329. dataIndex: 'groupSendName',
  330. key: 'groupSendName',
  331. width: 130,
  332. render(value, record) {
  333. return <>
  334. <Title level={5} style={{ margin: 0 }}>标题:{value}</Title>
  335. {record?.bizType && <Paragraph style={{ margin: 0 }}>业务类型:{record?.bizType || '<空>'}</Paragraph>}
  336. {record?.platform && <Paragraph style={{ margin: 0 }}>书城:{record?.platform || '<空>'}</Paragraph>}
  337. {record?.templateProductId && <Paragraph style={{ margin: 0 }}>适用产品:{record?.templateProductId || '<空>'}</Paragraph>}
  338. </>
  339. },
  340. onCell: (record) => {
  341. return { rowSpan: record.userRowSpan }
  342. }
  343. },
  344. {
  345. title: '策略信息',
  346. dataIndex: 'strategyData',
  347. key: 'strategyData',
  348. width: 200,
  349. render(value, record) {
  350. return <>
  351. <Title level={5} style={{ margin: 0 }}>策略{record.strategyIndex}</Title>
  352. <Paragraph style={{ margin: 0 }}>名称:{value?.strategyName || '<空>'}</Paragraph>
  353. <Paragraph style={{ margin: 0 }}>执行类型:{TIME_TYPE[value?.timeRepeatType]}</Paragraph>
  354. {value?.sendDay && <Paragraph style={{ margin: 0 }}>执行时间:{value?.sendDay}</Paragraph>}
  355. {value?.startTime && <Paragraph style={{ margin: 0 }}>执行日期:{value?.startTime}~{value?.endTime ? value?.endTime : '长期执行'}</Paragraph>}
  356. {value?.sendTime && <Paragraph style={{ margin: 0 }}>执行时间:{value?.sendTime}</Paragraph>}
  357. {value?.repeatArray && <Paragraph style={{ margin: 0 }}>执行天数:{value?.repeatArray.join('、')}</Paragraph>}
  358. </>
  359. },
  360. onCell: (record) => {
  361. return { rowSpan: record.strategyRowSpan }
  362. }
  363. },
  364. {
  365. title: '发送对象',
  366. dataIndex: 'sendData',
  367. key: 'sendData',
  368. width: 200,
  369. render(value, record) {
  370. return <>
  371. <Title level={5} style={{ margin: 0 }}>发送对象{record.sendDataIndex}</Title>
  372. <Paragraph style={{ margin: 0 }}>内容发送模式:{welcomeContentData?.find(i => i.value === record?.sendMode)?.label}</Paragraph>
  373. <Paragraph style={{ margin: 0 }}>类型:{value?.externalUserType === 'all' ? '全部' : '指定'}</Paragraph>
  374. {value?.externalUserType === 'specify' && <FilterUser isSHow value={value?.externalUserFilter} configType='GROUP_GROUP' />}
  375. </>
  376. },
  377. onCell: (record) => {
  378. return { rowSpan: record.sendDataRowSpan }
  379. }
  380. },
  381. {
  382. title: '群发外部联系人',
  383. dataIndex: 'externalUser',
  384. key: 'externalUser',
  385. width: 200,
  386. render(value) {
  387. return <>
  388. <Title ellipsis level={5} style={{ margin: 0 }}>消息发送号外部联系人</Title>
  389. <Paragraph ellipsis={{ tooltip: true }} style={{ margin: 0 }}>{value?.externalUserId}({value?.name})</Paragraph>
  390. <Title ellipsis level={5} style={{ margin: 0 }}>群聊所在主体</Title>
  391. <Paragraph ellipsis={{ tooltip: true }} style={{ margin: 0 }}>{value?.corpId}({value?.corpName})</Paragraph>
  392. </>
  393. },
  394. },
  395. {
  396. title: '发送内容',
  397. dataIndex: 'content',
  398. key: 'content',
  399. width: 200,
  400. render(_, record) {
  401. return <WelcomeShowTable
  402. name={<><span>内容{record.contentIndex}:</span><span dangerouslySetInnerHTML={{ __html: record.contentReactNode?.map((item) => item).join('、') }}></span></>}
  403. data={record?.content}
  404. />
  405. },
  406. },
  407. {
  408. title: '图文链接',
  409. dataIndex: 'linkUrl',
  410. key: 'linkUrl',
  411. width: 200,
  412. render(_, record) {
  413. return <Paragraph style={{ margin: 0, color: '#000', fontWeight: !!record?.groupMsgContent?.linkUrl ? 'bold' : 'normal' }}>{record?.groupMsgContent?.linkUrl || '--'}</Paragraph>
  414. },
  415. },
  416. {
  417. title: '小程序APPID',
  418. dataIndex: 'miniprogramAppid',
  419. key: 'miniprogramAppid',
  420. width: 200,
  421. render(_, record) {
  422. return <Paragraph style={{ margin: 0, color: '#000', fontWeight: !!record?.groupMsgContent?.miniprogramAppid ? 'bold' : 'normal' }}>{record?.groupMsgContent?.miniprogramAppid || '--'}</Paragraph>
  423. },
  424. },
  425. {
  426. title: '小程序路径',
  427. dataIndex: 'miniprogramPage',
  428. key: 'miniprogramPage',
  429. width: 200,
  430. render(_, record) {
  431. return <Paragraph style={{ margin: 0, color: '#000', fontWeight: !!record?.groupMsgContent?.miniprogramPage ? 'bold' : 'normal' }}>{record?.groupMsgContent?.miniprogramPage || '--'}</Paragraph>
  432. },
  433. }
  434. ]
  435. }
  436. export const welcomeColumns = (bookPlatForm: { platformName: string, id: number, platformKey: string }[], bookList: { id: number, bookName: string, platformId: number }[], setContent: (data: TASK_CREATE.SetContentProps) => void, previewContent: { groupMsgContent?: any[], welcomeMsgContent?: any[], externalUserTransferContent?: any[] }): ColumnsType<AnyObject> => {
  437. return [
  438. {
  439. title: '账号',
  440. dataIndex: 'corpUserGroupName',
  441. key: 'corpUserGroupName',
  442. width: 150,
  443. render(value, record) {
  444. return <>
  445. <Title level={5} style={{ margin: 0 }}>{value}({record?.corpUserList?.[0]?.corpName})</Title>
  446. <Paragraph style={{ margin: 0 }}>公众号ID:{record?.corpUserList?.[0]?.mpAccountId || '--'}</Paragraph>
  447. <Paragraph style={{ margin: 0 }}>客服号:{record?.corpUserList?.map(i => i.name).join('、')}</Paragraph>
  448. </>
  449. },
  450. onCell: (record) => {
  451. return { rowSpan: record.rowSpan }
  452. }
  453. },
  454. {
  455. title: '欢迎语信息',
  456. dataIndex: 'welcomeName',
  457. key: 'welcomeName',
  458. width: 130,
  459. render(value, record) {
  460. return <>
  461. <Title level={5} style={{ margin: 0 }}>标题:{value}</Title>
  462. {record?.bizType && <Paragraph style={{ margin: 0 }}>业务类型:{record?.bizType || '<空>'}</Paragraph>}
  463. {record?.platform && <Paragraph style={{ margin: 0 }}>书城:{record?.platform || '<空>'}</Paragraph>}
  464. {record?.templateProductId && <Paragraph style={{ margin: 0 }}>适用产品:{record?.templateProductId || '<空>'}</Paragraph>}
  465. </>
  466. },
  467. onCell: (record) => {
  468. return { rowSpan: record.rowSpan }
  469. }
  470. },
  471. {
  472. title: '智能标签',
  473. dataIndex: 'welcomeMsgTagDTO',
  474. key: 'welcomeMsgTagDTO',
  475. width: 200,
  476. render(value) {
  477. return <>
  478. {value?.business && <Paragraph style={{ margin: 0 }}>业务(来源渠道):{businessPlanData.find(i => i.value === value.business)?.label || '<空>'}</Paragraph>}
  479. {value?.bookCity && <Paragraph style={{ margin: 0 }}>书城(来源渠道):{bookPlatForm.find(i => i.id === value.bookCity)?.platformName || '<空>'}</Paragraph>}
  480. {value?.product && <Paragraph style={{ margin: 0 }}>产品(来源渠道):{bookList.find(i => i.id === value.product)?.bookName || '<空>'}</Paragraph>}
  481. </>
  482. },
  483. onCell: (record) => {
  484. return { rowSpan: record.rowSpan }
  485. }
  486. },
  487. {
  488. title: '内容组发送模式',
  489. dataIndex: 'sendMode',
  490. key: 'sendMode',
  491. width: 100,
  492. align: 'center',
  493. render(value) {
  494. return <Paragraph style={{ margin: 0 }}>{welcomeContentData?.find(i => i.value === value)?.label}</Paragraph>
  495. },
  496. onCell: (record) => {
  497. return { rowSpan: record.rowSpan }
  498. }
  499. },
  500. {
  501. title: '欢迎语发送内容',
  502. dataIndex: 'sendData',
  503. key: 'sendData',
  504. width: 200,
  505. render(value, record) {
  506. return <WelcomeShowTable
  507. name={<><span>内容{record.contentIndex}:</span><span dangerouslySetInnerHTML={{ __html: record.contentReactNode?.map((item) => item).join('、') }}></span></>}
  508. data={value}
  509. />
  510. },
  511. },
  512. {
  513. title: '图文链接',
  514. dataIndex: 'linkUrl',
  515. key: 'linkUrl',
  516. width: 250,
  517. render(_, record) {
  518. return record?.linkData?.length > 0 ? <div style={{ display: 'flex', gap: 4, alignItems: 'flex-end' }}>
  519. <Input.TextArea
  520. placeholder="请输入链接"
  521. allowClear
  522. value={previewContent?.welcomeMsgContent?.[record.corpUsergroupIndex]?.[record.contentIndex - 1]?.linkUrl}
  523. onChange={e => {
  524. setContent({
  525. msg: { linkUrl: e.target.value },
  526. index: [record.corpUsergroupIndex, record.contentIndex - 1],
  527. type: 'welcome'
  528. })
  529. }}
  530. />
  531. <SelectBookLinkButton
  532. bookPlatForm={bookPlatForm}
  533. mpAccountId={record.corpUserList?.[0]?.mpAccountId}
  534. linkData={record.linkData.map(item => ({
  535. msgType: "TASK_CONTENT_LINK",
  536. link: {
  537. title: item.linkTitle,
  538. picUrl: item.linkPicurl,
  539. desc: item.linkDesc
  540. }
  541. }))}
  542. onChange={(linkStr, miniprogramAppid, miniprogramPage) => {
  543. const msg: { [x: string]: string } = { linkUrl: linkStr }
  544. if (miniprogramAppid && miniprogramPage && record?.miniProgramData?.length > 0 && !previewContent?.welcomeMsgContent?.[record.corpUsergroupIndex]?.[record.contentIndex - 1]?.miniprogramAppid && !previewContent?.welcomeMsgContent?.[record.corpUsergroupIndex]?.[record.contentIndex - 1]?.miniprogramPage) {
  545. msg.miniprogramAppid = miniprogramAppid
  546. msg.miniprogramPage = miniprogramPage
  547. }
  548. setContent({
  549. msg,
  550. index: [record.corpUsergroupIndex, record.contentIndex - 1],
  551. type: 'welcome'
  552. })
  553. }}
  554. />
  555. </div> : '--'
  556. },
  557. },
  558. {
  559. title: '小程序APPID',
  560. dataIndex: 'miniprogramAppid',
  561. key: 'miniprogramAppid',
  562. width: 200,
  563. render(_, record) {
  564. return record?.miniProgramData?.length > 0 ? <Input.TextArea
  565. placeholder="请输入小程序APPID"
  566. allowClear
  567. value={previewContent?.welcomeMsgContent?.[record.corpUsergroupIndex]?.[record.contentIndex - 1]?.miniprogramAppid}
  568. onChange={e => setContent({
  569. msg: { miniprogramAppid: e.target.value },
  570. index: [record.corpUsergroupIndex, record.contentIndex - 1],
  571. type: 'welcome'
  572. })}
  573. /> : '--'
  574. },
  575. },
  576. {
  577. title: '小程序路径',
  578. dataIndex: 'miniprogramPage',
  579. key: 'miniprogramPage',
  580. width: 250,
  581. render(_, record) {
  582. return record?.miniProgramData?.length > 0 ? <div style={{ display: 'flex', gap: 4, alignItems: 'flex-end' }}>
  583. <Input.TextArea
  584. placeholder="请输入小程序路径"
  585. allowClear
  586. value={previewContent?.welcomeMsgContent?.[record.corpUsergroupIndex]?.[record.contentIndex - 1]?.miniprogramPage}
  587. onChange={e => setContent({
  588. msg: { miniprogramPage: e.target.value },
  589. index: [record.corpUsergroupIndex, record.contentIndex - 1],
  590. type: 'welcome'
  591. })}
  592. />
  593. <SelectBookLinkButton
  594. bookPlatForm={bookPlatForm}
  595. mpAccountId={record.corpUserList?.[0]?.mpAccountId}
  596. linkData={[{
  597. msgType: "TASK_CONTENT_LINK",
  598. link: {
  599. title: record.miniProgramData?.[0]?.miniprogramTitle,
  600. picUrl: record.miniProgramData?.[0]?.miniprogramPicurl,
  601. desc: ''
  602. }
  603. }]}
  604. onChange={(_, miniprogramAppid, miniprogramPage) => {
  605. const msg: { [x: string]: string } = {}
  606. if (miniprogramAppid && miniprogramPage) {
  607. msg.miniprogramAppid = miniprogramAppid
  608. msg.miniprogramPage = miniprogramPage
  609. setContent({
  610. msg,
  611. index: [record.corpUsergroupIndex, record.contentIndex - 1],
  612. type: 'welcome'
  613. })
  614. }
  615. }}
  616. />
  617. </div> : '--'
  618. }
  619. }
  620. ]
  621. }
  622. export const friendsColumns = (): ColumnsType<AnyObject> => {
  623. return [
  624. {
  625. title: '账号',
  626. dataIndex: 'corpUserName',
  627. key: 'corpUserName',
  628. width: 150,
  629. render(value, record) {
  630. return <Text>{value}({record.corpUserId})</Text>
  631. },
  632. onCell: (record) => {
  633. return { rowSpan: record.userRowSpan }
  634. }
  635. },
  636. {
  637. title: '朋友圈信息',
  638. dataIndex: 'momentSendName',
  639. key: 'momentSendName',
  640. width: 130,
  641. render(value, record) {
  642. return <>
  643. <Title level={5} style={{ margin: 0 }}>标题:{value}</Title>
  644. {record?.bizType && <Paragraph style={{ margin: 0 }}>业务类型:{record?.bizType || '<空>'}</Paragraph>}
  645. {record?.platform && <Paragraph style={{ margin: 0 }}>书城:{record?.platform || '<空>'}</Paragraph>}
  646. {record?.templateProductId && <Paragraph style={{ margin: 0 }}>适用产品:{record?.templateProductId || '<空>'}</Paragraph>}
  647. </>
  648. },
  649. onCell: (record) => {
  650. return { rowSpan: record.userRowSpan }
  651. }
  652. },
  653. {
  654. title: '策略信息',
  655. dataIndex: 'strategyData',
  656. key: 'strategyData',
  657. width: 200,
  658. render(value, record) {
  659. return <>
  660. <Title level={5} style={{ margin: 0 }}>策略{record.strategyIndex + 1}</Title>
  661. <Paragraph style={{ margin: 0 }}>名称:{value?.strategyName || '<空>'}</Paragraph>
  662. <Paragraph style={{ margin: 0 }}>执行类型:{TIME_TYPE[value?.timeRepeatType]}</Paragraph>
  663. {value?.sendDay && <Paragraph style={{ margin: 0 }}>执行时间:{value?.sendDay}</Paragraph>}
  664. {value?.startTime && <Paragraph style={{ margin: 0 }}>执行日期:{value?.startTime}~{value?.endTime ? value?.endTime : '长期执行'}</Paragraph>}
  665. {value?.sendTime && <Paragraph style={{ margin: 0 }}>执行时间:{value?.sendTime}</Paragraph>}
  666. {value?.repeatArray && <Paragraph style={{ margin: 0 }}>执行天数:{value?.repeatArray.join('、')}</Paragraph>}
  667. </>
  668. },
  669. onCell: (record) => {
  670. return { rowSpan: record.strategyRowSpan }
  671. }
  672. },
  673. {
  674. title: '发送对象',
  675. dataIndex: 'sendData',
  676. key: 'sendData',
  677. width: 200,
  678. render(value, record) {
  679. return <>
  680. <Title level={5} style={{ margin: 0 }}>发送对象{record.sendDataIndex}</Title>
  681. <Paragraph style={{ margin: 0 }}>内容发送模式:{welcomeContentData?.find(i => i.value === record?.sendMode)?.label}</Paragraph>
  682. <Paragraph style={{ margin: 0 }} ellipsis={{ rows: 3, tooltip: true }}>企微标签:{value?.length > 0 ? value?.map(i => i.title).join('、') : '全部'}</Paragraph>
  683. </>
  684. },
  685. onCell: (record) => {
  686. return { rowSpan: record.strategyRowSpan }
  687. }
  688. },
  689. {
  690. title: '发送内容',
  691. dataIndex: 'content',
  692. key: 'content',
  693. width: 200,
  694. render(_, record) {
  695. return <>
  696. <FriendsShowTable
  697. data={record?.content}
  698. name={<><span>内容{record.contentIndex + 1}:</span><span dangerouslySetInnerHTML={{ __html: record.contentReactNode?.map((item) => item).join('、') }}></span></>}
  699. />
  700. </>
  701. },
  702. },
  703. {
  704. title: '图文链接',
  705. dataIndex: 'linkUrl',
  706. key: 'linkUrl',
  707. width: 200,
  708. render(_, record) {
  709. return <Paragraph style={{ margin: 0, color: '#000', fontWeight: !!record?.friendsContent?.linkUrl ? 'bold' : 'normal' }}>{record?.friendsContent?.linkUrl || '--'}</Paragraph>
  710. },
  711. },
  712. {
  713. title: '小程序APPID',
  714. dataIndex: 'miniprogramAppid',
  715. key: 'miniprogramAppid',
  716. width: 200,
  717. render(_, record) {
  718. return <Paragraph style={{ margin: 0, color: '#000', fontWeight: !!record?.friendsContent?.miniprogramAppid ? 'bold' : 'normal' }}>{record?.friendsContent?.miniprogramAppid || '--'}</Paragraph>
  719. },
  720. },
  721. {
  722. title: '小程序路径',
  723. dataIndex: 'miniprogramPage',
  724. key: 'miniprogramPage',
  725. width: 200,
  726. render(_, record) {
  727. return <Paragraph style={{ margin: 0, color: '#000', fontWeight: !!record?.friendsContent?.miniprogramPage ? 'bold' : 'normal' }}>{record?.friendsContent?.miniprogramPage || '--'}</Paragraph>
  728. },
  729. }
  730. ]
  731. }