mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-27 22:55:59 +00:00
refactor: 大规模代码整理与功能优化
1. 重构后端API路由、CRUD与模块结构,整合日志管理,移除废弃demo代码 2. 优化前端组件类型定义、样式与路由配置,修复权限判断逻辑 3. 调整默认排序规则、滚动条样式与工具类函数,更新依赖与配置文件 4. 修复多处类型不匹配与默认值问题,完善表单与菜单验证逻辑
This commit is contained in:
@@ -113,6 +113,7 @@ export interface AiChatResponse {
|
||||
name: string;
|
||||
arguments: Record<string, any>;
|
||||
}> | null;
|
||||
action: Record<string, any> | null;
|
||||
}
|
||||
|
||||
export interface ChatSessionDetail {
|
||||
|
||||
@@ -83,7 +83,7 @@ export default DemoAPI;
|
||||
|
||||
export interface DemoPageQuery extends PageQuery {
|
||||
name?: string;
|
||||
status?: string;
|
||||
status?: number;
|
||||
created_time?: string[];
|
||||
updated_time?: string[];
|
||||
created_id?: number;
|
||||
@@ -92,33 +92,26 @@ export interface DemoPageQuery extends PageQuery {
|
||||
|
||||
export interface DemoTable extends BaseType {
|
||||
name?: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
created_by?: CommonType;
|
||||
updated_by?: CommonType;
|
||||
deleted_by?: CommonType;
|
||||
a?: number;
|
||||
b?: number;
|
||||
c?: number;
|
||||
d?: boolean;
|
||||
e?: string;
|
||||
f?: string;
|
||||
g?: string;
|
||||
h?: string;
|
||||
i?: Record<string, any>;
|
||||
int_val?: number;
|
||||
bigint_val?: number;
|
||||
float_val?: number;
|
||||
bool_val?: boolean;
|
||||
date_val?: string;
|
||||
time_val?: string;
|
||||
datetime_val?: string;
|
||||
text_val?: string;
|
||||
json_val?: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface DemoForm extends BaseFormType {
|
||||
name?: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
a?: number;
|
||||
b?: number;
|
||||
c?: number;
|
||||
d?: boolean;
|
||||
e?: string;
|
||||
f?: Date | string;
|
||||
g?: Date | string;
|
||||
h?: string;
|
||||
i?: Record<string, any>;
|
||||
int_val?: number;
|
||||
bigint_val?: number;
|
||||
float_val?: number;
|
||||
bool_val?: boolean;
|
||||
date_val?: string;
|
||||
time_val?: Date | string;
|
||||
datetime_val?: Date | string;
|
||||
text_val?: string;
|
||||
json_val?: Record<string, any>;
|
||||
}
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
import { request } from "@utils";
|
||||
|
||||
const API_PATH = "/example/demo01";
|
||||
|
||||
const Demo01API = {
|
||||
getDemo01List(query: Demo01PageQuery) {
|
||||
return request<ApiResponse<PageResult<Demo01Table>>>({
|
||||
url: `${API_PATH}/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
getDemo01Detail(id: number) {
|
||||
return request<ApiResponse<Demo01Table>>({
|
||||
url: `${API_PATH}/detail/${id}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
createDemo01(body: Demo01Form) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/create`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
updateDemo01(id: number, body: Demo01Form) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/update/${id}`,
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
deleteDemo01(body: number[]) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/delete`,
|
||||
method: "delete",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
batchDemo01(body: BatchType) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/available/setting`,
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
exportDemo01(body: Demo01PageQuery) {
|
||||
return request<Blob>({
|
||||
url: `${API_PATH}/export`,
|
||||
method: "post",
|
||||
data: body,
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
|
||||
downloadDemo01Template() {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/download/template`,
|
||||
method: "post",
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
|
||||
importDemo01(body: FormData) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/import`,
|
||||
method: "post",
|
||||
data: body,
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default Demo01API;
|
||||
|
||||
export interface Demo01PageQuery extends PageQuery {
|
||||
/** 与后端 Demo01QueryParam 一致 */
|
||||
name?: string;
|
||||
description?: string;
|
||||
/** 是否启用:0 启用 / 1 禁用(字符串) */
|
||||
status?: string;
|
||||
created_time?: string[];
|
||||
updated_time?: string[];
|
||||
created_id?: number;
|
||||
updated_id?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 与后端 Demo01OutSchema 一致:
|
||||
* Demo01CreateSchema(name,status,description) + BaseSchema + UserBySchema
|
||||
*/
|
||||
export interface Demo01Table extends BaseType {
|
||||
name?: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
created_id?: number;
|
||||
updated_id?: number;
|
||||
created_by?: CommonType;
|
||||
updated_by?: CommonType;
|
||||
deleted_by?: CommonType;
|
||||
}
|
||||
|
||||
/** 与后端 Demo01CreateSchema / Demo01UpdateSchema 一致(不含 id,更新走 URL) */
|
||||
export interface Demo01Form extends BaseFormType {
|
||||
name?: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
}
|
||||
@@ -193,7 +193,8 @@ export interface GenSyncPreviewSchema {
|
||||
table_name: string;
|
||||
added: string[];
|
||||
removed: string[];
|
||||
unchanged: string[];
|
||||
changed: GenSyncColumnChange[];
|
||||
sub_tables?: GenSyncPreviewSchema[];
|
||||
unchanged: number;
|
||||
sub_table_name?: string;
|
||||
sub?: GenSyncPreviewSchema;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
import { request } from "@utils";
|
||||
|
||||
const API_PATH = "/platform/email";
|
||||
|
||||
const EmailAPI = {
|
||||
// ─── SMTP 配置 ────────────────────────────────────────────
|
||||
listConfig(query?: EmailConfigPageQuery) {
|
||||
return request<ApiResponse<PageResult<EmailConfigTable>>>({
|
||||
url: `${API_PATH}/config/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
detailConfig(id: number) {
|
||||
return request<ApiResponse<EmailConfigTable>>({
|
||||
url: `${API_PATH}/config/detail/${id}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
createConfig(body: EmailConfigCreateForm) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/config/create`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
updateConfig(id: number, body: EmailConfigUpdateForm) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/config/update/${id}`,
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
deleteConfig(ids: number[]) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/config/delete`,
|
||||
method: "delete",
|
||||
data: ids,
|
||||
});
|
||||
},
|
||||
|
||||
testConfig(body: EmailTestForm) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/config/test`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
// ─── 邮件模板 ────────────────────────────────────────────
|
||||
listTemplate(query?: EmailTemplatePageQuery) {
|
||||
return request<ApiResponse<PageResult<EmailTemplateTable>>>({
|
||||
url: `${API_PATH}/template/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
detailTemplate(id: number) {
|
||||
return request<ApiResponse<EmailTemplateTable>>({
|
||||
url: `${API_PATH}/template/detail/${id}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
createTemplate(body: EmailTemplateCreateForm) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/template/create`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
updateTemplate(id: number, body: EmailTemplateUpdateForm) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/template/update/${id}`,
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
deleteTemplate(ids: number[]) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/template/delete`,
|
||||
method: "delete",
|
||||
data: ids,
|
||||
});
|
||||
},
|
||||
|
||||
// ─── 手动发送 ────────────────────────────────────────────
|
||||
sendEmail(body: EmailSendForm) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/send`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
// ─── 发送日志 ────────────────────────────────────────────
|
||||
listLog(query?: EmailLogPageQuery) {
|
||||
return request<ApiResponse<PageResult<EmailLogTable>>>({
|
||||
url: `${API_PATH}/log/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default EmailAPI;
|
||||
|
||||
// ─── EmailConfig 类型 ──────────────────────────────────────
|
||||
|
||||
export interface EmailConfigPageQuery extends PageQuery {
|
||||
name?: string;
|
||||
is_default?: boolean;
|
||||
}
|
||||
|
||||
export interface EmailConfigTable extends BaseType {
|
||||
name: string;
|
||||
smtp_host: string;
|
||||
smtp_port: number;
|
||||
smtp_user: string;
|
||||
from_name: string;
|
||||
use_tls: boolean;
|
||||
is_default: boolean;
|
||||
timeout: number;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface EmailConfigCreateForm {
|
||||
name: string;
|
||||
smtp_host: string;
|
||||
smtp_port: number;
|
||||
smtp_user: string;
|
||||
smtp_password: string;
|
||||
from_name?: string;
|
||||
use_tls?: boolean;
|
||||
is_default?: boolean;
|
||||
timeout?: number;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface EmailConfigUpdateForm {
|
||||
name?: string;
|
||||
smtp_host?: string;
|
||||
smtp_port?: number;
|
||||
smtp_user?: string;
|
||||
smtp_password?: string;
|
||||
from_name?: string;
|
||||
use_tls?: boolean;
|
||||
is_default?: boolean;
|
||||
timeout?: number;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface EmailTestForm {
|
||||
config_id: number;
|
||||
to_email: string;
|
||||
}
|
||||
|
||||
// ─── EmailTemplate 类型 ──────────────────────────────────────
|
||||
|
||||
export interface EmailTemplatePageQuery extends PageQuery {
|
||||
name?: string;
|
||||
template_code?: string;
|
||||
}
|
||||
|
||||
export interface EmailTemplateTable extends BaseType {
|
||||
name: string;
|
||||
template_code: string;
|
||||
subject: string;
|
||||
body_html: string;
|
||||
body_text?: string;
|
||||
variables?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface EmailTemplateCreateForm {
|
||||
name: string;
|
||||
template_code: string;
|
||||
subject: string;
|
||||
body_html: string;
|
||||
body_text?: string;
|
||||
variables?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface EmailTemplateUpdateForm {
|
||||
name?: string;
|
||||
template_code?: string;
|
||||
subject?: string;
|
||||
body_html?: string;
|
||||
body_text?: string;
|
||||
variables?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
// ─── EmailLog 类型 ──────────────────────────────────────────
|
||||
|
||||
export interface EmailLogPageQuery extends PageQuery {
|
||||
to_email?: string;
|
||||
biz_type?: string;
|
||||
status?: number;
|
||||
template_code?: string;
|
||||
}
|
||||
|
||||
export interface EmailLogTable {
|
||||
id: number;
|
||||
config_id?: number;
|
||||
template_code?: string;
|
||||
to_email: string;
|
||||
to_name?: string;
|
||||
subject: string;
|
||||
biz_type: string;
|
||||
status: number;
|
||||
error_msg?: string;
|
||||
retry_count: number;
|
||||
tenant_id?: number;
|
||||
created_time?: string;
|
||||
sent_time?: string;
|
||||
}
|
||||
|
||||
export interface EmailSendForm {
|
||||
to_email: string;
|
||||
to_name?: string;
|
||||
template_code: string;
|
||||
variables?: Record<string, unknown>;
|
||||
config_id?: number;
|
||||
biz_type?: string;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
import { request } from "@utils";
|
||||
|
||||
const PLATFORM_API = "/platform/invoice";
|
||||
const TENANT_API = "/platform/tenant/invoice";
|
||||
|
||||
const InvoiceAPI = {
|
||||
// ─── 平台端 ───
|
||||
listInvoices(query?: InvoicePageQuery) {
|
||||
return request<ApiResponse<{ list: InvoiceTable[]; total: number }>>({
|
||||
url: `${PLATFORM_API}/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
issueInvoice(invoiceId: number, body: { pdf_url?: string; api_response?: string }) {
|
||||
return request<ApiResponse>({
|
||||
url: `${PLATFORM_API}/issue/${invoiceId}`,
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
voidInvoice(invoiceId: number, reason?: string) {
|
||||
return request<ApiResponse>({
|
||||
url: `${PLATFORM_API}/void/${invoiceId}`,
|
||||
method: "put",
|
||||
data: { description: reason },
|
||||
});
|
||||
},
|
||||
|
||||
// ─── 租户端 ───
|
||||
tenantListInvoices(query?: InvoicePageQuery) {
|
||||
return request<ApiResponse<{ list: InvoiceTable[]; total: number }>>({
|
||||
url: `${TENANT_API}/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
applyInvoice(body: InvoiceApplyForm) {
|
||||
return request<ApiResponse>({
|
||||
url: `${TENANT_API}/apply`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
downloadInvoice(invoiceId: number) {
|
||||
return request<Blob>({
|
||||
url: `${TENANT_API}/${invoiceId}/download`,
|
||||
method: "get",
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default InvoiceAPI;
|
||||
|
||||
export interface InvoicePageQuery extends PageQuery {
|
||||
tenant_id?: number;
|
||||
invoice_type?: string;
|
||||
}
|
||||
|
||||
export interface InvoiceTable {
|
||||
id: number;
|
||||
tenant_id: number;
|
||||
order_id: number;
|
||||
invoice_no: string;
|
||||
invoice_type: string;
|
||||
title: string;
|
||||
tax_no?: string;
|
||||
amount: number;
|
||||
tax_amount: number;
|
||||
status: number;
|
||||
bank_info?: string;
|
||||
address_info?: string;
|
||||
pdf_url?: string;
|
||||
created_time?: string;
|
||||
}
|
||||
|
||||
export interface InvoiceApplyForm {
|
||||
order_id: number;
|
||||
invoice_type: string;
|
||||
title: string;
|
||||
tax_no?: string;
|
||||
address_info?: string;
|
||||
bank_info?: string;
|
||||
description?: string;
|
||||
}
|
||||
+16
-5
@@ -1,6 +1,6 @@
|
||||
import { request } from "@utils";
|
||||
|
||||
const API_PATH = "/system/menu";
|
||||
const API_PATH = "/platform/menu";
|
||||
|
||||
const MenuAPI = {
|
||||
listMenu(query?: MenuPageQuery) {
|
||||
@@ -44,7 +44,7 @@ const MenuAPI = {
|
||||
|
||||
batchMenu(body: BatchType) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/available/setting`,
|
||||
url: `${API_PATH}/status/batch`,
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
@@ -80,17 +80,21 @@ export interface MenuTable extends BaseType {
|
||||
title?: string;
|
||||
params?: { key: string; value: string }[];
|
||||
affix?: boolean;
|
||||
status?: string;
|
||||
description?: string;
|
||||
children?: MenuTable[];
|
||||
client?: "pc" | "app";
|
||||
link?: string;
|
||||
is_iframe?: boolean;
|
||||
is_hide_tab?: boolean;
|
||||
active_path?: string;
|
||||
show_badge?: boolean;
|
||||
show_text_badge?: string;
|
||||
scope?: "platform" | "tenant";
|
||||
}
|
||||
|
||||
export interface MenuForm extends BaseFormType {
|
||||
name?: string;
|
||||
type?: number;
|
||||
icon?: string;
|
||||
order?: number;
|
||||
permission?: string;
|
||||
route_name?: string;
|
||||
route_path?: string;
|
||||
@@ -104,6 +108,13 @@ export interface MenuForm extends BaseFormType {
|
||||
params?: KeyValue[];
|
||||
affix?: boolean;
|
||||
client?: "pc" | "app";
|
||||
link?: string;
|
||||
is_iframe?: boolean;
|
||||
is_hide_tab?: boolean;
|
||||
active_path?: string;
|
||||
show_badge?: boolean;
|
||||
show_text_badge?: string;
|
||||
scope?: "platform" | "tenant";
|
||||
}
|
||||
|
||||
export interface KeyValue {
|
||||
@@ -0,0 +1,187 @@
|
||||
import { request } from "@utils";
|
||||
|
||||
// ─── 平台订单 ──────────────────────────────────────────
|
||||
const ORDER_API = "/platform/order";
|
||||
const PAYMENT_API = "/platform/payment";
|
||||
const REFUND_API = "/platform/refund";
|
||||
const TENANT_ORDER_API = "/tenant/order";
|
||||
|
||||
const OrderAPI = {
|
||||
// ─── 订单管理 ───
|
||||
listOrders(query?: OrderPageQuery) {
|
||||
return request<ApiResponse<{ items: OrderTable[]; total: number }>>({
|
||||
url: `${ORDER_API}/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
detailOrder(orderId: number) {
|
||||
return request<ApiResponse<OrderTable>>({
|
||||
url: `${ORDER_API}/detail/${orderId}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
createOrder(body: OrderCreateForm) {
|
||||
return request<ApiResponse<{ id: number; order_no: string }>>({
|
||||
url: `${ORDER_API}/create`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
cancelOrder(orderId: number) {
|
||||
return request<ApiResponse<{ message: string }>>({
|
||||
url: `${ORDER_API}/cancel/${orderId}`,
|
||||
method: "post",
|
||||
});
|
||||
},
|
||||
|
||||
// ─── 支付操作 ───
|
||||
payOrder(orderId: number, body?: { pay_method?: string }) {
|
||||
return request<ApiResponse<{ pay_url?: string; qr_code?: string }>>({
|
||||
url: `${PAYMENT_API}/pay/${orderId}`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
queryPaymentStatus(orderId: number) {
|
||||
return request<ApiResponse<{ status: number; message?: string }>>({
|
||||
url: `${PAYMENT_API}/status/${orderId}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
mockPaymentCallback(orderId: number) {
|
||||
return request<ApiResponse>({
|
||||
url: `${PAYMENT_API}/mock/callback`,
|
||||
method: "post",
|
||||
data: { order_id: orderId },
|
||||
});
|
||||
},
|
||||
|
||||
// ─── 支付记录 ───
|
||||
listPaymentRecords(query?: PageQuery) {
|
||||
return request<ApiResponse<{ items: PaymentRecordTable[]; total: number }>>({
|
||||
url: `${PAYMENT_API}/record/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
// ─── 退款管理 ───
|
||||
listRefunds(query?: RefundPageQuery) {
|
||||
return request<ApiResponse<{ items: RefundTable[]; total: number }>>({
|
||||
url: `${REFUND_API}/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
approveRefund(refundId: number) {
|
||||
return request<ApiResponse<{ message: string }>>({
|
||||
url: `${REFUND_API}/approve/${refundId}`,
|
||||
method: "put",
|
||||
});
|
||||
},
|
||||
|
||||
rejectRefund(refundId: number, body: { reject_reason?: string }) {
|
||||
return request<ApiResponse<{ message: string }>>({
|
||||
url: `${REFUND_API}/reject/${refundId}`,
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
// ─── 租户端 ───
|
||||
tenantCreateOrder(body: {
|
||||
tenant_id: number;
|
||||
package_id?: number;
|
||||
plugin_id?: number;
|
||||
order_type: string;
|
||||
pay_method?: string;
|
||||
}) {
|
||||
return request<ApiResponse<{ id: number; order_no: string }>>({
|
||||
url: `${TENANT_ORDER_API}/create`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
tenantApplyRefund(orderId: number, body: { reason: string }) {
|
||||
return request<ApiResponse<{ id: number }>>({
|
||||
url: `${TENANT_ORDER_API}/refund/apply/${orderId}`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default OrderAPI;
|
||||
|
||||
// ─── Order 类型 ──────────────────────────────────────────
|
||||
|
||||
export interface OrderPageQuery extends PageQuery {
|
||||
tenant_id?: number;
|
||||
status?: number;
|
||||
order_type?: string;
|
||||
}
|
||||
|
||||
export interface OrderTable {
|
||||
id: number;
|
||||
order_no: string;
|
||||
tenant_id: number;
|
||||
package_id?: number;
|
||||
plugin_id?: number;
|
||||
order_type: string;
|
||||
amount: number;
|
||||
period_count: number;
|
||||
status: number;
|
||||
pay_method?: string;
|
||||
pay_time?: string;
|
||||
expire_time: string;
|
||||
created_time?: string;
|
||||
}
|
||||
|
||||
export interface OrderCreateForm {
|
||||
tenant_id: number;
|
||||
package_id?: number;
|
||||
plugin_id?: number;
|
||||
order_type: "new" | "renew" | "upgrade" | "downgrade" | "plugin";
|
||||
pay_method?: string;
|
||||
}
|
||||
|
||||
// ─── Payment 类型 ────────────────────────────────────────
|
||||
|
||||
export interface PaymentRecordTable {
|
||||
id: number;
|
||||
order_id: number;
|
||||
transaction_id?: string;
|
||||
pay_method: string;
|
||||
amount: number;
|
||||
status: number;
|
||||
pay_time?: string;
|
||||
created_time?: string;
|
||||
}
|
||||
|
||||
// ─── Refund 类型 ─────────────────────────────────────────
|
||||
|
||||
export interface RefundPageQuery extends PageQuery {
|
||||
status?: number;
|
||||
}
|
||||
|
||||
export interface RefundTable {
|
||||
id: number;
|
||||
order_id: number;
|
||||
refund_no: string;
|
||||
amount: number;
|
||||
reason: string;
|
||||
status: number;
|
||||
refund_transaction_id?: string;
|
||||
reviewer_id?: number;
|
||||
review_time?: string;
|
||||
reject_reason?: string;
|
||||
created_time?: string;
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
import { request } from "@utils";
|
||||
|
||||
const API_PATH = "/platform/package";
|
||||
|
||||
const PackageAPI = {
|
||||
listPackage(query?: PackagePageQuery) {
|
||||
return request<ApiResponse<PageResult<PackageTable>>>({
|
||||
url: `${API_PATH}/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
detailPackage(id: number) {
|
||||
return request<ApiResponse<PackageTable>>({
|
||||
url: `${API_PATH}/detail/${id}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
createPackage(body: PackageCreateForm) {
|
||||
return request<ApiResponse<PackageTable>>({
|
||||
url: `${API_PATH}/create`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
updatePackage(id: number, body: PackageUpdateForm) {
|
||||
return request<ApiResponse<PackageTable>>({
|
||||
url: `${API_PATH}/update/${id}`,
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
deletePackage(body: number[]) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/delete`,
|
||||
method: "delete",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
batchPackageStatus(body: { ids: number[]; status: number }) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/status/batch`,
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
getPackageMenus(packageId: number) {
|
||||
return request<ApiResponse<number[]>>({
|
||||
url: `${API_PATH}/menus/${packageId}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
setPackageMenus(packageId: number, menuIds: number[]) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/menus/${packageId}/set`,
|
||||
method: "post",
|
||||
data: { menu_ids: menuIds },
|
||||
});
|
||||
},
|
||||
|
||||
getPackagePlugins(packageId: number) {
|
||||
return request<ApiResponse<number[]>>({
|
||||
url: `${API_PATH}/plugins/${packageId}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
setPackagePlugins(packageId: number, pluginIds: number[]) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/plugins/${packageId}/set`,
|
||||
method: "post",
|
||||
data: { plugin_ids: pluginIds },
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default PackageAPI;
|
||||
|
||||
export interface PackagePageQuery extends PageQuery {
|
||||
name?: string;
|
||||
code?: string;
|
||||
}
|
||||
|
||||
export interface PackageTable extends BaseType {
|
||||
name: string;
|
||||
code: string;
|
||||
sort: number;
|
||||
price: number;
|
||||
period: string;
|
||||
trial_days: number;
|
||||
max_users: number;
|
||||
max_roles: number;
|
||||
max_depts: number;
|
||||
max_storage_mb: number;
|
||||
rate_limit: number;
|
||||
}
|
||||
|
||||
export interface PackageForm extends BaseFormType {
|
||||
name?: string;
|
||||
code?: string;
|
||||
sort?: number;
|
||||
price?: number;
|
||||
period?: string;
|
||||
trial_days?: number;
|
||||
max_users?: number;
|
||||
max_roles?: number;
|
||||
max_depts?: number;
|
||||
max_storage_mb?: number;
|
||||
rate_limit?: number;
|
||||
}
|
||||
|
||||
export interface PackageCreateForm {
|
||||
name: string;
|
||||
code: string;
|
||||
status?: number;
|
||||
sort?: number;
|
||||
description?: string;
|
||||
price?: number;
|
||||
period?: string;
|
||||
trial_days?: number;
|
||||
max_users?: number;
|
||||
max_roles?: number;
|
||||
max_depts?: number;
|
||||
max_storage_mb?: number;
|
||||
rate_limit?: number;
|
||||
}
|
||||
|
||||
export interface PackageUpdateForm {
|
||||
name?: string;
|
||||
code?: string;
|
||||
status?: number;
|
||||
sort?: number;
|
||||
description?: string;
|
||||
price?: number;
|
||||
period?: string;
|
||||
trial_days?: number;
|
||||
max_users?: number;
|
||||
max_roles?: number;
|
||||
max_depts?: number;
|
||||
max_storage_mb?: number;
|
||||
rate_limit?: number;
|
||||
}
|
||||
+14
-6
@@ -1,6 +1,6 @@
|
||||
import { request } from "@utils";
|
||||
|
||||
const API_PATH = "/system/plugin";
|
||||
const API_PATH = "/platform/plugin";
|
||||
|
||||
const PluginAPI = {
|
||||
// 超管:插件列表
|
||||
@@ -90,6 +90,14 @@ const PluginAPI = {
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
// 超管:热重载插件路由
|
||||
reload() {
|
||||
return request<ApiResponse<string>>({
|
||||
url: `${API_PATH}/reload`,
|
||||
method: "post",
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default PluginAPI;
|
||||
@@ -106,11 +114,13 @@ export interface PluginTable extends BaseType {
|
||||
category?: string;
|
||||
icon?: string;
|
||||
version?: string;
|
||||
description?: string;
|
||||
price?: number;
|
||||
status?: string;
|
||||
installed?: boolean;
|
||||
install_time?: string;
|
||||
author?: string;
|
||||
menu_path?: string;
|
||||
permission_prefix?: string;
|
||||
dependencies?: string;
|
||||
sort?: number;
|
||||
}
|
||||
|
||||
export interface PluginForm extends BaseFormType {
|
||||
@@ -119,9 +129,7 @@ export interface PluginForm extends BaseFormType {
|
||||
category?: string;
|
||||
icon?: string;
|
||||
version?: string;
|
||||
description?: string;
|
||||
price?: number;
|
||||
status?: string;
|
||||
sort?: number;
|
||||
author?: string;
|
||||
menu_path?: string;
|
||||
@@ -0,0 +1,152 @@
|
||||
import { request } from "@utils";
|
||||
|
||||
const API_PATH = "/platform/tenant";
|
||||
|
||||
const SelfServiceAPI = {
|
||||
/** 可选购的套餐列表 */
|
||||
getAvailablePackages() {
|
||||
return request<ApiResponse<AvailablePackage[]>>({
|
||||
url: `${API_PATH}/package/available`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
/** 套餐变更预览 */
|
||||
previewPackageChange(packageId: number) {
|
||||
return request<ApiResponse<PackageChangePreview>>({
|
||||
url: `${API_PATH}/package/preview`,
|
||||
method: "get",
|
||||
params: { target_package_id: packageId },
|
||||
});
|
||||
},
|
||||
|
||||
/** 创建自助订单 */
|
||||
createOrder(body: SelfServiceOrderForm) {
|
||||
return request<ApiResponse<{ id: number; order_no: string }>>({
|
||||
url: `${API_PATH}/order/create`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
/** 我的订单列表 */
|
||||
listMyOrders(query?: PageQuery) {
|
||||
return request<ApiResponse<PageResult<SelfServiceOrderItem>>>({
|
||||
url: `${API_PATH}/order/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
/** 订单详情 */
|
||||
detailMyOrder(orderId: number) {
|
||||
return request<ApiResponse<SelfServiceOrderItem>>({
|
||||
url: `${API_PATH}/order/detail/${orderId}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
/** 租户工作台概览 */
|
||||
getWorkspace() {
|
||||
return request<ApiResponse<WorkspaceData>>({
|
||||
url: `${API_PATH}/workspace`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
/** 购买付费插件 */
|
||||
purchasePlugin(body: { plugin_id: number; pay_method?: string }) {
|
||||
return request<ApiResponse<{ id: number; order_no: string }>>({
|
||||
url: `${API_PATH}/plugin/purchase`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default SelfServiceAPI;
|
||||
|
||||
export interface AvailablePackage {
|
||||
id: number;
|
||||
name: string;
|
||||
price: number;
|
||||
period: string;
|
||||
trial_days: number;
|
||||
max_users: number;
|
||||
max_roles: number;
|
||||
max_depts: number;
|
||||
max_storage_mb: number;
|
||||
description: string | null;
|
||||
is_current: boolean;
|
||||
available_actions: string[];
|
||||
}
|
||||
|
||||
export interface PackageChangePreview {
|
||||
current_package: string;
|
||||
target_package: string;
|
||||
action: string;
|
||||
amount: number;
|
||||
period: string;
|
||||
gained_menus: { id: number; name: string; path: string }[];
|
||||
lost_menus: { id: number; name: string; path: string }[];
|
||||
affected_roles: string[];
|
||||
affected_users: number;
|
||||
}
|
||||
|
||||
export interface SelfServiceOrderForm {
|
||||
package_id: number;
|
||||
order_type: "buy" | "renew" | "upgrade" | "downgrade";
|
||||
pay_method?: string;
|
||||
}
|
||||
|
||||
export interface SelfServiceOrderItem {
|
||||
id: number;
|
||||
order_no: string;
|
||||
package_name: string;
|
||||
order_type: string;
|
||||
amount: number;
|
||||
status: number;
|
||||
pay_method?: string;
|
||||
pay_time?: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface WorkspaceData {
|
||||
tenant: {
|
||||
id: number;
|
||||
name: string;
|
||||
code: string;
|
||||
status: string;
|
||||
status_label: string;
|
||||
start_time: string | null;
|
||||
end_time: string | null;
|
||||
days_remaining: number;
|
||||
};
|
||||
package: {
|
||||
id: number;
|
||||
name: string;
|
||||
price: number;
|
||||
period: string;
|
||||
} | null;
|
||||
quota: {
|
||||
max_users: number;
|
||||
max_roles: number;
|
||||
max_depts: number;
|
||||
current_users: number;
|
||||
current_roles: number;
|
||||
current_depts: number;
|
||||
usage_percent: {
|
||||
users: number;
|
||||
roles: number;
|
||||
depts: number;
|
||||
};
|
||||
};
|
||||
recent_orders: {
|
||||
id: number;
|
||||
order_no: string;
|
||||
amount: number;
|
||||
order_type: string;
|
||||
status: number;
|
||||
created_at: string | null;
|
||||
}[];
|
||||
}
|
||||
+81
-70
@@ -1,6 +1,6 @@
|
||||
import { request, NO_AUTH_FLAG } from "@utils";
|
||||
|
||||
const API_PATH = "/system/tenant";
|
||||
const API_PATH = "/platform/tenant";
|
||||
|
||||
const TenantAPI = {
|
||||
listTenant(query?: TenantPageQuery) {
|
||||
@@ -42,14 +42,16 @@ const TenantAPI = {
|
||||
});
|
||||
},
|
||||
|
||||
batchTenant(body: BatchType) {
|
||||
/** 批量修改租户状态 */
|
||||
batchTenantStatus(body: BatchType) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/available/setting`,
|
||||
url: `${API_PATH}/status/batch`,
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
/** 切换单个租户启用/禁用状态 */
|
||||
toggleTenantStatus(id: number) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/status/${id}`,
|
||||
@@ -57,6 +59,24 @@ const TenantAPI = {
|
||||
});
|
||||
},
|
||||
|
||||
/** 租户续期 */
|
||||
renewTenant(id: number, body: { end_time: string }) {
|
||||
return request<ApiResponse<TenantTable>>({
|
||||
url: `${API_PATH}/renew/${id}`,
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
/** 套餐变更影响预览 */
|
||||
getPackageChangePreview(tenantId: number, newPackageId: number) {
|
||||
return request<ApiResponse<PackageChangePreview>>({
|
||||
url: `${API_PATH}/${tenantId}/package-change-preview`,
|
||||
method: "get",
|
||||
params: { new_package_id: newPackageId },
|
||||
});
|
||||
},
|
||||
|
||||
getTenantUsers(tenantId: number) {
|
||||
return request<ApiResponse<TenantUser[]>>({
|
||||
url: `${API_PATH}/${tenantId}/users`,
|
||||
@@ -79,21 +99,6 @@ const TenantAPI = {
|
||||
});
|
||||
},
|
||||
|
||||
// P1: 配额管理
|
||||
getTenantQuota(tenantId: number) {
|
||||
return request<ApiResponse<TenantQuota>>({
|
||||
url: `${API_PATH}/${tenantId}/quota`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
updateTenantQuota(tenantId: number, body: TenantQuotaUpdate) {
|
||||
return request<ApiResponse<TenantQuota>>({
|
||||
url: `${API_PATH}/${tenantId}/quota`,
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
/** 公开接口:无需登录即可获取租户配置(用于登录页等场景) */
|
||||
getTenantConfigInfo(tenantId: number) {
|
||||
return request<ApiResponse<TenantConfigItem[]>>({
|
||||
@@ -105,13 +110,15 @@ const TenantAPI = {
|
||||
});
|
||||
},
|
||||
|
||||
// P1: 个性化配置
|
||||
/** 获取租户个性化配置 */
|
||||
getTenantConfig(tenantId: number) {
|
||||
return request<ApiResponse<TenantConfigItem[]>>({
|
||||
url: `${API_PATH}/${tenantId}/config`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
/** 批量更新租户个性化配置 */
|
||||
updateTenantConfig(tenantId: number, body: TenantConfigItem[]) {
|
||||
return request<ApiResponse<TenantConfigItem[]>>({
|
||||
url: `${API_PATH}/${tenantId}/config`,
|
||||
@@ -119,21 +126,6 @@ const TenantAPI = {
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
// P1: 菜单权限
|
||||
getTenantMenus(tenantId: number) {
|
||||
return request<ApiResponse<number[]>>({
|
||||
url: `${API_PATH}/${tenantId}/menus`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
setTenantMenus(tenantId: number, menuIds: number[]) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/${tenantId}/menus`,
|
||||
method: "put",
|
||||
data: { menu_ids: menuIds },
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default TenantAPI;
|
||||
@@ -141,15 +133,13 @@ export default TenantAPI;
|
||||
export interface TenantPageQuery extends PageQuery {
|
||||
name?: string;
|
||||
code?: string;
|
||||
status?: string;
|
||||
created_time?: string[];
|
||||
}
|
||||
|
||||
export interface TenantTable extends BaseType {
|
||||
name: string;
|
||||
code: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
package_id?: number;
|
||||
start_time?: string;
|
||||
end_time?: string;
|
||||
contact_name?: string;
|
||||
@@ -159,14 +149,22 @@ export interface TenantTable extends BaseType {
|
||||
domain?: string;
|
||||
logo_url?: string;
|
||||
sort?: number;
|
||||
version?: string;
|
||||
favicon?: string;
|
||||
login_bg?: string;
|
||||
copyright?: string;
|
||||
keep_record?: string;
|
||||
help_doc?: string;
|
||||
privacy?: string;
|
||||
clause?: string;
|
||||
git_code?: string;
|
||||
}
|
||||
|
||||
export interface TenantForm {
|
||||
id?: number;
|
||||
export interface TenantForm extends BaseFormType {
|
||||
name?: string;
|
||||
code?: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
package_id?: number;
|
||||
start_time?: string;
|
||||
end_time?: string;
|
||||
contact_name?: string;
|
||||
@@ -176,13 +174,21 @@ export interface TenantForm {
|
||||
domain?: string;
|
||||
logo_url?: string;
|
||||
sort?: number;
|
||||
version?: string;
|
||||
favicon?: string;
|
||||
login_bg?: string;
|
||||
copyright?: string;
|
||||
keep_record?: string;
|
||||
help_doc?: string;
|
||||
privacy?: string;
|
||||
clause?: string;
|
||||
git_code?: string;
|
||||
}
|
||||
|
||||
export interface TenantCreateForm {
|
||||
export interface TenantCreateForm extends BaseFormType {
|
||||
name: string;
|
||||
code: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
package_id?: number;
|
||||
start_time?: string;
|
||||
end_time?: string;
|
||||
contact_name?: string;
|
||||
@@ -192,12 +198,21 @@ export interface TenantCreateForm {
|
||||
domain?: string;
|
||||
logo_url?: string;
|
||||
sort?: number;
|
||||
version?: string;
|
||||
favicon?: string;
|
||||
login_bg?: string;
|
||||
copyright?: string;
|
||||
keep_record?: string;
|
||||
help_doc?: string;
|
||||
privacy?: string;
|
||||
clause?: string;
|
||||
git_code?: string;
|
||||
}
|
||||
|
||||
export interface TenantUpdateForm {
|
||||
export interface TenantUpdateForm extends BaseFormType {
|
||||
name?: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
code?: string;
|
||||
package_id?: number;
|
||||
start_time?: string;
|
||||
end_time?: string;
|
||||
contact_name?: string;
|
||||
@@ -207,11 +222,26 @@ export interface TenantUpdateForm {
|
||||
domain?: string;
|
||||
logo_url?: string;
|
||||
sort?: number;
|
||||
version?: string;
|
||||
favicon?: string;
|
||||
login_bg?: string;
|
||||
copyright?: string;
|
||||
keep_record?: string;
|
||||
help_doc?: string;
|
||||
privacy?: string;
|
||||
clause?: string;
|
||||
git_code?: string;
|
||||
}
|
||||
|
||||
export interface BatchType {
|
||||
ids: number[];
|
||||
status: string;
|
||||
/** 套餐变更影响预览 */
|
||||
export interface PackageChangePreview {
|
||||
new_package_id: number;
|
||||
new_package_name: string;
|
||||
affected_roles: Record<string, unknown>[];
|
||||
removed_menus: Record<string, unknown>[];
|
||||
added_menus: Record<string, unknown>[];
|
||||
quota_changes: Record<string, unknown>;
|
||||
total_affected_users: number;
|
||||
}
|
||||
|
||||
export interface TenantUser {
|
||||
@@ -231,27 +261,8 @@ export interface TenantUserAddForm {
|
||||
is_default: number;
|
||||
}
|
||||
|
||||
// P1 types
|
||||
export interface TenantQuota {
|
||||
id: number;
|
||||
tenant_id: number;
|
||||
max_users: number;
|
||||
max_roles: number;
|
||||
max_storage_mb: number;
|
||||
max_depts: number;
|
||||
}
|
||||
|
||||
export interface TenantQuotaUpdate {
|
||||
max_users?: number;
|
||||
max_roles?: number;
|
||||
max_storage_mb?: number;
|
||||
max_depts?: number;
|
||||
}
|
||||
|
||||
/** 租户配置项 */
|
||||
export interface TenantConfigItem {
|
||||
id?: number;
|
||||
tenant_id?: number;
|
||||
config_key: string;
|
||||
config_value: string;
|
||||
config_type: string;
|
||||
config_value: string | null;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import { request } from "@utils";
|
||||
|
||||
const API_PATH = "/system/auth";
|
||||
|
||||
/** 第三方 OAuth 登录渠道(与后端 `/system/auth/oauth/{provider}` 一致) */
|
||||
/** 方案提供方 */
|
||||
export type OAuthProvider = "wechat" | "qq" | "github" | "gitee";
|
||||
|
||||
const AuthAPI = {
|
||||
@@ -87,33 +87,79 @@ const AuthAPI = {
|
||||
data: { tenant_id: tenantId },
|
||||
});
|
||||
},
|
||||
/** 租户自助注册(PRD §4.5) */
|
||||
tenantRegister(body: TenantRegisterForm) {
|
||||
return request<ApiResponse<TenantRegisterResult>>({
|
||||
url: `${API_PATH}/tenant/register`,
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default AuthAPI;
|
||||
|
||||
/** 登录表单数据 */
|
||||
export interface TenantRegisterForm {
|
||||
username: string;
|
||||
password: string;
|
||||
email: string;
|
||||
tenant_name?: string;
|
||||
}
|
||||
|
||||
export interface TenantRegisterResult {
|
||||
user_id: number;
|
||||
username: string;
|
||||
tenant_id: number;
|
||||
tenant_name: string;
|
||||
tenant_code: string;
|
||||
package: string | null;
|
||||
trial_end: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
// ─── Auth 类型定义 ───
|
||||
|
||||
/** 登录表单 */
|
||||
export interface LoginFormData {
|
||||
username: string;
|
||||
password: string;
|
||||
captcha_key: string;
|
||||
captcha: string;
|
||||
remember: boolean;
|
||||
login_type: string;
|
||||
captcha?: string;
|
||||
captcha_key?: string;
|
||||
remember?: boolean;
|
||||
login_type?: string;
|
||||
}
|
||||
|
||||
// 刷新令牌
|
||||
export interface RefreshToekenBody {
|
||||
refresh_token: string;
|
||||
}
|
||||
|
||||
/** 登录响应 */
|
||||
/** 登录成功返回 (JWTOutSchema) */
|
||||
export interface LoginResult {
|
||||
access_token: string;
|
||||
refresh_token: string;
|
||||
token_type: string;
|
||||
expires_in: number;
|
||||
tenants?: TenantOption[];
|
||||
user_info?: UserInfoBrief;
|
||||
}
|
||||
|
||||
/** 刷新 Token 请求体 */
|
||||
export interface RefreshToekenBody {
|
||||
refresh_token: string;
|
||||
}
|
||||
|
||||
/** 退出登录请求体 */
|
||||
export interface LogoutBody {
|
||||
token: string;
|
||||
}
|
||||
|
||||
/** 免登录用户 (AutoLoginUserSchema) */
|
||||
export interface AutoLoginUser {
|
||||
id: number;
|
||||
username: string;
|
||||
name: string;
|
||||
avatar?: string | null;
|
||||
}
|
||||
|
||||
/** 免登录 Token (AutoLoginTokenSchema) */
|
||||
export interface AutoLoginToken {
|
||||
token: string;
|
||||
user: AutoLoginUser;
|
||||
}
|
||||
|
||||
/** 租户选项 */
|
||||
@@ -123,16 +169,7 @@ export interface TenantOption {
|
||||
code: string;
|
||||
}
|
||||
|
||||
/** 用户简要信息 */
|
||||
export interface UserInfoBrief {
|
||||
id: number;
|
||||
username: string;
|
||||
name: string;
|
||||
avatar?: string;
|
||||
is_super_admin?: boolean;
|
||||
}
|
||||
|
||||
/** 选择租户响应 */
|
||||
/** 选择租户返回 (SelectTenantOutSchema) */
|
||||
export interface SelectTenantResult {
|
||||
access_token: string;
|
||||
token_type: string;
|
||||
@@ -145,22 +182,3 @@ export interface CaptchaInfo {
|
||||
key: string;
|
||||
img_base: string;
|
||||
}
|
||||
|
||||
/** 退出登录操作 */
|
||||
export interface LogoutBody {
|
||||
token: string;
|
||||
}
|
||||
|
||||
/** 免登录用户信息 */
|
||||
export interface AutoLoginUser {
|
||||
id: number;
|
||||
username: string;
|
||||
name: string;
|
||||
avatar: string | null;
|
||||
}
|
||||
|
||||
/** 免登录Token响应 */
|
||||
export interface AutoLoginToken {
|
||||
token: string;
|
||||
user: AutoLoginUser;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ const DeptAPI = {
|
||||
|
||||
batchDept(body: BatchType) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/available/setting`,
|
||||
url: `${API_PATH}/status/batch`,
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
@@ -68,19 +68,14 @@ export interface DeptTable extends BaseType {
|
||||
email?: string;
|
||||
parent_id?: number;
|
||||
parent_name?: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
children?: DeptTable[];
|
||||
}
|
||||
|
||||
export interface DeptForm extends BaseFormType {
|
||||
name?: string;
|
||||
order?: number;
|
||||
code: string;
|
||||
leader?: string;
|
||||
phone?: string;
|
||||
email?: string;
|
||||
parent_id?: number;
|
||||
status?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ const DictAPI = {
|
||||
|
||||
batchDictType(body: BatchType) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/type/available/setting`,
|
||||
url: `${API_PATH}/type/status/batch`,
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
@@ -107,7 +107,7 @@ const DictAPI = {
|
||||
|
||||
batchDictData(body: BatchType) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/data/available/setting`,
|
||||
url: `${API_PATH}/data/status/batch`,
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
@@ -135,25 +135,17 @@ export default DictAPI;
|
||||
export interface DictPageQuery extends PageQuery {
|
||||
dict_name?: string;
|
||||
dict_type?: string;
|
||||
status?: string;
|
||||
created_time?: string[];
|
||||
updated_time?: string[];
|
||||
}
|
||||
|
||||
export interface DictDataPageQuery extends PageQuery {
|
||||
dict_label?: string;
|
||||
dict_type?: string;
|
||||
dict_type_id?: number;
|
||||
status?: string;
|
||||
created_time?: string[];
|
||||
updated_time?: string[];
|
||||
}
|
||||
|
||||
export interface DictTable extends BaseType {
|
||||
dict_name?: string;
|
||||
dict_type?: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface DictForm extends BaseFormType {
|
||||
@@ -170,7 +162,6 @@ export interface DictDataTable extends BaseType {
|
||||
css_class?: string;
|
||||
list_class?: string;
|
||||
is_default?: boolean;
|
||||
status?: string;
|
||||
}
|
||||
|
||||
export interface DictDataForm extends BaseFormType {
|
||||
|
||||
@@ -1,68 +1,94 @@
|
||||
import { request } from "@utils";
|
||||
|
||||
const API_PATH = "/system/log";
|
||||
// ==================== 操作日志 ====================
|
||||
|
||||
const LogAPI = {
|
||||
listLog(query: LogPageQuery) {
|
||||
return request<ApiResponse<PageResult<LogTable>>>({
|
||||
url: `${API_PATH}/list`,
|
||||
const OP_API = "/system/log/operation";
|
||||
|
||||
const OperationLogAPI = {
|
||||
list(query?: OperationLogPageQuery) {
|
||||
return request<ApiResponse<PageResult<OperationLogTable>>>({
|
||||
url: `${OP_API}/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
detailLog(query: number) {
|
||||
return request<ApiResponse<LogTable>>({
|
||||
url: `${API_PATH}/detail/${query}`,
|
||||
detail(id: number) {
|
||||
return request<ApiResponse<OperationLogTable>>({
|
||||
url: `${OP_API}/detail/${id}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
deleteLog(body: number[]) {
|
||||
delete(body: number[]) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/delete`,
|
||||
url: `${OP_API}/delete`,
|
||||
method: "delete",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
exportLog(body: LogPageQuery) {
|
||||
return request<Blob>({
|
||||
url: `${API_PATH}/export`,
|
||||
method: "post",
|
||||
export default OperationLogAPI;
|
||||
|
||||
export interface OperationLogPageQuery extends PageQuery {
|
||||
request_path?: string;
|
||||
creator_name?: string;
|
||||
created_time?: string[];
|
||||
}
|
||||
|
||||
export interface OperationLogTable {
|
||||
id: number;
|
||||
tenant_id: number;
|
||||
request_path?: string;
|
||||
request_method?: string;
|
||||
response_code?: number;
|
||||
process_time?: string;
|
||||
created_time?: string;
|
||||
}
|
||||
|
||||
// ==================== 登录日志 ====================
|
||||
|
||||
const LOGIN_API = "/system/log/login";
|
||||
|
||||
export const LoginLogAPI = {
|
||||
list(query?: LoginLogPageQuery) {
|
||||
return request<ApiResponse<PageResult<LoginLogTable>>>({
|
||||
url: `${LOGIN_API}/list`,
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
detail(id: number) {
|
||||
return request<ApiResponse<LoginLogTable>>({
|
||||
url: `${LOGIN_API}/detail/${id}`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
delete(body: number[]) {
|
||||
return request<ApiResponse>({
|
||||
url: `${LOGIN_API}/delete`,
|
||||
method: "delete",
|
||||
data: body,
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default LogAPI;
|
||||
|
||||
export interface LogPageQuery extends PageQuery {
|
||||
type?: number;
|
||||
request_path?: string;
|
||||
creator_name?: string;
|
||||
created_time?: string[];
|
||||
updated_time?: string[];
|
||||
created_id?: number;
|
||||
updated_id?: number;
|
||||
export interface LoginLogPageQuery extends PageQuery {
|
||||
status?: number;
|
||||
username?: string;
|
||||
}
|
||||
|
||||
export interface LogTable extends BaseType {
|
||||
type?: number; // 1 登录日志 2 操作日志
|
||||
request_path?: string;
|
||||
request_method?: string;
|
||||
request_ip?: string;
|
||||
export interface LoginLogTable {
|
||||
id: number;
|
||||
username: string;
|
||||
status: number;
|
||||
login_ip?: string;
|
||||
login_location?: string;
|
||||
request_browser?: string;
|
||||
request_os?: string;
|
||||
response_code?: number;
|
||||
request_payload?: string;
|
||||
response_json?: string;
|
||||
process_time?: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
created_by?: CommonType;
|
||||
updated_by?: CommonType;
|
||||
deleted_by?: CommonType;
|
||||
request_browser?: string;
|
||||
msg?: string;
|
||||
created_time?: string;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ const NoticeAPI = {
|
||||
|
||||
batchNotice(body: BatchType) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/available/setting`,
|
||||
url: `${API_PATH}/status/batch`,
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
@@ -66,9 +66,23 @@ const NoticeAPI = {
|
||||
});
|
||||
},
|
||||
|
||||
getLatestNotices() {
|
||||
return request<ApiResponse<NoticeTable[]>>({
|
||||
url: `${API_PATH}/latest`,
|
||||
readNotice(id: number) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/read/${id}`,
|
||||
method: "post",
|
||||
});
|
||||
},
|
||||
|
||||
readAllNotice() {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/read-all`,
|
||||
method: "post",
|
||||
});
|
||||
},
|
||||
|
||||
getUnreadCount() {
|
||||
return request<ApiResponse<number>>({
|
||||
url: `${API_PATH}/unread-count`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
@@ -86,11 +100,6 @@ export default NoticeAPI;
|
||||
export interface NoticePageQuery extends PageQuery {
|
||||
notice_title?: string;
|
||||
notice_type?: string;
|
||||
status?: string;
|
||||
created_time?: string[];
|
||||
updated_time?: string[];
|
||||
created_id?: number;
|
||||
updated_id?: number;
|
||||
}
|
||||
|
||||
export interface NoticeTable extends BaseType {
|
||||
|
||||
@@ -62,6 +62,14 @@ const ParamsAPI = {
|
||||
});
|
||||
},
|
||||
|
||||
batchParams(body: BatchType) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/status/batch`,
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
exportParams(body: ConfigPageQuery) {
|
||||
return request<Blob>({
|
||||
url: `${API_PATH}/export`,
|
||||
@@ -78,8 +86,6 @@ export interface ConfigPageQuery extends PageQuery {
|
||||
config_name?: string;
|
||||
config_key?: string;
|
||||
config_type?: boolean;
|
||||
created_time?: string[];
|
||||
updated_time?: string[];
|
||||
}
|
||||
|
||||
export interface ConfigTable extends BaseType {
|
||||
@@ -87,8 +93,6 @@ export interface ConfigTable extends BaseType {
|
||||
config_key?: string;
|
||||
config_value?: string;
|
||||
config_type?: boolean;
|
||||
status?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface ConfigForm extends BaseFormType {
|
||||
@@ -96,6 +100,4 @@ export interface ConfigForm extends BaseFormType {
|
||||
config_key?: string;
|
||||
config_value?: string;
|
||||
config_type?: boolean;
|
||||
status?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ const PositionAPI = {
|
||||
|
||||
batchPosition(body: BatchType) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/available/setting`,
|
||||
url: `${API_PATH}/status/batch`,
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
@@ -64,14 +64,11 @@ export default PositionAPI;
|
||||
|
||||
export interface PositionPageQuery extends PageQuery {
|
||||
name?: string;
|
||||
status?: string;
|
||||
created_id?: number;
|
||||
created_time?: string[];
|
||||
updated_time?: string[];
|
||||
}
|
||||
|
||||
export interface PositionTable extends BaseType {
|
||||
name?: string;
|
||||
code?: string;
|
||||
order?: number;
|
||||
created_by?: CommonType;
|
||||
updated_by?: CommonType;
|
||||
@@ -80,5 +77,6 @@ export interface PositionTable extends BaseType {
|
||||
|
||||
export interface PositionForm extends BaseFormType {
|
||||
name?: string;
|
||||
code?: string;
|
||||
order?: number;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ const RoleAPI = {
|
||||
|
||||
batchRole(body: BatchType) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/available/setting`,
|
||||
url: `${API_PATH}/status/batch`,
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
@@ -52,8 +52,8 @@ const RoleAPI = {
|
||||
|
||||
setPermission(body: permissionDataType) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/permission/setting`,
|
||||
method: "patch",
|
||||
url: `${API_PATH}/permission`,
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
@@ -72,19 +72,13 @@ export default RoleAPI;
|
||||
|
||||
export interface TablePageQuery extends PageQuery {
|
||||
name?: string;
|
||||
status?: string;
|
||||
created_time?: string[];
|
||||
updated_time?: string[];
|
||||
}
|
||||
|
||||
export interface RoleTable extends BaseType {
|
||||
id: number;
|
||||
name: string;
|
||||
order?: number;
|
||||
code: string;
|
||||
data_scope?: number;
|
||||
status?: string;
|
||||
description?: string;
|
||||
menus?: permissionMenuType[];
|
||||
depts?: permissionDeptType[];
|
||||
}
|
||||
@@ -93,8 +87,7 @@ export interface RoleForm extends BaseFormType {
|
||||
name?: string;
|
||||
order?: number;
|
||||
code: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
data_scope?: number;
|
||||
}
|
||||
|
||||
export interface permissionDataType {
|
||||
|
||||
@@ -40,17 +40,14 @@ export default TicketAPI;
|
||||
export interface TicketPageQuery extends PageQuery {
|
||||
title?: string;
|
||||
ticket_type?: string;
|
||||
status?: string;
|
||||
created_id?: number;
|
||||
assigned_id?: number;
|
||||
}
|
||||
|
||||
export interface TicketTable extends BaseType {
|
||||
title: string;
|
||||
ticket_content?: string;
|
||||
content: string;
|
||||
summary?: string;
|
||||
ticket_type: string;
|
||||
status: string;
|
||||
images?: string;
|
||||
reply?: string;
|
||||
assigned_id?: number;
|
||||
@@ -61,8 +58,8 @@ export interface TicketTable extends BaseType {
|
||||
|
||||
export interface TicketCreateForm {
|
||||
title: string;
|
||||
ticket_content: string;
|
||||
content?: string;
|
||||
ticket_content?: string;
|
||||
summary?: string;
|
||||
ticket_type: string;
|
||||
images?: string;
|
||||
description?: string;
|
||||
@@ -71,23 +68,21 @@ export interface TicketCreateForm {
|
||||
export interface TicketUpdateForm {
|
||||
title?: string;
|
||||
ticket_content?: string;
|
||||
content?: string;
|
||||
summary?: string;
|
||||
ticket_type?: string;
|
||||
status?: string;
|
||||
status?: number;
|
||||
reply?: string;
|
||||
assigned_id?: number;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface TicketForm {
|
||||
export interface TicketForm extends BaseFormType {
|
||||
id?: number;
|
||||
title: string;
|
||||
ticket_content: string;
|
||||
content?: string;
|
||||
ticket_content?: string;
|
||||
summary?: string;
|
||||
ticket_type: string;
|
||||
images?: string;
|
||||
description?: string;
|
||||
status?: string;
|
||||
reply?: string;
|
||||
assigned_id?: number;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { request } from "@utils";
|
||||
import { MenuTable, MenuForm } from "@/api/module_system/menu";
|
||||
import { MenuTable, MenuForm } from "@/api/module_platform/menu";
|
||||
|
||||
const API_PATH = "/system/user";
|
||||
|
||||
@@ -101,7 +101,7 @@ export const UserAPI = {
|
||||
|
||||
batchUser(body: BatchType) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/available/setting`,
|
||||
url: `${API_PATH}/status/batch`,
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
@@ -149,6 +149,7 @@ export interface RegisterForm {
|
||||
username: string;
|
||||
password: string;
|
||||
confirmPassword: string;
|
||||
email?: string;
|
||||
}
|
||||
|
||||
export interface UserPageQuery extends PageQuery {
|
||||
@@ -157,10 +158,6 @@ export interface UserPageQuery extends PageQuery {
|
||||
mobile?: string;
|
||||
email?: string;
|
||||
dept_id?: number;
|
||||
status?: string;
|
||||
created_time?: string[];
|
||||
created_id?: number;
|
||||
updated_id?: number;
|
||||
}
|
||||
|
||||
export interface searchSelectDataType {
|
||||
@@ -264,6 +261,8 @@ export interface UserForm extends BaseFormType {
|
||||
email?: string;
|
||||
mobile?: string;
|
||||
is_superuser?: boolean;
|
||||
avatar?: string;
|
||||
tenant_id?: number;
|
||||
}
|
||||
|
||||
export interface CurrentUserFormState {
|
||||
|
||||
@@ -137,7 +137,6 @@ export interface SchedulerJob {
|
||||
export interface JobLogPageQuery extends PageQuery {
|
||||
job_id?: string;
|
||||
job_name?: string;
|
||||
status?: string;
|
||||
trigger_type?: string;
|
||||
}
|
||||
|
||||
@@ -145,11 +144,8 @@ export interface JobLogTable extends BaseType {
|
||||
job_id: string;
|
||||
job_name?: string;
|
||||
trigger_type?: string;
|
||||
status: string;
|
||||
next_run_time?: string;
|
||||
job_state?: string;
|
||||
result?: string;
|
||||
error?: string;
|
||||
created_time?: string;
|
||||
updated_time?: string;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,14 @@ const NodeAPI = {
|
||||
});
|
||||
},
|
||||
|
||||
batchNode(body: BatchType) {
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/status/batch`,
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
executeNode(id: number, params: ExecuteNodeParams = { trigger: "now" }) {
|
||||
return request<ApiResponse<ExecuteNodeResult>>({
|
||||
url: `${API_PATH}/execute/${id}`,
|
||||
@@ -70,10 +78,6 @@ export default NodeAPI;
|
||||
export interface NodePageQuery extends PageQuery {
|
||||
name?: string;
|
||||
code?: string;
|
||||
created_id?: number;
|
||||
updated_id?: number;
|
||||
created_time?: string[];
|
||||
updated_time?: string[];
|
||||
}
|
||||
|
||||
export type TriggerType = "now" | "cron" | "interval" | "date";
|
||||
|
||||
@@ -66,18 +66,11 @@ export { WorkflowDefinitionAPI };
|
||||
export interface WorkflowPageQuery extends PageQuery {
|
||||
name?: string;
|
||||
code?: string;
|
||||
status?: string;
|
||||
created_time?: string[];
|
||||
updated_time?: string[];
|
||||
created_id?: number;
|
||||
updated_id?: number;
|
||||
}
|
||||
|
||||
export interface WorkflowTable extends BaseType {
|
||||
name?: string;
|
||||
code?: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
nodes?: any[];
|
||||
edges?: any[];
|
||||
created_by?: CommonType;
|
||||
@@ -88,8 +81,6 @@ export interface WorkflowTable extends BaseType {
|
||||
export interface WorkflowForm extends BaseFormType {
|
||||
name?: string;
|
||||
code?: string;
|
||||
status?: string;
|
||||
description?: string;
|
||||
nodes?: any[];
|
||||
edges?: any[];
|
||||
}
|
||||
|
||||
@@ -11,6 +11,13 @@ const WorkflowNodeTypeAPI = {
|
||||
});
|
||||
},
|
||||
|
||||
getWorkflowNodeTypeSelect() {
|
||||
return request<ApiResponse<WorkflowNodeTypeOption[]>>({
|
||||
url: `${API_PATH}/select`,
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
getWorkflowNodeTypeList(query: WorkflowNodeTypePageQuery) {
|
||||
return request<ApiResponse<PageResult<WorkflowNodeTypeTable>>>({
|
||||
url: `${API_PATH}/list`,
|
||||
@@ -69,10 +76,6 @@ export interface WorkflowNodeTypePageQuery extends PageQuery {
|
||||
code?: string;
|
||||
category?: string;
|
||||
is_active?: boolean;
|
||||
created_time?: string[];
|
||||
updated_time?: string[];
|
||||
created_id?: number;
|
||||
updated_id?: number;
|
||||
}
|
||||
|
||||
export interface WorkflowNodeTypeTable extends BaseType {
|
||||
|
||||
Reference in New Issue
Block a user