add:国际化

This commit is contained in:
zhangzq
2026-01-04 17:18:24 +08:00
parent cbcd26b325
commit e223f50982
3 changed files with 24 additions and 23 deletions

View File

@@ -62,6 +62,7 @@
"path-to-regexp": "2.4.0", "path-to-regexp": "2.4.0",
"qrcodejs2": "0.0.2", "qrcodejs2": "0.0.2",
"qs": "^6.9.1", "qs": "^6.9.1",
"vue-i18n": "^8.27.0",
"screenfull": "4.2.0", "screenfull": "4.2.0",
"sortablejs": "1.8.4", "sortablejs": "1.8.4",
"throttle-debounce": "^5.0.0", "throttle-debounce": "^5.0.0",

View File

@@ -1,6 +1,7 @@
import { download, initData } from '@/api/data' import { download, initData } from '@/api/data'
import { downloadFile, parseTime } from '@/utils/index' import { downloadFile, parseTime } from '@/utils/index'
import Vue from 'vue' import Vue from 'vue'
import i18n from '@/i18n'
/** /**
* CRUD配置 * CRUD配置
@@ -50,7 +51,7 @@ function CRUD(options) {
// 主页操作栏显示哪些按钮 // 主页操作栏显示哪些按钮
optShow: { optShow: {
add: true, add: true,
edit: true, edit: false,
del: true, del: true,
download: false, download: false,
reset: true reset: true
@@ -84,14 +85,14 @@ function CRUD(options) {
}, },
// 标题 // 标题
get title() { 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: { msg: {
submit: '提交成功', submit: i18n.t('common.submit'),
add: '新增成功', add: i18n.t('common.add'),
edit: '编辑成功', edit: i18n.t('common.edit'),
del: '删除成功' del: i18n.t('common.del')
}, },
page: { page: {
// 页码 // 页码
@@ -160,6 +161,16 @@ function CRUD(options) {
}) })
}) })
}, },
/**
* 格式化是否1-是0-否
*/
formatIsOrNot(row, column) {
if (!row[column.property]) {
return '否'
}
return row[column.property] == '1' ? '是' : '否'
},
/** /**
* 格式化数据保留0位小数 * 格式化数据保留0位小数
*/ */
@@ -169,15 +180,6 @@ function CRUD(options) {
} }
return parseFloat(row[column.property]).toFixed(0) 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位小数 * 格式化数据保留2位小数
*/ */
@@ -317,13 +319,9 @@ function CRUD(options) {
* 提交新增/编辑 * 提交新增/编辑
*/ */
submitCU(formName) { submitCU(formName) {
debugger
if (formName instanceof PointerEvent) { if (formName instanceof PointerEvent) {
formName = 'form' formName = 'form'
} }
if (typeof formName !== 'string') {
formName = 'form'
}
if (!callVmHook(crud, CRUD.HOOK.beforeValidateCU)) { if (!callVmHook(crud, CRUD.HOOK.beforeValidateCU)) {
return return
} }

View File

@@ -1,6 +1,7 @@
import Vue from 'vue' import Vue from 'vue'
import Router from 'vue-router' import Router from 'vue-router'
import Layout from '../layout/index' import Layout from '../layout/index'
import i18n from '@/i18n'
Vue.use(Router) Vue.use(Router)
@@ -39,9 +40,10 @@ export const constantRouterMap = [
children: [ children: [
{ {
path: 'dashboard', path: 'dashboard',
component: (resolve) => require(['@/views/monitor/server/index'], resolve), component: (resolve) => require(['@/views/system/redis/index'], resolve),
name: 'Dashboard', 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', path: 'center',
component: (resolve) => require(['@/views/system/user/center'], resolve), component: (resolve) => require(['@/views/system/user/center'], resolve),
name: '个人中心', name: i18n.t('common.Personal_center'),
meta: { title: '个人中心' } meta: { title: i18n.t('common.Personal_center') }
} }
] ]
} }