mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-26 14:23:48 +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:
@@ -38,7 +38,8 @@
|
||||
:perm-delete="['module_example:demo:delete']"
|
||||
:perm-patch="['module_example:demo:patch']"
|
||||
:delete-loading="batchDeleting"
|
||||
@add="openEditDialog('add')"
|
||||
:create-loading="createLoading"
|
||||
@add="handleAdd"
|
||||
@import="openImport"
|
||||
@export="openExport"
|
||||
@delete="handleBatchDelete"
|
||||
@@ -250,6 +251,8 @@ const faTableRef = ref<{ elTableRef?: { clearSelection: () => void } } | null>(n
|
||||
const { selectedRows, selectedIds, batchDeleting, onTableSelectionChange } =
|
||||
useTableSelection<DemoTable>();
|
||||
|
||||
const createLoading = ref(false);
|
||||
|
||||
const {
|
||||
columns,
|
||||
columnChecks,
|
||||
@@ -580,6 +583,15 @@ async function openDetailDialog(row: DemoTable) {
|
||||
dialogVisible.visible = true;
|
||||
}
|
||||
|
||||
async function handleAdd() {
|
||||
createLoading.value = true;
|
||||
try {
|
||||
await openEditDialog("add");
|
||||
} finally {
|
||||
createLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function openEditDialog(type: "add" | "edit", row?: DemoTable) {
|
||||
dialogVisible.type = type === "add" ? "create" : "update";
|
||||
if (type === "add") {
|
||||
@@ -679,7 +691,7 @@ async function handleBatchDelete() {
|
||||
}
|
||||
}
|
||||
|
||||
async function runBatchStatus(status: string) {
|
||||
async function runBatchStatus(status: number) {
|
||||
const ids = selectedIds.value;
|
||||
if (ids.length === 0) {
|
||||
ElMessage.warning("请先在列表中勾选数据");
|
||||
@@ -687,7 +699,7 @@ async function runBatchStatus(status: string) {
|
||||
}
|
||||
try {
|
||||
await confirmAction(
|
||||
`确认对选中的 ${ids.length} 条数据${status === "0" ? "启用" : "停用"}?`,
|
||||
`确认对选中的 ${ids.length} 条数据${status === 0 ? "启用" : "停用"}?`,
|
||||
"批量设置"
|
||||
);
|
||||
await DemoAPI.batchDemo({ ids, status });
|
||||
|
||||
Reference in New Issue
Block a user