|
|
@@ -1,6 +1,6 @@
|
|
|
import { useAjax } from "@/Hook/useAjax"
|
|
|
import { CheckOutlined, QuestionCircleOutlined, SyncOutlined } from "@ant-design/icons"
|
|
|
-import { Button, message, Modal, Radio, Space, Table, Tooltip } from "antd"
|
|
|
+import { Button, Input, message, Modal, Radio, Space, Table, Tooltip } from "antd"
|
|
|
import React, { useEffect, useState } from "react"
|
|
|
import style from '../GoodsModal/index.less'
|
|
|
import columns from './tableConfig'
|
|
|
@@ -20,6 +20,7 @@ const Audience: React.FC<Props> = (props) => {
|
|
|
|
|
|
/************************/
|
|
|
const { visible, onClose, data: data1, onChange } = props
|
|
|
+ const [searchQuery, setSearchQuery] = useState<string[]>([]) // 搜索关键词
|
|
|
const [tableData, setTableData] = useState<any[]>([])//table数据
|
|
|
const [selectAdz, setSelectAdz] = useState<number>(1) // 选择广告主
|
|
|
const [data, setData] = useState<PULLIN.AccountCreateLogsProps[]>(data1)
|
|
|
@@ -117,6 +118,19 @@ const Audience: React.FC<Props> = (props) => {
|
|
|
</div>
|
|
|
<div className={style.right}>
|
|
|
<Space style={{ marginBottom: 10 }} align="center">
|
|
|
+ <Input.Search
|
|
|
+ placeholder="人群包名称(多个,,空格分隔)"
|
|
|
+ style={{ width: 250 }}
|
|
|
+ allowClear
|
|
|
+ enterButton="搜索"
|
|
|
+ onSearch={(e) => {
|
|
|
+ let q: string[] = []
|
|
|
+ if (e) {
|
|
|
+ q = e.replace(/[,,\s]/g, ',').split(',').filter((a: any) => a)
|
|
|
+ }
|
|
|
+ setSearchQuery(q)
|
|
|
+ }}
|
|
|
+ />
|
|
|
<Radio.Group value={positionPackageType} onChange={(e) => setPositionPackageType(e.target.value)} buttonStyle="solid">
|
|
|
<Radio.Button value="customAudience">定向用户群 {(data[selectAdz - 1]?.['customAudience'] || [])?.length > 0 && <CheckOutlined />}</Radio.Button>
|
|
|
<Radio.Button value="excludedCustomAudience">排除用户群 {(data[selectAdz - 1]?.['excludedCustomAudience'] || [])?.length > 0 && <CheckOutlined />}</Radio.Button>
|
|
|
@@ -134,7 +148,13 @@ const Audience: React.FC<Props> = (props) => {
|
|
|
</Space>
|
|
|
<Table
|
|
|
columns={columns()}
|
|
|
- dataSource={tableData}
|
|
|
+ dataSource={searchQuery?.length > 0 ? tableData.filter(item => {
|
|
|
+ if (searchQuery.length > 1) {
|
|
|
+ return searchQuery.some(q => item.name?.toLowerCase().includes(q.toLowerCase()))
|
|
|
+ } else {
|
|
|
+ return item.name?.toLowerCase().includes(searchQuery?.[0]?.toLowerCase())
|
|
|
+ }
|
|
|
+ }) : tableData}
|
|
|
size="small"
|
|
|
loading={getAudiencesList?.loading}
|
|
|
scroll={{ y: 400 }}
|