Files
TERES_web_frontend/src/interfaces/common.ts
guangfei.zhao 5c937df5ed feat(knowledge): add knowledge base management with dialog system
- Implement knowledge base list, create, and detail pages
- Add dialog provider and components for confirmation and alerts
- Include knowledge card and grid view components
- Enhance header with user menu and logout functionality
- Implement knowledge operations hooks for CRUD operations
2025-10-13 12:26:10 +08:00

60 lines
1.5 KiB
TypeScript

import React from 'react';
export interface Pagination {
current: number;
pageSize: number;
total: number;
}
export interface BaseState {
pagination: Pagination;
searchString: string;
}
export interface IModalProps<T> {
showModal?(): void;
hideModal?(): void;
switchVisible?(visible: boolean): void;
visible?: boolean;
loading?: boolean;
onOk?(payload?: T): Promise<any> | void;
}
export interface ResponseType {
code: number;
message?: string;
data?: any;
}
// Dialog相关接口定义
export interface IDialogConfig {
title?: string;
content?: React.ReactNode;
type?: 'info' | 'success' | 'warning' | 'error' | 'confirm';
confirmText?: string;
cancelText?: string;
showCancel?: boolean;
maskClosable?: boolean;
width?: number | string;
onConfirm?: () => void | Promise<void>;
onCancel?: () => void;
}
export interface IDialogInstance {
id: string;
config: IDialogConfig;
resolve: (value: boolean) => void;
reject: (reason?: any) => void;
}
export interface IDialogContextValue {
dialogs: IDialogInstance[];
openDialog: (config: IDialogConfig) => Promise<boolean>;
closeDialog: (id: string, result?: boolean) => void;
confirm: (config: Omit<IDialogConfig, 'type'>) => Promise<boolean>;
info: (config: Omit<IDialogConfig, 'type'>) => Promise<boolean>;
success: (config: Omit<IDialogConfig, 'type'>) => Promise<boolean>;
warning: (config: Omit<IDialogConfig, 'type'>) => Promise<boolean>;
error: (config: Omit<IDialogConfig, 'type'>) => Promise<boolean>;
}