mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-20 20:39:55 +00:00
fix: 替换ElMessage.info为ElMessageBox.close取消操作提示
refactor: 移除未使用的ElementPlus导入和eslint相关依赖
This commit is contained in:
@@ -220,7 +220,7 @@ function logout() {
|
||||
router.push(`/login?redirect=${route.fullPath}`);
|
||||
});
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消强退');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { setupStore } from "@/store";
|
||||
import { setupElIcons } from "./icons";
|
||||
import { setupPermission } from "./permission";
|
||||
import { InstallCodeMirror } from "codemirror-editor-vue3";
|
||||
import ElementPlus from 'element-plus'
|
||||
// import ElementPlus from 'element-plus'
|
||||
|
||||
export default {
|
||||
install(app: App<Element>) {
|
||||
@@ -22,7 +22,7 @@ export default {
|
||||
setupPermission();
|
||||
// 注册 CodeMirror
|
||||
app.use(InstallCodeMirror);
|
||||
// 注册 ElementPlus
|
||||
app.use(ElementPlus);
|
||||
// // 注册 ElementPlus
|
||||
// app.use(ElementPlus);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -478,7 +478,6 @@ defineOptions({
|
||||
});
|
||||
|
||||
import JobAPI, { JobTable, JobForm, JobPageQuery } from "@/api/monitor/job";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
|
||||
import IntervalTab from "@/components/IntervalTab/index.vue";
|
||||
import "vue3-cron-plus-picker/style.css";
|
||||
@@ -700,7 +699,7 @@ async function handleDelete(ids: number[]) {
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage.info("已取消删除");
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -710,46 +709,44 @@ async function handleExport() {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const body = {
|
||||
...queryFormData,
|
||||
page_no: 1,
|
||||
page_size: total.value,
|
||||
};
|
||||
ElMessage.warning("正在导出数据,请稍候...");
|
||||
}).then(async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const body = {
|
||||
...queryFormData,
|
||||
page_no: 1,
|
||||
page_size: total.value,
|
||||
};
|
||||
ElMessage.warning("正在导出数据,请稍候...");
|
||||
|
||||
const response = await JobAPI.exportJob(body);
|
||||
const blob = new Blob([JSON.stringify(response.data.data)], {
|
||||
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8",
|
||||
});
|
||||
// 从响应头获取文件名
|
||||
const contentDisposition = response.headers["content-disposition"];
|
||||
let fileName = "系统配置.xlsx";
|
||||
if (contentDisposition) {
|
||||
const fileNameMatch = contentDisposition.match(/filename=(.*?)(;|$)/);
|
||||
if (fileNameMatch) {
|
||||
fileName = decodeURIComponent(fileNameMatch[1]);
|
||||
}
|
||||
const response = await JobAPI.exportJob(body);
|
||||
const blob = new Blob([JSON.stringify(response.data.data)], {
|
||||
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8",
|
||||
});
|
||||
// 从响应头获取文件名
|
||||
const contentDisposition = response.headers["content-disposition"];
|
||||
let fileName = "系统配置.xlsx";
|
||||
if (contentDisposition) {
|
||||
const fileNameMatch = contentDisposition.match(/filename=(.*?)(;|$)/);
|
||||
if (fileNameMatch) {
|
||||
fileName = decodeURIComponent(fileNameMatch[1]);
|
||||
}
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = fileName;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
} catch (error: any) {
|
||||
ElMessage.error("文件处理失败", error.message);
|
||||
console.error("导出错误:", error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage.info("已取消导出");
|
||||
});
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = fileName;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
} catch (error: any) {
|
||||
ElMessage.error("文件处理失败", error.message);
|
||||
console.error("导出错误:", error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
|
||||
function openIntervalTabHandle(value: any) {
|
||||
@@ -781,22 +778,20 @@ const handleClear = () => {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
await JobAPI.clearJob();
|
||||
ElMessage.success("清空成功");
|
||||
handleResetQuery();
|
||||
} catch (error: any) {
|
||||
ElMessage.error(error.message);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage.info("已取消清空");
|
||||
});
|
||||
}).then(async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
await JobAPI.clearJob();
|
||||
ElMessage.success("清空成功");
|
||||
handleResetQuery();
|
||||
} catch (error: any) {
|
||||
ElMessage.error(error.message);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessageBox.close();
|
||||
});
|
||||
};
|
||||
|
||||
// 操作按钮:操作类型 1: 暂停 2: 恢复 3: 重启(暂时移除重启)
|
||||
|
||||
@@ -193,7 +193,7 @@ async function handleSubmit(session_id: string) {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消强退');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ async function handleClear() {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消强退');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
onMounted(() => {
|
||||
|
||||
@@ -119,7 +119,7 @@ const resetForm = () => {
|
||||
}
|
||||
delete modifiedFields[key];
|
||||
}
|
||||
ElMessage.info('已撤销所有修改');
|
||||
ElMessageBox.close();
|
||||
};
|
||||
|
||||
// 系统配置项
|
||||
|
||||
@@ -428,7 +428,7 @@ async function handleExport() {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消导出');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -408,7 +408,7 @@ async function handleMoreClick(status: boolean) {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消批量操作');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ async function handleExport() {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消导出');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ async function handleMoreClick(status: boolean) {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消批量操作');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,7 +450,7 @@ async function handleExport() {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消导出');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ async function handleMoreClick(status: boolean) {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消批量操作');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ async function handleExport() {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消导出');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -736,7 +736,7 @@ async function handleMoreClick(status: boolean) {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消批量操作');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -476,7 +476,7 @@ async function handleExport() {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消导出');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -498,7 +498,7 @@ async function handleMoreClick(status: boolean) {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消批量操作');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ async function handleExport() {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消导出');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -450,7 +450,7 @@ async function handleMoreClick(status: boolean) {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消批量操作');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,7 +455,7 @@ async function handleExport() {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消导出');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -477,7 +477,7 @@ async function handleMoreClick(status: boolean) {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消批量操作');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,7 +470,7 @@ function hancleResetPassword(row: UserInfo) {
|
||||
});
|
||||
},
|
||||
() => {
|
||||
ElMessage.info("已取消重置密码");
|
||||
ElMessageBox.close();
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -625,7 +625,7 @@ async function handleOperation(type: 'import' | 'export') {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消导出');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
else {
|
||||
@@ -672,7 +672,7 @@ async function handleMoreClick(status: boolean) {
|
||||
loading.value = false;
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.info('已取消批量操作');
|
||||
ElMessageBox.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user