import React, { useCallback, useEffect, useRef, useState } from 'react'; import style from '../../corpUserManage/index.less' import { App, Button, Card, DatePicker, Drawer, Input, Pagination, Popconfirm, Select, Space, Table, Tabs, Tag, Typography } from 'antd'; import { MenuUnfoldOutlined, MenuFoldOutlined, SearchOutlined } from '@ant-design/icons'; import { useAjax } from '@/Hook/useAjax'; import { api_corpUser_allOfUser, getAdAccountAllOfMember } from '@/API/global'; import TeamMembers from '@/components/Team/teamMembers'; import SearchBox from '@/pages/weComTask/components/searchBox'; import { ApiParamsChatListProps, disbandChatApi, getGroupChatCountApi, getGroupChatListApi } from '@/pages/weComTask/API/global'; import { useSize } from 'ahooks'; import { TableConfig } from './tableConfig'; import UserContent from './userContent'; import RemarkSet from './remarkSet'; import DisbandChatLog from './disbandChatLog'; import ZpMp from './zpMp'; import ChatLog from './chatLog'; import { getBindMpListApi } from '@/pages/weComTask/API/corpUserAssign'; const { Title } = Typography; const WeAssociationList: React.FC = () => { /************************************/ const { message } = App.useApp() const ref = useRef(null) const size = useSize(ref) const [activeKey, setActiveKey] = useState('1') const [showLeft, setShowLeft] = useState(false) const userIdStr = sessionStorage.getItem('userId'); const [userId, setUserId] = useState(userIdStr ? Number(userIdStr) : undefined); const [listData, setListData] = useState({ pageNum: 1, pageSize: 20 }) const [userQuerys, setUserQuerys] = useState<{ numArr: Array, value: number | null, options: { value: number, label: string }[] }>({ numArr: [0, 100], value: null, options: [] }) const [open, setOpen] = useState(false) const [activeCorp, setActiveCorp] = useState() const [editSelectedRow, setEditSelectedRow] = useState([]) const [userData, setUserData] = useState() const [remarkVisible, setRemarkVisible] = useState(false) const [zpVisible, setZpVisible] = useState(false) const [chatLogData, setChatLogData] = useState<{ visible: boolean, chatData: any }>(); const corpUser_allOfUser = useAjax((params) => api_corpUser_allOfUser(params)) const getGroupChatList = useAjax((params) => getGroupChatListApi(params)) const getGroupChatCount = useAjax((params) => getGroupChatCountApi(params)) const allOfMember = useAjax(() => getAdAccountAllOfMember()) const disbandChat = useAjax((params) => disbandChatApi(params)) const getBindMpList = useAjax(() => getBindMpListApi()) /************************************/ useEffect(() => { allOfMember.run() getBindMpList.run() }, []) useEffect(() => { if (userId) { corpUser_allOfUser.run(userId).then(res => { setActiveCorp(res?.data?.[0]) setListData({ ...listData, corpId: res?.data?.[0]?.t1?.corpId, pageNum: 1 }) }) } }, [userId]) // 初始请求 useEffect(() => { if (listData.corpId) { getList() } else if (getGroupChatList?.data) { getGroupChatList.mutate({ data: { records: [], size: 20, total: 0, pages: 0, current: 1 } }) getGroupChatCount.mutate({ data: {} }) } }, [listData]) //搜索事件 const getList = () => { getGroupChatList.run({ ...listData }) getGroupChatCount.run({ ...listData }) } // 人数输入确定 const setNum = useCallback(() => { let options = [ { value: 1, label: `最小${userQuerys.numArr[0]}人` + '~' + `最大${userQuerys.numArr[1]}人` } ] setUserQuerys({ ...userQuerys, value: 1, options }) setListData({ ...listData, userCountMin: userQuerys.numArr[0], userCountMax: userQuerys.numArr[1], }) setOpen(false) }, [userQuerys, listData]) //查看客户 const lockUsers = (data: any) => { setUserData(data) } // 解散群聊 const disbandChatHandle = () => { disbandChat.run({ chatIdList: editSelectedRow.map(item => item.chatId), corpId: listData.corpId }).then(res => { if (res?.data) { message.success('任务提交成功') getGroupChatList.refresh() } }) } const handleChatLog = (d: any) => { setChatLogData({ visible: true, chatData: d }); } return
{ if (activeKey !== 'contract') { if (activeKey === '1') { setUserId(Number(userIdStr)); } setActiveKey(activeKey) } else { setShowLeft(!showLeft) } }} items={[{ label: '我的', key: '1' }, { label: '组员', key: '2' }, { label: showLeft ? : , key: 'contract' }]} />
{!showLeft && activeKey === '2' && { setUserId(putUserId); }} value={userId} />} } > <> { let v = e.target.value setListData({ ...listData, chatName: v }) }} /> { if (!value) { setUserQuerys({ numArr: [0, 100], value: null, options: [] }) let { userCountMin, userCountMax, ...newObj } = listData setListData(newObj) } console.log(value) }} open={open} onDropdownVisibleChange={(open) => { setOpen(open) }} dropdownRender={() => { return
{ let value = e.target.value if (!isNaN(Number(value)) && !value.includes('.')) { console.log(11111) let newArr = userQuerys.numArr newArr[0] = Number(value) setUserQuerys({ ...userQuerys, numArr: newArr }) } }} />~ { let value = e.target.value if (!isNaN(Number(value)) && !value.includes('.')) { let newArr = userQuerys.numArr newArr[1] = Number(value) setUserQuerys({ ...userQuerys, numArr: newArr }) } }} />
}} /> { let v = e.target.value setListData({ ...listData, remark: v }) }} /> { setListData({ ...listData, mpAccountId: e, mpAccountIdIsNull: undefined, pageNum: 1 }) }} filterOption={(input: string, option: any) => (option?.label ?? '').toLowerCase().includes(input.toLowerCase())} options={getBindMpList?.data?.data?.map((item: any) => ({ label: item.name, value: item.id }))} />