mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-03 16:53:29 +00:00
refactor: 统一项目代码风格并修复多处类型与调用问题
本次提交包含多项优化: 1. 移除大量冗余的文件头注释与过时的from __future__导入 2. 将CRUD的list方法统一重命名为get_list保持接口一致 3. 修复前后端状态字段类型不匹配问题,将string类型status改为number 4. 修正前端文案错别字,将"代办事项"修正为标准写法 5. 更新sqlalchemy版本并调整依赖配置 6. 新增缓存工具类替代fastapi-cache2,重构缓存调用逻辑 7. 新增开源授权函生成相关工具与数据库字段支持 8. 为多个业务模块添加防重复提交loading状态 9. 修复邮件模型的外键关联缺失问题 10. 优化pdf生成工具的导入时机与文档注释
This commit is contained in:
@@ -41,7 +41,9 @@
|
||||
:perm-delete="['module_platform:menu:delete']"
|
||||
:perm-patch="['module_platform:menu:patch']"
|
||||
:delete-loading="batchDeleting"
|
||||
@add="handleOpenDialog('create')"
|
||||
:create-loading="createLoading"
|
||||
:more-loading="moreLoading"
|
||||
@add="handleAdd"
|
||||
@delete="handleBatchDelete"
|
||||
@more="handleMoreClick"
|
||||
/>
|
||||
@@ -497,6 +499,8 @@ const selectedIds = computed(() =>
|
||||
);
|
||||
const batchDeleting = ref(false);
|
||||
const submitLoading = ref(false);
|
||||
const createLoading = ref(false);
|
||||
const moreLoading = ref(false);
|
||||
|
||||
const menuOptions = ref<OptionType[]>([]);
|
||||
const fullMenuTree = ref<MenuTable[]>([]);
|
||||
@@ -1124,6 +1128,15 @@ async function handleCloseDialog() {
|
||||
await resetForm();
|
||||
}
|
||||
|
||||
async function handleAdd() {
|
||||
createLoading.value = true;
|
||||
try {
|
||||
await handleOpenDialog("create");
|
||||
} finally {
|
||||
createLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleOpenDialog(
|
||||
type: "create" | "update" | "detail",
|
||||
id?: number,
|
||||
@@ -1222,13 +1235,13 @@ async function handleBatchDelete() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleMoreClick(status: string) {
|
||||
async function handleMoreClick(status: number) {
|
||||
const ids = selectedIds.value;
|
||||
if (!ids.length) {
|
||||
ElMessage.warning("请先选择要操作的数据");
|
||||
return;
|
||||
}
|
||||
ElMessageBox.confirm(`确认${status === "0" ? "启用" : "停用"}该项数据?`, "警告", {
|
||||
ElMessageBox.confirm(`确认${status === 0 ? "启用" : "停用"}该项数据?`, "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
@@ -1239,10 +1252,13 @@ async function handleMoreClick(status: string) {
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
});
|
||||
moreLoading.value = true;
|
||||
await MenuAPI.batchMenu({ ids, status });
|
||||
await loadMenuData();
|
||||
} catch {
|
||||
// 用户取消
|
||||
} finally {
|
||||
moreLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user