import { useAjax } from "@/Hook/useAjax"; import { delCorpWechatApi, getCorpWechatAllApi, getCorpWechatApi, getCorpWechatDetailApi } from "@/services/adqV3/global"; import { PlusOutlined, SearchOutlined } from "@ant-design/icons"; import { Button, Card, Divider, Input, message, Select, Table, Typography } from "antd"; import React, { useEffect, useState } from "react" import '../../tencentAdPutIn/index.less' import Modify from "./modify"; import columns from "./tableConfig"; const { Text, Paragraph } = Typography; /** * 企业微信 * @returns */ const CorpWechat: React.FC = () => { /**********************************/ const [queryForm, setQueryForm] = useState<{ pageNum: number, pageSize: number, wechatName?: string, wechatIdList?: string[] }>({ pageNum: 1, pageSize: 20 }) const [queryFormNew, setQueryFormNew] = useState<{ pageNum: number, pageSize: number, wechatName?: string, wechatIdList?: string[] }>({ pageNum: 1, pageSize: 20 }) const [visible, setVisible] = useState(false) const getCorpWechat = useAjax((params) => getCorpWechatApi(params)) const delCorpWechat = useAjax((params) => delCorpWechatApi(params)) /**********************************/ useEffect(() => { getCorpWechat.run(queryFormNew) }, [queryFormNew]) const del = (id: number) => { delCorpWechat.run(id).then(res => { if (res) { message.success('删除成功') getCorpWechat.refresh() } }) } return setQueryForm({ ...queryForm, wechatName: e.target.value, pageNum: 1 })} /> { let value = e.target.value let arr: string[] = [] if (value) { value = value.replace(/[,,\s]/g, ',') arr = value.split(',').filter((a: string) => a) } setQueryForm({ ...queryForm, wechatIdList: arr, pageNum: 1 }) }} /> } > { const { current, pageSize } = pagination setQueryForm({ ...queryForm, pageNum: current || 1, pageSize: pageSize || 10 }) setQueryFormNew({ ...queryForm, pageNum: current || 1, pageSize: pageSize || 10 }) }} /> {/* 新增修改 */} {visible && { setVisible(false) }} onChange={() => { setVisible(false) getCorpWechat.refresh() }} />} } /** * 选择企微 * @param param0 * @returns */ export const SelectCorpWechat: React.FC<{ value?: number, onChange?: (value?: number) => void }> = ({ value, onChange }) => { /*******************************/ const [visible, setVisible] = useState(false) const getCorpWechatAll = useAjax((params) => getCorpWechatAllApi(params)) /*******************************/ // 获取列表 useEffect(() => { getCorpWechatAll.run({}) }, []) return <> {/* 新增修改 */} {visible && { setVisible(false) }} onChange={() => { setVisible(false) getCorpWechatAll.refresh() }} />} } /** * 选择企微 * @param param0 * @returns */ export const SelectCorpWechatCorpId: React.FC<{ value?: string[], onChange?: (value?: string[]) => void }> = ({ value, onChange }) => { /*******************************/ const [visible, setVisible] = useState(false) const getCorpWechatAll = useAjax((params) => getCorpWechatAllApi(params)) /*******************************/ // 获取列表 useEffect(() => { getCorpWechatAll.run({}) }, []) return <> {/* 新增修改 */} {visible && { setVisible(false) }} onChange={() => { setVisible(false) getCorpWechatAll.refresh() }} />} } /** * 展示企微 * @param param0 * @returns */ export const ShowCorpWechatDetail: React.FC<{ id: number }> = ({ id }) => { /*******************************/ const getCorpWechatDetail = useAjax((params) => getCorpWechatDetailApi(params)) /*******************************/ // 获取列表 useEffect(() => { if (id) { getCorpWechatDetail.run(id) } }, [id]) return {getCorpWechatDetail.data ? <> 企业微信:{getCorpWechatDetail.data?.wechatName}{`(${getCorpWechatDetail.data?.wechatId}})`} : id} } export default CorpWechat