Merge pull request #103 from 1014TaoTao/v2.0.0

fix: 替换ElMessage.info为ElMessageBox.close取消操作提示
This commit is contained in:
fastapiadmin
2025-07-27 01:16:08 +08:00
committed by GitHub
16 changed files with 74 additions and 81 deletions
-2
View File
@@ -46,14 +46,12 @@
"@types/nprogress": "^0.2.3",
"@types/qs": "^6.14.0",
"@vitejs/plugin-vue": "^6.0.0",
"eslint": "^9.31.0",
"sass": "^1.89.2",
"terser": "^5.43.1",
"typescript": "^5.8.3",
"unocss": "66.2.3",
"unplugin-auto-import": "^19.3.0",
"unplugin-vue-components": "^28.8.0",
"vue-eslint-parser": "^10.2.0",
"vite": "^6.3.5"
},
"engines": {
@@ -220,7 +220,7 @@ function logout() {
router.push(`/login?redirect=${route.fullPath}`);
});
}).catch(() => {
ElMessage.info('已取消强退');
ElMessageBox.close();
});
}
+3 -3
View File
@@ -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);
},
};
+50 -55
View File
@@ -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: 重启(暂时移除重启)
+2 -2
View File
@@ -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();
};
// 系统配置项
+1 -1
View File
@@ -428,7 +428,7 @@ async function handleExport() {
loading.value = false;
}
}).catch(() => {
ElMessage.info('已取消导出');
ElMessageBox.close();
});
}
+1 -1
View File
@@ -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();
});
}
}
+2 -2
View File
@@ -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();
});
}
}
+1 -1
View File
@@ -386,7 +386,7 @@ async function handleExport() {
loading.value = false;
}
}).catch(() => {
ElMessage.info('已取消导出');
ElMessageBox.close();
});
}
+1 -1
View File
@@ -736,7 +736,7 @@ async function handleMoreClick(status: boolean) {
loading.value = false;
}
}).catch(() => {
ElMessage.info('已取消批量操作');
ElMessageBox.close();
});
}
+2 -2
View File
@@ -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();
});
}
}
+2 -2
View File
@@ -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();
});
}
}
+2 -2
View File
@@ -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();
});
}
}
+3 -3
View File
@@ -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();
});
}
}