mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-08 02:36:07 +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:
@@ -18,7 +18,6 @@
|
||||
</div>
|
||||
<el-button
|
||||
v-if="messages.length > 0"
|
||||
v-hasPerm="['ai:mcp:clear']"
|
||||
text
|
||||
:icon="Delete"
|
||||
@click="clearCurrentChat"
|
||||
@@ -26,7 +25,6 @@
|
||||
清空对话
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPerm="['ai:mcp:connection']"
|
||||
text
|
||||
:icon="Setting"
|
||||
@click="toggleConnection"
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" icon="delete" @click="handleClearLog">清空日志</el-button>
|
||||
<el-button v-hasPerm="['module_application:job:delete']" type="warning" icon="delete" @click="handleClearLog">清空日志</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
@@ -90,7 +90,7 @@
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="导出">
|
||||
<!-- 将直接导出改为打开导出弹窗 -->
|
||||
<el-button type="warning" icon="download" circle @click="handleOpenExportsModal" />
|
||||
<el-button v-hasPerm="['module_application:job:export']" type="warning" icon="download" circle @click="handleOpenExportsModal" />
|
||||
</el-tooltip>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
@@ -163,6 +163,7 @@
|
||||
<el-table-column fixed="right" label="操作" align="center" min-width="150">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-hasPerm="['module_application:job:query']"
|
||||
type="info"
|
||||
size="small"
|
||||
link
|
||||
@@ -172,6 +173,7 @@
|
||||
详情
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPerm="['module_application:job:delete']"
|
||||
type="danger"
|
||||
size="small"
|
||||
link
|
||||
@@ -342,7 +344,7 @@ async function loadingData() {
|
||||
loading.value = true;
|
||||
try {
|
||||
// 调用任务日志列表接口
|
||||
const response = await JobAPI.getJobLogList(queryFormData);
|
||||
const response = await JobAPI.listJobLog(queryFormData);
|
||||
pageTableData.value = response.data.data.items;
|
||||
total.value = response.data.data.total;
|
||||
} catch (error: any) {
|
||||
@@ -389,7 +391,7 @@ async function handleCloseDialog() {
|
||||
async function handleOpenDialog(type: "detail", id?: number) {
|
||||
dialogVisible.type = type;
|
||||
if (id) {
|
||||
const response = await JobAPI.getJobLogDetail(id);
|
||||
const response = await JobAPI.detailJobLog(id);
|
||||
dialogVisible.title = "任务日志详情";
|
||||
Object.assign(detailFormData.value, response.data.data);
|
||||
}
|
||||
@@ -478,7 +480,7 @@ const curdContentConfig = {
|
||||
query.page_size = 1000;
|
||||
const all: any[] = [];
|
||||
while (true) {
|
||||
const res = await JobAPI.getJobLogList(query);
|
||||
const res = await JobAPI.listJobLog(query);
|
||||
const items = res.data?.data?.items || [];
|
||||
const total = res.data?.data?.total || 0;
|
||||
all.push(...items);
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="清除">
|
||||
<el-button
|
||||
v-hasPerm="['module_application:job:clear']"
|
||||
v-hasPerm="['module_application:job:delete']"
|
||||
type="danger"
|
||||
icon="delete"
|
||||
circle
|
||||
@@ -137,7 +137,6 @@
|
||||
<el-col :span="1.5">
|
||||
<el-tooltip content="刷新">
|
||||
<el-button
|
||||
v-hasPerm="['module_application:job:refresh']"
|
||||
type="primary"
|
||||
icon="refresh"
|
||||
circle
|
||||
@@ -255,7 +254,7 @@
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<el-dropdown v-hasPerm="['module_application:job:status']" trigger="click">
|
||||
<el-dropdown v-hasPerm="['module_application:job:update']" trigger="click">
|
||||
<el-button type="warning" size="small" link icon="ArrowDown">更多</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
@@ -589,7 +588,7 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
v-else
|
||||
v-hasPerm="['module_application:job:detail']"
|
||||
v-hasPerm="['module_application:job:query']"
|
||||
type="primary"
|
||||
@click="handleCloseDialog"
|
||||
>
|
||||
@@ -732,7 +731,7 @@ async function handleRefresh() {
|
||||
async function loadingData() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const response = await JobAPI.getJobList(queryFormData);
|
||||
const response = await JobAPI.listJob(queryFormData);
|
||||
pageTableData.value = response.data.data.items;
|
||||
total.value = response.data.data.total;
|
||||
} catch (error: any) {
|
||||
@@ -809,7 +808,7 @@ async function handleCloseDialog() {
|
||||
async function handleOpenDialog(type: "create" | "update" | "detail", id?: number) {
|
||||
dialogVisible.type = type;
|
||||
if (id) {
|
||||
const response = await JobAPI.getJobDetail(id);
|
||||
const response = await JobAPI.detailJob(id);
|
||||
if (type === "detail") {
|
||||
dialogVisible.title = "任务详情";
|
||||
Object.assign(detailFormData.value, response.data.data);
|
||||
@@ -965,7 +964,7 @@ const curdContentConfig = {
|
||||
query.page_size = 1000;
|
||||
const all: any[] = [];
|
||||
while (true) {
|
||||
const res = await JobAPI.getJobList(query);
|
||||
const res = await JobAPI.listJob(query);
|
||||
const items = res.data?.data?.items || [];
|
||||
const total = res.data?.data?.total || 0;
|
||||
all.push(...items);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item class="search-buttons">
|
||||
<el-button
|
||||
v-hasPerm="['application:myapp:query']"
|
||||
v-hasPerm="['module_module_application:myapp:query']"
|
||||
type="primary"
|
||||
icon="search"
|
||||
native-type="submit"
|
||||
@@ -41,7 +41,7 @@
|
||||
查询
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPerm="['application:myapp:query']"
|
||||
v-hasPerm="['module_application:myapp:query']"
|
||||
icon="refresh"
|
||||
@click="handleResetQuery"
|
||||
>
|
||||
@@ -76,7 +76,7 @@
|
||||
应用市场
|
||||
</span>
|
||||
<el-button
|
||||
v-hasPerm="['application:myapp:create']"
|
||||
v-hasPerm="['module_application:myapp:create']"
|
||||
type="primary"
|
||||
icon="plus"
|
||||
@click="handleCreateApp"
|
||||
@@ -119,14 +119,14 @@
|
||||
<!-- 操作按钮 -->
|
||||
<div v-if="hoveredCard === app.id" class="card-actions" @click.stop>
|
||||
<el-button
|
||||
v-hasPerm="['application:myapp:update']"
|
||||
v-hasPerm="['module_application:myapp:update']"
|
||||
type="primary"
|
||||
link
|
||||
icon="Edit"
|
||||
@click="handleAppAction('edit', app)"
|
||||
></el-button>
|
||||
<el-button
|
||||
v-hasPerm="['application:myapp:delete']"
|
||||
v-hasPerm="['module_application:myapp:delete']"
|
||||
type="danger"
|
||||
link
|
||||
icon="Delete"
|
||||
@@ -322,7 +322,7 @@ const formatTime = (time: string | undefined) => {
|
||||
async function loadApplicationList() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const response = await ApplicationAPI.getApplicationList(queryFormData);
|
||||
const response = await ApplicationAPI.listApp(queryFormData);
|
||||
applicationList.value = response.data.data.items;
|
||||
total.value = response.data.data.total;
|
||||
} catch (error) {
|
||||
@@ -375,7 +375,7 @@ async function handleDeleteApp(app: ApplicationInfo) {
|
||||
type: "warning",
|
||||
});
|
||||
|
||||
await ApplicationAPI.deleteApplication([app.id!]);
|
||||
await ApplicationAPI.deleteApp([app.id!]);
|
||||
await loadApplicationList();
|
||||
} catch (error) {
|
||||
if (error !== "cancel") {
|
||||
@@ -478,9 +478,9 @@ async function handleSubmit() {
|
||||
await formRef.value?.validate();
|
||||
|
||||
if (dialogType.value === "create") {
|
||||
await ApplicationAPI.createApplication(formData);
|
||||
await ApplicationAPI.createApp(formData);
|
||||
} else {
|
||||
await ApplicationAPI.updateApplication(currentApp.value!.id!, formData);
|
||||
await ApplicationAPI.updateApp(currentApp.value!.id!, formData);
|
||||
}
|
||||
|
||||
dialogVisible.value = false;
|
||||
|
||||
@@ -339,11 +339,11 @@ defineOptions({
|
||||
});
|
||||
|
||||
import { ref, reactive, onMounted } from "vue";
|
||||
import ExampleAPI, {
|
||||
ExampleTable,
|
||||
ExampleForm,
|
||||
ExamplePageQuery,
|
||||
} from "@/api/module_generator/demo";
|
||||
import DemoAPI, {
|
||||
DemoTable,
|
||||
DemoForm,
|
||||
DemoPageQuery,
|
||||
} from "@/api/module_example/demo";
|
||||
import DatePicker from "@/components/DatePicker/index.vue";
|
||||
import { formatToDateTime } from "@/utils/dateUtil";
|
||||
|
||||
@@ -356,7 +356,7 @@ const isExpand = ref(false);
|
||||
const isExpandable = ref(true);
|
||||
|
||||
// 分页表单
|
||||
const pageTableData = ref<ExampleTable[]>([]);
|
||||
const pageTableData = ref<DemoTable[]>([]);
|
||||
|
||||
// 表格列配置
|
||||
const tableColumns = ref([
|
||||
@@ -372,7 +372,7 @@ const tableColumns = ref([
|
||||
]);
|
||||
|
||||
// 详情表单
|
||||
const detailFormData = ref<ExampleTable>({});
|
||||
const detailFormData = ref<DemoTable>({});
|
||||
|
||||
// 日期范围临时变量
|
||||
const dateRange = ref<[Date, Date] | []>([]);
|
||||
@@ -390,7 +390,7 @@ function handleDateRangeChange(range: [Date, Date]) {
|
||||
}
|
||||
|
||||
// 分页查询参数
|
||||
const queryFormData = reactive<ExamplePageQuery>({
|
||||
const queryFormData = reactive<DemoPageQuery>({
|
||||
page_no: 1,
|
||||
page_size: 10,
|
||||
name: undefined,
|
||||
@@ -400,7 +400,7 @@ const queryFormData = reactive<ExamplePageQuery>({
|
||||
});
|
||||
|
||||
// 编辑表单
|
||||
const formData = reactive<ExampleForm>({
|
||||
const formData = reactive<DemoForm>({
|
||||
id: undefined,
|
||||
name: "",
|
||||
status: true,
|
||||
@@ -429,7 +429,7 @@ async function handleRefresh() {
|
||||
async function loadingData() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const response = await ExampleAPI.getExampleList(queryFormData);
|
||||
const response = await DemoAPI.getDemoList(queryFormData);
|
||||
pageTableData.value = response.data.data.items;
|
||||
total.value = response.data.data.total;
|
||||
} catch (error: any) {
|
||||
@@ -457,7 +457,7 @@ async function handleResetQuery() {
|
||||
}
|
||||
|
||||
// 定义初始表单数据常量
|
||||
const initialFormData: ExampleForm = {
|
||||
const initialFormData: DemoForm = {
|
||||
id: undefined,
|
||||
name: "",
|
||||
status: true,
|
||||
@@ -489,7 +489,7 @@ async function handleCloseDialog() {
|
||||
async function handleOpenDialog(type: "create" | "update" | "detail", id?: number) {
|
||||
dialogVisible.type = type;
|
||||
if (id) {
|
||||
const response = await ExampleAPI.getExampleDetail(id);
|
||||
const response = await DemoAPI.getDemoDetail(id);
|
||||
if (type === "detail") {
|
||||
dialogVisible.title = "详情";
|
||||
Object.assign(detailFormData.value, response.data.data);
|
||||
@@ -514,7 +514,7 @@ async function handleSubmit() {
|
||||
const id = formData.id;
|
||||
if (id) {
|
||||
try {
|
||||
await ExampleAPI.updateExample(id, { id, ...formData });
|
||||
await DemoAPI.updateDemo(id, { id, ...formData });
|
||||
dialogVisible.visible = false;
|
||||
resetForm();
|
||||
handleCloseDialog();
|
||||
@@ -526,7 +526,7 @@ async function handleSubmit() {
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
await ExampleAPI.createExample(formData);
|
||||
await DemoAPI.createDemo(formData);
|
||||
dialogVisible.visible = false;
|
||||
resetForm();
|
||||
handleCloseDialog();
|
||||
@@ -551,7 +551,7 @@ async function handleDelete(ids: number[]) {
|
||||
.then(async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
await ExampleAPI.deleteExample(ids);
|
||||
await DemoAPI.deleteDemo(ids);
|
||||
handleResetQuery();
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
@@ -575,7 +575,7 @@ async function handleMoreClick(status: boolean) {
|
||||
.then(async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
await ExampleAPI.batchAvailableExample({ ids: selectIds.value, status });
|
||||
await DemoAPI.batchDemo({ ids: selectIds.value, status });
|
||||
handleResetQuery();
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
|
||||
Reference in New Issue
Block a user