This commit is contained in:
pycook 2020-02-15 20:57:05 +08:00
parent acf881dcb7
commit 07d2af6671
17 changed files with 244 additions and 157 deletions

View File

@ -1,5 +1,6 @@
import T from 'ant-design-vue/es/table/Table'
import get from 'lodash.get'
import i18n from '@/locales'
export default {
data () {
@ -232,7 +233,7 @@ export default {
<a style="margin-left: 24px" onClick={() => {
callback()
this.clearSelected()
}}>清空</a>
}}>{ i18n.t('table.clear') }</a>
)
},
renderAlert () {
@ -254,7 +255,7 @@ export default {
return (
<a-alert showIcon={true} style="margin-bottom: 16px">
<template slot="message">
<span style="margin-right: 12px">已选择: <a style="font-weight: 600">{this.selectedRows.length}</a></span>
<span style="margin-right: 12px">{ i18n.t('table.selected') }: <a style="font-weight: 600">{this.selectedRows.length}</a></span>
{needTotalItems}
{clearItem}
</template>

View File

@ -31,8 +31,6 @@ export default i18n
const loadedLanguages = [defaultLang]
// 从缓存設置中加载当前语言
function setI18nLanguage (lang) {
i18n.locale = lang
axios.defaults.headers.common['Accept-Language'] = lang
@ -46,7 +44,6 @@ export function i18nRender (key) {
export function loadLanguageAsync (lang = defaultLang) {
return new Promise(resolve => {
// 缓存语言设置
Vue.ls.set('lang', lang)
if (i18n.locale !== lang) {
if (!loadedLanguages.includes(lang)) {

View File

@ -6,11 +6,11 @@ export default {
preference: 'Preference',
relationViews: 'Relation Views',
treeViews: 'Tree Views',
batch: 'Batch',
ciType: 'CiType',
acl: 'ACL',
ciModelManager: 'Model',
ciPropertyRep: 'Propertys',
batch: 'Batch Import',
ciType: 'Modeling',
acl: 'Authorization',
ciModelManager: 'CI Type',
ciPropertyRep: 'Attributes',
ciRelationType: 'Relation Type',
ciRelationViewDefine: 'Relation View Define',
aclUsersManager: 'Users',
@ -23,13 +23,17 @@ export default {
submit: 'Submit',
query: 'Query',
add: 'Add',
new: 'New',
update: 'Edit',
delete: 'Delete',
yes: 'Yes',
no: 'No',
reset: 'Reset',
subscribe: 'Subscribe',
downloadTemplate: 'Download',
upload: 'Upload',
download: 'Download',
upload: 'Upload'
displayFields: 'Display Fields'
},
tip: {
sourceCode: 'view on',
@ -40,17 +44,47 @@ export default {
detail: 'Detail',
delete: 'Delete',
edit: 'Edit',
operate: 'Operate',
operate: 'Operation',
create: 'Create',
clear: 'Clear',
modify: 'Modify',
unselectedAttribute: 'Unselect Attributes',
selectedAttribute: 'Selected Attributes',
noData: 'No Data',
addSuccess: 'Add successfully',
updateSuccess: 'Update successfully',
deleteSuccess: 'Delete successfully',
cancelSuccess: 'Cancel successfully',
downloading: 'Downloading ...',
deleting: 'Deleting ...',
confirmDelete: 'Confirm deleting ?',
warning: 'Warning',
other: 'Other',
requestFailed: 'Request error, please try again later',
pleaseSelect: 'please select'
},
ci: {
batchOperate: 'Batch Operation',
confirmBatchUpdate: 'Confirm batch modification?',
batchUpdate: 'Batch update ...',
batchUpdateSuccess: 'Batch update successfully',
confirmDelete: 'Confirm deleting ?',
attribute: 'Attributes',
relation: 'Relation',
history: 'History',
time: 'Time',
user: 'User',
batchUpdateTip: 'Just fill in the fields that need to be modified!',
selectLevel: '- - directory level selection - -',
displayFieldDefine: 'Display Fields Define'
},
table: {
selected: 'Selected',
batchOperate: 'Batch operate'
clear: 'Clear'
},
preference: {
cancelSubscribeConfirm: 'Really want to unsubscribe ?',
subscribeSuccess: 'Subscribe successfully',
subscribeModel: 'Subscribe Model',
resourceView: 'Resource View',
subFormTip: 'You can either define a tree view or subscribe to a resource view, which will be presented separately in sidebar'
@ -62,11 +96,34 @@ export default {
dragFileHere: 'click or drag file to here!',
suportFileType: 'suport file type'
},
relationView: {
tip: 'The administrator has not configured the relational view, or you do not have permission to access it!'
},
treeView: {
tip: 'Please go to my subscription page to complete the subscription!'
},
ciType: {
add: 'Add',
editModel: 'edit model',
modelName: 'model name',
alias: 'alias',
addAttribute: 'Add Attribute',
editModel: 'Edit Model',
modelName: 'Model Name',
name: 'Name',
alias: 'Alias',
type: 'Type',
unique: 'Unique',
index: 'Index',
sort: 'Sort',
link: 'Link',
password: 'Password',
list: 'List',
integer: 'Integer',
float: 'Float',
text: 'Text',
nameValidate: "You can't start with a number, you can start with an English number and an underscore (_)",
nameRequired: 'Please enter a attribute name',
isIt: 'Is it ',
predefinedValue: 'Predefined values',
predefinedValueTip: 'Multiple values are separated by line breaks',
uniqueFlag: 'unique flag'
}
}

View File

@ -23,13 +23,17 @@ export default {
submit: '提交',
query: '查询',
add: '新增',
new: '新建',
update: '修改',
delete: '删除',
yes: '',
no: '',
reset: '重置',
subscribe: '订阅',
download: '下载模板',
upload: '上传'
downloadTemplate: '下载模板',
upload: '上传',
download: '下载',
displayFields: '显示字段'
},
tip: {
sourceCode: '源代码',
@ -41,16 +45,46 @@ export default {
delete: '删除',
edit: '编辑',
operate: '操作',
create: '创建',
clear: '清空',
modify: '修改',
unselectedAttribute: '未选属性',
selectedAttribute: '已选属性',
noData: '没数据',
addSuccess: '新增成功',
updateSuccess: '修改成功',
deleteSuccess: '删除成功',
cancelSuccess: '取消成功',
downloading: '正在下载 ...',
deleting: '正在删除 ...',
confirmDelete: '真的要删除吗 ?',
warning: '警告',
other: '其他',
requestFailed: '请求出现错误,请稍后再试',
pleaseSelect: '请选择'
},
ci: {
batchOperate: '批量操作',
confirmBatchUpdate: '确认要批量修改吗 ?',
batchUpdate: '批量修改',
batchUpdateSuccess: '批量修改成功',
confirmDelete: '真的要删除吗 ?',
attribute: '属性',
relation: '关系',
history: '操作历史',
time: '时间',
user: '用户',
batchUpdateTip: '只需要填写需要修改的字段即可!',
selectLevel: '- - 目录层级的选择 - -',
displayFieldDefine: '显示字段定义'
},
table: {
selected: '已选择',
batchOperate: '批量操作'
clear: '清空'
},
preference: {
cancelSubscribeConfirm: '真的要取消订阅吗 ?',
subscribeSuccess: '订阅成功',
subscribeModel: '订阅模型',
resourceView: '资源视图',
subFormTip: '既可以定义树形视图, 也可以订阅资源视图, 资源视图会在SideBar单独呈现'
@ -62,11 +96,34 @@ export default {
dragFileHere: '点击或拖拽文件至此上传!',
suportFileType: '支持文件类型'
},
relationView: {
tip: '管理员 还未配置关系视图, 或者你无权限访问!'
},
treeView: {
tip: '请先到 我的订阅 页面完成订阅!'
},
ciType: {
add: '新增',
addAttribute: '新增属性',
editModel: '编辑模型',
modelName: '模型名(英文)',
name: '名称',
alias: '别名',
type: '类型',
unique: '唯一',
index: '索引',
sort: '排序',
link: '链接',
password: '密码',
list: '列表',
integer: '整数',
float: '浮点数',
text: '文本',
nameValidate: '不能以数字开头,可以是英文 数字以及下划线 (_)',
nameRequired: '请输入属性名',
isIt: '是否',
predefinedValue: '预定义值',
predefinedValueTip: '多个值使用换行分隔',
uniqueFlag: '唯一标识'
}
}

View File

@ -12,7 +12,7 @@
:rowKey="record=>record.id"
:rowSelection="options.rowSelection"
:scroll="scroll"
: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="auto"
:pageSize="25"
ref="table"

View File

@ -19,7 +19,7 @@
style="margin-left: 20px"
:disabled="downLoadButtonDis"
@click="downLoadExcel"
>{{ $t('button.download') }}</a-button>
>{{ $t('button.downloadTemplate') }}</a-button>
</a-form-item>
</a-col>
</a-row>

View File

@ -11,8 +11,8 @@
type="primary"
icon="plus"
@click="$refs.create.visible = true; $refs.create.action='create'"
>新建</a-button>
<a-button class="right" @click="showDrawer(typeId)">显示字段</a-button>
>{{ $t('button.new') }}</a-button>
<a-button class="right" @click="showDrawer(typeId)">{{ $t('button.displayFields') }}</a-button>
<a-dropdown v-action:edit v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item
@ -20,20 +20,20 @@
@click="$refs.create.visible = true; $refs.create.action='update'"
>
<span @click="$refs.create.visible = true">
<a-icon type="edit" />&nbsp;修改
<a-icon type="edit" />&nbsp;{{ $t('button.update') }}
</span>
</a-menu-item>
<a-menu-item key="batchDownload" @click="batchDownload">
<json-excel :fetch="batchDownload" name="cmdb.xls">
<a-icon type="download" />&nbsp;下载
<a-icon type="download" />&nbsp;{{ $t('button.download') }}
</json-excel>
</a-menu-item>
<a-menu-item key="batchDelete" @click="batchDelete">
<a-icon type="delete" />删除
<a-icon type="delete" />{{ $t('button.delete') }}
</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px">
批量操作
{{ $t('ci.batchOperate') }}
<a-icon type="down" />
</a-button>
</a-dropdown>
@ -48,7 +48,7 @@
:alert="options.alert"
:rowSelection="options.rowSelection"
:scroll="{ x: scrollX, y: scrollY }"
: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="auto"
:pageSize="25"
>
@ -64,10 +64,10 @@
<template>
<a
@click="$refs.detail.visible = true; $refs.detail.ciId = record.key; $refs.detail.create()"
>详情</a>
>{{ $t('tip.detail') }}</a>
<a-divider type="vertical" />
<a @click="deleteCI(record)">删除</a>
<a @click="deleteCI(record)">{{ $t('tip.delete') }}</a>
</template>
</span>
</s-table>
@ -79,7 +79,7 @@
<template>
<div>
<a-drawer
title="显示字段定义"
:title="$t('ci.displayFieldDefine')"
:width="600"
@close="onClose"
:visible="visible"
@ -93,13 +93,13 @@
width: '230px',
height: '500px',
}"
:titles="['未选属性','已选属性']"
:titles="[$t('tip.unselectedAttribute'), $t('tip.selectedAttribute')]"
:render="item=>item.title"
:targetKeys="selectedAttrList"
@change="handleChange"
@search="handleSearch"
>
<span slot="notFoundContent">没数据</span>
<span slot="notFoundContent">{{ $t('tip.noData') }}</span>
</a-transfer>
</template>
<div
@ -114,8 +114,8 @@
textAlign: 'right',
}"
>
<a-button :style="{marginRight: '8px'}" @click="onClose">取消</a-button>
<a-button @click="subInstanceSubmit" type="primary">提交</a-button>
<a-button :style="{marginRight: '8px'}" @click="onClose">{{ $t('button.cancel') }}</a-button>
<a-button @click="subInstanceSubmit" type="primary">{{ $t('button.submit') }}</a-button>
</div>
</a-drawer>
</div>
@ -177,9 +177,7 @@ export default {
visible: false,
instanceList: [],
// 表头
columns: [],
// 加载数据方法 必须为 Promise 对象
loadInstances: parameter => {
const params = Object.assign(parameter, this.$refs.search.queryParam)
let q = `q=_type:${this.$router.currentRoute.meta.typeId}`
@ -288,10 +286,11 @@ export default {
this.visible = false
},
subInstanceSubmit () {
const that = this
subscribeCIType(this.typeId, this.selectedAttrList)
.then(res => {
notification.success({
message: '修改成功'
message: that.$t('tip.updateSuccess')
})
this.reload()
})
@ -388,7 +387,7 @@ export default {
})
columns.push({
title: '操作',
title: this.$t('tip.operate'),
key: 'operation',
width: 100,
fixed: 'right',
@ -423,7 +422,7 @@ export default {
},
async batchDownload () {
this.loading = true
this.loadTip = '正在下载 ...'
this.loadTip = this.$t('tip.downloading')
const promises = this.selectedRowKeys.map(ciId => {
return searchCI(`q=_id:${ciId}`).then(res => {
const ciMap = {}
@ -444,11 +443,11 @@ export default {
batchUpdate (values) {
const that = this
this.$confirm({
title: '警告',
content: '确认要批量修改吗 ?',
title: that.$t('tip.warning'),
content: that.$t('ci.confirmBatchUpdate'),
onOk () {
that.loading = true
that.loadTip = '正在批量修改 ...'
that.loadTip = that.$t('ci.batchUpdate')
const payload = {}
Object.keys(values).forEach(key => {
if (values[key] || values[key] === 0) {
@ -464,7 +463,7 @@ export default {
.then(res => {
that.loading = false
notification.success({
message: '批量修改成功'
message: that.$t('ci.batchUpdateSuccess')
})
that.$refs.create.visible = false
@ -490,11 +489,11 @@ export default {
batchDelete () {
const that = this
this.$confirm({
title: '警告',
content: '真的要删除吗 ?',
title: that.$t('tip.warning'),
content: that.$t('ci.confirmDelete'),
onOk () {
that.loading = true
that.loadTip = '正在删除 ...'
that.loadTip = that.$t('tip.deleting')
const promises = that.selectedRowKeys.map(ciId => {
return deleteCI(ciId).then(res => {
return 'ok'
@ -504,7 +503,7 @@ export default {
.then(res => {
that.loading = false
notification.success({
message: '删除成功'
message: that.$t('tip.deleteSuccess')
})
that.$refs.table.clearSelected()
setTimeout(() => {
@ -527,8 +526,8 @@ export default {
deleteCI (record) {
const that = this
this.$confirm({
title: '警告',
content: '真的要删除吗 ?',
title: that.$t('tip.warning'),
content: that.$t('ci.confirmDelete'),
onOk () {
deleteCI(record.key)
.then(res => {

View File

@ -16,7 +16,7 @@
<div v-if="activeTabKey === 'tab_1'">
<a-card
type="inner"
:title="group.name || '其他'"
:title="group.name || $t('tip.other')"
:key="group.name"
v-for="group in attributeGroups"
>
@ -116,22 +116,22 @@ export default {
tabList: [
{
key: 'tab_1',
tab: '属性'
tab: this.$t('ci.attribute')
},
{
key: 'tab_2',
tab: '关系'
tab: this.$t('ci.relation')
},
{
key: 'tab_3',
tab: '操作历史'
tab: this.$t('ci.history')
}
],
activeTabKey: 'tab_1',
rowSpanMap: {},
historyColumns: [
{
title: '时间',
title: this.$t('ci.time'),
dataIndex: 'created_at',
key: 'created_at',
customRender: (value, row, index) => {
@ -144,7 +144,7 @@ export default {
}
},
{
title: '用户',
title: this.$t('ci.user'),
dataIndex: 'username',
key: 'username',
customRender: (value, row, index) => {
@ -157,13 +157,13 @@ export default {
}
},
{
title: '操作',
title: this.$t('tip.operate'),
dataIndex: 'operate_type',
key: 'operate_type',
scopedSlots: { customRender: 'operate_type' }
},
{
title: '属性',
title: this.$t('ci.attribute'),
dataIndex: 'attr_alias',
key: 'attr_name'
},
@ -181,21 +181,12 @@ export default {
ciHistory: []
}
},
created () {
// this.getAttributes()
// this.getCI()
// this.getFirstCIs()
// this.getSecondCIs()
// this.getParentCITypes()
// this.getChildCITypes()
// this.getCIHistory()
},
filters: {
operateTypeFilter (operateType) {
const operateTypeMap = {
'0': '新增',
'1': '删除',
'2': '修改'
'0': this.$t('button.add'),
'1': this.$t('button.delete'),
'2': this.$t('button.update')
}
return operateTypeMap[operateType]
}

View File

@ -7,7 +7,7 @@
:visible="visible"
:wrapStyle="{height: 'calc(100% - 108px)', overflow: 'auto', paddingBottom: '108px'}"
>
<p v-if="action === 'update'">只需要填写需要修改的字段即可!</p>
<p v-if="action === 'update'">{{ $t('ci.batchUpdateTip') }}</p>
<a-form :form="form" :layout="formLayout" @submit="createInstance">
<a-button type="primary" @click="createInstance">Submit</a-button>
<a-form-item
@ -18,7 +18,7 @@
>
<a-select
v-decorator="[ attr.name, { rules: [ { required: attr.is_required && action === 'create' ? true: false } ] } ]"
placeholder="请选择"
:placeholder="$t('tip.pleaseSelect')"
v-if="attr.is_choice"
>
<a-select-option
@ -92,7 +92,7 @@ export default {
},
computed: {
title () {
return this.action === 'create' ? '创建 ' : '批量修改 '
return this.action === 'create' ? this.$t('tip.create') + ' ' : this.$t('ci.batchUpdate') + ' '
}
},
watch: {
@ -115,14 +115,6 @@ export default {
getAttributeList () {
getCITypeAttributesById(this.typeId).then(res => {
const attrList = res.attributes
// res.attributes.forEach(item =>
// attrList.push({
// name: item.name,
// alias: item.alias,
// value_type: item.value_type,
// is_required: item.is_required
// })
// )
this.attributeList = attrList.sort((x, y) => y.is_required - x.is_required)
})
},
@ -144,7 +136,7 @@ export default {
addCI(values)
.then(res => {
notification.success({
message: '新增成功'
message: this.$t('tip.addSuccess')
})
})
.catch(e => {

View File

@ -12,7 +12,7 @@
<a-form-item :label="prefAttr.alias || prefAttr.name">
<a-select
v-model="queryParam[prefAttr.name]"
placeholder="请选择"
:placeholder="$t('tip.pleaseSelect')"
v-if="prefAttr.is_choice"
>
<a-select-option
@ -45,7 +45,7 @@
v-for="item in preferenceAttrList.slice(4)"
>
<a-form-item :label="item.alias || item.name">
<a-select v-model="queryParam[item.name]" placeholder="请选择" v-if="item.is_choice">
<a-select v-model="queryParam[item.name]" :placeholder="$t('tip.pleaseSelect')" v-if="item.is_choice">
<a-select-option
:value="choice"
:key="'advanced_' + item.name + index"
@ -104,7 +104,6 @@ var valueTypeMap = {
export default {
data () {
return {
// 高级搜索 展开/关闭
advanced: false,
queryParam: {},
valueTypeMap: valueTypeMap

View File

@ -2,7 +2,7 @@
<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.addAttribute') }}</a-button>
</div>
<s-table
@ -12,7 +12,7 @@
:rowKey="record=>record.id"
:rowSelection="options.rowSelection"
:scroll="scroll"
: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="auto"
:pageSize="25"
ref="table"
@ -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"
@ -73,10 +73,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>
@ -104,7 +104,6 @@ export default {
data () {
return {
scroll: { x: 1000, y: 500 },
btnName: '新增属性',
CITypeName: this.$route.params.CITypeName,
CITypeId: this.$route.params.CITypeId,
@ -125,7 +124,7 @@ export default {
},
columns: [
{
title: '名称',
title: this.$t('ciType.alias'),
dataIndex: 'alias',
sorter: false,
width: 250,
@ -144,7 +143,7 @@ export default {
}
},
{
title: '英文名',
title: this.$t('ciType.name'),
dataIndex: 'name',
sorter: false,
width: 250,
@ -163,7 +162,7 @@ export default {
}
},
{
title: '类型',
title: this.$t('ciType.type'),
dataIndex: 'value_type',
sorter: false,
width: 80,
@ -172,7 +171,7 @@ export default {
},
{
title: '唯一',
title: this.$t('ciType.unique'),
dataIndex: 'is_unique',
width: 50,
sorter: false,
@ -180,7 +179,7 @@ export default {
},
{
title: '索引',
title: this.$t('ciType.index'),
dataIndex: 'is_index',
sorter: false,
width: 50,
@ -188,7 +187,7 @@ export default {
},
{
title: '排序',
title: this.$t('ciType.sort'),
dataIndex: 'is_sortable',
sorter: false,
width: 50,
@ -196,7 +195,7 @@ export default {
},
{
title: '链接',
title: this.$t('ciType.link'),
dataIndex: 'is_link',
sorter: false,
width: 50,
@ -204,7 +203,7 @@ export default {
},
{
title: '密码',
title: this.$t('ciType.password'),
dataIndex: 'is_password',
sorter: false,
width: 50,
@ -212,7 +211,7 @@ export default {
},
{
title: '列表',
title: this.$t('ciType.list'),
dataIndex: 'is_list',
sorter: false,
scopedSlots: { customRender: 'is_check' }
@ -220,7 +219,7 @@ export default {
},
{
title: '操作',
title: this.$t('tip.operate'),
dataIndex: 'action',
width: 100,
fixed: 'right',
@ -248,11 +247,8 @@ export default {
},
mdl: {},
// 高级搜索 展开/关闭
advanced: false,
// 查询参数
queryParam: {},
// 表头
selectedRowKeys: [],
selectedRows: [],
@ -340,13 +336,13 @@ export default {
deleteAttribute (attrId) {
deleteAttributesById(attrId)
.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}`)
}

View File

@ -13,18 +13,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"
@ -35,7 +34,7 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="数据类型"
:label="$t('ciType.type')"
>
<a-select
@ -51,7 +50,7 @@
<a-form-item
:label-col="horizontalFormItemLayout.labelCol"
:wrapper-col="horizontalFormItemLayout.wrapperCol"
label="是否唯一"
:label="$t('ciType.isIt') + $t('ciType.unique')"
>
<a-switch
@change="onChange"
@ -63,7 +62,7 @@
<a-form-item
:label-col="horizontalFormItemLayout.labelCol"
:wrapper-col="horizontalFormItemLayout.wrapperCol"
label="是否索引"
:label="$t('ciType.isIt') + $t('ciType.index')"
>
<a-switch
@change="onChange"
@ -75,7 +74,7 @@
<a-form-item
:label-col="horizontalFormItemLayout.labelCol"
:wrapper-col="horizontalFormItemLayout.wrapperCol"
label="是否可排序"
:label="$t('ciType.isIt') + $t('ciType.sort')"
>
<a-switch
@change="onChange"
@ -86,7 +85,7 @@
<a-form-item
:label-col="horizontalFormItemLayout.labelCol"
:wrapper-col="horizontalFormItemLayout.wrapperCol"
label="是否是链接"
:label="$t('ciType.isIt') + $t('ciType.link')"
>
<a-switch
@change="onChange"
@ -97,7 +96,7 @@
<a-form-item
:label-col="horizontalFormItemLayout.labelCol"
:wrapper-col="horizontalFormItemLayout.wrapperCol"
label="是否是密码"
:label="$t('ciType.isIt') + $t('ciType.password')"
>
<a-switch
@change="onChange"
@ -108,7 +107,7 @@
<a-form-item
:label-col="horizontalFormItemLayout.labelCol"
:wrapper-col="horizontalFormItemLayout.wrapperCol"
label="是否列表"
:label="$t('ciType.isIt') + $t('ciType.list')"
>
<a-switch
@change="onChange"
@ -119,12 +118,12 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="预定义值"
:label="$t('ciType.predefinedValue')"
>
<a-textarea
:rows="5"
name="choice_value"
placeholder="多个值使用换行分隔"
:placeholder="$t('ciType.predefinedValueTip')"
v-decorator="['choice_value', {rules: []} ]"
/>
</a-form-item>
@ -171,7 +170,7 @@ export default {
data () {
return {
drawerTitle: '新增属性',
drawerTitle: this.$t('ciType.addAttribute'),
drawerVisible: false,
CITypeName: this.$route.params.CITypeName,
CITypeId: this.$route.params.CITypeId,
@ -271,7 +270,7 @@ export default {
updateAttribute (attrId, data) {
updateAttributeById(attrId, data)
.then(res => {
this.$message.success(`更新成功`)
this.$message.success(this.$t('tip.updateSuccess'))
this.handleOk()
this.onClose()
}).catch(err => this.requestFailed(err))
@ -283,12 +282,12 @@ export default {
if (this.CITypeId) {
createCITypeAttributes(this.CITypeId, { attr_id: [res.attr_id] })
.then(res => {
this.$message.success(`添加成功`)
this.$message.success(this.$t('tip.addSuccess'))
this.handleOk()
this.onClose()
}).catch(err => this.requestFailed(err))
} else {
this.$message.success(`添加成功`)
this.$message.success(this.$t('tip.addSuccess'))
this.handleOk()
this.onClose()
}
@ -297,7 +296,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,9 +1,11 @@
import i18n from '@/locales'
export const valueTypeMap = {
'0': '整数',
'1': '浮点数',
'2': '文本',
'3': 'datetime',
'4': 'date',
'5': 'time',
'6': 'json'
'0': i18n.t('ciType.integer'),
'1': i18n.t('ciType.float'),
'2': i18n.t('ciType.text'),
'3': 'Datetime',
'4': 'Date',
'5': 'Time',
'6': 'Json'
}

View File

@ -158,8 +158,8 @@ export default {
form: this.$form.createForm(this),
scroll: { x: 1030, y: 600 },
singleAttrAction: {
btnName: '新增属性',
drawerTitle: '新增属性',
btnName: this.$t('ciType.addAttribute'),
drawerTitle: this.$t('ciType.addAttribute'),
drawerVisible: false
},
batchBindAttrAction: {

View File

@ -49,7 +49,7 @@
<a-select
ref="tree"
mode="multiple"
placeholder="- - 目录层级的选择 - -"
:placeholder="$t('ci.selectLevel')"
:value="treeViews"
style="width: 100%"
@change="handleTreeSub"
@ -80,13 +80,13 @@
width: '230px',
height: '500px',
}"
:titles="['未选属性','已选属性']"
:titles="[$t('tip.unselectedAttribute'), $t('tip.selectedAttribute')]"
:render="item=>item.title"
:targetKeys="selectedAttrList"
@change="handleChange"
@search="handleSearch"
>
<span slot="notFoundContent">没数据</span>
<span slot="notFoundContent">{{ $t('tip.noData') }}</span>
</a-transfer>
</template>
<div
@ -161,15 +161,15 @@ export default {
unsubscribe (citypeId) {
const that = this
this.$confirm({
title: '警告',
content: '真的要取消订阅吗 ?',
title: that.$t('tip.warning'),
content: that.$t('preference.cancelSubscribeConfirm'),
onOk () {
const unsubCIType = subscribeCIType(citypeId, '')
const unsubTree = subscribeTreeView(citypeId, '')
Promise.all([unsubCIType, unsubTree])
.then(() => {
notification.success({
message: '取消成功'
message: that.$t('tip.cancelSuccess')
})
that.resetRoute()
})
@ -183,7 +183,6 @@ export default {
onCancel () {}
})
},
// 显示右边的弹出框
showDrawer (typeId, typeName) {
this.typeId = typeId
this.typeName = typeName
@ -223,17 +222,15 @@ export default {
handleTreeSub (values) {
this.treeViews = values
},
// 处理点击改变事件
handleChange (targetKeys, direction, moveKeys) {
this.selectedAttrList = targetKeys
},
handleSearch (dir, value) {},
// 处理提交事件
subInstanceSubmit () {
subscribeCIType(this.typeId, this.selectedAttrList)
.then(res => {
notification.success({
message: '订阅成功'
message: this.$t('preference.subscribeSuccess')
})
this.resetRoute()
})
@ -281,7 +278,7 @@ export default {
subscribeTreeView(this.typeId, this.treeViews)
.then(res => {
notification.success({
message: '订阅成功'
message: this.$t('preference.subscribeSuccess')
})
})
.catch(e => {

View File

@ -7,7 +7,7 @@
>{{ item[0] }}</router-link>
</a-menu-item>
</a-menu>
<a-alert message="管理员 还未配置关系视图, 或者你无权限访问!" banner v-else-if="relationViews.name2id && !relationViews.name2id.length"></a-alert>
<a-alert :message="$t('relationView.tip')" banner v-else-if="relationViews.name2id && !relationViews.name2id.length"></a-alert>
<div style="clear: both; margin-top: 20px"></div>
<template>
<a-row :gutter="8">
@ -30,7 +30,7 @@
:columns="columns"
:data="loadInstances"
:scroll="{ x: scrollX, y: scrollY }"
: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}"
:pageSize="25"
showPagination="auto"
></s-table>

View File

@ -7,7 +7,7 @@
>{{ ciType.alias || ciTypes.name }}</router-link>
</a-menu-item>
</a-menu>
<a-alert message="请先到 我的订阅 页面完成订阅!" banner v-else-if="ciTypes && !ciTypes.length"></a-alert>
<a-alert :message="$t('treeView.tip')" banner v-else-if="ciTypes && !ciTypes.length"></a-alert>
<div style="clear: both; margin-top: 20px"></div>
<template>
<a-row :gutter="8">
@ -25,7 +25,7 @@
:columns="columns"
:data="loadInstances"
:scroll="{ x: scrollX, y: scrollY }"
: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}"
:pageSize="25"
showPagination="auto"
></s-table>