调整:国际化

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

View File

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