From bc44e40f5650b2336c36eecb95d21c540c68a3ba Mon Sep 17 00:00:00 2001 From: suyiiyii Date: Sun, 22 Sep 2024 17:12:52 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=94=AF=E6=8C=81=E5=88=A0?= =?UTF-8?q?=E9=99=A4=20CookieTarget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CookieTargetManager.tsx | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/admin-frontend/src/features/cookieTargetManager/CookieTargetManager.tsx b/admin-frontend/src/features/cookieTargetManager/CookieTargetManager.tsx index 80378b7..e628892 100644 --- a/admin-frontend/src/features/cookieTargetManager/CookieTargetManager.tsx +++ b/admin-frontend/src/features/cookieTargetManager/CookieTargetManager.tsx @@ -1,11 +1,10 @@ import React, { useState } from 'react'; import { useParams } from 'react-router-dom'; import { - Button, Empty, Table, Typography, + Button, Empty, Space, Table, Typography, } from '@arco-design/web-react'; -import { useGetCookieTargetsQuery } from '../cookieManager/cookieConfigSlice'; -import { SubscribeConfig } from '../../utils/type'; -import { useDeleteSubMutation } from '../subsribeConfigManager/subscribeConfigSlice'; +import { useDeleteCookieTargetMutation, useGetCookieTargetsQuery } from '../cookieManager/cookieConfigSlice'; +import { CookieTarget } from '../../utils/type'; import CookieTargetModal from './CookieTargetModal'; export default function () { @@ -13,12 +12,18 @@ export default function () { const { data: cookieTargets } = useGetCookieTargetsQuery(cookieId); console.log(cookieTargets); - const [{ isLoading: deleteIsLoading }] = useDeleteSubMutation(); - const isLoading = deleteIsLoading; const [showModal, setShowModal] = useState(false); + const [deleteCookieTarget] = useDeleteCookieTargetMutation(); const handleAdd = () => { setShowModal(true); }; + const handleDelete = (record: CookieTarget) => () => { + deleteCookieTarget({ + cookieId, + target: record.target.target, + platformName: record.target.platform_name, + }); + }; const columns = [ { title: '平台名称', @@ -33,6 +38,16 @@ export default function () { title: 'Cookie ID', dataIndex: 'cookie_id', }, + { + title: '操作', + dataIndex: 'op', + render: (_: null, record: CookieTarget) => ( + + + + ), + + }, ]; if (cookieId) { return ( @@ -44,8 +59,7 @@ export default function () { `${record.platformName}-${record.target}`} - loading={isLoading} + rowKey={(record: CookieTarget) => `${record.target.platform_name}-${record.target.target}`} scroll={{ x: true }} /> {