From edd870457fa4b9928687c3b3fe517ef69a615cb1 Mon Sep 17 00:00:00 2001 From: zhenhui <1276357500@qq.com> Date: Tue, 31 Mar 2026 18:20:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=89=8D=E7=AB=AF=E5=8F=8C?= =?UTF-8?q?=E8=AF=AD=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../art-header-bar/widget/ArtUserMenu.vue | 2 +- .../src/components/sai/sa-export/index.vue | 19 +++++---- saiadmin-artd/src/composables/useSaiAdmin.ts | 21 +++++----- saiadmin-artd/src/locales/index.ts | 2 +- saiadmin-artd/src/locales/langs/en.json | 40 ++++++++++++++++++ .../langs/en/dice/play_record_test.json | 5 +++ .../src/locales/langs/en/system/user.json | 6 +++ .../src/locales/langs/en/tool/code.json | 11 +++++ .../src/locales/langs/en/tool/crontab.json | 6 +++ saiadmin-artd/src/locales/langs/zh.json | 40 ++++++++++++++++++ .../langs/zh/dice/play_record_test.json | 5 +++ .../src/locales/langs/zh/system/user.json | 6 +++ .../src/locales/langs/zh/tool/code.json | 11 +++++ .../src/locales/langs/zh/tool/crontab.json | 6 +++ .../dice/play_record_test/index/index.vue | 6 +-- .../plugin/saipackage/install/terminal.vue | 29 ++++++------- .../src/views/safeguard/cache/index.vue | 11 ++--- .../src/views/safeguard/database/index.vue | 42 ++++++++++++------- saiadmin-artd/src/views/system/user/index.vue | 21 +++++----- .../views/tool/code/components/loadTable.vue | 5 ++- .../views/tool/code/components/preview.vue | 5 ++- saiadmin-artd/src/views/tool/code/index.vue | 25 +++++------ .../src/views/tool/crontab/index.vue | 9 ++-- .../views/tool/crontab/modules/log-list.vue | 15 +++---- 24 files changed, 253 insertions(+), 95 deletions(-) diff --git a/saiadmin-artd/src/components/core/layouts/art-header-bar/widget/ArtUserMenu.vue b/saiadmin-artd/src/components/core/layouts/art-header-bar/widget/ArtUserMenu.vue index 486ca17..596a696 100644 --- a/saiadmin-artd/src/components/core/layouts/art-header-bar/widget/ArtUserMenu.vue +++ b/saiadmin-artd/src/components/core/layouts/art-header-bar/widget/ArtUserMenu.vue @@ -84,7 +84,7 @@ */ const clearCache = (): void => { userStore.clearCache() - ElMessage.success('清理缓存成功') + ElMessage.success(t('uiMsg.clearCacheSuccess')) } /** diff --git a/saiadmin-artd/src/components/sai/sa-export/index.vue b/saiadmin-artd/src/components/sai/sa-export/index.vue index 09da6c8..cb0928a 100644 --- a/saiadmin-artd/src/components/sai/sa-export/index.vue +++ b/saiadmin-artd/src/components/sai/sa-export/index.vue @@ -14,6 +14,7 @@ import { ElMessage, ElMessageBox } from 'element-plus' import axios from 'axios' import { useUserStore } from '@/store/modules/user' + import { $t } from '@/locales' defineOptions({ name: 'SaExport' }) @@ -42,18 +43,18 @@ const handleExport = async () => { if (loading.value) return if (!props.url) { - ElMessage.error('未配置导出接口') + ElMessage.error($t('uiMsg.exportNotConfigured')) return } let finalFileName = props.fileName try { - const { value } = await ElMessageBox.prompt('请输入导出文件名称', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', + const { value } = await ElMessageBox.prompt($t('uiMsg.exportPromptFileName'), $t('uiMsg.titlePrompt'), { + confirmButtonText: $t('uiMsg.btnOk'), + cancelButtonText: $t('uiMsg.btnCancel'), inputValue: props.fileName, - inputValidator: (val) => !!val.trim() || '文件名不能为空' + inputValidator: (val) => !!val.trim() || $t('uiMsg.exportFileNameRequired') }) finalFileName = value } catch { @@ -87,10 +88,10 @@ reader.onload = () => { try { const result = JSON.parse(reader.result as string) - ElMessage.error(result.msg || '导出失败') + ElMessage.error(result.msg || $t('uiMsg.exportFail')) emit('error', result) } catch (e) { - ElMessage.error('导出失败') + ElMessage.error($t('uiMsg.exportFail')) emit('error', e) } } @@ -108,11 +109,11 @@ document.body.removeChild(link) URL.revokeObjectURL(url) - ElMessage.success('导出成功') + ElMessage.success($t('uiMsg.exportSuccess')) emit('success') } catch (error: any) { console.error(error) - ElMessage.error(error.message || '导出失败') + ElMessage.error(error.message || $t('uiMsg.exportFail')) emit('error', error) } finally { loading.value = false diff --git a/saiadmin-artd/src/composables/useSaiAdmin.ts b/saiadmin-artd/src/composables/useSaiAdmin.ts index 4a764b6..b454db0 100644 --- a/saiadmin-artd/src/composables/useSaiAdmin.ts +++ b/saiadmin-artd/src/composables/useSaiAdmin.ts @@ -1,5 +1,6 @@ import { ref, nextTick } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' +import { $t } from '@/locales' /** * SaiAdmin Composable @@ -39,13 +40,13 @@ export function useSaiAdmin() { apiFn: (params: any) => Promise, callback?: () => void ): void => { - ElMessageBox.confirm(`确定要删除该数据吗?`, '删除数据', { - confirmButtonText: '确定', - cancelButtonText: '取消', + ElMessageBox.confirm($t('uiMsg.deleteConfirmSingle'), $t('uiMsg.titleDelete'), { + confirmButtonText: $t('uiMsg.btnOk'), + cancelButtonText: $t('uiMsg.btnCancel'), type: 'error' }).then(() => { apiFn({ ids: [row.id] }).then(() => { - ElMessage.success('删除成功') + ElMessage.success($t('uiMsg.deleteSuccess')) if (callback) callback() }) }) @@ -57,20 +58,20 @@ export function useSaiAdmin() { callback?: () => void ): void => { if (selectedRows.value.length === 0) { - ElMessage.warning('请选择要删除的行') + ElMessage.warning($t('uiMsg.selectRowsToDelete')) return } ElMessageBox.confirm( - `确定要删除选中的 ${selectedRows.value.length} 条数据吗?`, - '删除选中数据', + $t('uiMsg.deleteConfirmSelected', { n: selectedRows.value.length }), + $t('uiMsg.titleDeleteSelected'), { - confirmButtonText: '确定', - cancelButtonText: '取消', + confirmButtonText: $t('uiMsg.btnOk'), + cancelButtonText: $t('uiMsg.btnCancel'), type: 'error' } ).then(() => { apiFn({ ids: selectedRows.value.map((row) => row.id) }).then(() => { - ElMessage.success('删除成功') + ElMessage.success($t('uiMsg.deleteSuccess')) if (callback) callback() selectedRows.value = [] }) diff --git a/saiadmin-artd/src/locales/index.ts b/saiadmin-artd/src/locales/index.ts index 36c2648..c1b7974 100644 --- a/saiadmin-artd/src/locales/index.ts +++ b/saiadmin-artd/src/locales/index.ts @@ -111,7 +111,7 @@ const i18n: I18n = createI18n(i18nOptions) * 翻译函数类型 */ interface Translation { - (key: string): string + (key: string, named?: Record): string } /** diff --git a/saiadmin-artd/src/locales/langs/en.json b/saiadmin-artd/src/locales/langs/en.json index d70b3fa..a218a42 100644 --- a/saiadmin-artd/src/locales/langs/en.json +++ b/saiadmin-artd/src/locales/langs/en.json @@ -39,6 +39,46 @@ "confirm": "Confirm", "logOutTips": "Do you want to log out?" }, + "uiMsg": { + "titlePrompt": "Prompt", + "titleDelete": "Delete", + "titleDeleteSelected": "Delete selected", + "btnOk": "Confirm", + "btnCancel": "Cancel", + "deleteConfirmSingle": "Are you sure you want to delete this item?", + "deleteConfirmSelected": "Are you sure you want to delete the selected {n} items?", + "deleteSuccess": "Deleted", + "operationSuccess": "Success", + "selectRowsToDelete": "Please select rows to delete", + "selectAtLeastOne": "Please select at least one item", + "clearCacheSuccess": "Cache cleared", + "copySuccess": "Copied", + "copyFail": "Copy failed, please copy manually", + "uploadSuccess": "Uploaded", + "uploadFail": "Upload failed", + "downloadTemplateFail": "Failed to download template", + "importSuccess": "Imported", + "importFail": "Import failed", + "exportFail": "Export failed", + "exportSuccess": "Exported" + , + "exportNotConfigured": "Export API is not configured", + "exportPromptFileName": "Please enter export file name", + "exportFileNameRequired": "File name is required", + "clearCacheSelect": "Please select a cache to clear", + "clearCacheTitle": "Clear selected cache", + "clearCacheConfirmByTag": "Are you sure you want to clear cache for tag: {tag}?" + , + "saipackageWebBuildTitle": "Frontend build & publish", + "saipackageWebBuildConfirm": "Rebuild frontend and publish the project?", + "saipackageWebBuildSuccess": "Frontend built and published", + "saipackageFrontendDepsTitle": "Frontend dependencies", + "saipackageFrontendDepsConfirm": "Update frontend Node dependencies?", + "saipackageFrontendDepsSuccess": "Frontend dependencies updated", + "saipackageComposerTitle": "Composer dependencies", + "saipackageComposerConfirm": "Update backend Composer packages?", + "saipackageComposerSuccess": "Composer packages updated" + }, "form": { "placeholderInput": "Please enter", "placeholderSelect": "Please select", diff --git a/saiadmin-artd/src/locales/langs/en/dice/play_record_test.json b/saiadmin-artd/src/locales/langs/en/dice/play_record_test.json index 2c44fd5..abc9dab 100644 --- a/saiadmin-artd/src/locales/langs/en/dice/play_record_test.json +++ b/saiadmin-artd/src/locales/langs/en/dice/play_record_test.json @@ -67,5 +67,10 @@ "ruleStatusRequired": "Status is required", "addSuccess": "Added successfully", "editSuccess": "Updated successfully" + }, + "ui": { + "clearAllConfirm": "Are you sure you want to clear all player draw test data?", + "clearAllSuccess": "All test data cleared", + "clearAllFail": "Clear failed" } } diff --git a/saiadmin-artd/src/locales/langs/en/system/user.json b/saiadmin-artd/src/locales/langs/en/system/user.json index af74aa9..3a87487 100644 --- a/saiadmin-artd/src/locales/langs/en/system/user.json +++ b/saiadmin-artd/src/locales/langs/en/system/user.json @@ -47,5 +47,11 @@ "ruleRoleRequired": "Please select role", "addSuccess": "Added successfully", "editSuccess": "Updated successfully" + }, + "ui": { + "promptNewPassword": "Please enter a new password", + "passwordLengthError": "Password length must be between 6 and 16", + "passwordChanged": "Password updated", + "clearCacheConfirm": "Are you sure you want to clear cache?" } } diff --git a/saiadmin-artd/src/locales/langs/en/tool/code.json b/saiadmin-artd/src/locales/langs/en/tool/code.json index 9dc4cae..2d92d23 100644 --- a/saiadmin-artd/src/locales/langs/en/tool/code.json +++ b/saiadmin-artd/src/locales/langs/en/tool/code.json @@ -16,5 +16,16 @@ "tplCategory": "Gen Type", "updateTime": "Update Time", "createTime": "Create Time" + }, + "ui": { + "generating": "Generating code package, please wait...", + "generateSuccess": "Code generated, downloading...", + "downloadFail": "Download failed", + "syncConfirm": "Sync will overwrite the configured table structure. Continue?", + "syncSuccess": "Synced", + "generateToProjectConfirm": "Generate-to-project will overwrite existing files. Continue?", + "generateToProjectSuccess": "Generated to project", + "loadSuccess": "Loaded", + "copyToClipboard": "Code copied to clipboard" } } diff --git a/saiadmin-artd/src/locales/langs/en/tool/crontab.json b/saiadmin-artd/src/locales/langs/en/tool/crontab.json index ca7fb4a..3366a10 100644 --- a/saiadmin-artd/src/locales/langs/en/tool/crontab.json +++ b/saiadmin-artd/src/locales/langs/en/tool/crontab.json @@ -58,5 +58,11 @@ "ruleTargetRequired": "Target is required", "addSuccess": "Added successfully", "editSuccess": "Updated successfully" + }, + "ui": { + "runTitle": "Run Task", + "runConfirm": "Are you sure you want to run task [{name}]?", + "runSuccess": "Task started", + "selectTaskFirst": "Please select a task first" } } diff --git a/saiadmin-artd/src/locales/langs/zh.json b/saiadmin-artd/src/locales/langs/zh.json index 0a8a99f..9aa7403 100644 --- a/saiadmin-artd/src/locales/langs/zh.json +++ b/saiadmin-artd/src/locales/langs/zh.json @@ -39,6 +39,46 @@ "confirm": "确定", "logOutTips": "您是否要退出登录?" }, + "uiMsg": { + "titlePrompt": "提示", + "titleDelete": "删除数据", + "titleDeleteSelected": "删除选中数据", + "btnOk": "确定", + "btnCancel": "取消", + "deleteConfirmSingle": "确定要删除该数据吗?", + "deleteConfirmSelected": "确定要删除选中的 {n} 条数据吗?", + "deleteSuccess": "删除成功", + "operationSuccess": "操作成功", + "selectRowsToDelete": "请选择要删除的行", + "selectAtLeastOne": "至少要选择一条数据", + "clearCacheSuccess": "清理缓存成功", + "copySuccess": "复制成功", + "copyFail": "复制失败,请手动复制", + "uploadSuccess": "上传成功", + "uploadFail": "上传失败", + "downloadTemplateFail": "下载模板失败", + "importSuccess": "导入成功", + "importFail": "导入失败", + "exportFail": "导出失败", + "exportSuccess": "导出成功" + , + "exportNotConfigured": "未配置导出接口", + "exportPromptFileName": "请输入导出文件名称", + "exportFileNameRequired": "文件名不能为空", + "clearCacheSelect": "请选择要清理的缓存", + "clearCacheTitle": "清理选中缓存", + "clearCacheConfirmByTag": "确定要清理标签:【{tag}】的缓存吗?" + , + "saipackageWebBuildTitle": "前端打包发布", + "saipackageWebBuildConfirm": "确认重新打包前端并发布项目吗?", + "saipackageWebBuildSuccess": "前端打包发布成功", + "saipackageFrontendDepsTitle": "前端依赖更新", + "saipackageFrontendDepsConfirm": "确认更新前端Node依赖吗?", + "saipackageFrontendDepsSuccess": "前端依赖更新成功", + "saipackageComposerTitle": "composer包更新", + "saipackageComposerConfirm": "确认更新后端composer包吗?", + "saipackageComposerSuccess": "composer包更新成功" + }, "form": { "placeholderInput": "请输入", "placeholderSelect": "请选择", diff --git a/saiadmin-artd/src/locales/langs/zh/dice/play_record_test.json b/saiadmin-artd/src/locales/langs/zh/dice/play_record_test.json index 64dbb1f..bac0d6a 100644 --- a/saiadmin-artd/src/locales/langs/zh/dice/play_record_test.json +++ b/saiadmin-artd/src/locales/langs/zh/dice/play_record_test.json @@ -67,5 +67,10 @@ "ruleStatusRequired": "状态必需填写", "addSuccess": "新增成功", "editSuccess": "修改成功" + }, + "ui": { + "clearAllConfirm": "确定清空所有玩家抽奖测试数据?", + "clearAllSuccess": "已清空所有测试数据", + "clearAllFail": "清空失败" } } diff --git a/saiadmin-artd/src/locales/langs/zh/system/user.json b/saiadmin-artd/src/locales/langs/zh/system/user.json index 05725df..d605e82 100644 --- a/saiadmin-artd/src/locales/langs/zh/system/user.json +++ b/saiadmin-artd/src/locales/langs/zh/system/user.json @@ -47,5 +47,11 @@ "ruleRoleRequired": "请选择角色", "addSuccess": "新增成功", "editSuccess": "修改成功" + }, + "ui": { + "promptNewPassword": "请输入新密码", + "passwordLengthError": "密码长度在6到16之间", + "passwordChanged": "修改密码成功", + "clearCacheConfirm": "确定要清理缓存吗?" } } diff --git a/saiadmin-artd/src/locales/langs/zh/tool/code.json b/saiadmin-artd/src/locales/langs/zh/tool/code.json index e50e743..48620ee 100644 --- a/saiadmin-artd/src/locales/langs/zh/tool/code.json +++ b/saiadmin-artd/src/locales/langs/zh/tool/code.json @@ -16,5 +16,16 @@ "tplCategory": "生成类型", "updateTime": "更新时间", "createTime": "创建时间" + }, + "ui": { + "generating": "代码生成下载中,请稍后", + "generateSuccess": "代码生成成功,开始下载", + "downloadFail": "文件下载失败", + "syncConfirm": "执行同步操作将会覆盖已经设置的表结构,确定要同步吗?", + "syncSuccess": "同步成功", + "generateToProjectConfirm": "生成到项目将会覆盖原有文件,确定要生成吗?", + "generateToProjectSuccess": "生成到项目成功", + "loadSuccess": "装载成功", + "copyToClipboard": "代码已复制到剪贴板" } } diff --git a/saiadmin-artd/src/locales/langs/zh/tool/crontab.json b/saiadmin-artd/src/locales/langs/zh/tool/crontab.json index 21e829d..1005958 100644 --- a/saiadmin-artd/src/locales/langs/zh/tool/crontab.json +++ b/saiadmin-artd/src/locales/langs/zh/tool/crontab.json @@ -58,5 +58,11 @@ "ruleTargetRequired": "调用目标不能为空", "addSuccess": "新增成功", "editSuccess": "修改成功" + }, + "ui": { + "runTitle": "运行任务", + "runConfirm": "确定要运行任务【{name}】吗?", + "runSuccess": "任务运行成功", + "selectTaskFirst": "请先选择一个任务" } } diff --git a/saiadmin-artd/src/views/plugin/dice/play_record_test/index/index.vue b/saiadmin-artd/src/views/plugin/dice/play_record_test/index/index.vue index 2373a87..1d0c573 100644 --- a/saiadmin-artd/src/views/plugin/dice/play_record_test/index/index.vue +++ b/saiadmin-artd/src/views/plugin/dice/play_record_test/index/index.vue @@ -208,15 +208,15 @@ const handleClearAll = async () => { try { - await ElMessageBox.confirm('确定清空所有玩家抽奖测试数据?', '提示', { + await ElMessageBox.confirm(t('page.ui.clearAllConfirm'), t('uiMsg.titlePrompt'), { type: 'warning' }) await api.clearAll() - ElMessage.success('已清空所有测试数据') + ElMessage.success(t('page.ui.clearAllSuccess')) getData() } catch (e: any) { if (e !== 'cancel') { - ElMessage.error(e?.message || '清空失败') + ElMessage.error(e?.message || t('page.ui.clearAllFail')) } } } diff --git a/saiadmin-artd/src/views/plugin/saipackage/install/terminal.vue b/saiadmin-artd/src/views/plugin/saipackage/install/terminal.vue index 7dd2873..040e4a6 100644 --- a/saiadmin-artd/src/views/plugin/saipackage/install/terminal.vue +++ b/saiadmin-artd/src/views/plugin/saipackage/install/terminal.vue @@ -143,6 +143,7 @@ import { ref } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' import { useTerminalStore, TaskStatus } from '../store/terminal' + import { $t } from '@/locales' const emit = defineEmits<{ (e: 'success'): void @@ -157,51 +158,51 @@ } const webBuild = () => { - ElMessageBox.confirm('确认重新打包前端并发布项目吗?', '前端打包发布', { - confirmButtonText: '确定', - cancelButtonText: '取消', + ElMessageBox.confirm($t('uiMsg.saipackageWebBuildConfirm'), $t('uiMsg.saipackageWebBuildTitle'), { + confirmButtonText: $t('uiMsg.btnOk'), + cancelButtonText: $t('uiMsg.btnCancel'), type: 'warning' }).then(() => { terminal.addNodeTask('web-build', '', () => { - ElMessage.success('前端打包发布成功') + ElMessage.success($t('uiMsg.saipackageWebBuildSuccess')) }) }) } const handleFronted = () => { - ElMessageBox.confirm('确认更新前端Node依赖吗?', '前端依赖更新', { - confirmButtonText: '确定', - cancelButtonText: '取消', + ElMessageBox.confirm($t('uiMsg.saipackageFrontendDepsConfirm'), $t('uiMsg.saipackageFrontendDepsTitle'), { + confirmButtonText: $t('uiMsg.btnOk'), + cancelButtonText: $t('uiMsg.btnCancel'), type: 'warning' }).then(() => { terminal.addNodeTask('web-install', '', () => { - ElMessage.success('前端依赖更新成功') + ElMessage.success($t('uiMsg.saipackageFrontendDepsSuccess')) }) }) } const handleBackend = () => { - ElMessageBox.confirm('确认更新后端composer包吗?', 'composer包更新', { - confirmButtonText: '确定', - cancelButtonText: '取消', + ElMessageBox.confirm($t('uiMsg.saipackageComposerConfirm'), $t('uiMsg.saipackageComposerTitle'), { + confirmButtonText: $t('uiMsg.btnOk'), + cancelButtonText: $t('uiMsg.btnCancel'), type: 'warning' }).then(() => { terminal.addTask('composer.update', '', () => { - ElMessage.success('composer包更新成功') + ElMessage.success($t('uiMsg.saipackageComposerSuccess')) }) }) } const frontInstall = (extend = '') => { terminal.addNodeTask('web-install', extend, () => { - ElMessage.success('前端依赖更新成功') + ElMessage.success($t('uiMsg.saipackageFrontendDepsSuccess')) emit('success') }) } const backendInstall = (extend = '') => { terminal.addTask('composer.update', extend, () => { - ElMessage.success('composer包更新成功') + ElMessage.success($t('uiMsg.saipackageComposerSuccess')) setTimeout(() => { emit('success') }, 500) diff --git a/saiadmin-artd/src/views/safeguard/cache/index.vue b/saiadmin-artd/src/views/safeguard/cache/index.vue index fe4257e..8959b20 100644 --- a/saiadmin-artd/src/views/safeguard/cache/index.vue +++ b/saiadmin-artd/src/views/safeguard/cache/index.vue @@ -186,6 +186,7 @@ import api from '@/api/safeguard/server' import { onMounted } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' + import { $t } from '@/locales' const loading = ref(false) @@ -219,16 +220,16 @@ */ const handleClearCache = (tag: string): void => { if (!tag) { - ElMessage.warning('请选择要清理的缓存') + ElMessage.warning($t('uiMsg.clearCacheSelect')) return } - ElMessageBox.confirm(`确定要清理标签:【${tag}】的缓存吗?`, '清理选中缓存', { - confirmButtonText: '确定', - cancelButtonText: '取消', + ElMessageBox.confirm($t('uiMsg.clearCacheConfirmByTag', { tag }), $t('uiMsg.clearCacheTitle'), { + confirmButtonText: $t('uiMsg.btnOk'), + cancelButtonText: $t('uiMsg.btnCancel'), type: 'error' }).then(() => { api.clear({ tag }).then(() => { - ElMessage.success('操作成功') + ElMessage.success($t('uiMsg.operationSuccess')) updateCacheInfo() }) }) diff --git a/saiadmin-artd/src/views/safeguard/database/index.vue b/saiadmin-artd/src/views/safeguard/database/index.vue index 5c0752e..b94eb51 100644 --- a/saiadmin-artd/src/views/safeguard/database/index.vue +++ b/saiadmin-artd/src/views/safeguard/database/index.vue @@ -84,7 +84,8 @@ diff --git a/saiadmin-artd/src/views/tool/code/index.vue b/saiadmin-artd/src/views/tool/code/index.vue index a6c4e43..8eacb63 100644 --- a/saiadmin-artd/src/views/tool/code/index.vue +++ b/saiadmin-artd/src/views/tool/code/index.vue @@ -133,6 +133,7 @@ import { useTable } from '@/hooks/core/useTable' import { useSaiAdmin } from '@/composables/useSaiAdmin' import { ElMessage, ElMessageBox } from 'element-plus' + import { $t } from '@/locales' import api from '@/api/tool/generate' import { downloadFile } from '@/utils/tool' @@ -211,15 +212,15 @@ * 生成代码下载 */ const generateCode = async (ids: number | string) => { - ElMessage.info('代码生成下载中,请稍后') + ElMessage.info($t('page.ui.generating')) const response = await api.generateCode({ ids: ids.toString().split(',') }) if (response) { downloadFile(response, 'code.zip') - ElMessage.success('代码生成成功,开始下载') + ElMessage.success($t('page.ui.generateSuccess')) } else { - ElMessage.error('文件下载失败') + ElMessage.error($t('page.ui.downloadFail')) } } @@ -227,13 +228,13 @@ * 同步表结构 */ const syncTable = async (id: number) => { - ElMessageBox.confirm('执行同步操作将会覆盖已经设置的表结构,确定要同步吗?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', + ElMessageBox.confirm($t('page.ui.syncConfirm'), $t('uiMsg.titlePrompt'), { + confirmButtonText: $t('uiMsg.btnOk'), + cancelButtonText: $t('uiMsg.btnCancel'), type: 'warning' }).then(() => { api.async({ id }).then(() => { - ElMessage.success('同步成功') + ElMessage.success($t('page.ui.syncSuccess')) }) }) } @@ -242,13 +243,13 @@ * 生成到项目 */ const generateFile = async (id: number) => { - ElMessageBox.confirm('生成到项目将会覆盖原有文件,确定要生成吗?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', + ElMessageBox.confirm($t('page.ui.generateToProjectConfirm'), $t('uiMsg.titlePrompt'), { + confirmButtonText: $t('uiMsg.btnOk'), + cancelButtonText: $t('uiMsg.btnCancel'), type: 'warning' }).then(() => { api.generateFile({ id }).then(() => { - ElMessage.success('生成到项目成功') + ElMessage.success($t('page.ui.generateToProjectSuccess')) }) }) } @@ -258,7 +259,7 @@ */ const batchGenerate = () => { if (selectedRows.value.length === 0) { - ElMessage.error('至少要选择一条数据') + ElMessage.error($t('uiMsg.selectAtLeastOne')) return } generateCode(selectedRows.value.map((item: any) => item.id).join(',')) diff --git a/saiadmin-artd/src/views/tool/crontab/index.vue b/saiadmin-artd/src/views/tool/crontab/index.vue index dd87fd8..d17c0fe 100644 --- a/saiadmin-artd/src/views/tool/crontab/index.vue +++ b/saiadmin-artd/src/views/tool/crontab/index.vue @@ -79,6 +79,7 @@ import { useTable } from '@/hooks/core/useTable' import { useSaiAdmin } from '@/composables/useSaiAdmin' import { ElMessage, ElMessageBox } from 'element-plus' + import { $t } from '@/locales' import api from '@/api/tool/crontab' import TableSearch from './modules/table-search.vue' import EditDialog from './modules/edit-dialog.vue' @@ -146,13 +147,13 @@ // 运行任务 const handleRun = (row: any) => { - ElMessageBox.confirm(`确定要运行任务【${row.name}】吗?`, '运行任务', { - confirmButtonText: '确定', - cancelButtonText: '取消', + ElMessageBox.confirm($t('page.ui.runConfirm', { name: row.name }), $t('page.ui.runTitle'), { + confirmButtonText: $t('uiMsg.btnOk'), + cancelButtonText: $t('uiMsg.btnCancel'), type: 'warning' }).then(() => { api.run({ id: row.id }).then(() => { - ElMessage.success('任务运行成功') + ElMessage.success($t('page.ui.runSuccess')) refreshData() }) }) diff --git a/saiadmin-artd/src/views/tool/crontab/modules/log-list.vue b/saiadmin-artd/src/views/tool/crontab/modules/log-list.vue index 5b9348e..43b9a4b 100644 --- a/saiadmin-artd/src/views/tool/crontab/modules/log-list.vue +++ b/saiadmin-artd/src/views/tool/crontab/modules/log-list.vue @@ -76,6 +76,7 @@