mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-07 02:01:37 +00:00
chore: 清理冗余代码与配置,优化项目结构
1. 删除无用文件与废弃代码:移除locale枚举、element-plus插件、sse路由、api token模块等 2. 简化类型导入与依赖:移除大量未使用的类型导入,统一echarts导入方式 3. 优化配置与样式:调整gitignore、样式引入顺序,新增列表动画样式 4. 修复接口与模型:修正接口返回类型、查询参数配置,更新部门模型字段 5. 优化性能与体验:添加图片懒加载,优化加载逻辑与表格渲染 6. 调整环境配置:新增并更新开发/生产环境配置文件
This commit is contained in:
@@ -113,7 +113,11 @@
|
||||
</template>
|
||||
<template #kwargs>
|
||||
<div class="dynamic-params">
|
||||
<div v-for="(item, index) in kwargsList" :key="index" class="param-item">
|
||||
<div
|
||||
v-for="(item, index) in kwargsList"
|
||||
:key="item.key || index"
|
||||
class="param-item"
|
||||
>
|
||||
<ElInput v-model="item.key" placeholder="键" />
|
||||
<ElInput v-model="item.value" placeholder="值" />
|
||||
<ElButton
|
||||
@@ -279,13 +283,9 @@ import type { FormItem } from "@/components/forms/fa-form/index.vue";
|
||||
import type FaForm from "@/components/forms/fa-form/index.vue";
|
||||
import type { SearchFormItem } from "@/components/forms/fa-search-bar/index.vue";
|
||||
import type FaSearchBar from "@/components/forms/fa-search-bar/index.vue";
|
||||
import IntervalTab from "@/components/others/fa-interval-tab/index.vue";
|
||||
import type { ColumnOption } from "@/types/component";
|
||||
import { useAuth } from "@/hooks/core/useAuth";
|
||||
import { renderTableOperationCell, type TableOperationAction } from "@utils";
|
||||
import { useTable } from "@/hooks/core/useTable";
|
||||
import type { TableOperationAction } from "@utils";
|
||||
import { computed, nextTick, onMounted, reactive, ref } from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { ElMessage } from "@/utils/message";
|
||||
import { vue3CronPlus } from "vue3-cron-plus";
|
||||
import "vue3-cron-plus/dist/index.css";
|
||||
import Codemirror, { CmComponentRef } from "codemirror-editor-vue3";
|
||||
@@ -296,11 +296,6 @@ import "codemirror/theme/dracula.css";
|
||||
const dictStore = useDictStore();
|
||||
const { hasAuth } = useAuth();
|
||||
|
||||
const BATCH_DELETE_NODE_MSG =
|
||||
"确认删除选中的节点吗?\n" +
|
||||
"此操作将同时删除节点定义并移除调度器中的相关任务。\n" +
|
||||
"正在运行的任务会被立即移除,待执行任务的日志将被标记为已取消。";
|
||||
|
||||
type NodeSearchForm = {
|
||||
name?: string;
|
||||
code?: string;
|
||||
@@ -366,14 +361,10 @@ function onTableSelectionChange(rows: NodeTable[]) {
|
||||
selectedRows.value = rows;
|
||||
}
|
||||
|
||||
async function deleteNodeRow(id: number | undefined) {
|
||||
async function deleteNodeRow(id: number | undefined, name: string | number) {
|
||||
if (id == null) return;
|
||||
try {
|
||||
await ElMessageBox.confirm("确认删除该节点吗?将从调度器移除相关任务。", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
});
|
||||
await confirmDelete(`确定删除节点「${name}」吗?`);
|
||||
await NodeAPI.deleteNode([id]);
|
||||
faTableRef.value?.elTableRef?.clearSelection();
|
||||
await refreshRemove();
|
||||
@@ -410,7 +401,7 @@ function buildNodeRowActions(row: NodeTable): TableOperationAction[] {
|
||||
icon: "ri:delete-bin-4-line",
|
||||
perm: "module_task:cronjob:node:delete",
|
||||
run: () => {
|
||||
void deleteNodeRow(row.id);
|
||||
void deleteNodeRow(row.id, String(row?.name ?? row?.id ?? ""));
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -427,11 +418,10 @@ async function handleBatchDelete() {
|
||||
const ids = selectedIds.value;
|
||||
if (ids.length === 0) return;
|
||||
try {
|
||||
await ElMessageBox.confirm(BATCH_DELETE_NODE_MSG, "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
});
|
||||
await confirmBatchDelete(
|
||||
ids.length,
|
||||
selectedRows.value.map((r) => String(r?.name ?? r?.id ?? ""))
|
||||
);
|
||||
batchDeleting.value = true;
|
||||
await NodeAPI.deleteNode(ids);
|
||||
selectedRows.value = [];
|
||||
@@ -868,8 +858,8 @@ async function handleSubmit() {
|
||||
} else {
|
||||
await refreshCreate();
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
} catch (error: unknown) {
|
||||
if (import.meta.env.DEV) console.error(error);
|
||||
} finally {
|
||||
submitLoading.value = false;
|
||||
}
|
||||
@@ -931,13 +921,14 @@ async function handleExecuteNode() {
|
||||
handleCloseExecuteDialog();
|
||||
|
||||
await refreshUpdate();
|
||||
} catch (error: any) {
|
||||
} catch (error: unknown) {
|
||||
const errMsg = (error as { response?: { data?: { msg?: string } } })?.response?.data?.msg;
|
||||
ElMessage.error({
|
||||
message: error.response?.data?.msg || "调试失败",
|
||||
message: errMsg || "调试失败",
|
||||
type: "error",
|
||||
duration: 3000,
|
||||
});
|
||||
console.error(error);
|
||||
if (import.meta.env.DEV) console.error(error);
|
||||
} finally {
|
||||
submitLoading.value = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user