|
@@ -1,9 +1,9 @@
|
|
|
-import { Button, Input, Table } from 'antd';
|
|
|
+import { Button, Input, message, Select, Table } from 'antd';
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
import '../../../../../tencentAdPutIn/index.less'
|
|
|
import { useAjax } from '@/Hook/useAjax';
|
|
|
-import { getCorpWechatAllApi, getTencentCorpCsgroupListApi, GetTencentCorpCsgroupListProps } from '@/services/adqV3/global';
|
|
|
-import { PlusOutlined, SearchOutlined } from '@ant-design/icons';
|
|
|
+import { getCorpWechatAllApi, getTencentCorpCsgroupListApi, GetTencentCorpCsgroupListProps, syncencentCorpCsgroupApi } from '@/services/adqV3/global';
|
|
|
+import { PlusOutlined, SearchOutlined, SyncOutlined } from '@ant-design/icons';
|
|
|
import columns from './tableConfig';
|
|
|
import AddTencentGroup from './addTencentGroup';
|
|
|
import BandLocal from './bandLocal';
|
|
@@ -18,6 +18,7 @@ const TencentGroup: React.FC<{ adAccountId?: number }> = ({ adAccountId }) => {
|
|
|
|
|
|
const getTencentCorpCsgroupList = useAjax((params) => getTencentCorpCsgroupListApi(params))
|
|
|
const getCorpWechatAll = useAjax((params) => getCorpWechatAllApi(params))
|
|
|
+ const syncencentCorpCsgroup = useAjax((params) => syncencentCorpCsgroupApi(params))
|
|
|
/**********************************/
|
|
|
|
|
|
useEffect(() => {
|
|
@@ -30,7 +31,7 @@ const TencentGroup: React.FC<{ adAccountId?: number }> = ({ adAccountId }) => {
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (adAccountId) {
|
|
|
- getTencentCorpCsgroupList.run({ ...queryParamsNew })
|
|
|
+ getTencentCorpCsgroupList.run({ ...queryParamsNew, accountId: adAccountId })
|
|
|
}
|
|
|
}, [queryParamsNew, adAccountId])
|
|
|
|
|
@@ -40,6 +41,22 @@ const TencentGroup: React.FC<{ adAccountId?: number }> = ({ adAccountId }) => {
|
|
|
};
|
|
|
|
|
|
|
|
|
+ const syncGroup = (value?: any) => {
|
|
|
+ const hide = message.loading('同步中...', 0);
|
|
|
+ let params: { [x: string]: any } = { accountId: adAccountId }
|
|
|
+ if (value?.groupId) {
|
|
|
+ params.tencentCorpId = value.tencentCorpId
|
|
|
+ params.groupId = value.groupId
|
|
|
+ } else {
|
|
|
+ params.tencentCorpId = queryParamsNew.tencentCorpId
|
|
|
+ }
|
|
|
+ syncencentCorpCsgroup.run(params).then(() => {
|
|
|
+ hide()
|
|
|
+ getTencentCorpCsgroupList.refresh()
|
|
|
+ }).catch(() => hide())
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
return <>
|
|
|
<div className="flexStart" style={{ gap: 8, marginBottom: 16 }}>
|
|
|
<Input.Search
|
|
@@ -49,6 +66,18 @@ const TencentGroup: React.FC<{ adAccountId?: number }> = ({ adAccountId }) => {
|
|
|
onSearch={(e) => setQueryParamsNew({ ...queryParamsNew, groupName: e, pageNum: 1 })}
|
|
|
allowClear
|
|
|
/>
|
|
|
+ <Select
|
|
|
+ showSearch
|
|
|
+ placeholder="请选择企业"
|
|
|
+ filterOption={(input, option) =>
|
|
|
+ ((option?.label ?? '') as any).toLowerCase().includes(input.toLowerCase())
|
|
|
+ }
|
|
|
+ style={{ width: 150 }}
|
|
|
+ value={queryParamsNew?.tencentCorpId}
|
|
|
+ onChange={(e) => setQueryParamsNew({ ...queryParamsNew, tencentCorpId: e, pageNum: 1 })}
|
|
|
+ allowClear
|
|
|
+ options={corpWechatList}
|
|
|
+ />
|
|
|
<Button type="primary" icon={<SearchOutlined />} loading={getTencentCorpCsgroupList.loading} onClick={() => getTencentCorpCsgroupList.refresh()}>刷新</Button>
|
|
|
<Button
|
|
|
type="primary"
|
|
@@ -57,9 +86,17 @@ const TencentGroup: React.FC<{ adAccountId?: number }> = ({ adAccountId }) => {
|
|
|
setAddData({ visible: true, initialValues: undefined })
|
|
|
}}
|
|
|
>新增</Button>
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ style={{ backgroundColor: '#FAAD14', borderColor: '#FAAD14' }}
|
|
|
+ icon={<SyncOutlined />}
|
|
|
+ disabled={queryParamsNew?.tencentCorpId === undefined}
|
|
|
+ onClick={syncGroup}
|
|
|
+ loading={syncencentCorpCsgroup.loading}
|
|
|
+ >同步</Button>
|
|
|
</div>
|
|
|
<Table
|
|
|
- columns={columns(handleBand)}
|
|
|
+ columns={columns(handleBand, syncGroup)}
|
|
|
dataSource={getTencentCorpCsgroupList.data?.records}
|
|
|
size="small"
|
|
|
loading={getTencentCorpCsgroupList?.loading}
|
|
@@ -75,7 +112,6 @@ const TencentGroup: React.FC<{ adAccountId?: number }> = ({ adAccountId }) => {
|
|
|
const { current, pageSize } = pagination
|
|
|
setQueryParamsNew({ ...queryParamsNew, pageNum: current as number, pageSize: pageSize as number || 20 })
|
|
|
}}
|
|
|
-
|
|
|
/>
|
|
|
|
|
|
{/* 设置修改腾讯组 */}
|
|
@@ -95,6 +131,7 @@ const TencentGroup: React.FC<{ adAccountId?: number }> = ({ adAccountId }) => {
|
|
|
{/* 绑定本地客服组 */}
|
|
|
{bandData?.visible && <BandLocal
|
|
|
{...bandData}
|
|
|
+ accountId={adAccountId as number}
|
|
|
onClose={() => {
|
|
|
setBandData({ visible: false, data: undefined })
|
|
|
}}
|