重构消息通知弹窗

This commit is contained in:
dengqichen 2025-11-14 14:45:45 +08:00
parent 3a7492ac91
commit 46f23104f9
5 changed files with 37 additions and 36 deletions

View File

@ -80,7 +80,7 @@ export const ApplicationCard: React.FC<ApplicationCardProps> = ({
{app.branch ? (
<code className="truncate font-mono">{app.branch}</code>
) : (
<Skeleton className="h-3 w-16" />
<span className="text-amber-600 italic font-medium"></span>
)}
</div>

View File

@ -59,7 +59,7 @@ const DeploymentFormModal: React.FC<DeploymentFormModalProps> = ({
environmentCode: environment.environmentCode || '',
environmentName: environment.environmentName || '',
// 任务编号(自动生成)
taskNo: '',
deployRemark: '',
// 审批信息
approval: {
required: environment.requiresApproval ? 'true' : 'false',

View File

@ -104,7 +104,7 @@ export const EnvironmentTabs: React.FC<EnvironmentTabsProps> = React.memo(({
</CardContent>
</Card>
) : (
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 gap-4">
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 gap-4">
{env.applications.map((app) => (
<ApplicationCard
key={app.teamApplicationId}

View File

@ -34,7 +34,7 @@ import {
createTemplate,
updateTemplate,
getTemplateById,
checkTemplateCodeUnique,
// checkTemplateCodeUnique, // 暂时注释掉,后端没有这个接口
renderTemplate,
} from '../service';
import { TemplateEditor, TemplateRender } from './';
@ -112,31 +112,31 @@ export const NotificationTemplateDialog: React.FC<NotificationTemplateDialogProp
const watchedTemplate = watch('contentTemplate');
const watchedTemplateConfig = watch('templateConfig');
// 验证编码唯一性
const validateCodeUnique = async (code: string) => {
if (!code || code.length < 1) return;
// 验证编码唯一性 - 暂时注释掉,后端没有这个接口
// const validateCodeUnique = async (code: string) => {
// if (!code || code.length < 1) return;
//
// try {
// const isUnique = await checkTemplateCodeUnique(code, editId);
// if (!isUnique) {
// setError('code', { message: '模板编码已存在' });
// } else {
// clearErrors('code');
// }
// } catch (error) {
// console.error('Failed to check code uniqueness:', error);
// }
// };
try {
const isUnique = await checkTemplateCodeUnique(code, editId);
if (!isUnique) {
setError('code', { message: '模板编码已存在' });
} else {
clearErrors('code');
}
} catch (error) {
console.error('Failed to check code uniqueness:', error);
}
};
// 监听编码变化进行唯一性验证
useEffect(() => {
if (watchedCode && mode === 'create') {
const timer = setTimeout(() => {
validateCodeUnique(watchedCode);
}, 500);
return () => clearTimeout(timer);
}
}, [watchedCode, mode]);
// 监听编码变化进行唯一性验证 - 暂时注释掉,后端没有这个接口
// useEffect(() => {
// if (watchedCode && mode === 'create') {
// const timer = setTimeout(() => {
// validateCodeUnique(watchedCode);
// }, 500);
// return () => clearTimeout(timer);
// }
// }, [watchedCode, mode]);
// 加载编辑数据
useEffect(() => {

View File

@ -126,15 +126,16 @@ export const batchDisableTemplates = async (ids: number[]): Promise<void> => {
/**
*
*
*/
export const checkTemplateCodeUnique = async (
code: string,
excludeId?: number
): Promise<boolean> => {
return request.get(`${API_PREFIX}/check-code`, {
params: { code, excludeId },
});
};
// export const checkTemplateCodeUnique = async (
// code: string,
// excludeId?: number
// ): Promise<boolean> => {
// return request.get(`${API_PREFIX}/check-code`, {
// params: { code, excludeId },
// });
// };
/**
*