import { Input, Typography } from "antd"; import { AnyObject } from "antd/es/_util/type" import { ColumnsType } from "antd/es/table" import { businessPlanData, TIME_TYPE, welcomeContentData } from "./const"; import FilterUser from "@/pages/weComTask/components/filterUser"; import ShowContentTable from "./components/massSending/showContentTable"; import WelcomeShowTable from "./components/welcome/welcomeShowTable"; import FriendsShowTable from "./components/friends/friendsShowTable"; import SelectBookLinkButton from "../../bookLink/SelectBookLinkButton"; const { Title, Text, Paragraph } = Typography; export const userInheritColumns = (setContent: (data: TASK_CREATE.SetContentProps) => void): ColumnsType => { return [ { title: '账号', dataIndex: 'corpUserGroupName', key: 'corpUserGroupName', width: 150, render(value, record) { return <> {value}({record?.corpUserList?.[0]?.corpName}) 客服号:{record?.corpUserList?.map(i => i.name).join('、')} }, onCell: (record) => { return { rowSpan: record.userRowSpan } } }, { title: '继承信息', dataIndex: 'taskName', key: 'taskName', width: 130, render(value, record) { return <> 标题:{value} {record?.bizType && 业务类型:{record?.bizType || '<空>'}} {record?.platform && 书城:{record?.platform || '<空>'}} {record?.templateProductId && 适用产品:{record?.templateProductId || '<空>'}} }, onCell: (record) => { return { rowSpan: record.userRowSpan } } }, { title: '策略信息', dataIndex: 'strategyData', key: 'strategyData', width: 200, render(value, record) { return <> 策略{record.strategyIndex} 名称:{value?.strategyName || '<空>'} 执行类型:{TIME_TYPE[value?.timeRepeatType]} {value?.sendDay && 执行时间:{value?.sendDay}} {value?.startTime && 执行日期:{value?.startTime}~{value?.endTime ? value?.endTime : '长期执行'}} {value?.sendTime && 执行时间:{value?.sendTime}} {value?.repeatArray && 执行天数:{value?.repeatArray.join('、')}} }, onCell: (record) => { return { rowSpan: record.strategyRowSpan } } }, { title: '继承对象', dataIndex: 'inheritData', key: 'inheritData', width: 200, render(value, record) { return <> 转移对象{record.inheritIndex} 类型:{value?.transferType === 'all' ? '全部' : '指定'} {value?.transferType === 'specify' && } }, }, { title: '继承后文本内容', dataIndex: 'transferSuccessMsg', key: 'transferSuccessMsg', width: 200, render(_, record) { return {record?.inheritData?.transferSuccessMsg || '<空>'} }, }, { title: '接替客户企微号', dataIndex: 'externalUser', key: 'externalUserCorpUserName', width: 100, render(_, record) { return setContent({ msg: { corpUserName: e.target.value }, index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.inheritIndex - 1], type: 'userInherit' })} /> }, }, { title: '接替客户企微号ID', dataIndex: 'externalUser', key: 'externalUserCorpUserId', width: 100, render(_, record) { return setContent({ msg: { corpUserId: e.target.value }, index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.inheritIndex - 1], type: 'userInherit' })} /> }, } ] } /** 群发 */ export const massSendingColumns = (setContent: (data: TASK_CREATE.SetContentProps) => void, bookPlatForm: TASK_CREATE.BookPlatFormProps[], previewContent: { groupMsgContent?: any[], welcomeMsgContent?: any[], externalUserTransferContent?: any[] }): ColumnsType => { return [ { title: '账号', dataIndex: 'corpUserGroupName', key: 'corpUserGroupName', width: 150, render(value, record) { return <> {value} 公众号ID:{record?.corpUserList?.[0]?.mpAccountId || '--'} 客服号:{record?.corpUserList?.map(i => i.name).join('、')} }, onCell: (record) => { return { rowSpan: record.userRowSpan } } }, { title: '群发信息', dataIndex: 'groupSendName', key: 'groupSendName', width: 130, render(value, record) { return <> 标题:{value} {record?.bizType && 业务类型:{record?.bizType || '<空>'}} {record?.platform && 书城:{record?.platform || '<空>'}} {record?.templateProductId && 适用产品:{record?.templateProductId || '<空>'}} }, onCell: (record) => { return { rowSpan: record.userRowSpan } } }, { title: '策略信息', dataIndex: 'strategyData', key: 'strategyData', width: 200, render(value, record) { return <> 策略{record.strategyIndex} 名称:{value?.strategyName || '<空>'} 执行类型:{TIME_TYPE[value?.timeRepeatType]} {value?.sendDay && 执行时间:{value?.sendDay}} {value?.startTime && 执行日期:{value?.startTime}~{value?.endTime ? value?.endTime : '长期执行'}} {value?.sendTime && 执行时间:{value?.sendTime}} {value?.repeatArray && 执行天数:{value?.repeatArray.join('、')}} }, onCell: (record) => { return { rowSpan: record.strategyRowSpan } } }, { title: '发送对象', dataIndex: 'sendData', key: 'sendData', width: 200, render(value, record) { return <> 发送对象{record.sendDataIndex} 内容发送模式:{welcomeContentData?.find(i => i.value === record?.sendMode)?.label} 类型:{value?.externalUserType === 'all' ? '全部' : '指定'} {value?.externalUserType === 'specify' && } }, onCell: (record) => { return { rowSpan: record.sendDataRowSpan } } }, { title: '发送内容', dataIndex: 'content', key: 'content', width: 200, render(_, record) { return <> 内容{record.contentIndex}: item).join('、') }}>} /> }, }, { title: '图文链接', dataIndex: 'linkUrl', key: 'linkUrl', width: 250, render(_, record) { return record?.linkData?.length > 0 ?
{ setContent({ msg: { linkUrl: e.target.value }, index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.sendDataIndex - 1, record.contentIndex - 1], type: 'massSending' }) }} /> { const msg: { [x: string]: string } = { linkUrl: linkStr } 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) { msg.miniprogramAppid = miniprogramAppid msg.miniprogramPage = miniprogramPage } setContent({ msg, index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.sendDataIndex - 1, record.contentIndex - 1], type: 'massSending' }) }} />
: '--' }, }, { title: '小程序APPID', dataIndex: 'miniprogramAppid', key: 'miniprogramAppid', width: 200, render(_, record) { return record?.miniProgramData?.length > 0 ? setContent({ msg: { miniprogramAppid: e.target.value }, index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.sendDataIndex - 1, record.contentIndex - 1], type: 'massSending' })} /> : '--' }, }, { title: '小程序路径', dataIndex: 'miniprogramPage', key: 'miniprogramPage', width: 250, render(_, record) { return record?.miniProgramData?.length > 0 ?
setContent({ msg: { miniprogramPage: e.target.value }, index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.sendDataIndex - 1, record.contentIndex - 1], type: 'massSending' })} /> { const msg: { [x: string]: string } = {} if (miniprogramAppid && miniprogramPage) { msg.miniprogramAppid = miniprogramAppid msg.miniprogramPage = miniprogramPage setContent({ msg, index: [record.corpUsergroupIndex, record.strategyIndex - 1, record.sendDataIndex - 1, record.contentIndex - 1], type: 'massSending' }) } }} />
: '--' } } ] } export const highMassSendingColumns = (): ColumnsType => { return [ { title: '账号', dataIndex: 'corpUserName', key: 'corpUserName', width: 150, render(value, record) { return {value}({record.corpUserId}) }, onCell: (record) => { return { rowSpan: record.userRowSpan } } }, { title: '群发信息', dataIndex: 'groupSendName', key: 'groupSendName', width: 130, render(value, record) { return <> 标题:{value} {record?.bizType && 业务类型:{record?.bizType || '<空>'}} {record?.platform && 书城:{record?.platform || '<空>'}} {record?.templateProductId && 适用产品:{record?.templateProductId || '<空>'}} }, onCell: (record) => { return { rowSpan: record.userRowSpan } } }, { title: '策略信息', dataIndex: 'strategyData', key: 'strategyData', width: 200, render(value, record) { return <> 策略{record.strategyIndex} 名称:{value?.strategyName || '<空>'} 执行类型:{TIME_TYPE[value?.timeRepeatType]} {value?.sendDay && 执行时间:{value?.sendDay}} {value?.startTime && 执行日期:{value?.startTime}~{value?.endTime ? value?.endTime : '长期执行'}} {value?.sendTime && 执行时间:{value?.sendTime}} {value?.repeatArray && 执行天数:{value?.repeatArray.join('、')}} }, onCell: (record) => { return { rowSpan: record.strategyRowSpan } } }, { title: '发送对象', dataIndex: 'sendData', key: 'sendData', width: 200, render(value, record) { return <> 发送对象{record.sendDataIndex} 内容发送模式:{welcomeContentData?.find(i => i.value === record?.sendMode)?.label} 类型:{value?.externalUserType === 'all' ? '全部' : '指定'} {value?.externalUserType === 'specify' && } }, onCell: (record) => { return { rowSpan: record.sendDataRowSpan } } }, { title: '群发外部联系人', dataIndex: 'externalUser', key: 'externalUser', width: 200, render(value) { return <> 消息发送号外部联系人 {value?.externalUserId}({value?.name}) 群聊所在主体 {value?.corpId}({value?.corpName}) }, }, { title: '发送内容', dataIndex: 'content', key: 'content', width: 200, render(_, record) { return 内容{record.contentIndex}: item).join('、') }}>} data={record?.content} /> }, }, { title: '图文链接', dataIndex: 'linkUrl', key: 'linkUrl', width: 200, render(_, record) { return {record?.groupMsgContent?.linkUrl || '--'} }, }, { title: '小程序APPID', dataIndex: 'miniprogramAppid', key: 'miniprogramAppid', width: 200, render(_, record) { return {record?.groupMsgContent?.miniprogramAppid || '--'} }, }, { title: '小程序路径', dataIndex: 'miniprogramPage', key: 'miniprogramPage', width: 200, render(_, record) { return {record?.groupMsgContent?.miniprogramPage || '--'} }, } ] } 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 => { return [ { title: '账号', dataIndex: 'corpUserGroupName', key: 'corpUserGroupName', width: 150, render(value, record) { return <> {value}({record?.corpUserList?.[0]?.corpName}) 公众号ID:{record?.corpUserList?.[0]?.mpAccountId || '--'} 客服号:{record?.corpUserList?.map(i => i.name).join('、')} }, onCell: (record) => { return { rowSpan: record.rowSpan } } }, { title: '欢迎语信息', dataIndex: 'welcomeName', key: 'welcomeName', width: 130, render(value, record) { return <> 标题:{value} {record?.bizType && 业务类型:{record?.bizType || '<空>'}} {record?.platform && 书城:{record?.platform || '<空>'}} {record?.templateProductId && 适用产品:{record?.templateProductId || '<空>'}} }, onCell: (record) => { return { rowSpan: record.rowSpan } } }, { title: '智能标签', dataIndex: 'welcomeMsgTagDTO', key: 'welcomeMsgTagDTO', width: 200, render(value) { return <> {value?.business && 业务(来源渠道):{businessPlanData.find(i => i.value === value.business)?.label || '<空>'}} {value?.bookCity && 书城(来源渠道):{bookPlatForm.find(i => i.id === value.bookCity)?.platformName || '<空>'}} {value?.product && 产品(来源渠道):{bookList.find(i => i.id === value.product)?.bookName || '<空>'}} }, onCell: (record) => { return { rowSpan: record.rowSpan } } }, { title: '内容组发送模式', dataIndex: 'sendMode', key: 'sendMode', width: 100, align: 'center', render(value) { return {welcomeContentData?.find(i => i.value === value)?.label} }, onCell: (record) => { return { rowSpan: record.rowSpan } } }, { title: '欢迎语发送内容', dataIndex: 'sendData', key: 'sendData', width: 200, render(value, record) { return 内容{record.contentIndex}: item).join('、') }}>} data={value} /> }, }, { title: '图文链接', dataIndex: 'linkUrl', key: 'linkUrl', width: 250, render(_, record) { return record?.linkData?.length > 0 ?
{ setContent({ msg: { linkUrl: e.target.value }, index: [record.corpUsergroupIndex, record.contentIndex - 1], type: 'welcome' }) }} /> ({ msgType: "TASK_CONTENT_LINK", link: { title: item.linkTitle, picUrl: item.linkPicurl, desc: item.linkDesc } }))} onChange={(linkStr, miniprogramAppid, miniprogramPage) => { const msg: { [x: string]: string } = { linkUrl: linkStr } if (miniprogramAppid && miniprogramPage && record?.miniProgramData?.length > 0 && !previewContent?.welcomeMsgContent?.[record.corpUsergroupIndex]?.[record.contentIndex - 1]?.miniprogramAppid && !previewContent?.welcomeMsgContent?.[record.corpUsergroupIndex]?.[record.contentIndex - 1]?.miniprogramPage) { msg.miniprogramAppid = miniprogramAppid msg.miniprogramPage = miniprogramPage } setContent({ msg, index: [record.corpUsergroupIndex, record.contentIndex - 1], type: 'welcome' }) }} />
: '--' }, }, { title: '小程序APPID', dataIndex: 'miniprogramAppid', key: 'miniprogramAppid', width: 200, render(_, record) { return record?.miniProgramData?.length > 0 ? setContent({ msg: { miniprogramAppid: e.target.value }, index: [record.corpUsergroupIndex, record.contentIndex - 1], type: 'welcome' })} /> : '--' }, }, { title: '小程序路径', dataIndex: 'miniprogramPage', key: 'miniprogramPage', width: 250, render(_, record) { return record?.miniProgramData?.length > 0 ?
setContent({ msg: { miniprogramPage: e.target.value }, index: [record.corpUsergroupIndex, record.contentIndex - 1], type: 'welcome' })} /> { const msg: { [x: string]: string } = {} if (miniprogramAppid && miniprogramPage) { msg.miniprogramAppid = miniprogramAppid msg.miniprogramPage = miniprogramPage setContent({ msg, index: [record.corpUsergroupIndex, record.contentIndex - 1], type: 'welcome' }) } }} />
: '--' } } ] } export const friendsColumns = (): ColumnsType => { return [ { title: '账号', dataIndex: 'corpUserName', key: 'corpUserName', width: 150, render(value, record) { return {value}({record.corpUserId}) }, onCell: (record) => { return { rowSpan: record.userRowSpan } } }, { title: '朋友圈信息', dataIndex: 'momentSendName', key: 'momentSendName', width: 130, render(value, record) { return <> 标题:{value} {record?.bizType && 业务类型:{record?.bizType || '<空>'}} {record?.platform && 书城:{record?.platform || '<空>'}} {record?.templateProductId && 适用产品:{record?.templateProductId || '<空>'}} }, onCell: (record) => { return { rowSpan: record.userRowSpan } } }, { title: '策略信息', dataIndex: 'strategyData', key: 'strategyData', width: 200, render(value, record) { return <> 策略{record.strategyIndex + 1} 名称:{value?.strategyName || '<空>'} 执行类型:{TIME_TYPE[value?.timeRepeatType]} {value?.sendDay && 执行时间:{value?.sendDay}} {value?.startTime && 执行日期:{value?.startTime}~{value?.endTime ? value?.endTime : '长期执行'}} {value?.sendTime && 执行时间:{value?.sendTime}} {value?.repeatArray && 执行天数:{value?.repeatArray.join('、')}} }, onCell: (record) => { return { rowSpan: record.strategyRowSpan } } }, { title: '发送对象', dataIndex: 'sendData', key: 'sendData', width: 200, render(value, record) { return <> 发送对象{record.sendDataIndex} 内容发送模式:{welcomeContentData?.find(i => i.value === record?.sendMode)?.label} 企微标签:{value?.length > 0 ? value?.map(i => i.title).join('、') : '全部'} }, onCell: (record) => { return { rowSpan: record.strategyRowSpan } } }, { title: '发送内容', dataIndex: 'content', key: 'content', width: 200, render(_, record) { return <> 内容{record.contentIndex + 1}: item).join('、') }}>} /> }, }, { title: '图文链接', dataIndex: 'linkUrl', key: 'linkUrl', width: 200, render(_, record) { return {record?.friendsContent?.linkUrl || '--'} }, }, { title: '小程序APPID', dataIndex: 'miniprogramAppid', key: 'miniprogramAppid', width: 200, render(_, record) { return {record?.friendsContent?.miniprogramAppid || '--'} }, }, { title: '小程序路径', dataIndex: 'miniprogramPage', key: 'miniprogramPage', width: 200, render(_, record) { return {record?.friendsContent?.miniprogramPage || '--'} }, } ] }