|
@@ -1,4 +1,4 @@
|
|
-import { Button, Table, Image, Modal, message, Select, Popconfirm } from "antd";
|
|
|
|
|
|
+import { Button, Table, Image, Modal, message, Select, Popconfirm, Input } from "antd";
|
|
import type { TableProps } from 'antd';
|
|
import type { TableProps } from 'antd';
|
|
import { useState, useEffect, useRef } from "react";
|
|
import { useState, useEffect, useRef } from "react";
|
|
import { InfoCircleFilled, CheckCircleFilled } from "@ant-design/icons";
|
|
import { InfoCircleFilled, CheckCircleFilled } from "@ant-design/icons";
|
|
@@ -323,12 +323,14 @@ const Gzh: React.FC = () => {
|
|
const [title, setTitle] = useState('');
|
|
const [title, setTitle] = useState('');
|
|
const [authFailed, setAuthFailed] = useState(false);
|
|
const [authFailed, setAuthFailed] = useState(false);
|
|
const [loading, setLoading] = useState(false);
|
|
const [loading, setLoading] = useState(false);
|
|
- const [data, setData] = useState<DataType[]>([]);
|
|
|
|
|
|
+ const [data, setData] = useState<DataType[]>([]);
|
|
|
|
+ const [queryName, setQueryName] = useState('');
|
|
|
|
+ const [isSearch, setIsSearch] = useState(false);
|
|
const [pagination, setPagination] = useState({
|
|
const [pagination, setPagination] = useState({
|
|
current: 1,
|
|
current: 1,
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
total: 0
|
|
total: 0
|
|
- });
|
|
|
|
|
|
+ });
|
|
|
|
|
|
const columns: TableProps<DataType>['columns'] = [
|
|
const columns: TableProps<DataType>['columns'] = [
|
|
{
|
|
{
|
|
@@ -376,10 +378,15 @@ const Gzh: React.FC = () => {
|
|
]
|
|
]
|
|
|
|
|
|
// 获取账号列表数据
|
|
// 获取账号列表数据
|
|
- const fetchAccountList = async (pageNum = 1, pageSize = 10) => {
|
|
|
|
|
|
+ const fetchAccountList = async (pageNum = 1, pageSize = 10, _queryName = '') => {
|
|
|
|
+ setIsSearch(_queryName.trim() !== '');
|
|
setLoading(true);
|
|
setLoading(true);
|
|
try {
|
|
try {
|
|
- const res = await http.post<AccountListResponse>(accountList, { pageNum, pageSize });
|
|
|
|
|
|
+ const res = await http.post<AccountListResponse>(accountList, {
|
|
|
|
+ pageNum,
|
|
|
|
+ pageSize,
|
|
|
|
+ name: (_queryName || isSearch) ? (_queryName || queryName) : '',
|
|
|
|
+ });
|
|
if (res.code === 0 && res.data) {
|
|
if (res.code === 0 && res.data) {
|
|
setData(res.data.objs || []);
|
|
setData(res.data.objs || []);
|
|
setPagination({
|
|
setPagination({
|
|
@@ -468,20 +475,35 @@ const Gzh: React.FC = () => {
|
|
setIsOpen(false);
|
|
setIsOpen(false);
|
|
// 重置当前选中的账号数据
|
|
// 重置当前选中的账号数据
|
|
setCurrentAccount(undefined);
|
|
setCurrentAccount(undefined);
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const handleSearch = () => {
|
|
|
|
+ fetchAccountList(1, pagination.pageSize, queryName);
|
|
|
|
+ }
|
|
|
|
|
|
// 当前选中的账号数据
|
|
// 当前选中的账号数据
|
|
const [currentAccount, setCurrentAccount] = useState<DataType | undefined>(undefined);
|
|
const [currentAccount, setCurrentAccount] = useState<DataType | undefined>(undefined);
|
|
|
|
|
|
return (
|
|
return (
|
|
- <>
|
|
|
|
|
|
+ <>
|
|
|
|
+ <div className={"text-[20px] font-medium mb-[10px]"}>公众号管理</div>
|
|
<div className={"flex mb-[10px]"}>
|
|
<div className={"flex mb-[10px]"}>
|
|
- <div className={"flex-1 leading-[32px]"}>公众号管理</div>
|
|
|
|
|
|
+ <div className={"flex-1 flex gap-[10px]"}>
|
|
|
|
+ <Input
|
|
|
|
+ className={"!w-[200px]"}
|
|
|
|
+ allowClear
|
|
|
|
+ placeholder="请输入账号名称"
|
|
|
|
+ value={queryName}
|
|
|
|
+ onChange={(e) => setQueryName(e.target.value)}
|
|
|
|
+ />
|
|
|
|
+ <Button type="primary" onClick={handleSearch}>搜索</Button>
|
|
|
|
+ </div>
|
|
<div>
|
|
<div>
|
|
<Button type="primary" onClick={addAccount} className={"mr-[10px]"}>+ 新建账号</Button>
|
|
<Button type="primary" onClick={addAccount} className={"mr-[10px]"}>+ 新建账号</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <Table
|
|
|
|
|
|
+ <Table
|
|
|
|
+
|
|
columns={columns}
|
|
columns={columns}
|
|
dataSource={data}
|
|
dataSource={data}
|
|
rowKey="id"
|
|
rowKey="id"
|