modeling i18n

This commit is contained in:
pycook 2020-02-16 14:50:17 +08:00
parent b4de2bdb9e
commit 1484a308cf
13 changed files with 199 additions and 142 deletions

View File

@ -25,6 +25,7 @@ export default {
add: 'Add',
new: 'New',
update: 'Edit',
save: 'Save',
delete: 'Delete',
yes: 'Yes',
no: 'No',
@ -33,6 +34,7 @@ export default {
downloadTemplate: 'Download',
upload: 'Upload',
download: 'Download',
batchUpdate: 'Batch update',
displayFields: 'Display Fields'
},
tip: {
@ -53,6 +55,7 @@ export default {
noData: 'No Data',
addSuccess: 'Add successfully',
updateSuccess: 'Update successfully',
saveSuccess: 'Save successfully',
deleteSuccess: 'Delete successfully',
cancelSuccess: 'Cancel successfully',
downloading: 'Downloading ...',
@ -66,7 +69,7 @@ export default {
ci: {
batchOperate: 'Batch Operation',
confirmBatchUpdate: 'Confirm batch modification?',
batchUpdate: 'Batch update ...',
batchUpdate: 'Batch update',
batchUpdateSuccess: 'Batch update successfully',
confirmDelete: 'Confirm deleting ?',
attribute: 'Attributes',
@ -105,6 +108,9 @@ export default {
ciType: {
add: 'Add',
addAttribute: 'Add Attribute',
addAttribute1: 'Add Attribute',
moreAttribute: 'More Attributes',
bindAttribute: 'Bind Attribute',
editModel: 'Edit Model',
modelName: 'Model Name',
name: 'Name',
@ -116,6 +122,7 @@ export default {
link: 'Link',
password: 'Password',
list: 'List',
required: 'Required',
integer: 'Integer',
float: 'Float',
text: 'Text',
@ -124,6 +131,34 @@ export default {
isIt: 'Is it ',
predefinedValue: 'Predefined values',
predefinedValueTip: 'Multiple values are separated by line breaks',
defaultShow: 'Default show',
typeAttribute: 'Attribute',
typeRelation: 'Relation',
requiredCheck: 'Required check',
defaultShowAttribute: 'Default display attributes',
attributeGroup: 'Attribute grouping & sorting',
addGroup: 'Add Group',
deleteGroup: 'Delete Group',
up: 'Up',
down: 'Down',
moveSuccess: 'Move successfully',
moveFailed: 'Move Failed',
groupNameExisted: 'The group name already exists',
moreAttributeCannotSort: 'More attributes cannot be sorted. If you need to sort, add them to other groups!',
newCIType: 'New CI Type',
editCIType: 'Edit CI Type',
newRelation: 'New Relation',
sourceCIType: 'Source CI Type',
targetCIType: 'Target CI Type',
relationType: 'Relation Type',
relationViewDefinePanel: 'Relationship view definition panel',
relationViewDefinePanelTip1: 'Method 1. Right-click tree node (recommended)',
relationViewDefinePanelTip2: 'Method 2. Open the switch in the upper right corner and select the node of the tree',
newRealtionView: 'New relational view',
RealtionViewName: 'Relational view name',
RealtionViewNameRequired: 'Please enter a relational view name',
newRelationType: 'New Relation Type',
relationTypeNameRequired: 'Please enter a type name',
uniqueFlag: 'unique flag'
}
}

View File

@ -25,6 +25,7 @@ export default {
add: '新增',
new: '新建',
update: '修改',
save: '保存',
delete: '删除',
yes: '',
no: '',
@ -33,6 +34,7 @@ export default {
downloadTemplate: '下载模板',
upload: '上传',
download: '下载',
batchUpdate: '批量修改',
displayFields: '显示字段'
},
tip: {
@ -48,11 +50,12 @@ export default {
create: '创建',
clear: '清空',
modify: '修改',
unselectedAttribute: '未选属性',
selectedAttribute: '已选属性',
unselectedAttribute: '当前项',
selectedAttribute: '已选',
noData: '没数据',
addSuccess: '新增成功',
updateSuccess: '修改成功',
saveSuccess: '保存成功',
deleteSuccess: '删除成功',
cancelSuccess: '取消成功',
downloading: '正在下载 ...',
@ -105,6 +108,9 @@ export default {
ciType: {
add: '新增',
addAttribute: '新增属性',
bindAttribute: '绑定属性',
addAttribute1: '添加属性',
moreAttribute: '更多属性',
editModel: '编辑模型',
modelName: '模型名(英文)',
name: '名称',
@ -116,6 +122,7 @@ export default {
link: '链接',
password: '密码',
list: '列表',
required: '必须',
integer: '整数',
float: '浮点数',
text: '文本',
@ -124,6 +131,34 @@ export default {
isIt: '是否',
predefinedValue: '预定义值',
predefinedValueTip: '多个值使用换行分隔',
defaultShow: '默认显示',
typeAttribute: '模型属性',
typeRelation: '模型关联',
requiredCheck: '必须校验',
defaultShowAttribute: '默认显示属性',
attributeGroup: '属性分组 & 排序',
addGroup: '添加分组',
deleteGroup: '删除分组',
up: '上移',
down: '下移',
moveSuccess: '移动成功',
moveFailed: '移动出错',
groupNameExisted: '分组名称已存在',
moreAttributeCannotSort: '更多属性不能进行排序, 如需排序需添加入其他分组中!',
newCIType: '新增模型',
editCIType: '编辑模型',
newRelation: '新增关系',
sourceCIType: '源模型',
targetCIType: '目标模型',
relationType: '关联关系',
relationViewDefinePanel: '关系视图定义面板',
relationViewDefinePanelTip1: '方法1. 右键选择树节点(推荐)',
relationViewDefinePanelTip2: '方法2. 先打开右上角的开关,再选择树的节点',
newRealtionView: '新增关系视图',
RealtionViewName: '关系视图名',
RealtionViewNameRequired: '请输入 关系视图名',
newRelationType: '新增关系类型',
relationTypeNameRequired: '请输入类型名',
uniqueFlag: '唯一标识'
}
}

View File

@ -72,10 +72,10 @@
<a-divider type="vertical"/>
<a-popconfirm
title="确认删除?"
:title="$t('tip.confirmDelete')"
@confirm="handleDelete(record)"
okText=""
cancelText=""
:okText="$t('button.yes')"
:cancelText="$t('button.no')"
>
<a>{{ $t('tip.delete') }}</a>
</a-popconfirm>
@ -100,7 +100,7 @@
:render="item=>item.title"
:selectedKeys="transferSelectedKeys"
:targetKeys="transferTargetKeys"
:titles="['当前项', '已选项']"
:titles="[$t('tip.unselectedAttribute'), $t('tip.selectedAttribute')]"
:listStyle="{
height: '600px',
width: '40%',
@ -163,8 +163,8 @@ export default {
drawerVisible: false
},
batchBindAttrAction: {
btnName: '绑定属性',
drawerTitle: '绑定属性',
btnName: this.$t('ciType.bindAttribute'),
drawerTitle: this.$t('ciType.bindAttribute'),
drawerVisible: false
},
@ -191,7 +191,7 @@ export default {
},
columns: [
{
title: '名称',
title: this.$t('ciType.alias'),
dataIndex: 'alias',
sorter: false,
width: 200,
@ -210,7 +210,7 @@ export default {
}
},
{
title: '英文名',
title: this.$t('ciType.name'),
dataIndex: 'name',
sorter: false,
width: 200,
@ -229,7 +229,7 @@ export default {
}
},
{
title: '类型',
title: this.$t('ciType.type'),
dataIndex: 'value_type',
sorter: false,
width: 100,
@ -238,7 +238,7 @@ export default {
},
{
title: '唯一',
title: this.$t('ciType.unique'),
dataIndex: 'is_unique',
width: 50,
sorter: false,
@ -246,7 +246,7 @@ export default {
},
{
title: '索引',
title: this.$t('ciType.index'),
dataIndex: 'is_index',
sorter: false,
width: 50,
@ -254,7 +254,7 @@ export default {
},
{
title: '排序',
title: this.$t('ciType.sort'),
dataIndex: 'is_sortable',
sorter: false,
width: 50,
@ -262,7 +262,7 @@ export default {
},
{
title: '链接',
title: this.$t('ciType.link'),
dataIndex: 'is_link',
sorter: false,
width: 50,
@ -270,7 +270,7 @@ export default {
},
{
title: '密码',
title: this.$t('ciType.password'),
dataIndex: 'is_password',
sorter: false,
width: 50,
@ -278,7 +278,7 @@ export default {
},
{
title: '列表',
title: this.$t('ciType.list'),
dataIndex: 'is_list',
sorter: false,
width: 50,
@ -286,7 +286,7 @@ export default {
},
{
title: '必须',
title: this.$t('ciType.required'),
dataIndex: 'is_required',
sorter: false,
width: 50,
@ -294,14 +294,14 @@ export default {
},
{
title: '默认显示',
title: this.$t('ciType.defaultShow'),
dataIndex: 'default_show',
sorter: false,
scopedSlots: { customRender: 'is_check' }
},
{
title: '操作',
title: this.$t('tip.operate'),
dataIndex: 'action',
width: 100,
fixed: 'right',
@ -323,11 +323,8 @@ export default {
},
mdl: {},
// 高级搜索 展开/关闭
advanced: false,
// 查询参数
queryParam: {},
// 表头
selectedRowKeys: [],
selectedRows: [],
@ -448,7 +445,7 @@ export default {
handleDelete (record) {
this.unbindAttribute([record.id])
.then(res => {
this.$message.success(`删除成功`)
this.$message.success(this.$t('tip.deleteSuccess'))
this.handleOk()
}).catch(err => this.requestFailed(err))
},
@ -486,7 +483,7 @@ export default {
const that = this
Promise.all(p).then(function (values) {
console.log(values)
that.$message.success(`修改成功`)
that.$message.success(that.$t('tip.updateSuccess'))
that.handleOk()
that.onBatchBindAttrActionClose()
}).catch(err => that.requestFailed(err))
@ -500,7 +497,7 @@ export default {
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
}

View File

@ -1,6 +1,6 @@
<template>
<div>
<a-button class="action-btn" @click="handleCreate" type="primary">批量修改</a-button>
<a-button class="action-btn" @click="handleCreate" type="primary">{{ $t('button.batchUpdate') }}</a-button>
<s-table
v-once
:alert="options.alert"
@ -41,7 +41,7 @@
:render="item=>item.title"
:selectedKeys="transferSelectedKeys"
:targetKeys="transferTargetKeys"
:titles="['当前项', '已选项']"
:titles="[$t('tip.unselectedAttribute'), $t('tip.selectedAttribute')]"
:listStyle="{
height: '600px',
width: '40%',
@ -113,21 +113,21 @@ export default {
showPagination: false,
columns: [
{
title: '属性名',
title: this.$t('ciType.alias'),
dataIndex: 'alias',
sorter: false,
width: 200,
scopedSlots: { customRender: 'alias' }
},
{
title: '属性英文名',
title: this.$t('ciType.name'),
dataIndex: 'name',
sorter: false,
width: 200,
scopedSlots: { customRender: 'name' }
},
{
title: '必须',
title: this.$t('ciType.required'),
dataIndex: 'is_required',
sorter: false,
scopedSlots: { customRender: 'is_check' }
@ -135,7 +135,7 @@ export default {
},
{
title: '操作',
title: this.$t('tip.operate'),
dataIndex: 'action',
width: 100,
fixed: 'right',
@ -156,9 +156,7 @@ export default {
},
mdl: {},
// 高级搜索 展开/关闭
advanced: false,
// 查询参数
queryParam: {},
// custom table alert & rowSelection
@ -259,7 +257,7 @@ export default {
updateCITypeAttributesById(this.CITypeId, { attributes: [{ attr_id: record.id, is_required: false }] })
.then(res => {
this.$message.success(`删除成功`)
this.$message.success(this.$t('tip.deleteSuccess'))
this.handleOk()
})
.catch(err => this.requestFailed(err))
@ -269,7 +267,7 @@ export default {
},
handleCreate () {
this.drawerTitle = '批量修改'
this.drawerTitle = this.$t('button.batchUpdate')
this.visible = true
},
@ -300,7 +298,7 @@ export default {
updateCITypeAttributesById(CITypeId, { attributes: requestData }).then(
res => {
this.$message.success(`更新成功`)
this.$message.success(this.$t('tip.updateSuccess'))
this.visible = false
this.handleOk()
}
@ -311,7 +309,7 @@ export default {
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
}

View File

@ -1,6 +1,6 @@
<template>
<div>
<a-button class="action-btn" @click="handleCreate" type="primary">批量修改</a-button>
<a-button class="action-btn" @click="handleCreate" type="primary">{{ $t('button.batchUpdate') }}</a-button>
<s-table
:alert="options.alert"
:columns="columns"
@ -40,7 +40,7 @@
:render="item=>item.title"
:selectedKeys="transferSelectedKeys"
:targetKeys="transferTargetKeys"
:titles="['当前项', '已选项']"
:titles="[$t('tip.unselectedAttribute'), $t('tip.selectedAttribute')]"
:listStyle="{
height: '600px',
width: '42%'
@ -113,28 +113,28 @@ export default {
showPagination: false,
columns: [
{
title: '属性名',
title: this.$t('ciType.alias'),
dataIndex: 'alias',
sorter: false,
width: 200,
scopedSlots: { customRender: 'alias' }
},
{
title: '属性英文名',
title: this.$t('ciType.name'),
dataIndex: 'name',
sorter: false,
width: 200,
scopedSlots: { customRender: 'name' }
},
{
title: '默认显示',
title: this.$t('ciType.defaultShow'),
dataIndex: 'default_show',
sorter: false,
scopedSlots: { customRender: 'is_check' }
},
{
title: '操作',
title: this.$t('tip.operate'),
dataIndex: 'action',
width: 100,
fixed: 'right',
@ -155,11 +155,8 @@ export default {
},
mdl: {},
// 高级搜索 展开/关闭
advanced: false,
// 查询参数
queryParam: {},
// 表头
selectedRowKeys: [],
selectedRows: [],
@ -261,7 +258,7 @@ export default {
updateCITypeAttributesById(this.CITypeId, { attributes: [{ attr_id: record.id, default_show: false }] })
.then(res => {
this.$message.success(`删除成功`)
this.$message.success(this.$t('tip.deleteSuccess'))
this.handleOk()
})
.catch(err => this.requestFailed(err))
@ -275,7 +272,7 @@ export default {
},
handleCreate () {
this.drawerTitle = '批量修改'
this.drawerTitle = this.$t('button.batchUpdate')
this.visible = true
},
@ -306,7 +303,7 @@ export default {
updateCITypeAttributesById(CITypeId, { attributes: requestData }).then(
res => {
this.$message.success(`更新成功`)
this.$message.success(this.$t('tip.updateSuccess'))
this.visible = false
this.handleOk()
}
@ -317,7 +314,7 @@ export default {
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
}

View File

@ -2,27 +2,27 @@
<a-card :bordered="false">
<a-tabs defaultActiveKey="1">
<a-tab-pane key="1" tab="模型属性">
<a-tab-pane key="1" :tab="$t('ciType.typeAttribute')">
<AttributesTable></AttributesTable>
</a-tab-pane>
<a-tab-pane forceRender key="2" tab="模型关联">
<a-tab-pane forceRender key="2" :tab="$t('ciType.typeRelation')">
<RelationTable :CITypeId="CITypeId" :CITypeName="CITypeName"></RelationTable>
</a-tab-pane>
<a-tab-pane forceRender key="3" tab="必须校验">
<a-tab-pane forceRender key="3" :tab="$t('ciType.requiredCheck')">
<CheckTable></CheckTable>
</a-tab-pane>
<a-tab-pane forceRender key="4" tab="默认显示属性">
<a-tab-pane forceRender key="4" :tab="$t('ciType.defaultShowAttribute')">
<DefaultShowTable></DefaultShowTable>
</a-tab-pane>
<a-tab-pane forceRender key="5" tab="属性分组 & 排序">
<a-tab-pane forceRender key="5" :tab="$t('ciType.attributeGroup')">
<Group></Group>
</a-tab-pane>

View File

@ -1,7 +1,7 @@
<template>
<div>
<div style="margin-bottom: 2rem">
<a-button type="primary" v-if="addGroupBtnVisible" @click="handleAddGroup">添加分组</a-button>
<a-button type="primary" v-if="addGroupBtnVisible" @click="handleAddGroup">{{ $t('ciType.addGroup') }}</a-button>
<template v-else>
<span>
@ -11,7 +11,7 @@
style="width: 10rem;margin-right: 0.5rem"
ref="addGroupInput"
v-model.trim="newGroupName" />
<a @click="handleCreateGroup" style="margin-right: 0.5rem">保存</a>
<a @click="handleCreateGroup" style="margin-right: 0.5rem">{{ $t('button.save') }}</a>
<a @click="handleCancelCreateGroup">{{ $t('button.cancel') }}</a>
</span>
</template>
@ -36,7 +36,7 @@
style="width: 15%;margin-right: 0.5rem"
ref="editGroupInput"
v-model.trim="CITypeGroup.name" />
<a @click="handleSaveGroupName(index, CITypeGroup)" style="margin-right: 0.5rem">保存</a>
<a @click="handleSaveGroupName(index, CITypeGroup)" style="margin-right: 0.5rem">{{ $t('button.save') }}</a>
<a @click="handleCancelGroupName(index, CITypeGroup)">{{ $t('button.cancel') }}</a>
</span>
</template>
@ -46,27 +46,27 @@
<a-button-group size="small">
<a-tooltip>
<template slot="title">
上移
{{ $t('ciType.up') }}
</template>
<a-button icon="arrow-up" size="small" @click="handleMoveGroup(index, index-1)" :disabled="index===0"/>
</a-tooltip>
<a-tooltip>
<template slot="title">
下移
{{ $t('ciType.down') }}
</template>
<a-button icon="arrow-down" size="small" @click="handleMoveGroup(index, index+1)" :disabled="index===CITypeGroups.length-1" />
</a-tooltip>
<a-tooltip>
<template slot="title">
添加属性
{{ $t('ciType.addAttribute1') }}
</template>
<a-button icon="plus" size="small" @click="handleAddExistGroupAttr(index)"/>
</a-tooltip>
<a-tooltip>
<template slot="title">
删除分组
{{ $t('ciType.deleteGroup') }}
</template>
<a-button icon="delete" size="small" @click="handleDeleteGroup(CITypeGroup.id)" :disabled="CITypeGroup.attributes.length!==0" />
@ -108,7 +108,7 @@
<li
class="property-item-empty"
@click="handleAddExistGroupAttr(index)"
style="">添加属性</li>
style="">{{ $t('ciType.addAttribute1') }}</li>
</template>
@ -121,34 +121,34 @@
<template>
<span style="margin-right: 0.2rem">更多属性</span>
<span style="margin-right: 0.2rem">{{ $t('ciType.moreAttribute') }}</span>
<span style="color: #c3cdd7; margin-right: 0.5rem">({{ otherGroupAttributes.length }})</span>
</template>
<div style="float: right">
<a-button-group size="small">
<a-tooltip>
<template slot="title">
上移
{{ $t('ciType.up') }}
</template>
<a-button icon="arrow-up" size="small" disabled/>
</a-tooltip>
<a-tooltip>
<template slot="title">
下移
{{ $t('ciType.down') }}
</template>
<a-button icon="arrow-down" size="small" disabled />
</a-tooltip>
<a-tooltip>
<template slot="title">
添加属性
{{ $t('ciType.addAttribute1') }}
</template>
<a-button icon="plus" size="small" @click="handleAddOtherGroupAttr"/>
</a-tooltip>
<a-tooltip>
<template slot="title">
删除分组
{{ $t('ciType.deleteGroup') }}
</template>
<a-button icon="delete" size="small" disabled />
@ -182,14 +182,14 @@
<li
class="property-item-empty"
@click="handleAddOtherGroupAttr"
style="">添加属性</li>
style="">{{ $t('ciType.addAttribute1') }}</li>
</template>
</draggable>
</div>
<a-modal
title="添加字段"
:title="$t('ciType.addAttribute1')"
:width="'80%'"
v-model="modalVisible"
@ok="handleSubmit"
@ -344,13 +344,13 @@ export default {
if (CITypeGroup.name === CITypeGroup.originName) {
this.handleCancelGroupName(index, CITypeGroup)
} else if (this.CITypeGroups.map(x => x.originName).includes(CITypeGroup.name)) {
this.$message.error('分组名称已存在')
this.$message.error(this.$t('ciType.groupNameExisted'))
} else {
updateCITypeGroupById(CITypeGroup.id, { name: CITypeGroup.name, attributes: CITypeGroup.attributes.map(x => x.id), order: CITypeGroup.order })
.then(res => {
CITypeGroup.editable = false
this.$set(this.CITypeGroups, index, CITypeGroup)
this.$message.success('修改成功')
this.$message.success(this.$t('tip.updateSuccess'))
})
.catch(err => this.requestFailed(err))
}
@ -389,14 +389,14 @@ export default {
const fromGroupId = this.CITypeGroups[beforeIndex].id
const toGroupId = this.CITypeGroups[afterIndex].id
transferCITypeGroupIndex(this.CITypeId, { from: fromGroupId, to: toGroupId }).then(res => {
this.$message.success('操作成功')
this.$message.success(this.$t('ciType.moveSuccess'))
const beforeGroup = this.CITypeGroups[beforeIndex]
this.CITypeGroups[beforeIndex] = this.CITypeGroups[afterIndex]
this.$set(this.CITypeGroups, beforeIndex, this.CITypeGroups[afterIndex])
this.$set(this.CITypeGroups, afterIndex, beforeGroup)
}).catch(err => {
this.$httpError(err, '移动出错')
this.$httpError(err, this.$t('ciType.moveFailed'))
})
},
handleAddExistGroupAttr (index) {
@ -463,13 +463,13 @@ export default {
handleChange (e, group) {
if (e.hasOwnProperty('moved') && e.moved.oldIndex !== e.moved.newIndex) {
if (group === -1) {
this.$message.error('更多属性不能进行排序, 如需排序需添加入其他分组中!')
this.$message.error(this.$t('ciType.moreAttributeCannotSort'))
} else {
transferCITypeAttrIndex(this.CITypeId,
{
from: { attr_id: e.moved.element.id, group_id: group > -1 ? group : null },
to: { order: e.moved.newIndex, group_id: group > -1 ? group : null }
}).then(res => this.$message.success('保存成功')).catch(err => {
}).then(res => this.$message.success(this.$t('tip.saveSuccess'))).catch(err => {
this.$httpError(err)
this.abortDraggable()
})
@ -486,7 +486,7 @@ export default {
{
from: { attr_id: e.removed.element.id, group_id: group > -1 ? group : null },
to: { group_id: this.addRemoveGroupFlag.to.group_id, order: this.addRemoveGroupFlag.to.order }
}).then(res => this.$message.success('保存成功')).catch(err => {
}).then(res => this.$message.success(this.$t('tip.saveSuccess'))).catch(err => {
this.$httpError(err)
this.abortDraggable()
}).finally(() => {
@ -501,9 +501,9 @@ export default {
})
},
updatePropertyIndex () {
const attributes = [] // 全部属性
let attributeOrder = 0 // 属性组
let groupOrder = 0 // 组排序
const attributes = [] // all attributes
let attributeOrder = 0 // attribute group
let groupOrder = 0 // sort by group
const promises = [
]
@ -548,14 +548,14 @@ export default {
const that = this
Promise.all(promises)
.then(values => {
that.$message.success(`修改成功`)
that.$message.success(this.$t('tip.updateSuccess'))
that.getCITypeGroupData()
that.modalVisible = false
})
.catch(err => that.requestFailed(err))
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
}
},

View File

@ -13,7 +13,7 @@
<template v-if="Object.keys(item).length === 0">
<a-button class="new-btn" type="dashed" @click="handleCreate">
<a-icon type="plus"/>
新增
{{ $t('ciType.add') }}
</a-button>
</template>
<template v-else>
@ -28,7 +28,7 @@
<a-icon type="setting" />
</router-link>
<a-icon type="edit" @click="handleEdit(item)"/>
<a-popconfirm title="确认删除" @confirm="handleDelete(item)" okText="" cancelText="">
<a-popconfirm :title="$t('tip.confirmDelete')" @confirm="handleDelete(item)" :okText="$t('button.yes')" :cancelText="$t('button.no')">
<a-icon type="delete"/>
</a-popconfirm>
</template>
@ -66,18 +66,17 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="模型名(英文)"
:label="$t('ciType.name')"
>
<a-input
name="name"
placeholder="英文"
v-decorator="['name', {rules: [{ required: true, message: '请输入属性名'},{message: '不能以数字开头,可以是英文 数字以及下划线 (_)', pattern: RegExp('^(?!\\d)[a-zA-Z_0-9]+$')}]} ]"
v-decorator="['name', {rules: [{ required: true, message: $t('ciType.nameRequired')},{message: $t('ciType.nameValidate'), pattern: RegExp('^(?!\\d)[a-zA-Z_0-9]+$')}]} ]"
/>
</a-form-item>
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="别名"
:label="$t('ciType.alias')"
>
<a-input
name="alias"
@ -88,7 +87,7 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="唯一标识*"
:label="$t('ciType.unique') + '*'"
>
<a-select
@ -203,7 +202,7 @@ export default {
})
},
handleCreate () {
this.drawerTitle = '新增模型'
this.drawerTitle = this.$t('ciType.newCIType')
this.drawerVisible = true
},
onClose () {
@ -211,7 +210,7 @@ export default {
this.drawerVisible = false
},
handleEdit (record) {
this.drawerTitle = '编辑模型'
this.drawerTitle = this.$t('ciType.editCIType')
this.drawerVisible = true
this.$nextTick(() => {
@ -228,7 +227,7 @@ export default {
handleDelete (record) {
deleteCIType(record.id)
.then(res => {
this.$message.success(`删除成功`)
this.$message.success(this.$t('tip.deleteSuccess'))
this.getCITypes()
})
.catch(err => this.requestFailed(err))
@ -252,7 +251,7 @@ export default {
createCIType (data) {
createCIType(data)
.then(res => {
this.$message.success(`添加成功`)
this.$message.success(this.$t('tip.addSuccess'))
this.drawerVisible = false
this.getCITypes()
})
@ -262,14 +261,14 @@ export default {
updateCIType (CITypeId, data) {
updateCIType(CITypeId, data)
.then(res => {
this.$message.success(`修改成功`)
this.$message.success(this.$t('tip.updateSuccess'))
this.drawerVisible = false
this.getCITypes()
})
.catch(err => this.requestFailed(err))
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
}

View File

@ -1,6 +1,6 @@
<template>
<div>
<a-button class="action-btn" @click="handleCreate" type="primary">新增关系</a-button>
<a-button class="action-btn" @click="handleCreate" type="primary">{{ $t('ciType.newRelation') }}</a-button>
<s-table
:alert="options.alert"
:columns="columns"
@ -38,21 +38,23 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="源模型"
:label="$t('ciType.sourceCIType')"
>
<a-select
name="source_ci_type_id"
style="width: 120px"
v-decorator="['source_ci_type_id', {rules: [], } ]"
>
<a-select-option :value="CIType.id" :key="CIType.id" v-for="CIType in CITypes" v-if="CITypeId === CIType.id">{{ CIType.alias }}</a-select-option>
<template v-for="CIType in CITypes">
<a-select-option :value="CIType.id" :key="CIType.id" v-if="CITypeId == CIType.id">{{ CIType.alias }}</a-select-option>
</template>
</a-select>
</a-form-item>
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="目标模型"
:label="$t('ciType.targetCIType')"
>
<a-select
name="ci_type_id"
@ -66,7 +68,7 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="关联关系"
:label="$t('ciType.relationType')"
>
<a-select
name="relation_type_id"
@ -138,27 +140,27 @@ export default {
showPagination: false,
columns: [
{
title: '源模型英文名',
title: this.$t('ciType.sourceCIType') + this.$t('ciType.name'),
dataIndex: 'source_ci_type_name',
sorter: false,
width: 200,
scopedSlots: { customRender: 'source_ci_type_name' }
},
{
title: '关联类型',
title: this.$t('ciType.relationType'),
dataIndex: 'relation_type',
sorter: false,
width: 100,
scopedSlots: { customRender: 'name' }
},
{
title: '目标模型名',
title: this.$t('ciType.targetCIType') + this.$t('ciType.alias'),
dataIndex: 'alias',
sorter: false,
scopedSlots: { customRender: 'alias' }
},
{
title: '操作',
title: this.$t('tip.operate'),
dataIndex: 'action',
width: 100,
fixed: 'right',
@ -189,9 +191,7 @@ export default {
},
mdl: {},
// 高级搜索 展开/关闭
advanced: false,
// 查询参数
queryParam: {},
// custom table alert & rowSelection
options: {
@ -254,7 +254,7 @@ export default {
deleteRelation(record.source_ci_type_id, record.id)
.then(res => {
this.$message.success(`删除成功`)
this.$message.success(this.$t('tip.deleteSuccess'))
this.handleOk()
}).catch(err => this.requestFailed(err))
@ -264,7 +264,7 @@ export default {
},
handleCreate () {
this.drawerTitle = '新增关系'
this.drawerTitle = this.$t('ciType.newRelation')
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue({
@ -292,7 +292,7 @@ export default {
createRelation(values.source_ci_type_id, values.ci_type_id, values.relation_type_id)
.then(res => {
this.$message.success(`添加成功`)
this.$message.success(this.$t('tip.addSuccess'))
this.onClose()
this.handleOk()
}).catch(err => this.requestFailed(err))
@ -301,7 +301,7 @@ export default {
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
}

View File

@ -1,8 +1,8 @@
<template>
<div>
<a-card :bordered="true" title="关系视图定义面板">
<a-card-meta description="方法1. 右键选择树节点(推荐)"></a-card-meta>
<a-card-meta description="方法2. 先打开右上角的开关,再选择树的节点"></a-card-meta>
<a-card :bordered="true" :title="$t('ciType.relationViewDefinePanel')">
<a-card-meta :description="$t('ciType.relationViewDefinePanelTip1')"></a-card-meta>
<a-card-meta :description="$t('ciType.relationViewDefinePanelTip2')"></a-card-meta>
<a-switch
slot="extra"
@change="toggleSelect"
@ -330,8 +330,8 @@ export default {
deleteView (viewName) {
const that = this
this.$confirm({
title: '警告',
content: '确认要删除吗 ?',
title: that.$t('tip.warning'),
content: that.$t('tip.confirmDelete'),
onOk () {
deleteRelationView(viewName).then(res => {
that.create()

View File

@ -13,12 +13,12 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="关系视图名"
:label="$t('ciType.RealtionViewName')"
>
<a-input
name="name"
placeholder=""
v-decorator="['name', {rules: [{ required: true, message: '请输入 关系视图名'}]} ]"
v-decorator="['name', {rules: [{ required: true, message: $t('ciType.RealtionViewNameRequired')}]} ]"
/>
</a-form-item>
@ -59,7 +59,7 @@ export default {
name: 'RelationViewForm',
data () {
return {
drawerTitle: '新增关系视图',
drawerTitle: this.$t('ciType.newRealtionView'),
drawerVisible: false,
formLayout: 'vertical',
crIds: []
@ -117,7 +117,7 @@ export default {
data.cr_ids = this.crIds
subscribeRelationView(data)
.then(res => {
this.$message.success(`添加成功`)
this.$message.success(this.$t('tip.addSuccess'))
this.onClose()
this.$emit('refresh')
})
@ -126,7 +126,7 @@ export default {
requestFailed (err) {
console.log(err, 'error')
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
}

View File

@ -2,14 +2,14 @@
<a-card :bordered="false">
<div class="action-btn">
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem;">{{ btnName }}</a-button>
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem;">{{ $t('ciType.newRelationType') }}</a-button>
</div>
<s-table
:alert="options.alert"
:columns="columns"
:data="loadData"
:pagination="{ showTotal: (total, range) => `${range[0]}-${range[1]} 共 ${total} 条记录`, pageSizeOptions: pageSizeOptions}"
:pagination="{ showTotal: (total, range) => `${range[0]}-${range[1]} ${total} records in total`, pageSizeOptions: pageSizeOptions}"
:showPagination="false"
:pageSize="25"
:rowKey="record=>record.id"
@ -34,7 +34,7 @@
icon="search"
size="small"
style="width: 90px; margin-right: 8px"
>搜索</a-button>
>{{ $t('button.query') }}</a-button>
<a-button
@click="() => handleReset(clearFilters, column)"
size="small"
@ -61,11 +61,11 @@
<a-divider type="vertical"/>
<a-popconfirm
title="确认删除?"
:title="$t('tip.confirmDelete')"
@confirm="handleDelete(record)"
@cancel="cancel"
okText=""
cancelText=""
:okText="$t('button.yes')"
:cancelText="$t('button.no')"
>
<a>{{ $t('tip.delete') }}</a>
</a-popconfirm>
@ -92,7 +92,6 @@ export default {
data () {
return {
scroll: { x: 1000, y: 500 },
btnName: '新增关系类型',
formLayout: 'vertical',
@ -104,7 +103,7 @@ export default {
columns: [
{
width: 150,
title: '类型名',
title: this.$t('ciType.name'),
dataIndex: 'name',
sorter: false,
scopedSlots: {
@ -123,7 +122,7 @@ export default {
},
{
width: 150,
title: '操作',
title: this.$t('tip.operate'),
key: 'operation',
scopedSlots: { customRender: 'action' }
}
@ -139,11 +138,8 @@ export default {
},
mdl: {},
// 高级搜索 展开/关闭
advanced: false,
// 查询参数
queryParam: {},
// 表头
selectedRowKeys: [],
selectedRows: [],
@ -226,13 +222,13 @@ export default {
deleteRelationType (id) {
deleteRelationType(id)
.then(res => {
this.$message.success(`删除成功`)
this.$message.success(this.$t('tip.deleteSuccess'))
this.handleOk()
})
.catch(err => this.requestFailed(err))
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
},
cancel () {

View File

@ -13,12 +13,12 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="类型名"
:label="$t('ciType.name')"
>
<a-input
name="name"
placeholder=""
v-decorator="['name', {rules: [{ required: true, message: '请输入类型名'}]} ]"
v-decorator="['name', {rules: [{ required: true, message: $t('ciType.relationTypeNameRequired')}]} ]"
/>
</a-form-item>
@ -59,7 +59,7 @@ export default {
name: 'RelationTypeForm',
data () {
return {
drawerTitle: '新增关系类型',
drawerTitle: this.$t('ciType.newRelationType'),
drawerVisible: false,
formLayout: 'vertical'
}
@ -134,7 +134,7 @@ export default {
updateRelationType (id, data) {
updateRelationType(id, data)
.then(res => {
this.$message.success(`更新成功`)
this.$message.success(this.$t('tip.updateSuccess'))
this.handleOk()
this.onClose()
}).catch(err => this.requestFailed(err))
@ -143,7 +143,7 @@ export default {
createRelationType (data) {
addRelationType(data)
.then(res => {
this.$message.success(`添加成功`)
this.$message.success(this.$t('tip.addSuccess'))
this.handleOk()
this.onClose()
})
@ -151,7 +151,7 @@ export default {
},
requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requsetFailed')
this.$message.error(`${msg}`)
}