update 基本完成国际化
This commit is contained in:
@@ -110,7 +110,7 @@ import i18n from '@/i18n'
|
||||
const title = {
|
||||
detail: i18n.t('detail'),
|
||||
add: i18n.t('add'),
|
||||
edit: '编辑'
|
||||
edit: i18n.t('edit')
|
||||
}
|
||||
|
||||
// 或者也可以改造成自定义颜色:
|
||||
@@ -124,9 +124,9 @@ const btnType = {
|
||||
|
||||
const btnName = {
|
||||
// for i18n
|
||||
save: '保存',
|
||||
update: '更新',
|
||||
reset: '重置',
|
||||
save: i18n.t('save'),
|
||||
update: i18n.t('update'),
|
||||
reset: i18n.t('reset'),
|
||||
cancel: i18n.t('cancel')
|
||||
// add more...
|
||||
}
|
||||
@@ -207,7 +207,7 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
/** 计算 defaultPlaceholders */
|
||||
const prefix = '请输入'
|
||||
const prefix = i18n.t('hints.input')
|
||||
Object.entries(this.defaultNames).map(([key, value]) => {
|
||||
this.defaultPlaceholders[key] = prefix + value
|
||||
})
|
||||
@@ -251,7 +251,7 @@ export default {
|
||||
if (item.required) {
|
||||
const requiredRule = {
|
||||
required: true,
|
||||
message: '请输入必填项',
|
||||
message: i18n.t('validate.required'),
|
||||
trigger: 'change'
|
||||
}
|
||||
/** 检查是否已经存在该字段的规则 */
|
||||
@@ -296,19 +296,14 @@ export default {
|
||||
this.configs.extraComponents &&
|
||||
this.configs.extraComponents.forEach(item => {
|
||||
if (Object.hasOwn(this.dataForm, [item.name])) {
|
||||
console.log('有了!')
|
||||
return
|
||||
} else {
|
||||
console.log('新建!')
|
||||
this.$set(this.dataForm, [item.name], calDefault(item.fieldType))
|
||||
}
|
||||
|
||||
console.log('component: ', item.component)
|
||||
})
|
||||
|
||||
/** 单独设置 id */
|
||||
this.$set(this.dataForm, 'id', null)
|
||||
console.log('mounted: this.dataForm', JSON.stringify(this.dataForm))
|
||||
})
|
||||
},
|
||||
|
||||
@@ -335,7 +330,7 @@ export default {
|
||||
: this.defaultPlaceholders[opt.name]
|
||||
? this.defaultPlaceholders[opt.name]
|
||||
: opt.label
|
||||
? (opt.type === 'select' ? i18n.t('choose') : '请输入') + opt.label
|
||||
? (opt.type === 'select' ? i18n.t('choose') : i18n.t('hints.input')) + opt.label
|
||||
: null
|
||||
|
||||
// : opt.type === 'select'
|
||||
@@ -402,7 +397,6 @@ export default {
|
||||
this.fileForm[file.typeCode] = [file.id]
|
||||
}
|
||||
})
|
||||
console.log('after分流:', this.fileList)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -411,12 +405,12 @@ export default {
|
||||
if (this.shouldWait)
|
||||
this.shouldWait.then(() => {
|
||||
if (this.tempForm.length) {
|
||||
console.log('create new, tempform', JSON.stringify(this.tempForm.length))
|
||||
// console.log('create new, tempform', JSON.stringify(this.tempForm.length))
|
||||
this.tempForm.forEach(item => {
|
||||
console.log('item data', item.data)
|
||||
// console.log('item data', item.data)
|
||||
this.dataForm[item.name] = item.data
|
||||
})
|
||||
console.log('create new, dataform', JSON.stringify(this.dataForm))
|
||||
// console.log('create new, dataform', JSON.stringify(this.dataForm))
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -427,9 +421,7 @@ export default {
|
||||
this.$emit('select-change', { name, id })
|
||||
},
|
||||
|
||||
handleEditorReady(val) {
|
||||
console.log('editor rready..', val)
|
||||
},
|
||||
handleEditorReady(val) {},
|
||||
|
||||
handleClick(btn) {
|
||||
/** 提取url */
|
||||
@@ -448,7 +440,6 @@ export default {
|
||||
if (valid) {
|
||||
/** 对于文件上传的单独处理(合并处理) */
|
||||
if (Object.keys(this.fileForm).length) {
|
||||
console.log('fileform 有值')
|
||||
// LABEL: FILE_RELATED
|
||||
let fileIds = []
|
||||
for (const [key, item] of Object.entries(this.fileForm)) {
|
||||
@@ -471,7 +462,8 @@ export default {
|
||||
.then(({ data: res }) => {
|
||||
if (res && res.code === 0) {
|
||||
this.$message({
|
||||
message: btn.name === 'save' ? '添加成功!' : '更新成功!',
|
||||
message: i18n.t('prompt.success'),
|
||||
// message: btn.name === 'save' ? i18n.t('prompt.success') : '更新成功!',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
@@ -512,7 +504,7 @@ export default {
|
||||
|
||||
// LABEL: FILE_RELATED
|
||||
handleUploadListUpdate(filelist, typeCode = 'DefaultTypeCode') {
|
||||
console.log('before handleUploadListUpdate(): ', JSON.parse(JSON.stringify(this.fileForm)))
|
||||
// console.log('before handleUploadListUpdate(): ', JSON.parse(JSON.stringify(this.fileForm)))
|
||||
// 设备类型 typeCode: EquipmentTypeFile
|
||||
// 设备信息 typeCode: EquipmentInfoFile | EquipmentInfoImage
|
||||
|
||||
@@ -529,7 +521,7 @@ export default {
|
||||
typeCode,
|
||||
filelist.map(item => item.id)
|
||||
)
|
||||
console.log('after handleUploadListUpdate(): ', this.fileForm)
|
||||
// console.log('after handleUploadListUpdate(): ', this.fileForm)
|
||||
},
|
||||
|
||||
handleClose() {
|
||||
|
||||
Reference in New Issue
Block a user