调整:国际化

This commit is contained in:
fan 2019-08-15 10:47:59 +08:00
parent 1b42eec5e3
commit 9787c8aaeb
2 changed files with 34 additions and 34 deletions

View File

@ -12,9 +12,9 @@
</el-card> </el-card>
<div class="draft"> <div class="draft">
<el-button-group> <el-button-group>
<el-button v-if="isAdd" type="primary" style="margin-left: 120px" @click="create">创建</el-button> <el-button v-if="isAdd" type="primary" style="margin-left: 120px" @click="create">{{$t('global.create')}}</el-button>
<el-button v-if="isEdit" type="warning" style="margin-left: 120px" @click="update">更新</el-button> <el-button v-if="isEdit" type="warning" style="margin-left: 120px" @click="update">{{$t('global.update')}}</el-button>
<el-button type="primary" @click="turnback">返回</el-button> <el-button type="primary" @click="turnback">{{$t('global.return')}}</el-button>
</el-button-group> </el-button-group>
</div> </div>
</div> </div>
@ -48,10 +48,10 @@ export default {
computed: { computed: {
title() { title() {
if (this.isAdd) { if (this.isAdd) {
return '添加地图皮肤'; return this.$t('map.addMapSkin');
} }
if (this.isEdit) { if (this.isEdit) {
return '更新地图皮肤'; return this.$t('map.updateMapSkin');
} }
return ''; return '';
}, },
@ -68,10 +68,10 @@ export default {
const form = { const form = {
labelWidth: '140px', labelWidth: '140px',
items: [ items: [
{ prop: 'code', label: '皮肤编码', type: 'text', required: false, disabled: this.isDisabled }, { prop: 'code', label: this.$t('map.skinCoding'), type: 'text', required: false, disabled: this.isDisabled },
{ prop: 'name', label: '皮肤名称', type: 'text', required: false }, { prop: 'name', label: this.$t('map.skinDesignation'), type: 'text', required: false },
{ prop: 'origin', label: '原点坐标', type: 'point', required: false }, { prop: 'origin', label: this.$t('map.coordinatesOrigin'), type: 'point', required: false },
{ prop: 'scaling', label: '缩放比例', type: 'number', required: false, message: `(缩放比例最大为8级)` } { prop: 'scaling', label: this.$t('map.scaling'), type: 'number', required: false, message: this.$t('map.maxScaling') }
] ]
}; };
return form; return form;
@ -80,22 +80,22 @@ export default {
rules() { rules() {
const baseRules = { const baseRules = {
code: [ code: [
{ required: true, message: '请输入皮肤编码', trigger: 'blur' } { required: true, message: this.$t('map.skinCodingInput'), trigger: 'blur' }
], ],
name: [ name: [
{ required: true, message: '请输入皮肤名称', trigger: 'blur' } { required: true, message: this.$t('map.skinDesignationInput'), trigger: 'blur' }
], ],
origin: [ origin: [
{ required: true, message: '请输入原点坐标', trigger: 'blur' } { required: true, message: this.$t('map.coordinatesOriginInput'), trigger: 'blur' }
], ],
scaling: [ scaling: [
{ required: true, message: '请输入缩放比例', trigger: 'blur' }, { required: true, message: this.$t('map.scalingInput'), trigger: 'blur' },
{ {
validator(rule, value, callback) { validator(rule, value, callback) {
if (Number(value) >= 1 && Number(value) <= 8) { if (Number(value) >= 1 && Number(value) <= 8) {
callback(); callback();
} else { } else {
callback(new Error('请输入有效的缩放比例')); callback(new Error(this.$t('map.scalingInputPrompt')));
} }
}, },
trigger: 'blur' trigger: 'blur'
@ -146,12 +146,12 @@ export default {
querySkinCodeExistByCode(this.formModel.code).then(resp => { querySkinCodeExistByCode(this.formModel.code).then(resp => {
addSkinCode(this.formModel).then(response => { addSkinCode(this.formModel).then(response => {
this.turnback(); this.turnback();
this.$message.success('创建成功'); this.$message.success(this.$t('tip.creatingSuccessful'));
}).catch(() => { }).catch(() => {
this.$messageBox('创建失败'); this.$messageBox(this.$t('tip.creatingFailed'));
}); });
}).catch(() => { }).catch(() => {
this.$messageBox('地图皮肤编码已存在'); this.$messageBox(this.$t('map.skinCodingExist'));
}); });
}); });
}, },
@ -160,9 +160,9 @@ export default {
this.$refs.dataform.validateForm(() => { this.$refs.dataform.validateForm(() => {
updateSkinCode(this.formModel).then(response => { updateSkinCode(this.formModel).then(response => {
this.turnback(); this.turnback();
this.$message.success('更新成功'); this.$message.success(this.$t('tip.updateSuccessfully'));
}).catch(() => { }).catch(() => {
this.$messageBox('更新失败'); this.$messageBox(this.$t('tip.updateFailed'));
}); });
}); });
}, },

View File

@ -25,11 +25,11 @@ export default {
queryObject: { queryObject: {
name: { name: {
type: 'text', type: 'text',
label: '皮肤名称' label: this.$t('map.skinDesignation')
}, },
code: { code: {
type: 'text', type: 'text',
label: '皮肤编码' label: this.$t('map.skinCoding')
} }
} }
}, },
@ -39,36 +39,36 @@ export default {
indexShow: true, indexShow: true,
columns: [ columns: [
{ {
title: '皮肤编码', title: this.$t('map.skinCoding'),
prop: 'code' prop: 'code'
}, },
{ {
title: '皮肤名称', title: this.$t('map.skinDesignation'),
prop: 'name' prop: 'name'
}, },
{ {
title: '原点坐标', title: this.$t('map.coordinatesOrigin'),
prop: 'origin', prop: 'origin',
type: 'tag', type: 'tag',
columnValue: (row) => { return `(${row.origin.x}, ${row.origin.y})`; }, columnValue: (row) => { return `(${row.origin.x}, ${row.origin.y})`; },
tagType: () => { return ''; } tagType: () => { return ''; }
}, },
{ {
title: '缩放比例', title: this.$t('map.scalingColon'),
prop: 'scaling' prop: 'scaling'
}, },
{ {
type: 'button', type: 'button',
title: '操作', title: this.$t('global.operate'),
width: '250', width: '250',
buttons: [ buttons: [
{ {
name: '编辑', name: this.$t('global.edit'),
handleClick: this.handleEdit, handleClick: this.handleEdit,
type: '' type: ''
}, },
{ {
name: '删除', name: this.$t('global.delete'),
handleClick: this.handleDelete, handleClick: this.handleDelete,
type: 'danger' type: 'danger'
} }
@ -76,7 +76,7 @@ export default {
} }
], ],
actions: [ actions: [
{ text: '新增', handler: this.handleAdd } { text: this.$t('global.add'), handler: this.handleAdd }
] ]
} }
}; };
@ -103,15 +103,15 @@ export default {
this.$router.push(`${UrlConfig.map.skinCodeDraft}/edit/${row.id}`); this.$router.push(`${UrlConfig.map.skinCodeDraft}/edit/${row.id}`);
}, },
handleDelete(index, row) { handleDelete(index, row) {
this.$confirm('此操作将永久删除该皮肤, 是否继续?', '提示', { this.$confirm(this.$t('map.skinDeleteConfirmation'), this.$t('tip.hint'), {
confirmButtonText: '确定', confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: '取消', cancelButtonText: this.$t('tip.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
delSkinCode(row.id).then(() => { delSkinCode(row.id).then(() => {
this.$message.success('删除皮肤成功'); this.$message.success(this.$t('tip.skinDeleteSuccessfully'),);
}).catch(() => { }).catch(() => {
this.$messageBox('删除皮肤失败'); this.$messageBox(this.$t('tip.skinDeleteFailed'));
}); });
}).catch(() => { }).catch(() => {
}); });