add:国际化
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user