From e223f50982719019539f257bb681c70c1f82287a Mon Sep 17 00:00:00 2001 From: zhangzq Date: Sun, 4 Jan 2026 17:18:24 +0800 Subject: [PATCH] =?UTF-8?q?add:=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lms/nladmin-ui/package.json | 1 + lms/nladmin-ui/src/components/Crud/crud.js | 36 ++++++++++------------ lms/nladmin-ui/src/router/routers.js | 10 +++--- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/lms/nladmin-ui/package.json b/lms/nladmin-ui/package.json index 47d2ec5..5d4e08d 100644 --- a/lms/nladmin-ui/package.json +++ b/lms/nladmin-ui/package.json @@ -62,6 +62,7 @@ "path-to-regexp": "2.4.0", "qrcodejs2": "0.0.2", "qs": "^6.9.1", + "vue-i18n": "^8.27.0", "screenfull": "4.2.0", "sortablejs": "1.8.4", "throttle-debounce": "^5.0.0", diff --git a/lms/nladmin-ui/src/components/Crud/crud.js b/lms/nladmin-ui/src/components/Crud/crud.js index 50ed0b5..3025671 100644 --- a/lms/nladmin-ui/src/components/Crud/crud.js +++ b/lms/nladmin-ui/src/components/Crud/crud.js @@ -1,6 +1,7 @@ import { download, initData } from '@/api/data' import { downloadFile, parseTime } from '@/utils/index' import Vue from 'vue' +import i18n from '@/i18n' /** * CRUD配置 @@ -50,7 +51,7 @@ function CRUD(options) { // 主页操作栏显示哪些按钮 optShow: { add: true, - edit: true, + edit: false, del: true, download: false, reset: true @@ -84,14 +85,14 @@ function CRUD(options) { }, // 标题 get title() { - return this.add > CRUD.STATUS.NORMAL ? `新增${crud.title}` : this.edit > CRUD.STATUS.NORMAL ? `编辑${crud.title}` : this.view > CRUD.STATUS.NORMAL ? `${crud.title}详情` : crud.title + return this.add > CRUD.STATUS.NORMAL ? i18n.t('common.Create') + ' ' + i18n.t(`${crud.title}`) : this.edit > CRUD.STATUS.NORMAL ? i18n.t('common.Editors') + ' ' + i18n.t(`${crud.title}`) : crud.title } }, msg: { - submit: '提交成功', - add: '新增成功', - edit: '编辑成功', - del: '删除成功' + submit: i18n.t('common.submit'), + add: i18n.t('common.add'), + edit: i18n.t('common.edit'), + del: i18n.t('common.del') }, page: { // 页码 @@ -160,6 +161,16 @@ function CRUD(options) { }) }) }, + /** + * 格式化是否1-是,0-否 + */ + formatIsOrNot(row, column) { + if (!row[column.property]) { + return '否' + } + return row[column.property] == '1' ? '是' : '否' + }, + /** * 格式化数据,保留0位小数 */ @@ -169,15 +180,6 @@ function CRUD(options) { } return parseFloat(row[column.property]).toFixed(0) }, - /** - * 格式化数据,保留1位小数 - */ - formatNum1(row, column) { - if (!row[column.property]) { - return 0 - } - return parseFloat(row[column.property]).toFixed(1) - }, /** * 格式化数据,保留2位小数 */ @@ -317,13 +319,9 @@ function CRUD(options) { * 提交新增/编辑 */ submitCU(formName) { - debugger if (formName instanceof PointerEvent) { formName = 'form' } - if (typeof formName !== 'string') { - formName = 'form' - } if (!callVmHook(crud, CRUD.HOOK.beforeValidateCU)) { return } diff --git a/lms/nladmin-ui/src/router/routers.js b/lms/nladmin-ui/src/router/routers.js index 07be08d..84050cf 100644 --- a/lms/nladmin-ui/src/router/routers.js +++ b/lms/nladmin-ui/src/router/routers.js @@ -1,6 +1,7 @@ import Vue from 'vue' import Router from 'vue-router' import Layout from '../layout/index' +import i18n from '@/i18n' Vue.use(Router) @@ -39,9 +40,10 @@ export const constantRouterMap = [ children: [ { path: 'dashboard', - component: (resolve) => require(['@/views/monitor/server/index'], resolve), + component: (resolve) => require(['@/views/system/redis/index'], resolve), name: 'Dashboard', - meta: { title: '首页', icon: 'index', affix: true, noCache: true } + meta: { title: i18n.t('common.home'), icon: 'index', affix: true, noCache: true } + // meta: { title: '首页', icon: 'index', affix: true, noCache: true } } ] }, @@ -54,8 +56,8 @@ export const constantRouterMap = [ { path: 'center', component: (resolve) => require(['@/views/system/user/center'], resolve), - name: '个人中心', - meta: { title: '个人中心' } + name: i18n.t('common.Personal_center'), + meta: { title: i18n.t('common.Personal_center') } } ] }