/* Copyright (C) 2025 QuantumNous This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import React, { useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { FlaskConical } from 'lucide-react'; import { Button, Tag, TextArea, Typography } from '@/components/ui'; import { API } from '../../../helpers/api'; import { showError } from '../../../helpers'; import OrgPanel from '../components/OrgPanel'; // OrgDsTest 脱敏测试子 tab:按本企业生效策略 + 生效规则集(含企业私有规则)演示脱敏效果。 // 样本仅内存处理、不入库。 const OrgDsTest = ({ orgId }) => { const { t } = useTranslation(); const headers = useMemo(() => ({ 'X-Org-Id': String(orgId) }), [orgId]); const [text, setText] = useState('我的邮箱 zhang@abc.com,手机 13800138000'); const [testing, setTesting] = useState(false); const [result, setResult] = useState(null); const runTest = async () => { if (!text.trim()) { showError(t('请输入要测试的样本文本')); return; } setTesting(true); try { const res = await API.post( '/api/org/data-security/test', { text }, { headers }, ); if (res.data.success) { setResult(res.data.data); } else { showError(res.data.message || t('测试失败')); } } catch (err) { if (err?.name !== 'AxiosError') showError(err); } finally { setTesting(false); } }; return (