mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-04 01:10:36 +00:00
refactor: 重构代码结构并优化命名一致性
feat(backend): 新增模块示例和路径配置 fix(backend): 修复菜单模型名称唯一性约束 refactor(backend): 重构日志模块和路径配置 style(backend): 统一API方法命名规范 refactor(frontend): 重构API方法命名规范 fix(frontend): 修复权限校验问题 refactor: 移动定时任务测试文件到正确模块 docs: 更新模板文件路径 refactor: 优化日志记录和错误处理 fix: 修复排序默认值问题
This commit is contained in:
@@ -369,7 +369,7 @@ const submitChanges = async () => {
|
||||
.filter(Boolean);
|
||||
// 转换为JSON字符串格式保存
|
||||
const apiWhitelistJson = JSON.stringify(apiWhitelistArray);
|
||||
await ParamsAPI.updateConfig(apiWhitelistConfigs.value.white_api_list_path.id, {
|
||||
await ParamsAPI.updateParams(apiWhitelistConfigs.value.white_api_list_path.id, {
|
||||
...apiWhitelistConfigs.value.white_api_list_path,
|
||||
config_value: apiWhitelistJson,
|
||||
});
|
||||
@@ -382,7 +382,7 @@ const submitChanges = async () => {
|
||||
.filter(Boolean);
|
||||
// 转换为JSON字符串格式保存
|
||||
const ipBlacklistJson = JSON.stringify(ipBlacklistArray);
|
||||
await ParamsAPI.updateConfig(ipBlacklistConfigs.value.ip_black_list.id, {
|
||||
await ParamsAPI.updateParams(ipBlacklistConfigs.value.ip_black_list.id, {
|
||||
...ipBlacklistConfigs.value.ip_black_list,
|
||||
config_value: ipBlacklistJson,
|
||||
});
|
||||
@@ -395,7 +395,7 @@ const submitChanges = async () => {
|
||||
.filter(Boolean);
|
||||
// 转换为JSON字符串格式保存
|
||||
const demoIpWhitelistJson = JSON.stringify(demoIpWhitelistArray);
|
||||
await ParamsAPI.updateConfig(demoConfigs.value.ip_white_list.id, {
|
||||
await ParamsAPI.updateParams(demoConfigs.value.ip_white_list.id, {
|
||||
...demoConfigs.value.ip_white_list,
|
||||
config_value: demoIpWhitelistJson,
|
||||
});
|
||||
@@ -412,7 +412,7 @@ const submitChanges = async () => {
|
||||
securityPrivacyConfigs.value[key as keyof typeof securityPrivacyConfigs.value] ||
|
||||
userAgreementConfigs.value[key as keyof typeof userAgreementConfigs.value] ||
|
||||
demoConfigs.value[key as keyof typeof demoConfigs.value];
|
||||
return item && item.id ? ParamsAPI.updateConfig(item.id, { ...item }) : Promise.resolve();
|
||||
return item && item.id ? ParamsAPI.updateParams(item.id, { ...item }) : Promise.resolve();
|
||||
});
|
||||
await Promise.all(otherUpdatePromises);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button
|
||||
v-hasPerm="['module_system:config:query']"
|
||||
v-hasPerm="['module_system:param:query']"
|
||||
type="primary"
|
||||
icon="search"
|
||||
native-type="submit"
|
||||
@@ -48,7 +48,7 @@
|
||||
查询
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPerm="['module_system:config:query']"
|
||||
v-hasPerm="['module_system:param:query']"
|
||||
icon="refresh"
|
||||
@click="handleResetQuery"
|
||||
>
|
||||
@@ -91,7 +91,7 @@
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-hasPerm="['module_system:config:create']"
|
||||
v-hasPerm="['module_system:param:create']"
|
||||
type="success"
|
||||
icon="plus"
|
||||
@click="handleOpenDialog('create')"
|
||||
@@ -101,7 +101,7 @@
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-hasPerm="['module_system:config:delete']"
|
||||
v-hasPerm="['module_system:param:delete']"
|
||||
type="danger"
|
||||
icon="delete"
|
||||
:disabled="selectIds.length === 0"
|
||||
@@ -117,7 +117,7 @@
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导出">
|
||||
<el-button
|
||||
v-hasPerm="['module_system:config:export']"
|
||||
v-hasPerm="['module_system:param:export']"
|
||||
type="warning"
|
||||
icon="download"
|
||||
circle
|
||||
@@ -128,7 +128,7 @@
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button
|
||||
v-hasPerm="['module_system:config:refresh']"
|
||||
v-hasPerm="['module_system:param:refresh']"
|
||||
type="primary"
|
||||
icon="refresh"
|
||||
circle
|
||||
@@ -137,7 +137,7 @@
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-dropdown v-hasPerm="['module_system:config:filter']" trigger="click">
|
||||
<el-dropdown v-hasPerm="['module_system:param:query']" trigger="click">
|
||||
<el-button type="default" icon="operation" circle />
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
@@ -264,7 +264,7 @@
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-hasPerm="['module_system:config:detail']"
|
||||
v-hasPerm="['module_system:param:query']"
|
||||
type="info"
|
||||
size="small"
|
||||
link
|
||||
@@ -274,7 +274,7 @@
|
||||
详情
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPerm="['module_system:config:update']"
|
||||
v-hasPerm="['module_system:param:update']"
|
||||
type="primary"
|
||||
size="small"
|
||||
link
|
||||
@@ -284,7 +284,7 @@
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPerm="['module_system:config:delete']"
|
||||
v-hasPerm="['module_system:param:delete']"
|
||||
type="danger"
|
||||
size="small"
|
||||
link
|
||||
@@ -388,7 +388,7 @@
|
||||
<el-button @click="handleCloseDialog">取消</el-button>
|
||||
<el-button
|
||||
v-if="dialogVisible.type !== 'detail'"
|
||||
v-hasPerm="['module_system:config:create']"
|
||||
v-hasPerm="['module_system:param:create']"
|
||||
type="primary"
|
||||
@click="handleSubmit"
|
||||
>
|
||||
@@ -396,7 +396,7 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
v-else
|
||||
v-hasPerm="['module_system:config:detail']"
|
||||
v-hasPerm="['module_system:param:detail']"
|
||||
type="primary"
|
||||
@click="handleCloseDialog"
|
||||
>
|
||||
@@ -522,7 +522,7 @@ async function handleRefresh() {
|
||||
async function loadingData() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const response = await ParamsAPI.getConfigList(queryFormData);
|
||||
const response = await ParamsAPI.listParams(queryFormData);
|
||||
pageTableData.value = response.data.data.items;
|
||||
total.value = response.data.data.total;
|
||||
} catch (error: any) {
|
||||
@@ -590,7 +590,7 @@ async function handleCloseDialog() {
|
||||
async function handleOpenDialog(type: "create" | "update" | "detail", id?: number) {
|
||||
dialogVisible.type = type;
|
||||
if (id) {
|
||||
const response = await ParamsAPI.getConfigDetail(id);
|
||||
const response = await ParamsAPI.detailParams(id);
|
||||
if (type === "detail") {
|
||||
dialogVisible.title = "系统配置详情";
|
||||
Object.assign(detailFormData.value, response.data.data);
|
||||
@@ -615,7 +615,7 @@ async function handleSubmit() {
|
||||
const id = formData.id;
|
||||
if (id) {
|
||||
try {
|
||||
await ParamsAPI.updateConfig(id, formData);
|
||||
await ParamsAPI.updateParams(id, formData);
|
||||
dialogVisible.visible = false;
|
||||
resetForm();
|
||||
handleResetQuery();
|
||||
@@ -626,7 +626,7 @@ async function handleSubmit() {
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
await ParamsAPI.createConfig(formData);
|
||||
await ParamsAPI.createParams(formData);
|
||||
dialogVisible.visible = false;
|
||||
resetForm();
|
||||
handleResetQuery();
|
||||
@@ -650,7 +650,7 @@ async function handleDelete(ids: number[]) {
|
||||
.then(async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
await ParamsAPI.deleteConfig(ids);
|
||||
await ParamsAPI.deleteParams(ids);
|
||||
handleResetQuery();
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
@@ -681,7 +681,7 @@ const exportColumns = [
|
||||
|
||||
// 导入/导出配置(用于导出弹窗)
|
||||
const curdContentConfig = {
|
||||
permPrefix: "module_system:config",
|
||||
permPrefix: "module_system:param",
|
||||
cols: exportColumns as any,
|
||||
exportsAction: async (params: any) => {
|
||||
const query: any = { ...params };
|
||||
@@ -692,7 +692,7 @@ const curdContentConfig = {
|
||||
query.page_size = 1000;
|
||||
const all: any[] = [];
|
||||
while (true) {
|
||||
const res = await ParamsAPI.getConfigList(query);
|
||||
const res = await ParamsAPI.listParams(query);
|
||||
const items = res.data?.data?.items || [];
|
||||
const total = res.data?.data?.total || 0;
|
||||
all.push(...items);
|
||||
|
||||
Reference in New Issue
Block a user