|
@@ -4,20 +4,18 @@ import style from './index.less'
|
|
|
import { App, Button, Card, Empty, Flex, Form, Input, Popconfirm, Select, Space, Spin, Table, Tabs } from 'antd';
|
|
|
import MassSending from './components/massSending';
|
|
|
import { useAjax } from '@/Hook/useAjax';
|
|
|
-import { MediaContentProps, welcomeMsgJobTypeApi } from '@/pages/weComTask/API/weMaterial/weMaterial';
|
|
|
+import { welcomeMsgJobTypeApi } from '@/pages/weComTask/API/weMaterial/weMaterial';
|
|
|
import SelectCorpUser from '../../corpUserManage/selectCorpUser';
|
|
|
import { SearchOutlined, PlusOutlined, RedoOutlined, SaveOutlined, CheckOutlined } from '@ant-design/icons';
|
|
|
-import { getGroupData, getHighGroupData, getUserInDataData, restoreGroupData, restoreUserInheritData } from './const';
|
|
|
+import { getGroupData, getUserInDataData, restoreGroupData, restoreUserInheritData } from './const';
|
|
|
import { friendsColumns, highMassSendingColumns, massSendingColumns, userInheritColumns, welcomeColumns } from './tableConfig';
|
|
|
import SubmitModal from './submitModal';
|
|
|
-import { addTaskApi, getCreateDetailsApi, getProjectDetailsApi, updateTaskApi } from '@/pages/weComTask/API/businessPlan/create';
|
|
|
+import { addTaskApi, getCreateDetailsApi, updateTaskApi } from '@/pages/weComTask/API/businessPlan/create';
|
|
|
import { useNavigate } from 'react-router-dom';
|
|
|
import SelectExternalAccount from '@/pages/weComTask/components/selectExternalAccount';
|
|
|
import Welcome from './components/welcome';
|
|
|
import UserInherit from './components/userInherit';
|
|
|
-import HighMassSending from './components/highMassSending';
|
|
|
import { toJS } from 'mobx';
|
|
|
-import Friends from './components/friends';
|
|
|
import SelectCwTag from '@/pages/weComTask/components/selectCwTag';
|
|
|
import SelectCorpUserGroup from '../../corpUserManage/selectCorpUserGroup';
|
|
|
import { getBindMpListApi } from '@/pages/weComTask/API/corpUserAssign';
|
|
@@ -62,7 +60,7 @@ const Create: React.FC<{ weComTaskStore: { data: { bookList: TASK_CREATE.BookLis
|
|
|
setProjectId(id)
|
|
|
}
|
|
|
getCreateDetails.run(id).then(res => {
|
|
|
- sessionStorage.removeItem('OFFICIALTASKID')
|
|
|
+ // sessionStorage.removeItem('OFFICIALTASKID')
|
|
|
if (res?.data) {
|
|
|
const { corpUsers, bizType, platform, templateProductId, welcomeMsgTemplateDTO, groupSendTaskAddDTO, externalUserTransferTasksDTO } = res.data
|
|
|
let newSettings: TASK_CREATE.SettingsProps = {
|
|
@@ -87,6 +85,34 @@ const Create: React.FC<{ weComTaskStore: { data: { bookList: TASK_CREATE.BookLis
|
|
|
newSettings.userInherit = data
|
|
|
}
|
|
|
setSettings(newSettings)
|
|
|
+
|
|
|
+ // 历史数据回填
|
|
|
+
|
|
|
+ const welcomeMsgContent: any[] = []
|
|
|
+ const groupMsgContent: any[] = []
|
|
|
+ corpUsers.forEach((c, c_index) => {
|
|
|
+ if (c?.welcomeMsgContent?.length > 0) {
|
|
|
+ welcomeMsgContent[c_index] = c?.welcomeMsgContent?.map(item => ({
|
|
|
+ linkUrl: item?.linkUrl,
|
|
|
+ miniprogramAppid: item?.miniprogramAppid,
|
|
|
+ miniprogramPage: item?.miniprogramPage
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ if (c?.groupMsgContent?.length > 0) {
|
|
|
+ groupMsgContent[c_index] = c?.groupMsgContent?.map(item => {
|
|
|
+ return item?.map(i2 => i2?.map(item => ({
|
|
|
+ linkUrl: item?.linkUrl,
|
|
|
+ miniprogramAppid: item?.miniprogramAppid,
|
|
|
+ miniprogramPage: item?.miniprogramPage
|
|
|
+ })))
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const newPreviewContent: { groupMsgContent?: any[], welcomeMsgContent?: any[], externalUserTransferContent?: any[] } = {
|
|
|
+ welcomeMsgContent,
|
|
|
+ groupMsgContent
|
|
|
+ }
|
|
|
+ setPreviewContent(newPreviewContent)
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
@@ -280,157 +306,6 @@ const Create: React.FC<{ weComTaskStore: { data: { bookList: TASK_CREATE.BookLis
|
|
|
console.log('userInherit-->', userInherit)
|
|
|
newPreviewData.userInherit = userInherit
|
|
|
}
|
|
|
-
|
|
|
- // 是否有高级群发
|
|
|
- // if ((settings?.highMassSendingContent && Object.keys(settings?.highMassSendingContent).length) && (settings?.highMassSendingStrategy && Object.keys(settings?.highMassSendingStrategy).length)) {
|
|
|
- // if (settings?.highMassSendingContent?.massSendingContentDTO?.some(item => item?.sendContentDto?.some(si => si?.contentDTO?.some(i => i?.some(a => ["miniprogram", 'link'].includes(a?.mediaType))))) && settings?.corpUsers?.every(item => !item?.highGroupMsgContent?.length)) {
|
|
|
- // message.error('需要配置小程序、链接,请上传配置好的高级群发Excel文件')
|
|
|
- // return
|
|
|
- // }
|
|
|
- // const massSendingData = getHighGroupData(settings)
|
|
|
- // console.log('massSendingData---->', massSendingData)
|
|
|
- // const highMassSending = []
|
|
|
- // let rowLength = 0
|
|
|
- // if (!settings?.corpUsers?.every((item, i) => {
|
|
|
-
|
|
|
- // let strategyIndex = 0
|
|
|
- // let corpUserCount = 0
|
|
|
- // return massSendingData.every((dataItem, li, row) => {
|
|
|
-
|
|
|
- // const mediaItem = JSON.parse(JSON.stringify(dataItem?.content || []))
|
|
|
- // const contentReactNode = mediaItem.map(item => {
|
|
|
- // switch (item.mediaType) {
|
|
|
- // case 'link':
|
|
|
- // return `<span style="color: red">链接</span>`
|
|
|
- // case 'miniprogram':
|
|
|
- // return `<span style="color: red">小程序</span>`
|
|
|
- // case 'file':
|
|
|
- // return `<span>文件</span>`
|
|
|
- // case 'video':
|
|
|
- // return `<span>视频</span>`
|
|
|
- // case 'image':
|
|
|
- // return `<span>图片</span>`
|
|
|
- // case 'text':
|
|
|
- // return `<span>文本</span>`
|
|
|
- // default:
|
|
|
- // return `<span style="color: red">请联系管理员</span>`
|
|
|
- // }
|
|
|
- // })
|
|
|
- // const externalUserListLength = item.externalUserList.length
|
|
|
- // return item.externalUserList?.every((externalUser, ii) => {
|
|
|
- // const layer3 = externalUser.corpId + '-' + externalUser.externalUserId
|
|
|
- // const externalUserMsg = item.highGroupMsgContent?.[dataItem.strategyIndex - 1]?.[dataItem.sendDataIndex - 1]?.[layer3]?.[dataItem.contentIndex - 1]
|
|
|
- // if (mediaItem?.some(media => media?.mediaType === 'link' ? !externalUserMsg?.linkUrl : media?.mediaType === 'miniprogram' ? (!externalUserMsg?.miniprogramAppid || !externalUserMsg?.miniprogramPage) : false)) {
|
|
|
- // message.error('高级群发配置错误,请检查')
|
|
|
- // return false
|
|
|
- // }
|
|
|
- // rowLength++;
|
|
|
- // highMassSending.push({
|
|
|
- // ...dataItem,
|
|
|
- // groupMsgContent: externalUserMsg,
|
|
|
- // contentReactNode,
|
|
|
- // externalUser,
|
|
|
- // corpUserId: item.corpUserId,
|
|
|
- // corpUserName: item.name,
|
|
|
- // bizType: settings?.bizType,
|
|
|
- // channel: settings?.channel,
|
|
|
- // platform: settings?.platform,
|
|
|
- // templateProductId: settings?.templateProductId,
|
|
|
- // id: rowLength,
|
|
|
- // userRowSpan: corpUserCount === 0 ? (massSendingData.length * externalUserListLength) : 0,
|
|
|
- // strategyRowSpan: strategyIndex !== dataItem.strategyIndex ? dataItem.sendDataRowSpan * externalUserListLength * dataItem.strategyItemSendDataCount : 0,
|
|
|
- // sendDataRowSpan: ii === 0 ? externalUserListLength * dataItem.sendDataRowSpan : 0
|
|
|
- // })
|
|
|
- // corpUserCount++;
|
|
|
- // strategyIndex = dataItem.strategyIndex
|
|
|
-
|
|
|
- // return true
|
|
|
- // })
|
|
|
- // })
|
|
|
- // })) {
|
|
|
- // return
|
|
|
- // }
|
|
|
- // newPreviewData.highMassSending = highMassSending
|
|
|
- // }
|
|
|
-
|
|
|
- // 是否有朋友圈任务
|
|
|
- // if ((settings?.friendsContent && Object.keys(settings?.friendsContent).length) && (settings?.friendsStrategy && Object.keys(settings?.friendsStrategy).length)) {
|
|
|
- // if (settings?.friendsContent?.friendsContentDTO?.some(item => item?.contentDTO?.some(i => i?.attachmentList?.some(a => ['link', 'miniprogram'].includes(a?.mediaType)))) && settings?.corpUsers?.every(item => !item?.friendsMsgContent?.length)) {
|
|
|
- // message.error('朋友圈需要配置小程序、链接,请上传配置好的群发Excel文件')
|
|
|
- // return
|
|
|
- // }
|
|
|
- // const friends = []
|
|
|
- // let rowLength = 1
|
|
|
- // if (!settings?.corpUsers?.every((item, i) => {
|
|
|
- // let uIndex = 0
|
|
|
- // const uLength = settings?.friendsStrategy?.strategySettings?.reduce((pre, _, i) => settings?.friendsContent?.friendsContentDTO?.[i]?.contentDTO?.length + pre, 0)
|
|
|
- // return settings?.friendsStrategy?.strategySettings?.every((strategyItem, strategyIndex) => {
|
|
|
- // const friendsContentDTO = settings?.friendsContent?.friendsContentDTO?.[strategyIndex]
|
|
|
- // let sIndex = 0
|
|
|
- // return friendsContentDTO.contentDTO.every((contentItem, contentIndex) => {
|
|
|
- // const msgContent = item.friendsMsgContent?.[strategyIndex]?.[contentIndex]
|
|
|
- // if (contentItem?.attachmentList?.length && contentItem?.attachmentList?.some(item => (item?.mediaType === 'link' ? !msgContent?.linkUrl : item?.mediaType === 'miniprogram' ? (!msgContent?.miniprogramAppid || !msgContent?.miniprogramPage) : false))) {
|
|
|
- // message.error('朋友圈内容配置错误,请检查')
|
|
|
- // return false
|
|
|
- // }
|
|
|
-
|
|
|
- // const mediaItem = JSON.parse(JSON.stringify(contentItem?.attachmentList || []))
|
|
|
- // if (contentItem?.text?.content) {
|
|
|
- // mediaItem.push({
|
|
|
- // mediaType: 'text',
|
|
|
- // textContent: contentItem?.text?.content
|
|
|
- // })
|
|
|
- // }
|
|
|
- // const contentReactNode = mediaItem.map(item => {
|
|
|
- // switch (item.mediaType) {
|
|
|
- // case 'link':
|
|
|
- // return `<span style="color: red">链接</span>`
|
|
|
- // case 'miniprogram':
|
|
|
- // return `<span style="color: red">小程序</span>`
|
|
|
- // case 'file':
|
|
|
- // return `<span>文件</span>`
|
|
|
- // case 'video':
|
|
|
- // return `<span>视频</span>`
|
|
|
- // case 'image':
|
|
|
- // return `<span>图片</span>`
|
|
|
- // case 'text':
|
|
|
- // return `<span>文本</span>`
|
|
|
- // default:
|
|
|
- // return `<span style="color: red">请联系管理员</span>`
|
|
|
- // }
|
|
|
- // })
|
|
|
-
|
|
|
- // friends.push({
|
|
|
- // corpUserId: item.corpUserId,
|
|
|
- // corpUserName: item.name,
|
|
|
- // bizType: settings?.bizType,
|
|
|
- // channel: settings?.channel,
|
|
|
- // platform: settings?.platform,
|
|
|
- // templateProductId: settings?.templateProductId,
|
|
|
- // momentSendName: settings?.friendsStrategy?.momentSendName,
|
|
|
- // strategyData: strategyItem,
|
|
|
- // strategyIndex: strategyIndex,
|
|
|
- // sendData: item?.friendsTagContent,
|
|
|
- // contentReactNode,
|
|
|
- // contentIndex,
|
|
|
- // sendMode: friendsContentDTO?.sendMode,
|
|
|
- // content: contentItem,
|
|
|
- // friendsContent: msgContent,
|
|
|
- // id: rowLength,
|
|
|
- // userRowSpan: uIndex === 0 ? uLength : 0,
|
|
|
- // strategyRowSpan: sIndex === 0 ? friendsContentDTO.contentDTO.length : 0
|
|
|
- // })
|
|
|
- // rowLength++;
|
|
|
- // uIndex++;
|
|
|
- // sIndex++;
|
|
|
- // return true
|
|
|
- // })
|
|
|
- // })
|
|
|
- // })) {
|
|
|
- // return
|
|
|
- // }
|
|
|
- // newPreviewData.friends = friends
|
|
|
- // }
|
|
|
if (newPreviewData && Object.keys(newPreviewData).length) {
|
|
|
setPreviewData(newPreviewData)
|
|
|
setPreviewDataOld(newPreviewData)
|
|
@@ -441,6 +316,7 @@ const Create: React.FC<{ weComTaskStore: { data: { bookList: TASK_CREATE.BookLis
|
|
|
|
|
|
// 设置任务名称
|
|
|
const setTaskName = () => {
|
|
|
+ console.log('---------->', previewContent)
|
|
|
// 欢迎语
|
|
|
if (settings?.welcomeMsgTemplateDTO && Object.keys(settings?.welcomeMsgTemplateDTO).length) {
|
|
|
if (settings?.welcomeMsgTemplateDTO?.mediaContentList?.some(item => item?.some(i => i?.mediaType === 'link' || i?.mediaType === 'miniprogram')) && !(previewContent?.welcomeMsgContent?.length > 0)) {
|
|
@@ -564,101 +440,7 @@ const Create: React.FC<{ weComTaskStore: { data: { bookList: TASK_CREATE.BookLis
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- // 高级群发
|
|
|
- // if (highMassSendingStrategy && Object.keys(highMassSendingStrategy).length) {
|
|
|
- // params.messageSendTaskAddDTO = {
|
|
|
- // groupSendName: highMassSendingStrategy.groupSendName,
|
|
|
- // strategyList: highMassSendingStrategy?.strategySettings?.map((settingsItem, settingsIndex) => {
|
|
|
- // const {
|
|
|
- // // 发送对象
|
|
|
- // sendData,
|
|
|
- // // 策略
|
|
|
- // ...strategy
|
|
|
- // } = settingsItem
|
|
|
- // return {
|
|
|
- // ...strategy,
|
|
|
- // taskDetail: sendData.map((sendItem, sendIndex) => {
|
|
|
- // // 发送内容
|
|
|
- // const { contentDTO, sendMode } = highMassSendingContent.massSendingContentDTO[settingsIndex]['sendContentDto'][sendIndex]
|
|
|
- // const detail: { [x: string]: any } = {
|
|
|
- // sendMode,
|
|
|
- // contentDTO: contentDTO.map(item => {
|
|
|
|
|
|
- // let newContentDTO: { [x: string]: any } = {}
|
|
|
- // item.forEach((item: MediaContentProps) => {
|
|
|
- // switch (item.mediaType) {
|
|
|
- // case "text":
|
|
|
- // newContentDTO = {
|
|
|
- // text: {
|
|
|
- // content: item?.textContent
|
|
|
- // },
|
|
|
- // msgType: 'TASK_CONTENT_TEXT'
|
|
|
- // }
|
|
|
- // break
|
|
|
- // case "miniprogram":
|
|
|
- // newContentDTO = {
|
|
|
- // miniprogram: {
|
|
|
- // appId: item?.miniprogramAppid,
|
|
|
- // page: item?.miniprogramPage,
|
|
|
- // title: item?.miniprogramTitle,
|
|
|
- // picUrl: item?.miniprogramPicurl
|
|
|
- // },
|
|
|
- // msgType: 'TASK_STATUS_MINIPROGRAM'
|
|
|
- // }
|
|
|
- // break
|
|
|
- // case "link":
|
|
|
- // newContentDTO = {
|
|
|
- // link: {
|
|
|
- // desc: item?.linkDesc,
|
|
|
- // picUrl: item?.linkPicurl,
|
|
|
- // title: item?.linkTitle,
|
|
|
- // url: item?.linkUrl
|
|
|
- // },
|
|
|
- // msgType: 'TASK_CONTENT_LINK'
|
|
|
- // }
|
|
|
- // break
|
|
|
- // case "image":
|
|
|
- // newContentDTO = {
|
|
|
- // image: {
|
|
|
- // picUrl: item?.imageUrl
|
|
|
- // },
|
|
|
- // msgType: 'TASK_CONTENT_IMAGE'
|
|
|
- // }
|
|
|
- // break
|
|
|
- // case "video":
|
|
|
- // newContentDTO = {
|
|
|
- // video: {
|
|
|
- // videoUrl: item?.videoUrl
|
|
|
- // },
|
|
|
- // msgType: 'TASK_STATUS_VIDEO'
|
|
|
- // }
|
|
|
- // break
|
|
|
- // case "file":
|
|
|
- // newContentDTO = {
|
|
|
- // file: {
|
|
|
- // fileUrl: item?.fileUrl
|
|
|
- // },
|
|
|
- // msgType: 'TASK_STATUS_FILE'
|
|
|
- // }
|
|
|
- // break
|
|
|
- // }
|
|
|
- // })
|
|
|
-
|
|
|
- // return newContentDTO
|
|
|
- // })
|
|
|
- // }
|
|
|
- // if (sendItem.externalUserType === 'specify') {
|
|
|
- // detail.externalUserFilter = {
|
|
|
- // configName: sendItem.externalUserFilter.configName,
|
|
|
- // ...sendItem.externalUserFilter.configContent
|
|
|
- // }
|
|
|
- // }
|
|
|
- // return detail
|
|
|
- // })
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }
|
|
|
// 客户继承
|
|
|
if (userInherit && Object.keys(userInherit).length) {
|
|
|
params.externalUserTransferTasksDTO = {
|
|
@@ -686,68 +468,6 @@ const Create: React.FC<{ weComTaskStore: { data: { bookList: TASK_CREATE.BookLis
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- // 朋友圈
|
|
|
- // if (friendsStrategy && Object.keys(friendsStrategy).length) {
|
|
|
- // params.momentCreateDTO = {
|
|
|
- // momentSendName: friendsStrategy.momentSendName,
|
|
|
- // strategyList: friendsStrategy.strategySettings.map((item, index) => {
|
|
|
- // const { sendMode, contentDTO } = settings?.friendsContent?.friendsContentDTO?.[index]
|
|
|
-
|
|
|
- // return {
|
|
|
- // ...item,
|
|
|
- // taskDetail: {
|
|
|
- // sendMode,
|
|
|
- // contentDTO: contentDTO.map(item => {
|
|
|
-
|
|
|
- // return {
|
|
|
- // text: item.text,
|
|
|
- // attachmentList: item.attachmentList.map((item: any) => {
|
|
|
- // switch (item.mediaType) {
|
|
|
- // case 'image':
|
|
|
- // return {
|
|
|
- // image: {
|
|
|
- // picUrl: item.imageUrl,
|
|
|
- // mediaFormat: item.mediaFormat,
|
|
|
- // mediaSize: item.mediaSize,
|
|
|
- // mediaPlayTime: item.mediaPlayTime,
|
|
|
- // mediaWidth: item.mediaWidth,
|
|
|
- // mediaHeight: item.mediaHeight
|
|
|
- // }, msgType: 'TASK_CONTENT_IMAGE'
|
|
|
- // }
|
|
|
- // case 'video':
|
|
|
- // return {
|
|
|
- // video: {
|
|
|
- // videoUrl: item.videoUrl,
|
|
|
- // mediaFormat: item.mediaFormat,
|
|
|
- // mediaSize: item.mediaSize,
|
|
|
- // mediaPlayTime: item.mediaPlayTime,
|
|
|
- // mediaWidth: item.mediaWidth,
|
|
|
- // mediaHeight: item.mediaHeight
|
|
|
- // }, msgType: 'TASK_STATUS_VIDEO'
|
|
|
- // }
|
|
|
- // case 'file':
|
|
|
- // return { file: { fileUrl: item.fileUrl }, msgType: 'TASK_STATUS_FILE' }
|
|
|
- // case 'link':
|
|
|
- // return { link: { desc: item.linkDesc, picUrl: item.linkPicurl, title: item.linkTitle, url: item.linkUrl }, msgType: 'TASK_CONTENT_LINK' }
|
|
|
- // case 'miniprogram':
|
|
|
- // return {
|
|
|
- // miniprogram: {
|
|
|
- // appId: item.miniprogramAppid,
|
|
|
- // page: item.miniprogramPage,
|
|
|
- // picUrl: item.miniprogramPicurl,
|
|
|
- // title: item.miniprogramTitle
|
|
|
- // },
|
|
|
- // msgType: 'TASK_STATUS_MINIPROGRAM'
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
- // }
|
|
|
console.log('11111111111111', values)
|
|
|
if (projectId) {
|
|
|
params.projectId = projectId
|