import { App, Button, Card, Empty, Form, Input, InputNumber, Modal, Popover, Radio, Select, Space, Table, Typography } from 'antd'; import React, { useEffect, useState } from 'react'; import { PlusOutlined, QuestionCircleFilled } from '@ant-design/icons'; import FilterUser from '@/pages/weComTask/components/filterUser'; import MindTags from '@/pages/weComTask/components/mindTags'; import { getAllWxListApi } from '@/pages/weComTask/API/corpUserAssign'; import { useAjax } from '@/Hook/useAjax'; import FilterUserTooltip from '@/pages/weComTask/components/filterUser/filterUserTooltip'; import { businessPlanData } from '@/pages/weComTask/page/businessPlan/create/const'; import { ColumnsType } from 'antd/es/table'; const { Text, Paragraph } = Typography; /** * 进群对象新建组件 * @param param0 * @returns */ const AddGroupObject: React.FC = ({ value = [], onChange, bookPlatForm, bookList }) => { /******************************************/ const [visible, setVisible] = useState(false) const [initialValues, setInitialValues] = useState(undefined) /******************************************/ return <> {value?.length > 0 ? { onChange?.(value.filter((_, index) => index + 1 !== id)) }} handleEdit={(record) => { setInitialValues(record) setVisible(true) }} /> : } {visible && { const newValue = JSON.parse(JSON.stringify(value)) if (initialValues?.id) { newValue[initialValues.id - 1] = values } else { newValue.push(values) } onChange?.(newValue) setVisible(false) setInitialValues(undefined) }} onClose={() => { setVisible(false) setInitialValues(undefined) }} />} }; export const ShowGroupUserTable: React.FC = React.memo(({ bookList, bookPlatForm, value, handleEdit, handleDelete, isPreview }) => { const columns: ColumnsType = [ { title: '群配置名称', dataIndex: 'groupObjectName', key: 'groupObjectName', width: 120, ellipsis: true, fixed: 'left' }, { title: '进群对象', dataIndex: 'externalUserFilter', key: 'externalUserFilter', width: 90, align: 'center', render(value) { return value ?
指定
({ label: item.platformName, value: item.platformKey }))} configName={value?.configName} data={value?.configContent} />} >
: '全部' }, }, { title: '群递增起始编号', dataIndex: 'groupIndex', key: 'groupIndex', width: 60, align: 'center' }, { title: '群固定人数', dataIndex: 'groupUserCount', key: 'groupUserCount', width: 50, align: 'center' }, { title: '邀请客户进群完毕后客服号是否退群', dataIndex: 'autoOutGroup', key: 'autoOutGroup', width: 85, align: 'center', render(value) { return value ? : }, }, { title: '是否排除已在群的客户', dataIndex: 'excludeInGroup', key: 'excludeInGroup', width: 60, align: 'center', render(value) { return value ? : }, }, { title: '拉群完成后自动删除拉群标签', dataIndex: 'excludeInGroup', key: 'excludeInGroup', width: 70, align: 'center', render(value) { return value ? : }, }, { title: '群聊关联公众号', dataIndex: 'weChatAppid', key: 'weChatAppid', width: 100, align: 'center', ellipsis: true, render(value) { return value || '--' }, }, { title: '拉群完成后群聊备注', dataIndex: 'remark', key: 'remark', width: 140, ellipsis: true, render(value) { return value || '--' }, }, { title: '拉群完成后群聊智能标签', dataIndex: 'tagDTO', key: 'tagDTO', width: 200, ellipsis: true, render(value) { return value && Object.keys(value)?.length > 0 ? {Object.keys(value).map(key => { if (key === 'business' && value[key]) { return `业务(来源渠道):${businessPlanData.find(i => i.value === value.business)?.label || '<空>'}` } else if (key === 'bookCity' && value[key]) { return `书城(来源渠道):${bookPlatForm.find(i => i.id === value.bookCity)?.platformName || '<空>'}` } else if (key === 'product' && value[key]) { return `产品(来源渠道):${bookList.find(i => i.id === value.product)?.bookName || '<空>'}` } return '' }).join('、')} : '--' }, }, { title: '建群成功发送内容', dataIndex: 'groupSendMsg', key: 'groupSendMsg', width: 140, ellipsis: true }, { title: '操作', dataIndex: 'cz', key: 'cz', width: 75, fixed: 'right', align: 'center', render(_, record) { return { handleEdit?.(record) }}>修改 { handleDelete?.(record.id) }}>删除 }, } ] if (isPreview) { columns.pop() } return ({ ...item, id: index + 1 }))} scroll={{ y: 1000 }} columns={columns} /> }) const AddGroupObjectModal: React.FC = React.memo(({ visible, onChange, onClose, initialValues }) => { /******************************************/ const { message } = App.useApp(); const [form] = Form.useForm(); const externalUserType = Form.useWatch('externalUserType', form); const getAccountList = useAjax(() => getAllWxListApi()) /******************************************/ useEffect(() => { getAccountList.run() }, []) const handleOk = () => { form.validateFields().then((values) => { console.log(values) onChange?.(values) }).catch(() => { form.submit() }); } return {(initialValues && Object.keys(initialValues).length > 0) ? '修改' : '新建'}群配置} open={visible} onCancel={onClose} width={600} onOk={handleOk} styles={{ body: { maxHeight: 550, overflowY: 'auto' } }} >
{ message.error(errorFields?.[0]?.errors?.[0]) }} onFinish={handleOk} initialValues={(initialValues && Object.keys(initialValues).length > 0) ? initialValues : { externalUserType: 'all', groupIndex: 1, groupUserCount: 37, autoOutGroup: false, excludeInGroup: true, deleteGroupTag: true }} preserve={true} > 群配置名称} rules={[{ required: true, message: '请输入群配置名称!' }]} > 进群对象配置} required >
{externalUserType === 'specify' &&
}
群递增起始编号} rules={[{ required: true, message: '请输入群递增起始编号!' }]} > 群固定人数} rules={[{ required: true, message: '请输入群固定人数!' }]} > 邀请客户进群完毕后客服号是否退群} rules={[{ required: true, message: '请选择是否退群!' }]} > 是否排除已在群的客户} rules={[{ required: true, message: '请选择是否排除已在群的客户!' }]} > 拉群完成后自动删除拉群标签} rules={[{ required: true, message: '请选择拉群完成后自动删除拉群标签!' }]} > 群聊关联公众号} >