mirror of https://github.com/veops/cmdb.git
feat(cmdb-ui):i18n
This commit is contained in:
parent
3401cf4a1e
commit
420106ae65
Binary file not shown.
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 30 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 143 KiB |
|
@ -63,7 +63,7 @@ export default {
|
|||
updateCI(this.row.ci_id || this.row._id, {
|
||||
[`${this.column.property}`]: this.default_value_json_right ? this.jsonData : {},
|
||||
}).then(() => {
|
||||
this.$message.success('保存成功!')
|
||||
this.$message.success(this.$t('saveSuccess'))
|
||||
this.handleCancel()
|
||||
this.$emit('jsonEditorOk', this.row, this.column, this.default_value_json_right ? this.jsonData : {})
|
||||
})
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
width: '200px',
|
||||
height: `${height}px`,
|
||||
}"
|
||||
:titles="['未选属性', '已选属性']"
|
||||
:titles="[$t('cmdb.components.unselectAttributes'), $t('cmdb.components.selectAttributes')]"
|
||||
:render="(item) => item.title"
|
||||
:targetKeys="targetKeys"
|
||||
@change="handleChange"
|
||||
|
@ -16,7 +16,7 @@
|
|||
:filterOption="filterOption"
|
||||
class="cmdb-transfer"
|
||||
>
|
||||
<span slot="notFoundContent">暂无数据</span>
|
||||
<span slot="notFoundContent">{{ $t('noData') }}</span>
|
||||
<template slot="children" slot-scope="{ props: { direction, filteredItems } }">
|
||||
<div class="ant-transfer-list-content" v-if="direction === 'right'">
|
||||
<draggable :value="targetKeys" animation="300" @end="dragEnd" :disabled="!isSortable">
|
||||
|
@ -27,10 +27,11 @@
|
|||
:style="{ height: '38px' }"
|
||||
>
|
||||
<li
|
||||
:class="{
|
||||
'ant-transfer-list-content-item': true,
|
||||
'ant-transfer-list-content-item-selected': selectedKeys.includes(item.key),
|
||||
}"
|
||||
:class="
|
||||
`ant-transfer-list-content-item ${
|
||||
selectedKeys.includes(item.key) ? 'ant-transfer-list-content-item-selected' : ''
|
||||
}`
|
||||
"
|
||||
@click="setSelectedKeys(item)"
|
||||
>
|
||||
<OpsMoveIcon class="move-icon" />
|
||||
|
@ -62,9 +63,11 @@
|
|||
:style="{ height: '38px' }"
|
||||
>
|
||||
<li
|
||||
:class="`ant-transfer-list-content-item ${
|
||||
selectedKeys.includes(item.key) ? 'ant-transfer-list-content-item-selected' : ''
|
||||
}`"
|
||||
:class="
|
||||
`ant-transfer-list-content-item ${
|
||||
selectedKeys.includes(item.key) ? 'ant-transfer-list-content-item-selected' : ''
|
||||
}`
|
||||
"
|
||||
@click="setSelectedKeys(item)"
|
||||
>
|
||||
<div class="ant-transfer-list-content-item-text" style="display: inline">
|
||||
|
@ -83,7 +86,7 @@
|
|||
</template>
|
||||
</a-transfer>
|
||||
<div v-if="hasFooter" :style="{ marginTop: '5px', height: '20px' }">
|
||||
<a-button :style="{ float: 'right' }" size="small" @click="handleSubmit" type="primary">确定</a-button>
|
||||
<a-button :style="{ float: 'right' }" size="small" @click="handleSubmit" type="primary">{{ $t('confirm') }}</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -110,12 +113,12 @@ export default {
|
|||
default: true,
|
||||
},
|
||||
isSortable: {
|
||||
// 右侧是否可排序
|
||||
// Is the right side sortable?
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
isFixable: {
|
||||
// 右侧是否可固定
|
||||
// Can the right side be fixed?
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
|
|
|
@ -1,21 +1,30 @@
|
|||
<template>
|
||||
<a-modal :visible="visible" title="导出数据" @cancel="handleCancel" okText="导出" @ok="handleOk">
|
||||
<a-modal
|
||||
:visible="visible"
|
||||
:title="$t('cmdb.components.downloadCI')"
|
||||
@cancel="handleCancel"
|
||||
@ok="handleOk"
|
||||
width="700px"
|
||||
>
|
||||
<a-form :form="form" :label-col="{ span: 6 }" :wrapper-col="{ span: 15 }">
|
||||
<a-form-item label="文件名">
|
||||
<a-form-item :label="$t('cmdb.components.filename')">
|
||||
<a-input
|
||||
placeholder="请输入文件名"
|
||||
v-decorator="['filename', { rules: [{ required: true, message: '请输入文件名' }] }]"
|
||||
:placeholder="$t('cmdb.components.filenameInputTips')"
|
||||
v-decorator="['filename', { rules: [{ required: true, message: $t('cmdb.components.filenameInputTips') }] }]"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="保存类型">
|
||||
<a-form-item :label="$t('cmdb.components.saveType')">
|
||||
<a-select
|
||||
placeholder="请选择保存类型"
|
||||
v-decorator="['type', { rules: [{ required: true, message: '请选择保存类型' }], initialValue: 'xlsx' }]"
|
||||
:placeholder="$t('cmdb.components.saveTypeTips')"
|
||||
v-decorator="[
|
||||
'type',
|
||||
{ rules: [{ required: true, message: $t('cmdb.components.saveTypeTips') }], initialValue: 'xlsx' },
|
||||
]"
|
||||
>
|
||||
<a-select-option v-for="item in typeList" :key="item.id" :values="item.id">{{ item.label }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="选择字段">
|
||||
<a-form-item :label="$t('cmdb.ciType.selectAttributes')">
|
||||
<div
|
||||
:style="{
|
||||
paddingLeft: '26px',
|
||||
|
@ -29,7 +38,7 @@
|
|||
:checked="checkAll"
|
||||
@change="onCheckAllChange"
|
||||
:style="{ marginRight: '10px' }"
|
||||
/>全选
|
||||
/>{{ $t('checkAll') }}
|
||||
</div>
|
||||
<div
|
||||
:style="{
|
||||
|
@ -76,30 +85,7 @@ export default {
|
|||
},
|
||||
},
|
||||
data() {
|
||||
const typeList = [
|
||||
{
|
||||
id: 'xlsx',
|
||||
label: 'Excel工作簿(*.xlsx)',
|
||||
},
|
||||
{
|
||||
id: 'csv',
|
||||
label: 'CSV(逗号分隔)(*.csv)',
|
||||
},
|
||||
{
|
||||
id: 'html',
|
||||
label: '网页(*.html)',
|
||||
},
|
||||
{
|
||||
id: 'xml',
|
||||
label: 'XML数据(*.xml)',
|
||||
},
|
||||
{
|
||||
id: 'txt',
|
||||
label: '文本文件(制表符分隔)(*.txt)',
|
||||
},
|
||||
]
|
||||
return {
|
||||
typeList,
|
||||
visible: false,
|
||||
form: this.$form.createForm(this),
|
||||
preferenceAttrList: [],
|
||||
|
@ -109,6 +95,32 @@ export default {
|
|||
defaultChecked: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
typeList() {
|
||||
return [
|
||||
{
|
||||
id: 'xlsx',
|
||||
label: this.$t('cmdb.components.xlsx'),
|
||||
},
|
||||
{
|
||||
id: 'csv',
|
||||
label: this.$t('cmdb.components.csv'),
|
||||
},
|
||||
{
|
||||
id: 'html',
|
||||
label: this.$t('cmdb.components.html'),
|
||||
},
|
||||
{
|
||||
id: 'xml',
|
||||
label: this.$t('cmdb.components.xml'),
|
||||
},
|
||||
{
|
||||
id: 'txt',
|
||||
label: this.$t('cmdb.components.txt'),
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapMutations('cmdbStore', ['SET_IS_TABLE_LOADING']),
|
||||
open({ preferenceAttrList, ciTypeName = undefined }) {
|
||||
|
|
|
@ -25,17 +25,17 @@
|
|||
</vxe-column>
|
||||
<template #empty>
|
||||
<div v-if="loading()" style="height: 200px; line-height: 200px;color:#2F54EB">
|
||||
<a-icon type="loading" /> 加载中...
|
||||
<a-icon type="loading" /> {{ $t('loading') }}
|
||||
</div>
|
||||
<div v-else>
|
||||
<img :style="{ width: '100px' }" :src="require('@/assets/data_empty.png')" />
|
||||
<div>暂无数据</div>
|
||||
<div>{{ $t('noData') }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</vxe-table>
|
||||
<a-space>
|
||||
<span class="grant-button" @click="grantDepart">授权用户/部门</span>
|
||||
<span class="grant-button" @click="grantRole">授权角色</span>
|
||||
<span class="grant-button" @click="grantDepart">{{ $t('cmdb.components.grantUser') }}</span>
|
||||
<span class="grant-button" @click="grantRole">{{ $t('cmdb.components.grantRole') }}</span>
|
||||
</a-space>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -95,10 +95,8 @@ export default {
|
|||
}
|
||||
return (this.windowHeight - 104) / 2 - 116
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permMap,
|
||||
permMap() {
|
||||
return permMap()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -131,8 +129,8 @@ export default {
|
|||
} else {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: `确认删除 【${row.name}】 的 【授权】 权限?`,
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('cmdb.components.confirmRevoke', { name: `${row.name}` }),
|
||||
onOk() {
|
||||
that.handleChange({ target: { checked: false } }, col, row)
|
||||
const _idx = that.tableData.findIndex((item) => item.rid === row.rid)
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
export const permMap = {
|
||||
read: '查看',
|
||||
add: '新增',
|
||||
create: '新增',
|
||||
update: '修改',
|
||||
delete: '删除',
|
||||
config: '配置',
|
||||
grant: '授权',
|
||||
'read_attr': '查看字段',
|
||||
'read_ci': '查看实例'
|
||||
import i18n from '@/lang'
|
||||
|
||||
export const permMap = () => {
|
||||
return {
|
||||
read: i18n.t('view'),
|
||||
add: i18n.t('new'),
|
||||
create: i18n.t('new'),
|
||||
update: i18n.t('update'),
|
||||
delete: i18n.t('delete'),
|
||||
config: i18n.t('cmdb.components.config'),
|
||||
grant: i18n.t('grant'),
|
||||
'read_attr': i18n.t('cmdb.components.readAttribute'),
|
||||
'read_ci': i18n.t('cmdb.components.readCI')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="cmdb-grant" :style="{ maxHeight: `${windowHeight - 104}px` }">
|
||||
<template v-if="cmdbGrantType.includes('ci_type')">
|
||||
<div class="cmdb-grant-title">模型权限</div>
|
||||
<div class="cmdb-grant-title">{{ $t('cmdb.components.ciTypeGrant') }}</div>
|
||||
<CiTypeGrant
|
||||
:CITypeId="CITypeId"
|
||||
:tableData="tableData"
|
||||
|
@ -18,7 +18,7 @@
|
|||
cmdbGrantType.includes('ci_type,ci') || (cmdbGrantType.includes('ci') && !cmdbGrantType.includes('ci_type'))
|
||||
"
|
||||
>
|
||||
<div class="cmdb-grant-title">实例权限</div>
|
||||
<div class="cmdb-grant-title">{{ $t('cmdb.components.ciGrant') }}</div>
|
||||
<CiTypeGrant
|
||||
:CITypeId="CITypeId"
|
||||
:tableData="tableData"
|
||||
|
@ -32,7 +32,7 @@
|
|||
/>
|
||||
</template>
|
||||
<template v-if="cmdbGrantType.includes('type_relation')">
|
||||
<div class="cmdb-grant-title">关系权限</div>
|
||||
<div class="cmdb-grant-title">{{ $t('cmdb.components.relationGrant') }}</div>
|
||||
<TypeRelationGrant
|
||||
:typeRelationIds="typeRelationIds"
|
||||
:tableData="tableData"
|
||||
|
@ -45,7 +45,7 @@
|
|||
/>
|
||||
</template>
|
||||
<template v-if="cmdbGrantType.includes('relation_view')">
|
||||
<div class="cmdb-grant-title">{{ resourceTypeName }}权限</div>
|
||||
<div class="cmdb-grant-title">{{ resourceTypeName }}{{ $t('cmdb.components.perm') }}</div>
|
||||
<RelationViewGrant
|
||||
:resourceTypeName="resourceTypeName"
|
||||
:tableData="tableData"
|
||||
|
@ -116,7 +116,7 @@ export default {
|
|||
attrGroup: [],
|
||||
filerPerimissions: {},
|
||||
loading: false,
|
||||
addedRids: [], // 本次新增的rid
|
||||
addedRids: [], // added rid this time
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -203,12 +203,12 @@ export default {
|
|||
this.tableData = perms
|
||||
this.loading = false
|
||||
},
|
||||
// 授权common-setting中的部门 从中拿到roleid
|
||||
// Grant the department in common-setting and get the roleid from it
|
||||
grantDepart(grantType) {
|
||||
this.$refs.grantModal.open('depart')
|
||||
this.grantType = grantType
|
||||
},
|
||||
// 授权最古老的角色权限
|
||||
// Grant the oldest role permissions
|
||||
grantRole(grantType) {
|
||||
this.$refs.grantModal.open('role')
|
||||
this.grantType = grantType
|
||||
|
|
|
@ -26,9 +26,9 @@ export default {
|
|||
computed: {
|
||||
title() {
|
||||
if (this.type === 'depart') {
|
||||
return '授权用户/部门'
|
||||
return this.$t('cmdb.components.grantUser')
|
||||
}
|
||||
return '授权角色'
|
||||
return this.$t('cmdb.components.grantRole')
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
<a-modal :width="680" :title="title" :visible="visible" @ok="handleOk" @cancel="handleCancel">
|
||||
<CustomRadio
|
||||
:radioList="[
|
||||
{ value: 1, label: '全部' },
|
||||
{ value: 2, label: '自定义', layout: 'vertical' },
|
||||
{ value: 3, label: '无' },
|
||||
{ value: 1, label: $t('cmdb.components.all') },
|
||||
{ value: 2, label: $t('cmdb.components.customize'), layout: 'vertical' },
|
||||
{ value: 3, label: $t('cmdb.components.none') },
|
||||
]"
|
||||
v-model="radioValue"
|
||||
>
|
||||
|
@ -16,7 +16,7 @@
|
|||
:clearable="true"
|
||||
searchable
|
||||
:options="attrGroup"
|
||||
placeholder="请选择属性字段"
|
||||
:placeholder="$t('cmdb.ciType.selectAttributes')"
|
||||
value-consists-of="LEAF_PRIORITY"
|
||||
:limit="10"
|
||||
:limitText="(count) => `+ ${count}`"
|
||||
|
@ -24,8 +24,8 @@
|
|||
(node) => {
|
||||
return {
|
||||
id: node.name || -1,
|
||||
label: node.alias || node.name || '其他',
|
||||
title: node.alias || node.name || '其他',
|
||||
label: node.alias || node.name || $t('other'),
|
||||
title: node.alias || node.name || $t('other'),
|
||||
children: node.attributes,
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@
|
|||
:wrapperCol="{ span: 10 }"
|
||||
ref="form"
|
||||
>
|
||||
<a-form-model-item label="名称" prop="name">
|
||||
<a-form-model-item :label="$t('name')" prop="name">
|
||||
<a-input v-model="form.name" />
|
||||
</a-form-model-item>
|
||||
<FilterComp
|
||||
|
@ -99,16 +99,16 @@ export default {
|
|||
name: '',
|
||||
},
|
||||
rules: {
|
||||
name: [{ required: true, message: '请输入自定义筛选条件名' }],
|
||||
name: [{ required: true, message: this.$t('cmdb.components.customizeFilterName') }],
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
if (this.colType === 'read_attr') {
|
||||
return '字段权限'
|
||||
return this.$t('cmdb.components.attributeGrant')
|
||||
}
|
||||
return '实例权限'
|
||||
return this.$t('cmdb.components.ciGrant')
|
||||
},
|
||||
attrGroup() {
|
||||
return this.provide_attrGroup()
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
</vxe-column>
|
||||
</vxe-table>
|
||||
<a-space>
|
||||
<span class="grant-button" @click="grantDepart">授权用户/部门</span>
|
||||
<span class="grant-button" @click="grantRole">授权角色</span>
|
||||
<span class="grant-button" @click="grantDepart">{{ $t('cmdb.components.grantUser') }}</span>
|
||||
<span class="grant-button" @click="grantRole">{{ $t('cmdb.components.grantRole') }}</span>
|
||||
</a-space>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -51,7 +51,6 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
permMap,
|
||||
columns: ['read', 'grant'],
|
||||
}
|
||||
},
|
||||
|
@ -65,6 +64,9 @@ export default {
|
|||
}
|
||||
return (this.windowHeight - 104) / 2 - 116
|
||||
},
|
||||
permMap() {
|
||||
return permMap()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getCurrentRowStyle,
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
</vxe-column>
|
||||
</vxe-table>
|
||||
<a-space>
|
||||
<span class="grant-button" @click="grantDepart">授权用户/部门</span>
|
||||
<span class="grant-button" @click="grantRole">授权角色</span>
|
||||
<span class="grant-button" @click="grantDepart">{{ $t('cmdb.components.grantUser') }}</span>
|
||||
<span class="grant-button" @click="grantRole">{{ $t('cmdb.components.grantRole') }}</span>
|
||||
</a-space>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -51,7 +51,6 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
permMap,
|
||||
columns: ['create', 'grant', 'delete'],
|
||||
}
|
||||
},
|
||||
|
@ -65,6 +64,9 @@ export default {
|
|||
}
|
||||
return (this.windowHeight - 104) / 2 - 116
|
||||
},
|
||||
permMap() {
|
||||
return permMap()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getCurrentRowStyle,
|
||||
|
|
|
@ -132,7 +132,7 @@ export default {
|
|||
} else if (color.indexOf('rgb') !== -1) {
|
||||
hsvObj = this.rgbToHSV(color)
|
||||
} else {
|
||||
throw new Error('初始化颜色格式错误,使用#fff或rgb格式')
|
||||
throw new Error(this.$t('cmdb.components.colorPickerError'))
|
||||
// this.$message.error('颜色格式错误,使用16进制格式')
|
||||
}
|
||||
if (hsvObj) {
|
||||
|
|
|
@ -15,19 +15,19 @@
|
|||
:edit-config="isEdit ? { trigger: 'click', mode: 'cell' } : {}"
|
||||
>
|
||||
<template v-if="isEdit">
|
||||
<vxe-colgroup title="自动发现">
|
||||
<vxe-column field="name" title="名称" width="100"> </vxe-column>
|
||||
<vxe-column field="type" title="类型" width="80"> </vxe-column>
|
||||
<vxe-column field="example" title="示例值">
|
||||
<vxe-colgroup :title="$t('cmdb.ciType.autoDiscovery')">
|
||||
<vxe-column field="name" :title="$t('name')" width="100"> </vxe-column>
|
||||
<vxe-column field="type" :title="$t('type')" width="80"> </vxe-column>
|
||||
<vxe-column field="example" :title="$t('cmdb.components.example')">
|
||||
<template #default="{row}">
|
||||
<span v-if="row.type === 'json'">{{ JSON.stringify(row.example) }}</span>
|
||||
<span v-else>{{ row.example }}</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="desc" title="描述"> </vxe-column>
|
||||
<vxe-column field="desc" :title="$t('desc')"> </vxe-column>
|
||||
</vxe-colgroup>
|
||||
<vxe-colgroup title="模型属性">
|
||||
<vxe-column field="attr" title="名称" :edit-render="{}">
|
||||
<vxe-colgroup :title="$t('cmdb.ciType.attributes')">
|
||||
<vxe-column field="attr" :title="$t('name')" :edit-render="{}">
|
||||
<template #default="{row}">
|
||||
{{ row.attr }}
|
||||
</template>
|
||||
|
@ -45,15 +45,15 @@
|
|||
</vxe-colgroup>
|
||||
</template>
|
||||
<template v-else>
|
||||
<vxe-column field="name" title="名称" width="100"> </vxe-column>
|
||||
<vxe-column field="type" title="类型" width="80"> </vxe-column>
|
||||
<vxe-column field="example" title="示例值">
|
||||
<vxe-column field="name" :title="$t('name')" width="100"> </vxe-column>
|
||||
<vxe-column field="type" :title="$t('type')" width="80"> </vxe-column>
|
||||
<vxe-column field="example" :title="$t('cmdb.components.example')">
|
||||
<template #default="{row}">
|
||||
<span v-if="row.type === 'object'">{{ JSON.stringify(row.example) }}</span>
|
||||
<span v-else>{{ row.example }}</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="desc" title="描述"> </vxe-column>
|
||||
<vxe-column field="desc" :title="$t('desc')"> </vxe-column>
|
||||
</template>
|
||||
</vxe-table>
|
||||
</div>
|
||||
|
@ -61,12 +61,6 @@
|
|||
|
||||
<script>
|
||||
import { getHttpCategories, getHttpAttributes, getSnmpAttributes } from '../../api/discovery'
|
||||
const httpMap = {
|
||||
阿里云: { name: 'aliyun' },
|
||||
腾讯云: { name: 'tencentcloud' },
|
||||
华为云: { name: 'huaweicloud' },
|
||||
AWS: { name: 'aws' },
|
||||
}
|
||||
export default {
|
||||
name: 'HttpSnmpAD',
|
||||
props: {
|
||||
|
@ -107,13 +101,21 @@ export default {
|
|||
const { ruleType, ruleName } = this
|
||||
return { ruleType, ruleName }
|
||||
},
|
||||
httpMap() {
|
||||
return {
|
||||
[this.$t('cmdb.components.aliyun')]: { name: 'aliyun' },
|
||||
[this.$t('cmdb.components.tencentcloud')]: { name: 'tencentcloud' },
|
||||
[this.$t('cmdb.components.huaweicloud')]: { name: 'huaweicloud' },
|
||||
AWS: { name: 'aws' },
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
currentCate: {
|
||||
immediate: true,
|
||||
handler(newVal) {
|
||||
if (newVal) {
|
||||
getHttpAttributes(httpMap[`${this.ruleName}`].name, { category: newVal }).then((res) => {
|
||||
getHttpAttributes(this.httpMap[`${this.ruleName}`].name, { category: newVal }).then((res) => {
|
||||
if (this.isEdit) {
|
||||
this.formatTableData(res)
|
||||
} else {
|
||||
|
@ -139,7 +141,7 @@ export default {
|
|||
})
|
||||
}
|
||||
if (ruleType === 'http' && ruleName) {
|
||||
getHttpCategories(httpMap[`${this.ruleName}`].name).then((res) => {
|
||||
getHttpCategories(this.httpMap[`${this.ruleName}`].name).then((res) => {
|
||||
this.categories = res
|
||||
if (res && res.length) {
|
||||
this.currentCate = res[0]
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<Editor class="notice-content-editor" :defaultConfig="editorConfig" mode="simple" @onCreated="onCreated" />
|
||||
<div class="notice-content-sidebar">
|
||||
<template v-if="needOld">
|
||||
<div class="notice-content-sidebar-divider">变更前</div>
|
||||
<div class="notice-content-sidebar-divider">{{ $t('cmdb.components.beforeChange') }}</div>
|
||||
<div
|
||||
@dblclick="dblclickSidebar(`old_${attr.name}`, attr.alias || attr.name)"
|
||||
class="notice-content-sidebar-item"
|
||||
|
@ -29,7 +29,7 @@
|
|||
>
|
||||
{{ attr.alias || attr.name }}
|
||||
</div>
|
||||
<div class="notice-content-sidebar-divider">变更后</div>
|
||||
<div class="notice-content-sidebar-divider">{{ $t('cmdb.components.afterChange') }}</div>
|
||||
</template>
|
||||
<div
|
||||
@dblclick="dblclickSidebar(attr.name, attr.alias || attr.name)"
|
||||
|
@ -65,7 +65,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
editor: null,
|
||||
editorConfig: { placeholder: '请输入通知内容', readOnly: this.readOnly },
|
||||
editorConfig: { placeholder: this.$t('cmdb.components.noticeContentTips'), readOnly: this.readOnly },
|
||||
content: '',
|
||||
defaultParams: [],
|
||||
value2LabelMap: {},
|
||||
|
@ -74,11 +74,11 @@ export default {
|
|||
beforeDestroy() {
|
||||
const editor = this.editor
|
||||
if (editor == null) return
|
||||
editor.destroy() // 组件销毁时,及时销毁编辑器
|
||||
editor.destroy() // When the component is destroyed, destroy the editor in time
|
||||
},
|
||||
methods: {
|
||||
onCreated(editor) {
|
||||
this.editor = Object.seal(editor) // 一定要用 Object.seal() ,否则会报错
|
||||
this.editor = Object.seal(editor) // Be sure to use Object.seal(), otherwise an error will be reported
|
||||
},
|
||||
getContent() {
|
||||
const html = _.cloneDeep(this.editor.getHtml())
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
@blur="handleInputConfirm"
|
||||
@keyup.enter="handleInputConfirm"
|
||||
/>
|
||||
<a-button v-else type="primary" size="small" ghost @click="showInput">保存筛选条件</a-button>
|
||||
<a-button v-else type="primary" size="small" ghost @click="showInput">{{ $t('cmdb.components.saveQuery') }}</a-button>
|
||||
</span>
|
||||
<template v-for="(item, index) in preferenceSearchList.slice(0, 3)">
|
||||
<span
|
||||
|
@ -26,7 +26,7 @@
|
|||
<a-tooltip :title="item.name">
|
||||
<span @click="clickPreferenceSearch(item)">{{ `${item.name.slice(0, 6)}...` }}</span>
|
||||
</a-tooltip>
|
||||
<a-popconfirm title="确认删除?" @confirm="deletePreferenceSearch(item)">
|
||||
<a-popconfirm :title="$t('cmdb.ciType.confirmDelete2')" @confirm="deletePreferenceSearch(item)">
|
||||
<a-icon type="close" />
|
||||
</a-popconfirm>
|
||||
</span>
|
||||
|
@ -40,7 +40,7 @@
|
|||
}"
|
||||
>
|
||||
<span @click="clickPreferenceSearch(item)">{{ item.name }}</span>
|
||||
<a-popconfirm title="确认删除?" @confirm="deletePreferenceSearch(item)">
|
||||
<a-popconfirm :title="$t('cmdb.ciType.confirmDelete2')" @confirm="deletePreferenceSearch(item)">
|
||||
<a-icon type="close" />
|
||||
</a-popconfirm>
|
||||
</span>
|
||||
|
@ -73,7 +73,7 @@
|
|||
{{ item.name }}
|
||||
</div>
|
||||
<a-popconfirm
|
||||
title="确认删除?"
|
||||
:title="$t('cmdb.ciType.confirmDelete2')"
|
||||
:getPopupContainer="(trigger) => trigger.parentElement"
|
||||
placement="left"
|
||||
@confirm="
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
:limit="1"
|
||||
:limitText="(count) => `+ ${count}`"
|
||||
value-consists-of="LEAF_PRIORITY"
|
||||
placeholder="模型"
|
||||
:placeholder="$t('cmdb.ciType.ciType')"
|
||||
@close="closeCiTypeGroup"
|
||||
@open="openCiTypeGroup"
|
||||
@input="inputCiTypeGroup"
|
||||
|
@ -23,8 +23,8 @@
|
|||
(node) => {
|
||||
return {
|
||||
id: node.id || -1,
|
||||
label: node.alias || node.name || '其他',
|
||||
title: node.alias || node.name || '其他',
|
||||
label: node.alias || node.name || $t('other'),
|
||||
title: node.alias || node.name || $t('other'),
|
||||
children: node.ci_types,
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@
|
|||
<a-input
|
||||
v-model="fuzzySearch"
|
||||
:style="{ display: 'inline-block', width: '244px' }"
|
||||
placeholder="请查找"
|
||||
:placeholder="$t('cmdb.components.pleaseSearch')"
|
||||
@pressEnter="emitRefresh"
|
||||
class="ops-input ops-input-radius"
|
||||
>
|
||||
|
@ -54,7 +54,7 @@
|
|||
/>
|
||||
<a-tooltip slot="prefix" placement="bottom" :overlayStyle="{ maxWidth: '550px' }">
|
||||
<template slot="title">
|
||||
1、json属性不能搜索<br />2、搜索内容包括逗号,则需转义 \,<br />3、只搜索索引属性,非索引属性使用条件过滤
|
||||
{{ $t('cmdb.components.ciSearchTips') }}
|
||||
</template>
|
||||
<a><a-icon type="question-circle"/></a>
|
||||
</a-tooltip>
|
||||
|
@ -68,7 +68,7 @@
|
|||
>
|
||||
<div slot="popover_item" class="search-form-bar-filter">
|
||||
<a-icon class="search-form-bar-filter-icon" type="filter" />
|
||||
条件过滤
|
||||
{{ $t('cmdb.components.conditionFilter') }}
|
||||
<a-icon class="search-form-bar-filter-icon" type="down" />
|
||||
</div>
|
||||
</FilterComp>
|
||||
|
@ -97,8 +97,8 @@
|
|||
</a-space>
|
||||
</div>
|
||||
<a-space>
|
||||
<a-button @click="reset" size="small">重置</a-button>
|
||||
<a-tooltip title="属性说明" v-if="type === 'relationView'">
|
||||
<a-button @click="reset" size="small">{{ $t('reset') }}</a-button>
|
||||
<a-tooltip :title="$t('cmdb.components.attributeDesc')" v-if="type === 'relationView'">
|
||||
<a
|
||||
@click="
|
||||
() => {
|
||||
|
@ -149,7 +149,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
// 高级搜索 展开/关闭
|
||||
// Advanced Search Expand/Close
|
||||
advanced: false,
|
||||
queryParam: {},
|
||||
isFocusExpression: false,
|
||||
|
@ -163,7 +163,7 @@ export default {
|
|||
|
||||
computed: {
|
||||
placeholder() {
|
||||
return this.isFocusExpression ? '例:q=hostname:*0.0.0.0*' : '表达式'
|
||||
return this.isFocusExpression ? this.$t('cmdb.components.ciSearchTips2') : this.$t('cmdb.ciType.expr')
|
||||
},
|
||||
width() {
|
||||
return '200px'
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
>
|
||||
<a-tabs v-model="activeKey">
|
||||
<a-tab-pane key="1">
|
||||
<span slot="tab"><ops-icon type="cmdb-ci" />资源数据</span>
|
||||
<span slot="tab"><ops-icon type="cmdb-ci" />{{ $t('cmdb.menu.ciTable') }}</span>
|
||||
<div class="cmdb-subscribe-drawer-container" :style="{ height: `${windowHeight - 60}px` }">
|
||||
<div class="cmdb-subscribe-drawer-container-title">
|
||||
<span>订阅模型:{{ ciType.alias || ciType.name }}</span>
|
||||
<span>{{ $t('cmdb.components.subCIType') }}: {{ ciType.alias || ciType.name }}</span>
|
||||
<span :style="{ fontWeight: 500, color: instanceSubscribed ? 'green' : 'red' }">{{
|
||||
`(${instanceSubscribed ? '已' : '未'}订阅)`
|
||||
}}</span>
|
||||
`(${instanceSubscribed ? $t('cmdb.components.already') : $t('cmdb.components.not')}`
|
||||
}}{{ $t('cmdb.components.sub') }})</span>
|
||||
</div>
|
||||
<template>
|
||||
<AttributesTransfer
|
||||
|
@ -31,22 +31,22 @@
|
|||
:height="windowHeight - 170"
|
||||
/>
|
||||
<div class="custom-drawer-bottom-action">
|
||||
<a-button @click="subInstanceSubmit" type="primary">订阅</a-button>
|
||||
<a-button @click="subInstanceSubmit" type="primary">{{ $t('cmdb.preference.sub') }}</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" force-render>
|
||||
<span slot="tab"><ops-icon type="cmdb-tree" />资源层级</span>
|
||||
<span slot="tab"><ops-icon type="cmdb-tree" />{{ $t('cmdb.menu.ciTree') }}</span>
|
||||
<div class="cmdb-subscribe-drawer-container" :style="{ height: `${windowHeight - 60}px` }">
|
||||
<div class="cmdb-subscribe-drawer-container-title">
|
||||
<span>订阅模型:{{ ciType.alias || ciType.name }}</span>
|
||||
<span>{{ $t('cmdb.components.subCIType') }}: {{ ciType.alias || ciType.name }}</span>
|
||||
<span :style="{ fontWeight: 500, color: treeSubscribed ? 'green' : 'red' }">{{
|
||||
`(${treeSubscribed ? '已' : '未'}订阅)`
|
||||
}}</span>
|
||||
`(${treeSubscribed ? $t('cmdb.components.already') : $t('cmdb.components.not')}`
|
||||
}}{{ $t('cmdb.components.sub') }})</span>
|
||||
</div>
|
||||
<div class="cmdb-subscribe-drawer-tree-header" :style="{ maxHeight: `${(windowHeight - 170) / 3 - 20}px` }">
|
||||
<span v-if="!treeViews.length">请在下方进行选择</span>
|
||||
<span v-if="!treeViews.length">{{ $t('cmdb.components.selectBelow') }}</span>
|
||||
<div
|
||||
class="cmdb-subscribe-drawer-tree-header-selected"
|
||||
:style="{ marginLeft: `${18 * index}px` }"
|
||||
|
@ -70,7 +70,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="custom-drawer-bottom-action">
|
||||
<a-button @click="subTreeSubmit" type="primary">订阅</a-button>
|
||||
<a-button @click="subTreeSubmit" type="primary">{{ $t('cmdb.preference.sub') }}</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
|
@ -179,7 +179,7 @@ export default {
|
|||
},
|
||||
subTreeSubmit() {
|
||||
subscribeTreeView(this.ciType.type_id, this.treeViews).then((res) => {
|
||||
this.$message.success('订阅成功')
|
||||
this.$message.success(this.$t('cmdb.components.subSuccess'))
|
||||
if (this.treeViews.length > 0) {
|
||||
this.treeSubscribed = true
|
||||
} else {
|
||||
|
@ -194,7 +194,7 @@ export default {
|
|||
return [item, !!this.fixedList.includes(item)]
|
||||
})
|
||||
).then((res) => {
|
||||
this.$message.success('订阅成功')
|
||||
this.$message.success(this.$t('cmdb.components.subSuccess'))
|
||||
this.resetRoute()
|
||||
if (this.selectedAttrList.length > 0) {
|
||||
this.instanceSubscribed = true
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
<div style="margin-top:10px">
|
||||
<table v-if="authorizationType === 'BasicAuth'">
|
||||
<tr>
|
||||
<td><a-input class="authorization-input" v-model="BasicAuth.username" placeholder="用户名" /></td>
|
||||
<td><a-input class="authorization-input" v-model="BasicAuth.username" :placeholder="$t('cmdb.ciType.username')" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a-input class="authorization-input" v-model="BasicAuth.password" placeholder="密码" /></td>
|
||||
<td><a-input class="authorization-input" v-model="BasicAuth.password" :placeholder="$t('cmdb.ciType.password')" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
@ -87,7 +87,7 @@
|
|||
}"
|
||||
>
|
||||
<img slot="image" :src="require('@/assets/data_empty.png')" />
|
||||
<span slot="description"> 暂无请求认证 </span>
|
||||
<span slot="description"> {{ $t('cmdb.components.noAuthRequest') }} </span>
|
||||
</a-empty>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="headers-header">
|
||||
<span>请求参数</span>
|
||||
<span>{{ $t('cmdb.components.requestParam') }}</span>
|
||||
<a-space>
|
||||
<a-tooltip title="清空">
|
||||
<a-tooltip :title="$t('cmdb.components.clear')">
|
||||
<ops-icon
|
||||
type="icon-xianxing-delete"
|
||||
@click="
|
||||
|
@ -19,7 +19,7 @@
|
|||
"
|
||||
/>
|
||||
</a-tooltip>
|
||||
<a-tooltip title="新增">
|
||||
<a-tooltip :title="$t('new')">
|
||||
<a-icon type="plus" @click="add" />
|
||||
</a-tooltip>
|
||||
</a-space>
|
||||
|
@ -27,8 +27,8 @@
|
|||
<div class="headers-box">
|
||||
<table>
|
||||
<tr v-for="(item, index) in headers" :key="item.id">
|
||||
<td><a-input class="headers-input" v-model="item.key" :placeholder="`参数${index + 1}`" /></td>
|
||||
<td><a-input class="headers-input" v-model="item.value" :placeholder="`值${index + 1}`" /></td>
|
||||
<td><a-input class="headers-input" v-model="item.key" :placeholder="$t('cmdb.components.param', { param: `${index + 1}` })" /></td>
|
||||
<td><a-input class="headers-input" v-model="item.value" :placeholder="$t('cmdb.components.value', { value: `${index + 1}` })" /></td>
|
||||
<td>
|
||||
<a style="color:red">
|
||||
<ops-icon type="icon-xianxing-delete" @click="deleteParam(index)" />
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
searchable
|
||||
:options="methodList"
|
||||
value-consists-of="LEAF_PRIORITY"
|
||||
placeholder="请选择方式"
|
||||
:placeholder="$t('cmdb.components.selectMethods')"
|
||||
>
|
||||
</treeselect>
|
||||
<a-input :style="{ display: 'inline-block', width: 'calc(100% - 100px)' }" v-model="url" />
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="parameters-header">
|
||||
<span>请求参数</span>
|
||||
<span>{{ $t('cmdb.components.requestParam') }}</span>
|
||||
<a-space>
|
||||
<a-tooltip title="清空">
|
||||
<a-tooltip :title="$t('cmdb.components.clear')">
|
||||
<ops-icon
|
||||
type="icon-xianxing-delete"
|
||||
@click="
|
||||
|
@ -13,7 +13,7 @@
|
|||
"
|
||||
/>
|
||||
</a-tooltip>
|
||||
<a-tooltip title="新增">
|
||||
<a-tooltip :title="$t('new')">
|
||||
<a-icon type="plus" @click="add" />
|
||||
</a-tooltip>
|
||||
</a-space>
|
||||
|
@ -21,8 +21,8 @@
|
|||
<div class="parameters-box" v-if="parameters && parameters.length">
|
||||
<table>
|
||||
<tr v-for="(item, index) in parameters" :key="item.id">
|
||||
<td><a-input class="parameters-input" v-model="item.key" :placeholder="`参数${index + 1}`" /></td>
|
||||
<td><a-input class="parameters-input" v-model="item.value" :placeholder="`值${index + 1}`" /></td>
|
||||
<td><a-input class="parameters-input" v-model="item.key" :placeholder="$t('cmdb.components.param', { param: `${index + 1}` })" /></td>
|
||||
<td><a-input class="parameters-input" v-model="item.value" :placeholder="$t('cmdb.components.value', { value: `${index + 1}` })" /></td>
|
||||
<td>
|
||||
<a style="color:red">
|
||||
<ops-icon type="icon-xianxing-delete" @click="deleteParam(index)" />
|
||||
|
@ -38,9 +38,9 @@
|
|||
}"
|
||||
>
|
||||
<img slot="image" :src="require('@/assets/data_empty.png')" />
|
||||
<span slot="description"> 暂无请求参数 </span>
|
||||
<span slot="description"> {{ $t('cmdb.components.noParamRequest') }} </span>
|
||||
<a-button @click="add" type="primary" size="small" icon="plus" class="ops-button-primary">
|
||||
添加
|
||||
{{ $t('add') }}
|
||||
</a-button>
|
||||
</a-empty>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,483 @@
|
|||
const cmdb_en = {
|
||||
relation: 'Relation',
|
||||
attribute: 'Attributes',
|
||||
menu: {
|
||||
views: 'Views',
|
||||
config: 'Configuration',
|
||||
backend: 'Management',
|
||||
ciTable: 'Resource Views',
|
||||
ciTree: 'Tree Views',
|
||||
ciSearch: 'Search',
|
||||
adCIs: 'AutoDiscovery Pool',
|
||||
preference: 'Preference',
|
||||
batchUpload: 'Batch Import',
|
||||
citypeManage: 'Modeling',
|
||||
backendManage: 'Backend',
|
||||
customDashboard: 'Custom Dashboard',
|
||||
serviceTreeDefine: 'Service Tree',
|
||||
citypeRelation: 'CIType Relation',
|
||||
operationHistory: 'Operation Audit',
|
||||
relationType: 'Relation Type',
|
||||
ad: 'AutoDiscovery',
|
||||
},
|
||||
ciType: {
|
||||
ciType: 'CIType',
|
||||
attributes: 'Attributes',
|
||||
relation: 'Relation',
|
||||
trigger: 'Triggers',
|
||||
attributeAD: 'Attributes AutoDiscovery',
|
||||
relationAD: 'Relation AutoDiscovery',
|
||||
grant: 'Grant',
|
||||
addGroup: 'New Group',
|
||||
editGroup: 'Edit Group',
|
||||
group: 'Group',
|
||||
attributeLibray: 'Attribute Library',
|
||||
addCITypeInGroup: 'Add a new CIType to the group',
|
||||
addCIType: 'Add CIType',
|
||||
editGroupName: 'Edit group name',
|
||||
deleteGroup: 'Delete this group',
|
||||
CITypeName: 'Name(English)',
|
||||
English: 'English',
|
||||
inputAttributeName: 'Please enter the attribute name',
|
||||
attributeNameTips: 'It cannot start with a number, it can be English numbers and underscores (_)',
|
||||
editCIType: 'Edit CIType',
|
||||
defaultSort: 'Default sort',
|
||||
selectDefaultOrderAttr: 'Select default sorting attributes',
|
||||
asec: 'Forward order',
|
||||
desc: 'Reverse order',
|
||||
uniqueKey: 'Uniquely Identifies',
|
||||
uniqueKeySelect: 'Please select a unique identifier',
|
||||
notfound: 'Can\'t find what you want?',
|
||||
cannotDeleteGroupTips: 'There is data under this group and cannot be deleted!',
|
||||
confirmDeleteGroup: 'Are you sure you want to delete group [{groupName}]?',
|
||||
confirmDeleteCIType: 'Are you sure you want to delete model [{typeName}]?',
|
||||
uploading: 'Uploading',
|
||||
uploadFailed: 'Upload failed, please try again later',
|
||||
addPlugin: 'New plugin',
|
||||
deletePlugin: 'Delete plugin',
|
||||
confirmDeleteADT: 'Do you confirm to delete [{pluginName}]',
|
||||
attributeMap: 'Attribute mapping',
|
||||
autoDiscovery: 'AutoDiscovery',
|
||||
node: 'Node',
|
||||
adExecConfig: 'Execute configuration',
|
||||
adExecTarget: 'Execute targets',
|
||||
oneagentIdTips: 'Please enter the hexadecimal OneAgent ID starting with 0x',
|
||||
selectFromCMDBTips: 'Select from CMDB ',
|
||||
adAutoInLib: 'Save as CI auto',
|
||||
adInterval: 'Collection frequency',
|
||||
byInterval: 'by interval',
|
||||
allNodes: 'All nodes',
|
||||
specifyNodes: 'Specify Node',
|
||||
specifyNodesTips: 'Please fill in the specify node!',
|
||||
username: 'Username',
|
||||
password: 'Password',
|
||||
link: 'Link',
|
||||
list: 'List',
|
||||
listTips: 'The value of the field is one or more, and the type of the value returned by the interface is list.',
|
||||
computeForAllCITips: 'All CI trigger computes',
|
||||
confirmcomputeForAllCITips: 'Confirm triggering computes for all CIs?',
|
||||
isUnique: 'Is it unique',
|
||||
unique: 'Unique',
|
||||
isChoice: 'Choiced',
|
||||
defaultShow: 'Default Display',
|
||||
defaultShowTips: 'The CI instance table displays this field by default',
|
||||
isSortable: 'Sortable',
|
||||
isIndex: 'Indexed',
|
||||
index: 'Index',
|
||||
indexTips: 'Fields can be used for retrieval to speed up queries',
|
||||
confirmDelete: 'Confirm to delete [{name}]?',
|
||||
confirmDelete2: 'Confirm to delete?',
|
||||
computeSuccess: 'Triggered successfully!',
|
||||
basicConfig: 'Basic Settings',
|
||||
AttributeName: 'Name(English)',
|
||||
DataType: 'Data Type',
|
||||
defaultValue: 'Default value',
|
||||
autoIncID: 'Auto-increment ID',
|
||||
customTime: 'Custom time',
|
||||
advancedSettings: 'Advanced Settings',
|
||||
font: 'Font',
|
||||
color: 'Color',
|
||||
choiceValue: 'Predefined value',
|
||||
computedAttribute: 'Computed Attribute',
|
||||
computedAttributeTips: 'The value of this attribute is calculated through an expression constructed from other attributes of the CIType or by executing a piece of code. The reference method of the attribute is: {{ attribute name }}',
|
||||
addAttribute: 'New attribute',
|
||||
existedAttributes: 'Already have attributes',
|
||||
editAttribute: 'Edit attribute',
|
||||
addAttributeTips1: 'If sorting is selected, it must also be selected!',
|
||||
uniqueConstraint: 'Unique Constraint',
|
||||
up: 'Move up',
|
||||
down: 'Move down',
|
||||
selectAttribute: 'Select Attribute',
|
||||
groupExisted: 'Group name already exists',
|
||||
attributeSortedTips: 'Attributes in other groups cannot be sorted. If you need to sort, please drag them to a custom group first!',
|
||||
buildinAttribute: 'built-in attributes',
|
||||
expr: 'Expression',
|
||||
code: 'Code',
|
||||
apply: 'apply',
|
||||
continueAdd: 'Keep adding',
|
||||
filter: 'Filter',
|
||||
choiceOther: 'Other CIType Attributes',
|
||||
choiceWebhookTips: 'The returned results are filtered by fields, and the hierarchical nesting is separated by ##, such as k1##k2. The web request returns {k1: [{k2: 1}, {k2: 2}]}, and the parsing result is [1, 2 ]',
|
||||
selectCIType: 'Please select a CMDB CIType',
|
||||
selectCITypeAttributes: 'Please select CIType attributes',
|
||||
selectAttributes: 'Please select attributes',
|
||||
choiceScriptDemo: 'class ChoiceValue(object):\n @staticmethod\n def values():\n """\n Execution entry, returns predefined value\n :return: Returns a list, the type of the value is the same as the type of the attribute\n For example:\n return ["online", "offline"]\n """\n return []',
|
||||
valueExisted: 'The current value already exists!',
|
||||
addRelation: 'Add Relation',
|
||||
sourceCIType: 'Source CIType',
|
||||
sourceCITypeTips: 'Please select Source CIType',
|
||||
dstCIType: 'Target CIType',
|
||||
dstCITypeTips: 'Please select target CIType',
|
||||
relationType: 'Relation Type',
|
||||
relationTypeTips: 'Please select relation type',
|
||||
isParent: 'is parent',
|
||||
relationConstraint: 'Constraints',
|
||||
relationConstraintTips: 'please select a relationship constraint',
|
||||
one2Many: 'One to Many',
|
||||
one2One: 'One to One',
|
||||
many2Many: 'Many to Many',
|
||||
basicInfo: 'Basic Information',
|
||||
nameInputTips: 'Please enter name',
|
||||
triggerDataChange: 'Data changes',
|
||||
triggerDate: 'Date attribute',
|
||||
triggerEnable: 'Turn on',
|
||||
descInput: 'Please enter remarks',
|
||||
triggerCondition: 'Triggering conditions',
|
||||
addInstance: 'Add new instance',
|
||||
deleteInstance: 'Delete instance',
|
||||
changeInstance: 'Instance changes',
|
||||
selectMutipleAttributes: 'Please select attributes (multiple selections)',
|
||||
selectSingleAttribute: 'Please select an attribute (single choice)',
|
||||
beforeDays: 'ahead of time',
|
||||
days: 'Days',
|
||||
notifyAt: 'Send time',
|
||||
notify: 'Notify',
|
||||
triggerAction: 'Trigger action',
|
||||
receivers: 'Recipients',
|
||||
emailTips: 'Please enter your email address, separate multiple email addresses with ;',
|
||||
customEmail: 'Custom recipients',
|
||||
notifySubject: 'Notification title',
|
||||
notifySubjectTips: 'Please enter notification title',
|
||||
notifyContent: 'Content',
|
||||
notifyMethod: 'Notify methods',
|
||||
botSelect: 'Please select a robot',
|
||||
refAttributeTips: 'The title and content can reference the attribute value of the CIType. The reference method is: {{ attr_name }}',
|
||||
webhookRefAttributeTips: 'Request parameters can reference the attribute value of the model. The reference method is: {{ attr_name }}',
|
||||
newTrigger: 'Add trigger',
|
||||
editTriggerTitle: 'Edit trigger {name}',
|
||||
newTriggerTitle: 'Add trigger {name}',
|
||||
confirmDeleteTrigger: 'Are you sure to delete this trigger?',
|
||||
int: 'Integer',
|
||||
float: 'Float',
|
||||
text: 'Text',
|
||||
datetime: 'DateTime',
|
||||
date: 'Date',
|
||||
time: 'Time',
|
||||
json: 'JSON',
|
||||
event: 'Event'
|
||||
},
|
||||
components: {
|
||||
unselectAttributes: 'Unselected',
|
||||
selectAttributes: 'Selected',
|
||||
downloadCI: 'Export data',
|
||||
filename: 'Filename',
|
||||
filenameInputTips: 'Please enter filename',
|
||||
saveType: 'Save type',
|
||||
saveTypeTips: 'Please select save type',
|
||||
xlsx: 'Excel workbook (*.xlsx)',
|
||||
csv: 'CSV (comma separated) (*.csv)',
|
||||
html: 'Web page (*.html)',
|
||||
xml: 'XML data (*.xml)',
|
||||
txt: 'Text file (tab delimited) (*.txt)',
|
||||
grantUser: 'Grant User/Department',
|
||||
grantRole: 'Grant Role',
|
||||
confirmRevoke: 'Confirm to delete the [Authorization] permission of [{name}]?',
|
||||
readAttribute: 'View Attributes',
|
||||
readCI: 'View CIs',
|
||||
config: 'Configuration',
|
||||
ciTypeGrant: 'Grant CIType',
|
||||
ciGrant: 'Grant CI',
|
||||
attributeGrant: 'Grant Attribute',
|
||||
relationGrant: 'Grant Relation',
|
||||
perm: 'Permissions',
|
||||
all: 'All',
|
||||
customize: 'Customize',
|
||||
none: 'None',
|
||||
customizeFilterName: 'Please enter a custom filter name',
|
||||
colorPickerError: 'Initialization color format error, use #fff or rgb format',
|
||||
example: 'Example value',
|
||||
aliyun: 'aliyun',
|
||||
tencentcloud: 'Tencent Cloud',
|
||||
huaweicloud: 'Huawei Cloud',
|
||||
beforeChange: 'Before change',
|
||||
afterChange: 'After change',
|
||||
noticeContentTips: 'Please enter notification content',
|
||||
saveQuery: 'Save Filters',
|
||||
pleaseSearch: 'Please search',
|
||||
conditionFilter: 'Conditional filtering',
|
||||
attributeDesc: 'Attribute Description',
|
||||
ciSearchTips: '1. JSON attributes cannot be searched<br />2. If the search content includes commas, they need to be escaped,<br />3. Only index attributes are searched, non-index attributes use conditional filtering',
|
||||
ciSearchTips2: 'For example: q=hostname:*0.0.0.0*',
|
||||
subCIType: 'Subscription CIType',
|
||||
already: 'already',
|
||||
not: 'not',
|
||||
sub: 'subscription',
|
||||
selectBelow: 'Please select below',
|
||||
subSuccess: 'Subscription successful',
|
||||
selectMethods: 'Please select a method',
|
||||
noAuthRequest: 'No certification requested yet',
|
||||
noParamRequest: 'No parameter certification yet',
|
||||
requestParam: 'Request parameters',
|
||||
param: 'Parameter{param}',
|
||||
value: 'Value{value}',
|
||||
clear: 'Clear',
|
||||
},
|
||||
batch: {
|
||||
downloadFailed: 'Download failed',
|
||||
unselectCIType: 'No CIType selected yet',
|
||||
pleaseUploadFile: 'Please upload files',
|
||||
batchUploadCanceled: 'Batch upload canceled',
|
||||
selectCITypeTips: 'Please select CIType',
|
||||
downloadTemplate: 'Download Template',
|
||||
drawTips: 'Click or drag files here to upload!',
|
||||
supportFileTypes: 'Supported file types: xls, xlsx',
|
||||
uploadResult: 'Upload results',
|
||||
total: 'total',
|
||||
successItems: 'items, succeeded',
|
||||
failedItems: 'items, failed',
|
||||
items: 'items',
|
||||
errorTips: 'Error message',
|
||||
requestFailedTips: 'An error occurred with the request, please try again later',
|
||||
requestSuccessTips: 'Upload completed',
|
||||
},
|
||||
preference: {
|
||||
mySub: 'My Subscription',
|
||||
sub: 'Subscribe',
|
||||
cancelSub: 'Unsubscribe',
|
||||
editSub: 'Edit subscription',
|
||||
peopleSub: ' people subscribed',
|
||||
noSub: 'No subscribed',
|
||||
cancelSubSuccess: 'Unsubscribe successfully',
|
||||
confirmcancelSub: 'Are you sure to cancel your subscription?',
|
||||
confirmcancelSub2: 'Are you sure you want to unsubscribe {name}?',
|
||||
of: 'of',
|
||||
hoursAgo: 'hours ago',
|
||||
daysAgo: 'days ago',
|
||||
monthsAgo: 'month ago',
|
||||
yearsAgo: 'years ago',
|
||||
just: 'just now',
|
||||
},
|
||||
custom_dashboard: {
|
||||
charts: 'Chart',
|
||||
newChart: 'Add Chart',
|
||||
editChart: 'Edit Chart',
|
||||
title: 'Title',
|
||||
titleTips: 'Please enter a chart title',
|
||||
calcIndicators: 'Counter',
|
||||
dimensions: 'Dimensions',
|
||||
selectDimensions: 'Please select a dimension',
|
||||
quantity: 'Quantity',
|
||||
childCIType: 'Relational CIType',
|
||||
level: 'Level',
|
||||
levelTips: 'Please enter the relationship level',
|
||||
preview: 'Preview',
|
||||
showIcon: 'Display icon',
|
||||
chartType: 'Chart Type',
|
||||
dataFilter: 'Data Filtering',
|
||||
format: 'Formats',
|
||||
fontColor: 'Font Color',
|
||||
backgroundColor: 'Background',
|
||||
chartColor: 'Chart Color',
|
||||
chartLength: 'Length',
|
||||
barType: 'Bar Type',
|
||||
stackedBar: 'Stacked Bar',
|
||||
multipleSeriesBar: 'Multiple Series Bar ',
|
||||
axis: 'Axis',
|
||||
direction: 'Direction',
|
||||
lowerShadow: 'Lower Shadow',
|
||||
count: 'Indicator',
|
||||
bar: 'Bar',
|
||||
line: 'Line',
|
||||
pie: 'Pie',
|
||||
table: 'Table',
|
||||
default: 'default',
|
||||
relation: 'Relation',
|
||||
noCustomDashboard: 'The administrator has not customized the dashboard yet',
|
||||
},
|
||||
preference_relation: {
|
||||
newServiceTree: 'Add ServiceTree',
|
||||
serviceTreeName: 'Name',
|
||||
public: 'Public',
|
||||
saveLayout: 'Save Layout',
|
||||
childNodesNotFound: 'There are no child nodes and no business relationship can be formed. Please select again!',
|
||||
tips1: 'Cannot form a view with the currently selected node, please select again!',
|
||||
tips2: 'Please enter the new serviceTree name!',
|
||||
tips3: 'Please select at least two nodes!',
|
||||
},
|
||||
history: {
|
||||
ciChange: 'CI',
|
||||
relationChange: 'Relation',
|
||||
ciTypeChange: 'CIType',
|
||||
triggerHistory: 'Triggers',
|
||||
opreateTime: 'Operate Time',
|
||||
user: 'User',
|
||||
userTips: 'Enter filter username',
|
||||
filter: 'Search',
|
||||
filterOperate: 'fitler operation',
|
||||
attribute: 'Attribute',
|
||||
old: 'Old',
|
||||
new: 'New',
|
||||
noUpdate: 'No update',
|
||||
itemsPerPage: '/page',
|
||||
triggerName: 'Name',
|
||||
event: 'Event',
|
||||
action: 'Actoin',
|
||||
status: 'Status',
|
||||
done: 'Done',
|
||||
undone: 'Undone',
|
||||
triggerTime: 'Trigger Time',
|
||||
totalItems: '{total} records in total',
|
||||
pleaseSelect: 'Please select',
|
||||
startTime: 'Start Time',
|
||||
endTime: 'End Time',
|
||||
deleteCIType: 'Delete CIType',
|
||||
addCIType: 'Add CIType',
|
||||
updateCIType: 'Update CIType',
|
||||
addAttribute: 'Add Attribute',
|
||||
updateAttribute: 'Update Attribute',
|
||||
deleteAttribute: 'Delete Attribute',
|
||||
addTrigger: 'Add Trigger',
|
||||
updateTrigger: 'Update Trigger',
|
||||
deleteTrigger: 'Delete Trigger',
|
||||
addUniqueConstraint: 'Add Unique Constraint',
|
||||
updateUniqueConstraint: 'Update Unique Constraint',
|
||||
deleteUniqueConstraint: 'Delete Unique Constraint',
|
||||
addRelation: 'Add Relation',
|
||||
deleteRelation: 'Delete Relation',
|
||||
noModifications: 'No Modifications',
|
||||
attr: 'attribute',
|
||||
attrId: 'attribute id',
|
||||
changeDescription: 'attribute id: {attr_id}, {before_days} day(s) in advance, Subject: {subject}\nContent: {body}\nNotify At: {notify_at}'
|
||||
},
|
||||
relation_type: {
|
||||
addRelationType: 'New',
|
||||
nameTips: 'Please enter a type name',
|
||||
},
|
||||
ad: {
|
||||
upload: 'Import',
|
||||
download: 'Export',
|
||||
accpet: 'Accept',
|
||||
accpetBy: 'Accept By',
|
||||
acceptTime: 'Accept Time',
|
||||
confirmAccept: 'Confirm Accept?',
|
||||
accpetSuccess: 'Accept successfully',
|
||||
isAccpet: 'Is accept',
|
||||
deleteADC: 'Confirm to delete this data?',
|
||||
batchDelete: 'Confirm to delete this data?',
|
||||
agent: 'Built-in & Plug-ins',
|
||||
snmp: 'Network Devices',
|
||||
http: 'Public Clouds',
|
||||
rule: 'AutoDiscovery Rules',
|
||||
timeout: 'Timeout error',
|
||||
mode: 'Mode',
|
||||
collectSettings: 'Collection Settings',
|
||||
updateFields: 'Update Field',
|
||||
pluginScript: `# -*- coding:utf-8 -*-
|
||||
|
||||
import json
|
||||
|
||||
|
||||
class AutoDiscovery(object):
|
||||
|
||||
@property
|
||||
def unique_key(self):
|
||||
"""
|
||||
|
||||
:return: Returns the name of a unique attribute
|
||||
"""
|
||||
return
|
||||
|
||||
@staticmethod
|
||||
def attributes():
|
||||
"""
|
||||
Define attribute fields
|
||||
:return: Returns a list of attribute fields. The list items are (name, type, description). The name must be in English.
|
||||
type: String Integer Float Date DateTime Time JSON
|
||||
For example:
|
||||
return [
|
||||
("ci_type", "String", "CIType name"),
|
||||
("private_ip", "String", "Internal IP, multiple values separated by commas")
|
||||
]
|
||||
"""
|
||||
return []
|
||||
|
||||
@staticmethod
|
||||
def run():
|
||||
"""
|
||||
Execution entry, returns collected attribute values
|
||||
:return:
|
||||
Returns a list, the list item is a dictionary, the dictionary key is the attribute name, and the value is the attribute value
|
||||
For example:
|
||||
return [dict(ci_type="server", private_ip="192.168.1.1")]
|
||||
"""
|
||||
return []
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
result = AutoDiscovery().run()
|
||||
if isinstance(result, list):
|
||||
print("AutoDiscovery::Result::{}".format(json.dumps(result)))
|
||||
else:
|
||||
print("ERROR: The collection return must be a list")
|
||||
`,
|
||||
server: 'Server',
|
||||
vserver: 'VServer',
|
||||
nic: 'NIC',
|
||||
disk: 'harddisk',
|
||||
},
|
||||
ci: {
|
||||
attributeDesc: 'Attribute Description',
|
||||
selectRows: 'Select: {rows} items',
|
||||
addRelation: 'Add Relation',
|
||||
all: 'All',
|
||||
batchUpdate: 'Batch Update',
|
||||
batchUpdateConfirm: 'Are you sure you want to make batch updates?',
|
||||
batchUpdateInProgress: 'Currently being updated in batches',
|
||||
batchUpdateInProgress2: 'Updating in batches, {total} in total, {successNum} successful, {errorNum} failed',
|
||||
batchDeleting: 'Deleting...',
|
||||
batchDeleting2: 'Deleting {total} items in total, {successNum} items successful, {errorNum} items failed',
|
||||
copyFailed: 'Copy failed',
|
||||
noLevel: 'No hierarchical relationship!',
|
||||
batchAddRelation: 'Batch Add Relation',
|
||||
history: 'History',
|
||||
topo: 'Topology',
|
||||
table: 'Table',
|
||||
m2mTips: 'The current CIType relationship is many-to-many, please go to the SerivceTree(relation view) to add or delete',
|
||||
confirmDeleteRelation: 'Confirm to delete the relationship?',
|
||||
tips1: 'Use commas to separate multiple values',
|
||||
tips2: 'The field can be modified as needed. When the value is empty, the field will be left empty.',
|
||||
tips3: 'Please select the fields that need to be modified',
|
||||
tips4: 'At least one field must be selected',
|
||||
tips5: 'Search name | alias',
|
||||
tips6: 'Speed up retrieval, full-text search possible, no need to use conditional filtering\n\n json currently does not support indexing \n\nText characters longer than 190 cannot be indexed',
|
||||
tips7: 'The form of expression is a drop-down box, and the value must be in the predefined value',
|
||||
tips8: 'Multiple values, such as intranet IP',
|
||||
tips9: 'For front-end only',
|
||||
tips10: 'Other attributes of the CIType are computed using expressions\n\nA code snippet computes the returned value.',
|
||||
newUpdateField: 'Add a Attribute',
|
||||
attributeSettings: 'Attribute Settings',
|
||||
},
|
||||
serviceTree: {
|
||||
deleteNode: 'Delete Node',
|
||||
tips1: 'For example: q=os_version:centos&sort=os_version',
|
||||
tips2: 'Expression search',
|
||||
alert1: 'The administrator has not configured the ServiceTree(relation view), or you do not have permission to access it!',
|
||||
copyFailed: 'Copy failed',
|
||||
deleteRelationConfirm: 'Confirm to remove selected {name} from current relationship?',
|
||||
},
|
||||
tree: {
|
||||
tips1: 'Please go to Preference page first to complete your subscription!',
|
||||
subSettings: 'Settings',
|
||||
}
|
||||
}
|
||||
export default cmdb_en
|
|
@ -0,0 +1,482 @@
|
|||
const cmdb_zh = {
|
||||
relation: '关系',
|
||||
attribute: '属性',
|
||||
menu: {
|
||||
views: '视图',
|
||||
config: '配置',
|
||||
backend: '管理端',
|
||||
ciTable: '资源数据',
|
||||
ciTree: '资源层级',
|
||||
ciSearch: '资源搜索',
|
||||
adCIs: '自动发现池',
|
||||
preference: '我的订阅',
|
||||
batchUpload: '批量导入',
|
||||
citypeManage: '模型配置',
|
||||
backendManage: '后台管理',
|
||||
customDashboard: '定制仪表盘',
|
||||
serviceTreeDefine: '服务树定义',
|
||||
citypeRelation: '模型关系',
|
||||
operationHistory: '操作审计',
|
||||
relationType: '关系类型',
|
||||
ad: '自动发现',
|
||||
},
|
||||
ciType: {
|
||||
ciType: '模型',
|
||||
attributes: '模型属性',
|
||||
relation: '模型关联',
|
||||
trigger: '触发器',
|
||||
attributeAD: '属性自动发现',
|
||||
relationAD: '关系自动发现',
|
||||
grant: '权限配置',
|
||||
addGroup: '新增分组',
|
||||
editGroup: '修改分组',
|
||||
group: '分组',
|
||||
attributeLibray: '属性库',
|
||||
addCITypeInGroup: '在该组中新增CI模型',
|
||||
addCIType: '新增CI模型',
|
||||
editGroupName: '编辑组名称',
|
||||
deleteGroup: '删除该组',
|
||||
CITypeName: '模型名(英文)',
|
||||
English: '英文',
|
||||
inputAttributeName: '请输入属性名',
|
||||
attributeNameTips: '不能以数字开头,可以是英文 数字以及下划线 (_)',
|
||||
editCIType: '编辑模型',
|
||||
defaultSort: '默认排序',
|
||||
selectDefaultOrderAttr: '选择默认排序属性',
|
||||
asec: '正序',
|
||||
desc: '倒序',
|
||||
uniqueKey: '唯一标识',
|
||||
uniqueKeySelect: '请选择唯一标识',
|
||||
notfound: '找不到想要的?',
|
||||
cannotDeleteGroupTips: '该分组下有数据, 不能删除!',
|
||||
confirmDeleteGroup: '确定要删除分组 【{groupName}】 吗?',
|
||||
confirmDeleteCIType: '确定要删除模型 【{typeName}】 吗?',
|
||||
uploading: '正在导入中',
|
||||
uploadFailed: '导入失败,请稍后重试',
|
||||
addPlugin: '新建plugin',
|
||||
deletePlugin: '删除plugin',
|
||||
confirmDeleteADT: '确认删除 【{pluginName}】',
|
||||
attributeMap: '字段映射',
|
||||
autoDiscovery: '自动发现',
|
||||
node: '节点',
|
||||
adExecConfig: '执行配置',
|
||||
adExecTarget: '执行机器',
|
||||
oneagentIdTips: '请输入以0x开头的16进制OneAgent ID',
|
||||
selectFromCMDBTips: '从CMDB中选择 ',
|
||||
adAutoInLib: '自动入库',
|
||||
adInterval: '采集频率',
|
||||
byInterval: '按间隔',
|
||||
allNodes: '所有节点',
|
||||
specifyNodes: '指定节点',
|
||||
specifyNodesTips: '请填写指定节点!',
|
||||
username: '用户名',
|
||||
password: '密码',
|
||||
link: '链接',
|
||||
list: '多值',
|
||||
listTips: '字段的值是1个或者多个,接口返回的值的类型是list',
|
||||
computeForAllCITips: '所有CI触发计算',
|
||||
confirmcomputeForAllCITips: '确认触发所有CI的计算?',
|
||||
isUnique: '是否唯一',
|
||||
unique: '唯一',
|
||||
isChoice: '是否选择',
|
||||
defaultShow: '默认显示',
|
||||
defaultShowTips: 'CI实例表格默认展示该字段',
|
||||
isSortable: '可排序',
|
||||
isIndex: '是否索引',
|
||||
index: '索引',
|
||||
indexTips: '字段可被用于检索,加速查询',
|
||||
confirmDelete: '确认删除【{name}】?',
|
||||
confirmDelete2: '确认删除?',
|
||||
computeSuccess: '触发成功!',
|
||||
basicConfig: '基础设置',
|
||||
AttributeName: '属性名(英文)',
|
||||
DataType: '数据类型',
|
||||
defaultValue: '默认值',
|
||||
autoIncID: '自增ID',
|
||||
customTime: '自定义时间',
|
||||
advancedSettings: '高级设置',
|
||||
font: '字体',
|
||||
color: '颜色',
|
||||
choiceValue: '预定义值',
|
||||
computedAttribute: '计算属性',
|
||||
computedAttributeTips: '该属性的值是通过模型的其它属性构建的表达式或者执行一段代码的方式计算而来,属性的引用方法为: {{ 属性名 }}',
|
||||
addAttribute: '新增属性',
|
||||
existedAttributes: '已有属性',
|
||||
editAttribute: '编辑属性',
|
||||
addAttributeTips1: '选中排序,则必须也要选中!',
|
||||
uniqueConstraint: '唯一校验',
|
||||
up: '上移',
|
||||
down: '下移',
|
||||
selectAttribute: '添加属性',
|
||||
groupExisted: '分组名称已存在',
|
||||
attributeSortedTips: '其他分组中的属性不能进行排序,如需排序请先拖至自定义的分组!',
|
||||
buildinAttribute: '内置字段',
|
||||
expr: '表达式',
|
||||
code: '代码',
|
||||
apply: '应用',
|
||||
continueAdd: '继续添加',
|
||||
filter: '过滤',
|
||||
choiceOther: '其他模型属性',
|
||||
choiceWebhookTips: '返回的结果按字段来过滤,层级嵌套用##分隔,比如k1##k2,web请求返回{k1: [{k2: 1}, {k2: 2}]}, 解析结果为[1, 2]',
|
||||
selectCIType: '请选择CMDB模型',
|
||||
selectCITypeAttributes: '请选择模型属性',
|
||||
selectAttributes: '请选择属性',
|
||||
choiceScriptDemo: 'class ChoiceValue(object):\n @staticmethod\n def values():\n """\n 执行入口, 返回预定义值\n :return: 返回一个列表, 值的类型同属性的类型\n 例如:\n return ["在线", "下线"]\n """\n return []',
|
||||
valueExisted: '当前值已存在!',
|
||||
addRelation: '新增关系',
|
||||
sourceCIType: '源模型',
|
||||
sourceCITypeTips: '请选择源模型',
|
||||
dstCIType: '目标模型名',
|
||||
dstCITypeTips: '请选择目标模型',
|
||||
relationType: '关联类型',
|
||||
relationTypeTips: '请选择关联类型',
|
||||
isParent: '被',
|
||||
relationConstraint: '关系约束',
|
||||
relationConstraintTips: '请选择关系约束',
|
||||
one2Many: '一对多',
|
||||
one2One: '一对一',
|
||||
many2Many: '多对多',
|
||||
basicInfo: '基本信息',
|
||||
nameInputTips: '请输入名称',
|
||||
triggerDataChange: '数据变更',
|
||||
triggerDate: '日期属性',
|
||||
triggerEnable: '开启',
|
||||
descInput: '请输入备注',
|
||||
triggerCondition: '触发条件',
|
||||
addInstance: '新增实例',
|
||||
deleteInstance: '删除实例',
|
||||
changeInstance: '实例变更',
|
||||
selectMutipleAttributes: '请选择属性(多选)',
|
||||
selectSingleAttribute: '请选择属性(单选)',
|
||||
beforeDays: '提前',
|
||||
days: '天',
|
||||
notifyAt: '发送时间',
|
||||
notify: '通知',
|
||||
triggerAction: '触发动作',
|
||||
receivers: '收件人',
|
||||
emailTips: '请输入邮箱,多个邮箱用;分隔',
|
||||
customEmail: '自定义收件人',
|
||||
notifySubject: '通知标题',
|
||||
notifySubjectTips: '请输入通知标题',
|
||||
notifyContent: '内容',
|
||||
notifyMethod: '通知方式',
|
||||
botSelect: '请选择机器人',
|
||||
refAttributeTips: '标题、内容可以引用该模型的属性值,引用方法为: {{ attr_name }}',
|
||||
webhookRefAttributeTips: '请求参数可以引用该模型的属性值,引用方法为: {{ attr_name }}',
|
||||
newTrigger: '新增触发器',
|
||||
editTriggerTitle: '编辑触发器 {name}',
|
||||
newTriggerTitle: '新增触发器 {name}',
|
||||
confirmDeleteTrigger: '确认删除该触发器吗?',
|
||||
int: '整数',
|
||||
float: '浮点数',
|
||||
text: '文本',
|
||||
datetime: '日期时间',
|
||||
date: '日期',
|
||||
time: '时间',
|
||||
json: 'JSON',
|
||||
event: '事件'
|
||||
},
|
||||
components: {
|
||||
unselectAttributes: '未选属性',
|
||||
selectAttributes: '已选属性',
|
||||
downloadCI: '导出数据',
|
||||
filename: '文件名',
|
||||
filenameInputTips: '请输入文件名',
|
||||
saveType: '保存类型',
|
||||
saveTypeTips: '请选择保存类型',
|
||||
xlsx: 'Excel工作簿(*.xlsx)',
|
||||
csv: 'CSV(逗号分隔)(*.csv)',
|
||||
html: '网页(*.html)',
|
||||
xml: 'XML数据(*.xml)',
|
||||
txt: '文本文件(制表符分隔)(*.txt)',
|
||||
grantUser: '授权用户/部门',
|
||||
grantRole: '授权角色',
|
||||
confirmRevoke: '确认删除 【{name}】 的 【授权】 权限?',
|
||||
readAttribute: '查看字段',
|
||||
readCI: '查看实例',
|
||||
config: '配置',
|
||||
ciTypeGrant: '模型权限',
|
||||
ciGrant: '实例权限',
|
||||
attributeGrant: '字段权限',
|
||||
relationGrant: '关系权限',
|
||||
perm: '权限',
|
||||
all: '全部',
|
||||
customize: '自定义',
|
||||
none: '无',
|
||||
customizeFilterName: '请输入自定义筛选条件名',
|
||||
colorPickerError: '初始化颜色格式错误,使用#fff或rgb格式',
|
||||
example: '示例值',
|
||||
aliyun: '阿里云',
|
||||
tencentcloud: '腾讯云',
|
||||
huaweicloud: '华为云',
|
||||
beforeChange: '变更前',
|
||||
afterChange: '变更后',
|
||||
noticeContentTips: '请输入通知内容',
|
||||
saveQuery: '保存筛选条件',
|
||||
pleaseSearch: '请查找',
|
||||
conditionFilter: '条件过滤',
|
||||
attributeDesc: '属性说明',
|
||||
ciSearchTips: '1. json属性不能搜索<br />2. 搜索内容包括逗号, 则需转义 ,<br />3. 只搜索索引属性, 非索引属性使用条件过滤',
|
||||
ciSearchTips2: '例: q=hostname:*0.0.0.0*',
|
||||
subCIType: '订阅模型',
|
||||
already: '已',
|
||||
not: '未',
|
||||
sub: '订阅',
|
||||
selectBelow: '请在下方进行选择',
|
||||
subSuccess: '订阅成功',
|
||||
selectMethods: '请选择方式',
|
||||
noAuthRequest: '暂无请求认证',
|
||||
noParamRequest: '暂无参数认证',
|
||||
requestParam: '请求参数',
|
||||
param: '参数{param}',
|
||||
value: '值{value}',
|
||||
clear: '清空',
|
||||
},
|
||||
batch: {
|
||||
downloadFailed: '失败下载',
|
||||
unselectCIType: '尚未选择模板类型',
|
||||
pleaseUploadFile: '请上传文件',
|
||||
batchUploadCanceled: '批量上传已取消',
|
||||
selectCITypeTips: '请选择模板类型',
|
||||
downloadTemplate: '下载模板',
|
||||
drawTips: '点击或拖拽文件至此上传!',
|
||||
supportFileTypes: '支持文件类型:xls,xlsx',
|
||||
uploadResult: '上传结果',
|
||||
total: '共',
|
||||
successItems: '条,已成功',
|
||||
failedItems: '条,失败',
|
||||
items: '条',
|
||||
errorTips: '错误信息',
|
||||
requestFailedTips: '请求出现错误,请稍后再试',
|
||||
requestSuccessTips: '批量上传已完成',
|
||||
},
|
||||
preference: {
|
||||
mySub: '我的订阅',
|
||||
sub: '订阅',
|
||||
cancelSub: '取消订阅',
|
||||
editSub: '编辑订阅',
|
||||
peopleSub: '位同事已订阅',
|
||||
noSub: '暂无同事订阅',
|
||||
cancelSubSuccess: '取消订阅成功',
|
||||
confirmcancelSub: '确认取消订阅',
|
||||
confirmcancelSub2: '确认取消订阅 {name} 吗?',
|
||||
of: '的',
|
||||
hoursAgo: '小时前',
|
||||
daysAgo: '天前',
|
||||
monthsAgo: '月前',
|
||||
yearsAgo: '年前',
|
||||
just: '刚刚',
|
||||
},
|
||||
custom_dashboard: {
|
||||
charts: '图表',
|
||||
newChart: '新增图表',
|
||||
editChart: '编辑图表',
|
||||
title: '标题',
|
||||
titleTips: '请输入图表标题',
|
||||
calcIndicators: '计算指标',
|
||||
dimensions: '维度',
|
||||
selectDimensions: '请选择维度',
|
||||
quantity: '数量',
|
||||
childCIType: '关系模型',
|
||||
level: '层级',
|
||||
levelTips: '请输入关系层级',
|
||||
preview: '预览',
|
||||
showIcon: '是否显示icon',
|
||||
chartType: '图表类型',
|
||||
dataFilter: '数据筛选',
|
||||
format: '格式',
|
||||
fontColor: '字体颜色',
|
||||
backgroundColor: '背景颜色',
|
||||
chartColor: '图表颜色',
|
||||
chartLength: '图表长度',
|
||||
barType: '柱状图类型',
|
||||
stackedBar: '堆积柱状图',
|
||||
multipleSeriesBar: '多系列柱状图',
|
||||
axis: '轴',
|
||||
direction: '方向',
|
||||
lowerShadow: '下方阴影',
|
||||
count: '指标',
|
||||
bar: '柱状图',
|
||||
line: '折线图',
|
||||
pie: '饼状图',
|
||||
table: '表格',
|
||||
default: '默认',
|
||||
relation: '关系',
|
||||
noCustomDashboard: '管理员暂未定制仪表盘',
|
||||
},
|
||||
preference_relation: {
|
||||
newServiceTree: '新增服务树',
|
||||
serviceTreeName: '服务树名',
|
||||
public: '公开',
|
||||
saveLayout: '保存布局',
|
||||
childNodesNotFound: '不存在子节点,不能形成业务关系,请重新选择!',
|
||||
tips1: '不能与当前选中节点形成视图,请重新选择!',
|
||||
tips2: '请输入新增服务树名!',
|
||||
tips3: '请选择至少两个节点!',
|
||||
},
|
||||
history: {
|
||||
ciChange: 'CI变更',
|
||||
relationChange: '关系变更',
|
||||
ciTypeChange: '模型变更',
|
||||
triggerHistory: '触发历史',
|
||||
opreateTime: '操作时间',
|
||||
user: '用户',
|
||||
userTips: '输入筛选用户名',
|
||||
filter: '筛选',
|
||||
filterOperate: '筛选操作',
|
||||
attribute: '属性',
|
||||
old: '旧',
|
||||
new: '新',
|
||||
noUpdate: '没有修改',
|
||||
itemsPerPage: '/页',
|
||||
triggerName: '触发器名称',
|
||||
event: '事件',
|
||||
action: '动作',
|
||||
status: '状态',
|
||||
done: '已完成',
|
||||
undone: '未完成',
|
||||
triggerTime: '触发时间',
|
||||
totalItems: '共 {total} 条记录',
|
||||
pleaseSelect: '请选择',
|
||||
startTime: '开始时间',
|
||||
endTime: '结束时间',
|
||||
deleteCIType: '删除模型',
|
||||
addCIType: '新增模型',
|
||||
updateCIType: '修改模型',
|
||||
addAttribute: '新增属性',
|
||||
updateAttribute: '修改属性',
|
||||
deleteAttribute: '删除属性',
|
||||
addTrigger: '新增触发器',
|
||||
updateTrigger: '修改触发器',
|
||||
deleteTrigger: '删除触发器',
|
||||
addUniqueConstraint: '新增联合唯一',
|
||||
updateUniqueConstraint: '修改联合唯一',
|
||||
deleteUniqueConstraint: '删除联合唯一',
|
||||
addRelation: '新增关系',
|
||||
deleteRelation: '删除关系',
|
||||
noModifications: '没有修改',
|
||||
attr: '属性名',
|
||||
attrId: '属性ID',
|
||||
changeDescription: '属性ID:{attr_id},提前:{before_days}天,主题:{subject}\n内容:{body}\n通知时间:{notify_at}'
|
||||
},
|
||||
relation_type: {
|
||||
addRelationType: '新增关系类型',
|
||||
nameTips: '请输入类型名',
|
||||
},
|
||||
ad: {
|
||||
upload: '规则导入',
|
||||
download: '规则导出',
|
||||
accpet: '入库',
|
||||
accpetBy: '入库人',
|
||||
acceptTime: '入库时间',
|
||||
confirmAccept: '确认入库?',
|
||||
accpetSuccess: '入库成功',
|
||||
isAccpet: '是否入库',
|
||||
deleteADC: '确认删除该条数据?',
|
||||
batchDelete: '确认删除这些数据?',
|
||||
agent: '内置 & 插件',
|
||||
snmp: '网络设备',
|
||||
http: '公有云资源',
|
||||
rule: '自动发现规则',
|
||||
timeout: '超时错误',
|
||||
mode: '模式',
|
||||
collectSettings: '采集设置',
|
||||
updateFields: '更新字段',
|
||||
pluginScript: `# -*- coding:utf-8 -*-
|
||||
|
||||
import json
|
||||
|
||||
|
||||
class AutoDiscovery(object):
|
||||
|
||||
@property
|
||||
def unique_key(self):
|
||||
"""
|
||||
|
||||
:return: 返回唯一属性的名字
|
||||
"""
|
||||
return
|
||||
|
||||
@staticmethod
|
||||
def attributes():
|
||||
"""
|
||||
定义属性字段
|
||||
:return: 返回属性字段列表, 列表项是(名称, 类型, 描述), 名称必须是英文
|
||||
类型: String Integer Float Date DateTime Time JSON
|
||||
例如:
|
||||
return [
|
||||
("ci_type", "String", "模型名称"),
|
||||
("private_ip", "String", "内网IP, 多值逗号分隔")
|
||||
]
|
||||
"""
|
||||
return []
|
||||
|
||||
@staticmethod
|
||||
def run():
|
||||
"""
|
||||
执行入口, 返回采集的属性值
|
||||
:return: 返回一个列表, 列表项是字典, 字典key是属性名称, value是属性值
|
||||
例如:
|
||||
return [dict(ci_type="server", private_ip="192.168.1.1")]
|
||||
"""
|
||||
return []
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
result = AutoDiscovery().run()
|
||||
if isinstance(result, list):
|
||||
print("AutoDiscovery::Result::{}".format(json.dumps(result)))
|
||||
else:
|
||||
print("ERROR: 采集返回必须是列表")
|
||||
`,
|
||||
server: '物理机',
|
||||
vserver: '虚拟机',
|
||||
nic: '网卡',
|
||||
disk: '硬盘',
|
||||
},
|
||||
ci: {
|
||||
attributeDesc: '属性说明',
|
||||
selectRows: '选取:{rows} 项',
|
||||
addRelation: '添加关系',
|
||||
all: '全部',
|
||||
batchUpdate: '批量修改',
|
||||
batchUpdateConfirm: '确认要批量修改吗?',
|
||||
batchUpdateInProgress: '正在批量修改',
|
||||
batchUpdateInProgress2: '正在批量修改,共{total}个,成功{successNum}个,失败{errorNum}个',
|
||||
batchDeleting: '正在删除...',
|
||||
batchDeleting2: '正在删除,共{total}个,成功{successNum}个,失败{errorNum}个',
|
||||
copyFailed: '复制失败!',
|
||||
noLevel: '无层级关系!',
|
||||
batchAddRelation: '批量添加关系',
|
||||
history: '操作历史',
|
||||
topo: '拓扑',
|
||||
table: '表格',
|
||||
m2mTips: '当前模型关系为多对多,请前往关系视图进行增删操作',
|
||||
confirmDeleteRelation: '确认删除关系?',
|
||||
tips1: '多个值使用,分割',
|
||||
tips2: '可根据需要修改字段,当值为 空 时,则该字段 置空',
|
||||
tips3: '请选择需要修改的字段',
|
||||
tips4: '必须至少选择一个字段',
|
||||
tips5: '搜索 名称 | 别名',
|
||||
tips6: '加快检索, 可以全文搜索, 无需使用条件过滤\n\n json目前不支持建索引 \n\n文本字符长度超过190不能建索引',
|
||||
tips7: '表现形式是下拉框, 值必须在预定义值里',
|
||||
tips8: '多值, 比如内网IP',
|
||||
tips9: '仅针对前端',
|
||||
tips10: '模型的其他属性通过表达式的方式计算出来\n\n一个代码片段计算返回的值',
|
||||
newUpdateField: '新增修改字段',
|
||||
attributeSettings: '字段设置',
|
||||
},
|
||||
serviceTree: {
|
||||
deleteNode: '删除节点',
|
||||
tips1: '例:q=os_version:centos&sort=os_version',
|
||||
tips2: '表达式搜索',
|
||||
alert1: '管理员 还未配置业务关系, 或者你无权限访问!',
|
||||
copyFailed: '复制失败',
|
||||
deleteRelationConfirm: '确认将选中的 {name} 从当前关系中删除?',
|
||||
},
|
||||
tree: {
|
||||
tips1: '请先到 我的订阅 页面完成订阅!',
|
||||
subSettings: '订阅设置',
|
||||
}
|
||||
}
|
||||
export default cmdb_zh
|
|
@ -13,19 +13,19 @@ const genCmdbRoutes = async () => {
|
|||
{
|
||||
path: '/cmdb/dashboard',
|
||||
name: 'cmdb_dashboard',
|
||||
meta: { title: '仪表盘', icon: 'ops-cmdb-dashboard', selectedIcon: 'ops-cmdb-dashboard-selected', keepAlive: false },
|
||||
meta: { title: 'dashboard', icon: 'ops-cmdb-dashboard', selectedIcon: 'ops-cmdb-dashboard-selected', keepAlive: false },
|
||||
component: () => import('../views/dashboard/index_v2.vue')
|
||||
},
|
||||
{
|
||||
path: '/cmdb/disabled1',
|
||||
name: 'cmdb_disabled1',
|
||||
meta: { title: '视图', disabled: true },
|
||||
meta: { title: 'cmdb.menu.views', disabled: true },
|
||||
},
|
||||
{
|
||||
path: '/cmdb/resourceviews',
|
||||
name: 'cmdb_resource_views',
|
||||
component: RouteView,
|
||||
meta: { title: '资源数据', icon: 'ops-cmdb-resource', selectedIcon: 'ops-cmdb-resource-selected', keepAlive: true },
|
||||
meta: { title: 'cmdb.menu.ciTable', icon: 'ops-cmdb-resource', selectedIcon: 'ops-cmdb-resource-selected', keepAlive: true },
|
||||
hideChildrenInMenu: false,
|
||||
children: []
|
||||
},
|
||||
|
@ -33,108 +33,108 @@ const genCmdbRoutes = async () => {
|
|||
path: '/cmdb/tree_views',
|
||||
component: () => import('../views/tree_views'),
|
||||
name: 'cmdb_tree_views',
|
||||
meta: { title: '资源层级', icon: 'ops-cmdb-tree', selectedIcon: 'ops-cmdb-tree-selected', keepAlive: false },
|
||||
meta: { title: 'cmdb.menu.ciTree', icon: 'ops-cmdb-tree', selectedIcon: 'ops-cmdb-tree-selected', keepAlive: false },
|
||||
hideChildrenInMenu: true,
|
||||
children: [
|
||||
{
|
||||
path: '/cmdb/tree_views/:typeId',
|
||||
name: 'cmdb_tree_views_item',
|
||||
component: () => import('../views/tree_views'),
|
||||
meta: { title: '资源层级', keepAlive: false },
|
||||
meta: { title: 'cmdb.menu.ciTree', keepAlive: false },
|
||||
hidden: true
|
||||
}]
|
||||
},
|
||||
{
|
||||
path: '/cmdb/resourcesearch',
|
||||
name: 'cmdb_resource_search',
|
||||
meta: { title: '资源搜索', icon: 'ops-cmdb-search', selectedIcon: 'ops-cmdb-search-selected', keepAlive: false },
|
||||
meta: { title: 'cmdb.menu.ciSearch', icon: 'ops-cmdb-search', selectedIcon: 'ops-cmdb-search-selected', keepAlive: false },
|
||||
component: () => import('../views/resource_search/index.vue')
|
||||
},
|
||||
{
|
||||
path: '/cmdb/adc',
|
||||
name: 'cmdb_auto_discovery_ci',
|
||||
meta: { title: '自动发现池', icon: 'ops-cmdb-adc', selectedIcon: 'ops-cmdb-adc-selected', keepAlive: false },
|
||||
meta: { title: 'cmdb.menu.adCIs', icon: 'ops-cmdb-adc', selectedIcon: 'ops-cmdb-adc-selected', keepAlive: false },
|
||||
component: () => import('../views/discoveryCI/index.vue')
|
||||
},
|
||||
{
|
||||
path: '/cmdb/disabled2',
|
||||
name: 'cmdb_disabled2',
|
||||
meta: { title: '配置', disabled: true, },
|
||||
meta: { title: 'cmdb.menu.config', disabled: true, },
|
||||
},
|
||||
{
|
||||
path: '/cmdb/preference',
|
||||
component: () => import('../views/preference/index'),
|
||||
name: 'cmdb_preference',
|
||||
meta: { title: '我的订阅', icon: 'ops-cmdb-preference', selectedIcon: 'ops-cmdb-preference-selected', keepAlive: false }
|
||||
meta: { title: 'cmdb.menu.preference', icon: 'ops-cmdb-preference', selectedIcon: 'ops-cmdb-preference-selected', keepAlive: false }
|
||||
},
|
||||
{
|
||||
path: '/cmdb/batch',
|
||||
component: () => import('../views/batch'),
|
||||
name: 'cmdb_batch',
|
||||
meta: { 'title': '批量导入', icon: 'ops-cmdb-batch', selectedIcon: 'ops-cmdb-batch-selected', keepAlive: false }
|
||||
meta: { 'title': 'cmdb.menu.batchUpload', icon: 'ops-cmdb-batch', selectedIcon: 'ops-cmdb-batch-selected', keepAlive: false }
|
||||
},
|
||||
{
|
||||
path: '/cmdb/ci_types',
|
||||
name: 'ci_type',
|
||||
component: () => import('../views/ci_types/index'),
|
||||
meta: { title: '模型配置', icon: 'ops-cmdb-citype', selectedIcon: 'ops-cmdb-citype-selected', keepAlive: false, permission: ['cmdb_admin', 'admin'] }
|
||||
meta: { title: 'cmdb.menu.citypeManage', icon: 'ops-cmdb-citype', selectedIcon: 'ops-cmdb-citype-selected', keepAlive: false, permission: ['cmdb_admin', 'admin'] }
|
||||
},
|
||||
{
|
||||
path: '/cmdb/disabled3',
|
||||
name: 'cmdb_disabled3',
|
||||
meta: { title: '管理端', disabled: true, permission: ['cmdb_admin', 'OneOPS_Application_Admin', 'admin'], },
|
||||
meta: { title: 'cmdb.menu.backend', disabled: true, permission: ['cmdb_admin', 'OneOPS_Application_Admin', 'admin'], },
|
||||
},
|
||||
{
|
||||
path: '/cmdb/citypes',
|
||||
name: 'cmdb_ci_type',
|
||||
component: RouteView,
|
||||
redirect: '/cmdb/ci_type',
|
||||
meta: { title: '后台管理', icon: 'setting', permission: ['cmdb_admin', 'OneOPS_Application_Admin', 'admin'], },
|
||||
meta: { title: 'cmdb.menu.backendManage', icon: 'setting', permission: ['cmdb_admin', 'OneOPS_Application_Admin', 'admin'], },
|
||||
children: [
|
||||
{
|
||||
path: '/cmdb/customdashboard',
|
||||
name: 'cmdb_custom_dashboard',
|
||||
component: () => import('../views/custom_dashboard/index'),
|
||||
meta: { title: '定制仪表盘', keepAlive: false, icon: 'ops-cmdb-customdashboard', selectedIcon: 'ops-cmdb-customdashboard-selected' }
|
||||
meta: { title: 'cmdb.menu.customDashboard', keepAlive: false, icon: 'ops-cmdb-customdashboard', selectedIcon: 'ops-cmdb-customdashboard-selected' }
|
||||
},
|
||||
{
|
||||
path: '/cmdb/preferencerelation',
|
||||
name: 'preference_relation',
|
||||
component: () => import('../views/preference_relation/index'),
|
||||
meta: { title: '业务关系定义', keepAlive: false, icon: 'ops-cmdb-preferencerelation', selectedIcon: 'ops-cmdb-preferencerelation-selected' }
|
||||
meta: { title: 'cmdb.menu.serviceTreeDefine', keepAlive: false, icon: 'ops-cmdb-preferencerelation', selectedIcon: 'ops-cmdb-preferencerelation-selected' }
|
||||
},
|
||||
{
|
||||
path: '/cmdb/modelrelation',
|
||||
name: 'model_relation',
|
||||
hideChildrenInMenu: true,
|
||||
component: () => import('../views/model_relation/index'),
|
||||
meta: { title: '模型关系', keepAlive: false, icon: 'ops-cmdb-modelrelation', selectedIcon: 'ops-cmdb-modelrelation-selected' }
|
||||
meta: { title: 'cmdb.menu.citypeRelation', keepAlive: false, icon: 'ops-cmdb-modelrelation', selectedIcon: 'ops-cmdb-modelrelation-selected' }
|
||||
},
|
||||
{
|
||||
path: '/cmdb/operationhistory',
|
||||
name: 'operation_history',
|
||||
hideChildrenInMenu: true,
|
||||
component: () => import('../views/operation_history/index'),
|
||||
meta: { title: '操作审计', keepAlive: false, icon: 'ops-cmdb-operation', selectedIcon: 'ops-cmdb-operation-selected' }
|
||||
meta: { title: 'cmdb.menu.operationHistory', keepAlive: false, icon: 'ops-cmdb-operation', selectedIcon: 'ops-cmdb-operation-selected' }
|
||||
},
|
||||
{
|
||||
path: '/cmdb/relationtype',
|
||||
name: 'relation_type',
|
||||
hideChildrenInMenu: true,
|
||||
component: () => import('../views/relation_type/index'),
|
||||
meta: { title: '关系类型', keepAlive: false, icon: 'ops-cmdb-relationtype', selectedIcon: 'ops-cmdb-relationtype-selected' }
|
||||
meta: { title: 'cmdb.menu.relationType', keepAlive: false, icon: 'ops-cmdb-relationtype', selectedIcon: 'ops-cmdb-relationtype-selected' }
|
||||
},
|
||||
{
|
||||
path: '/cmdb/discovery',
|
||||
name: 'discovery',
|
||||
component: () => import('../views/discovery/index'),
|
||||
meta: { title: '自动发现', keepAlive: false, icon: 'ops-cmdb-adr', selectedIcon: 'ops-cmdb-adr-selected' }
|
||||
meta: { title: 'cmdb.menu.ad', keepAlive: false, icon: 'ops-cmdb-adr', selectedIcon: 'ops-cmdb-adr-selected' }
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
// 动态添加订阅的条目及业务关系
|
||||
// Dynamically add subscription items and business relationships
|
||||
const [preference, relation] = await Promise.all([getPreference(), getRelationView()])
|
||||
|
||||
preference.forEach(item => {
|
||||
|
@ -143,7 +143,7 @@ const genCmdbRoutes = async () => {
|
|||
component: () => import(`../views/ci/index`),
|
||||
name: `cmdb_${item.id}`,
|
||||
meta: { title: item.alias, keepAlive: false, typeId: item.id, name: item.name, customIcon: item.icon },
|
||||
// hideChildrenInMenu: true // 强制显示 MenuItem 而不是 SubMenu
|
||||
// hideChildrenInMenu: true // Force display of MenuItem instead of SubMenu
|
||||
})
|
||||
})
|
||||
const lastTypeId = window.localStorage.getItem('ops_ci_typeid') || undefined
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
export const valueTypeMap = {
|
||||
'0': '整数',
|
||||
'1': '浮点数',
|
||||
'2': '文本',
|
||||
'3': '日期时间',
|
||||
'4': '日期',
|
||||
'5': '时间',
|
||||
'6': 'JSON',
|
||||
'7': '密码',
|
||||
'8': '链接'
|
||||
import i18n from '@/lang'
|
||||
|
||||
export const valueTypeMap = () => {
|
||||
return {
|
||||
'0': i18n.t('cmdb.ciType.int'),
|
||||
'1': i18n.t('cmdb.ciType.float'),
|
||||
'2': i18n.t('cmdb.ciType.text'),
|
||||
'3': i18n.t('cmdb.ciType.datetime'),
|
||||
'4': i18n.t('cmdb.ciType.date'),
|
||||
'5': i18n.t('cmdb.ciType.time'),
|
||||
'6': 'JSON',
|
||||
'7': i18n.t('cmdb.ciType.password'),
|
||||
'8': i18n.t('cmdb.ciType.link')
|
||||
}
|
||||
}
|
||||
|
||||
export const defautValueColor = [
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
<CiUploadTable :ciTypeAttrs="ciTypeAttrs" ref="ciUploadTable" :uploadData="uploadData"></CiUploadTable>
|
||||
<div class="cmdb-batch-upload-action">
|
||||
<a-space size="large">
|
||||
<a-button type="primary" ghost @click="handleCancel">取消</a-button>
|
||||
<a-button @click="handleUpload" type="primary">上传</a-button>
|
||||
<a-button v-if="hasError && !isUploading" @click="downloadError" type="primary">失败下载</a-button>
|
||||
<a-button type="primary" ghost @click="handleCancel">{{ $t('cancel') }}</a-button>
|
||||
<a-button @click="handleUpload" type="primary">{{ $t('upload') }}</a-button>
|
||||
<a-button v-if="hasError && !isUploading" @click="downloadError" type="primary">{{ $t('cmdb.batch.downloadFailed') }}</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
</a-col>
|
||||
|
@ -109,7 +109,7 @@ export default {
|
|||
},
|
||||
handleUpload() {
|
||||
if (!this.ciType) {
|
||||
this.$message.error('尚未选择模板类型')
|
||||
this.$message.error(this.$t('cmdb.batch.unselectCIType'))
|
||||
return
|
||||
}
|
||||
if (this.uploadData && this.uploadData.length > 0) {
|
||||
|
@ -118,7 +118,7 @@ export default {
|
|||
this.$refs.uploadResult.upload2Server()
|
||||
})
|
||||
} else {
|
||||
this.$message.error('请上传文件')
|
||||
this.$message.error(this.$t('cmdb.batch.pleaseUploadFile'))
|
||||
}
|
||||
},
|
||||
handleCancel() {
|
||||
|
@ -127,7 +127,7 @@ export default {
|
|||
this.$refs.ciTypeChoice.selectNum = null
|
||||
this.hasError = false
|
||||
} else {
|
||||
this.$message.warning('批量上传已取消')
|
||||
this.$message.warning(this.$t('cmdb.batch.batchUploadCanceled'))
|
||||
this.isUploading = false
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<a-space>
|
||||
<span>模板类型:</span>
|
||||
<span>{{ $t('cmdb.ciType.ciType') }}: </span>
|
||||
<a-select
|
||||
showSearch
|
||||
placeholder="请选择模板类型"
|
||||
:placeholder="$t('cmdb.batch.selectCITypeTips')"
|
||||
@change="selectCiType"
|
||||
:style="{ width: '300px' }"
|
||||
class="ops-select"
|
||||
|
@ -20,7 +20,7 @@
|
|||
type="primary"
|
||||
class="ops-button-primary"
|
||||
icon="download"
|
||||
>下载模板</a-button
|
||||
>{{ $t('cmdb.batch.downloadTemplate') }}</a-button
|
||||
>
|
||||
<a-modal
|
||||
:bodyStyle="{ paddingTop: 0 }"
|
||||
|
@ -31,14 +31,14 @@
|
|||
@ok="handleOk"
|
||||
wrapClassName="ci-type-choice-modal"
|
||||
>
|
||||
<a-divider orientation="left">模型属性</a-divider>
|
||||
<a-divider orientation="left">{{ $t('cmdb.ciType.attributes') }}</a-divider>
|
||||
<a-checkbox
|
||||
@change="changeCheckAll"
|
||||
:style="{ marginBottom: '20px' }"
|
||||
:indeterminate="indeterminate"
|
||||
:checked="checkAll"
|
||||
>
|
||||
全选
|
||||
{{ $t('checkAll') }}
|
||||
</a-checkbox>
|
||||
<br />
|
||||
<a-checkbox-group style="width:100%" v-model="checkedAttrs">
|
||||
|
@ -52,7 +52,7 @@
|
|||
</a-row>
|
||||
</a-checkbox-group>
|
||||
<template v-if="parentsType && parentsType.length">
|
||||
<a-divider orientation="left">模型关联</a-divider>
|
||||
<a-divider orientation="left">{{ $t('cmdb.ciType.relation') }}</a-divider>
|
||||
<a-row :gutter="[24, 24]" align="top" type="flex">
|
||||
<a-col :style="{ display: 'inline-flex' }" :span="12" v-for="item in parentsType" :key="item.id">
|
||||
<a-checkbox @click="clickParent(item)" :checked="checkedParents.includes(item.alias || item.name)">
|
||||
|
@ -150,7 +150,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
selectCiType(el) {
|
||||
// 当选择好模板类型时的回调函数
|
||||
// Callback function when a template type is selected
|
||||
getCITypeAttributesById(el).then((res) => {
|
||||
this.$emit('getCiTypeAttr', res)
|
||||
this.selectCiTypeAttrList = res
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
:disabled="!ciType || isUploading"
|
||||
>
|
||||
<img :style="{ width: '80px', height: '80px' }" src="@/assets/file_upload.png" />
|
||||
<p class="ant-upload-text">点击或拖拽文件至此上传!</p>
|
||||
<p class="ant-upload-hint">支持文件类型:xls,xlsx</p>
|
||||
<p class="ant-upload-text">{{ $t('cmdb.batch.drawTips') }}</p>
|
||||
<p class="ant-upload-hint">{{ $t('cmdb.batch.supportFileTypes') }}</p>
|
||||
</a-upload-dragger>
|
||||
<div v-for="item in fileList" :key="item.name" class="cmdb-batch-upload-dragger-file">
|
||||
<span><a-icon type="file" :style="{ color: '#2F54EB', marginRight: '5px' }" />{{ item.name }}</span>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<template>
|
||||
<div class="cmdb-batch-upload-result" v-if="visible">
|
||||
<h3 class="cmdb-batch-upload-result-title">上传结果</h3>
|
||||
<h3 class="cmdb-batch-upload-result-title">{{ $t('cmdb.batch.uploadResult') }}</h3>
|
||||
<div class="cmdb-batch-upload-result-content">
|
||||
<h4>
|
||||
共 <span style="color: blue">{{ total }}</span> 条,已成功
|
||||
<span style="color: lightgreen">{{ success }}</span> 条,失败 <span style="color: red">{{ errorNum }} </span>条
|
||||
{{ $t('cmdb.batch.total') }} <span style="color: blue">{{ total }}</span> {{ $t('cmdb.batch.successItems') }}
|
||||
<span style="color: lightgreen">{{ success }}</span> {{ $t('cmdb.batch.failedItems') }} <span style="color: red">{{ errorNum }} </span>{{ $t('cmdb.batch.items') }}
|
||||
</h4>
|
||||
<div>
|
||||
<span>错误信息:</span>
|
||||
<span>{{ $t('cmdb.batch.errorTips') }}: </span>
|
||||
<ol>
|
||||
<li :key="item + index" v-for="(item, index) in errorItems">{{ item }}</li>
|
||||
</ol>
|
||||
|
@ -71,7 +71,7 @@ export default {
|
|||
if (r.status === 'fulfilled') {
|
||||
this.success += 1
|
||||
} else {
|
||||
this.errorItems.push(r?.reason?.response?.data.message ?? '请求出现错误,请稍后再试')
|
||||
this.errorItems.push(r?.reason?.response?.data.message ?? this.$t('cmdb.batch.requestFailedTips'))
|
||||
this.errorNum += 1
|
||||
this.$emit('uploadResultError', 6 * i + j)
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ export default {
|
|||
}
|
||||
if (this.isUploading) {
|
||||
this.$emit('uploadResultDone')
|
||||
this.$message.success('批量上传已完成')
|
||||
this.$message.success(this.$t('cmdb.batch.requestSuccessTips'))
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
@ -11,22 +11,24 @@
|
|||
"
|
||||
class="cmdb-views-header-metadata"
|
||||
>
|
||||
<a-icon type="info-circle" />属性说明
|
||||
<a-icon type="info-circle" />{{ $t('cmdb.ci.attributeDesc') }}
|
||||
</span>
|
||||
</span>
|
||||
<a-space>
|
||||
<a-button size="small" icon="plus" type="primary" @click="$refs.create.handleOpen(true, 'create')">
|
||||
新建
|
||||
{{ $t('create') }}
|
||||
</a-button>
|
||||
<a-button size="small" icon="user-add" type="primary" ghost @click="handlePerm">授权</a-button>
|
||||
<a-button size="small" icon="user-add" type="primary" ghost @click="handlePerm">{{ $t('grant') }}</a-button>
|
||||
<a-popconfirm
|
||||
:title="`确认取消订阅 ${this.$route.meta.title || this.$route.meta.name} 吗?`"
|
||||
ok-text="确认"
|
||||
cancel-text="取消"
|
||||
:title="
|
||||
$t('cmdb.preference.confirmcancelSub2', { name: `${this.$route.meta.title || this.$route.meta.name}` })
|
||||
"
|
||||
:ok-text="$t('confirm')"
|
||||
:cancel-text="$t('cancel')"
|
||||
@confirm="unsubscribe"
|
||||
placement="bottomRight"
|
||||
>
|
||||
<a-button size="small" icon="star" type="primary" ghost>取消订阅</a-button>
|
||||
<a-button size="small" icon="star" type="primary" ghost>{{ $t('cmdb.preference.cancelSub') }}</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</div>
|
||||
|
@ -47,12 +49,12 @@
|
|||
@setParamsFromPreferenceSearch="setParamsFromPreferenceSearch"
|
||||
/>
|
||||
<div class="ops-list-batch-action" v-show="!!selectedRowKeys.length">
|
||||
<span @click="$refs.create.handleOpen(true, 'update')">修改</span>
|
||||
<span @click="$refs.create.handleOpen(true, 'update')">{{ $t('update') }}</span>
|
||||
<a-divider type="vertical" />
|
||||
<span @click="openBatchDownload">下载</span>
|
||||
<span @click="openBatchDownload">{{ $t('download') }}</span>
|
||||
<a-divider type="vertical" />
|
||||
<span @click="batchDelete">删除</span>
|
||||
<span>选取:{{ selectedRowKeys.length }} 项</span>
|
||||
<span @click="batchDelete">{{ $t('delete') }}</span>
|
||||
<span>{{ $t('cmdb.ci.selectRows', { rows: selectedRowKeys.length }) }}</span>
|
||||
</div>
|
||||
</SearchForm>
|
||||
<CiDetail ref="detail" :typeId="typeId" />
|
||||
|
@ -114,7 +116,7 @@
|
|||
:getPopupContainer="(trigger) => trigger.parentElement"
|
||||
:style="{ width: '100%', height: '32px' }"
|
||||
v-model="row[col.field]"
|
||||
placeholder="请选择"
|
||||
:v-bind="$t('placeholder2')"
|
||||
v-if="col.is_choice"
|
||||
:showArrow="false"
|
||||
:mode="col.is_list ? 'multiple' : 'default'"
|
||||
|
@ -149,7 +151,7 @@
|
|||
:getPopupContainer="(trigger) => trigger.parentElement"
|
||||
:style="{ width: '100%', height: '32px' }"
|
||||
v-model="row[col.field]"
|
||||
placeholder="请选择"
|
||||
:placeholder="$t('placeholder2')"
|
||||
v-else-if="col.is_list"
|
||||
:showArrow="false"
|
||||
mode="tags"
|
||||
|
@ -230,9 +232,9 @@
|
|||
</template>
|
||||
</template>
|
||||
</vxe-table-column>
|
||||
<vxe-column align="left" field="operate" fixed="right" width="80">
|
||||
<vxe-column align="left" field="operate" fixed="right" width="120">
|
||||
<template #header>
|
||||
<span>操作</span>
|
||||
<span>{{ $t('operation') }}</span>
|
||||
<EditAttrsPopover :typeId="typeId" class="operation-icon" @refresh="refreshAfterEditAttrs" />
|
||||
<!-- <a-icon class="operation-icon" type="control" /> -->
|
||||
</template>
|
||||
|
@ -241,7 +243,7 @@
|
|||
<a @click="$refs.detail.create(row.ci_id || row._id)">
|
||||
<a-icon type="unordered-list" />
|
||||
</a>
|
||||
<a-tooltip title="添加关系">
|
||||
<a-tooltip :title="$t('cmdb.ci.addRelation')">
|
||||
<a @click="$refs.detail.create(row.ci_id || row._id, 'tab_2', '2')">
|
||||
<a-icon type="retweet" />
|
||||
</a>
|
||||
|
@ -253,10 +255,10 @@
|
|||
</template>
|
||||
</vxe-column>
|
||||
<template #empty>
|
||||
<div v-if="loading" style="height: 200px; line-height: 200px">加载中...</div>
|
||||
<div v-if="loading" style="height: 200px; line-height: 200px">{{ $t('loading') }}</div>
|
||||
<div v-else>
|
||||
<img :style="{ width: '200px' }" :src="require('@/assets/data_empty.png')" />
|
||||
<div>暂无数据</div>
|
||||
<div>{{ $t('noData') }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</ops-table>
|
||||
|
@ -270,7 +272,14 @@
|
|||
:page-size="pageSize"
|
||||
:page-size-options="pageSizeOptions"
|
||||
@showSizeChange="onShowSizeChange"
|
||||
:show-total="(total, range) => `当前${range[0]}-${range[1]} 共 ${total}条记录`"
|
||||
:show-total="
|
||||
(total, range) =>
|
||||
$t('pagination.total', {
|
||||
range0: range[0],
|
||||
range1: range[1],
|
||||
total,
|
||||
})
|
||||
"
|
||||
@change="
|
||||
(page) => {
|
||||
currentPage = page
|
||||
|
@ -278,12 +287,14 @@
|
|||
"
|
||||
>
|
||||
<template slot="buildOptionText" slot-scope="props">
|
||||
<span v-if="props.value !== '100000'">{{ props.value }}条/页</span>
|
||||
<span v-if="props.value === '100000'">全部</span>
|
||||
<span v-if="props.value !== '100000'">{{ props.value }}{{ $t('itemsPerPage') }}</span>
|
||||
<span v-if="props.value === '100000'">{{ $t('cmdb.ci.all') }}</span>
|
||||
</template>
|
||||
</a-pagination>
|
||||
</div>
|
||||
<create-instance-form ref="create" @reload="reloadData" @submit="batchUpdate" />
|
||||
<!-- <EditAttrsDrawer ref="editAttrsDrawer" @refresh="refreshAfterEditAttrs" /> -->
|
||||
<!-- <batch-update-relation :typeId="typeId" ref="batchUpdateRelation" @submit="batchUpdateRelation" /> -->
|
||||
<JsonEditor ref="jsonEditor" @jsonEditorOk="jsonEditorOk" />
|
||||
<BatchDownload ref="batchDownload" @batchDownload="batchDownload" />
|
||||
<MetadataDrawer ref="metadataDrawer" />
|
||||
|
@ -363,17 +374,16 @@ export default {
|
|||
preferenceAttrList: [],
|
||||
|
||||
instanceList: [],
|
||||
// 表头
|
||||
columns: [],
|
||||
// custom table alert & rowSelection
|
||||
selectedRowKeys: [],
|
||||
// 对照是否编辑
|
||||
// Check whether to edit
|
||||
initialInstanceList: [],
|
||||
sortByTable: undefined,
|
||||
isEditActive: false,
|
||||
attrList: [],
|
||||
attributes: {},
|
||||
// 表格拖拽的参数
|
||||
// Table drag parameters
|
||||
tableDragClassName: [],
|
||||
|
||||
resource_type: {},
|
||||
|
@ -419,11 +429,15 @@ export default {
|
|||
},
|
||||
inject: ['reloadBoard'],
|
||||
mounted() {
|
||||
// window.onkeypress = (e) => {
|
||||
// this.handleKeyPress(e)
|
||||
// }
|
||||
setTimeout(() => {
|
||||
this.columnDrop()
|
||||
}, 1000)
|
||||
},
|
||||
beforeDestroy() {
|
||||
// window.onkeypress = null
|
||||
if (this.sortable) {
|
||||
this.sortable.destroy()
|
||||
}
|
||||
|
@ -449,14 +463,19 @@ export default {
|
|||
async loadTableData(sortByTable = undefined) {
|
||||
try {
|
||||
this.loading = true
|
||||
// 若模糊搜索可以 queryParam相关后期可删除
|
||||
// If fuzzy search is possible, queryParam can be deleted later.
|
||||
// const queryParams = this.$refs['search'].queryParam || {}
|
||||
const fuzzySearch = this.$refs['search'].fuzzySearch
|
||||
const expression = this.$refs['search'].expression || ''
|
||||
const regQ = /(?<=q=).+(?=&)|(?<=q=).+$/g
|
||||
const regSort = /(?<=sort=).+/g
|
||||
|
||||
const exp = expression.match(regQ) ? expression.match(regQ)[0] : null
|
||||
// 如果是表格点击的排序 以表格为准
|
||||
// if (exp) {
|
||||
// exp = exp.replace(/(\:)/g, '$1*')
|
||||
// exp = exp.replace(/(\,)/g, '*$1')
|
||||
// }
|
||||
// If the sorting is done by clicking on the table, the table will prevail.
|
||||
let sort
|
||||
if (sortByTable) {
|
||||
sort = sortByTable
|
||||
|
@ -514,18 +533,55 @@ export default {
|
|||
this.$refs['xTable'].getVxetableRef().setCheckboxRow(rows, true)
|
||||
}
|
||||
},
|
||||
// mergeQ(params) {
|
||||
// let q = `_type:${this.typeId}`
|
||||
// Object.keys(params).forEach((key) => {
|
||||
// if (!['pageNo', 'pageSize', 'sortField', 'sortOrder'].includes(key) && params[key] + '' !== '') {
|
||||
// if (typeof params[key] === 'object' && params[key] && params[key].length > 1) {
|
||||
// q += `,${key}:(${params[key].join(';')})`
|
||||
// } else if (params[key]) {
|
||||
// q += `,${key}:*${params[key]}*`
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// return q
|
||||
// },
|
||||
|
||||
async loadPreferenceAttrList() {
|
||||
const subscribed = await getSubscribeAttributes(this.typeId)
|
||||
this.preferenceAttrList = subscribed.attributes // 已经订阅的全部列
|
||||
this.preferenceAttrList = subscribed.attributes // All columns that have been subscribed
|
||||
},
|
||||
|
||||
onSelectChange() {
|
||||
// const current = records.map((i) => i.ci_id || i._id)
|
||||
|
||||
// const cached = new Set(this.selectedRowKeys)
|
||||
// if (checked) {
|
||||
// current.forEach((i) => {
|
||||
// cached.add(i)
|
||||
// })
|
||||
// } else {
|
||||
// if (row) {
|
||||
// cached.delete(row.ci_id || row._id)
|
||||
// } else {
|
||||
// this.instanceList.map((row) => {
|
||||
// cached.delete(row.ci_id || row._id)
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
const xTable = this.$refs.xTable.getVxetableRef()
|
||||
const records = [...xTable.getCheckboxRecords(), ...xTable.getCheckboxReserveRecords()]
|
||||
this.selectedRowKeys = records.map((i) => i.ci_id || i._id)
|
||||
},
|
||||
onSelectRangeEnd({ records }) {
|
||||
// const current = records.map((i) => i.ci_id || i._id)
|
||||
// const cached = new Set(this.selectedRowKeys)
|
||||
// current.forEach((i) => {
|
||||
// cached.add(i)
|
||||
// })
|
||||
this.selectedRowKeys = records.map((i) => i.ci_id || i._id)
|
||||
|
||||
// this.setSelectRows()
|
||||
},
|
||||
reloadData() {
|
||||
this.loadTableData()
|
||||
|
@ -538,7 +594,10 @@ export default {
|
|||
const $table = this.$refs['xTable'].getVxetableRef()
|
||||
const data = {}
|
||||
this.columns.forEach((item) => {
|
||||
if (!(item.field in this.initialPasswordValue) && !_.isEqual(row[item.field], this.initialInstanceList[rowIndex][item.field])) {
|
||||
if (
|
||||
!(item.field in this.initialPasswordValue) &&
|
||||
!_.isEqual(row[item.field], this.initialInstanceList[rowIndex][item.field])
|
||||
) {
|
||||
data[item.field] = row[item.field] ?? null
|
||||
}
|
||||
})
|
||||
|
@ -553,7 +612,7 @@ export default {
|
|||
if (JSON.stringify(data) !== '{}') {
|
||||
updateCI(row.ci_id || row._id, data)
|
||||
.then(() => {
|
||||
this.$message.success('保存成功!')
|
||||
this.$message.success(this.$t('saveSuccess'))
|
||||
$table.reloadRow(row, null)
|
||||
const _initialInstanceList = _.cloneDeep(this.initialInstanceList)
|
||||
_initialInstanceList[rowIndex] = {
|
||||
|
@ -611,8 +670,8 @@ export default {
|
|||
batchUpdate(values) {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: '确认要批量修改吗?',
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('cmdb.ci.batchUpdateConfirm'),
|
||||
async onOk() {
|
||||
that.batchUpdateAsync(values)
|
||||
},
|
||||
|
@ -622,14 +681,14 @@ export default {
|
|||
let successNum = 0
|
||||
let errorNum = 0
|
||||
this.loading = true
|
||||
this.loadTip = `正在批量修改...`
|
||||
this.loadTip = this.$t('cmdb.ci.batchUpdateInProgress') + '...'
|
||||
const payload = {}
|
||||
Object.keys(values).forEach((key) => {
|
||||
if (values[key] || values[key] === 0) {
|
||||
payload[key] = values[key]
|
||||
}
|
||||
// 字段值支持置空
|
||||
// 目前存在字段值不支持置空,由后端返回
|
||||
// Field values support blanking
|
||||
// There are currently field values that do not support blanking and will be returned by the backend.
|
||||
if (values[key] === undefined || values[key] === null) {
|
||||
payload[key] = null
|
||||
}
|
||||
|
@ -644,7 +703,11 @@ export default {
|
|||
errorNum += 1
|
||||
})
|
||||
.finally(() => {
|
||||
this.loadTip = `正在批量修改,共${this.selectedRowKeys.length}个,成功${successNum}个,失败${errorNum}个`
|
||||
this.loadTip = this.$t('cmdb.ci.batchUpdateInProgress2', {
|
||||
total: this.selectedRowKeys.length,
|
||||
successNum: successNum,
|
||||
errorNum: errorNum,
|
||||
})
|
||||
})
|
||||
}
|
||||
this.loading = false
|
||||
|
@ -657,8 +720,8 @@ export default {
|
|||
batchDelete() {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: '确认删除?',
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('confirmDelete'),
|
||||
onOk() {
|
||||
that.batchDeleteAsync()
|
||||
},
|
||||
|
@ -668,7 +731,7 @@ export default {
|
|||
let successNum = 0
|
||||
let errorNum = 0
|
||||
this.loading = true
|
||||
this.loadTip = `正在删除...`
|
||||
this.loadTip = this.$t('cmdb.ci.batchDeleting')
|
||||
const floor = Math.ceil(this.selectedRowKeys.length / 6)
|
||||
for (let i = 0; i < floor; i++) {
|
||||
const itemList = this.selectedRowKeys.slice(6 * i, 6 * i + 6)
|
||||
|
@ -684,7 +747,11 @@ export default {
|
|||
})
|
||||
})
|
||||
.finally(() => {
|
||||
this.loadTip = `正在删除,共${this.selectedRowKeys.length}个,成功${successNum}个,失败${errorNum}个`
|
||||
this.loadTip = this.$t('cmdb.ci.batchDeleting2', {
|
||||
total: this.selectedRowKeys.length,
|
||||
successNum: successNum,
|
||||
errorNum: errorNum,
|
||||
})
|
||||
})
|
||||
}
|
||||
this.loading = false
|
||||
|
@ -703,12 +770,12 @@ export default {
|
|||
deleteCI(record) {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: '确认删除?',
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('confirmDelete'),
|
||||
onOk() {
|
||||
deleteCI(record.ci_id || record._id).then((res) => {
|
||||
// that.$refs.table.refresh(true)
|
||||
that.$message.success('删除成功!')
|
||||
that.$message.success(that.$t('deleteSuccess'))
|
||||
that.reloadData()
|
||||
})
|
||||
},
|
||||
|
@ -731,7 +798,7 @@ export default {
|
|||
this.$refs.jsonEditor.open(column, row)
|
||||
},
|
||||
jsonEditorOk(row, column, jsonData) {
|
||||
// 后端写数据有快慢,不拉接口直接修改table的数据
|
||||
// The backend writes data at different speeds. You can modify the table data directly without pulling the interface.
|
||||
// this.reloadData()
|
||||
this.instanceList.forEach((item) => {
|
||||
if (item._id === row._id) {
|
||||
|
@ -747,6 +814,9 @@ export default {
|
|||
} else {
|
||||
this.currentPage = 1
|
||||
}
|
||||
setTimeout(() => {
|
||||
// this.setSelectRows()
|
||||
}, 500)
|
||||
},
|
||||
handleSortCol({ column, property, order, sortBy, sortList, $event }) {
|
||||
let sortByTable
|
||||
|
@ -781,7 +851,7 @@ export default {
|
|||
},
|
||||
onEnd: (params) => {
|
||||
// 由于开启了虚拟滚动,newIndex和oldIndex是虚拟的
|
||||
const { newIndex, oldIndex, from, to } = params
|
||||
const { newIndex, oldIndex } = params
|
||||
// 从tableDragClassName拿到colid
|
||||
const fromColid = this.tableDragClassName[oldIndex]
|
||||
const toColid = this.tableDragClassName[newIndex]
|
||||
|
@ -798,6 +868,9 @@ export default {
|
|||
)
|
||||
})
|
||||
},
|
||||
// tableFilterChangeEvent({ column, property, values, datas, filterList, $event }) {
|
||||
// console.log(111)
|
||||
// },
|
||||
getChoiceValueStyle(col, colValue) {
|
||||
const _find = col.filters.find((item) => String(item[0]) === String(colValue))
|
||||
if (_find) {
|
||||
|
@ -885,10 +958,10 @@ export default {
|
|||
const text = `q=_type:${this.typeId}${exp ? `,${exp}` : ''}${fuzzySearch ? `,*${fuzzySearch}*` : ''}`
|
||||
this.$copyText(text)
|
||||
.then(() => {
|
||||
this.$message.success('复制成功!')
|
||||
this.$message.success(this.$t('copySuccess'))
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.error('复制失败!')
|
||||
this.$message.error(this.$t('cmdb.ci.copyFailed'))
|
||||
})
|
||||
},
|
||||
unsubscribe(ciType, type = 'all') {
|
||||
|
@ -898,7 +971,7 @@ export default {
|
|||
if (Number(ciType) === Number(lastTypeId)) {
|
||||
localStorage.setItem('ops_ci_typeid', '')
|
||||
}
|
||||
this.$message.success('取消订阅成功')
|
||||
this.$message.success(this.$t('cmdb.preference.cancelSubSuccess'))
|
||||
this.resetRoute()
|
||||
this.$router.push('/cmdb/preference')
|
||||
})
|
||||
|
@ -929,7 +1002,7 @@ export default {
|
|||
})
|
||||
})
|
||||
} else {
|
||||
this.$message.error('权限不足!')
|
||||
this.$message.error(this.$t('noPermission'))
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<a-drawer
|
||||
title="批量添加关系"
|
||||
:title="$t('cmdb.ci.batchAddRelation')"
|
||||
width="50%"
|
||||
@close="() => { visible = false; $emit('refresh', true) }"
|
||||
:visible="visible"
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
>
|
||||
<a-tabs v-model="activeTabKey" @change="changeTab">
|
||||
<a-tab-pane key="tab_1">
|
||||
<span slot="tab"><a-icon type="book" />属性</span>
|
||||
<span slot="tab"><a-icon type="book" />{{ $t('cmdb.attribute') }}</span>
|
||||
<div :style="{ maxHeight: `${windowHeight - 44}px`, overflow: 'auto', padding: '24px' }" class="ci-detail-attr">
|
||||
<el-descriptions
|
||||
:title="group.name || '其他'"
|
||||
:title="group.name || $t('other')"
|
||||
:key="group.name"
|
||||
v-for="group in attributeGroups"
|
||||
border
|
||||
|
@ -36,13 +36,13 @@
|
|||
</div>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="tab_2">
|
||||
<span slot="tab"><a-icon type="branches" />关系</span>
|
||||
<span slot="tab"><a-icon type="branches" />{{ $t('cmdb.relation') }}</span>
|
||||
<div :style="{ padding: '24px' }">
|
||||
<CiDetailRelation ref="ciDetailRelation" :ciId="ciId" :typeId="typeId" :ci="ci" />
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="tab_3">
|
||||
<span slot="tab"><a-icon type="clock-circle" />操作历史</span>
|
||||
<span slot="tab"><a-icon type="clock-circle" />{{ $t('cmdb.ci.history') }}</span>
|
||||
<div :style="{ padding: '24px', height: 'calc(100vh - 44px)' }">
|
||||
<vxe-table
|
||||
ref="xTable"
|
||||
|
@ -54,22 +54,22 @@
|
|||
:scroll-y="{ enabled: false }"
|
||||
class="ops-stripe-table"
|
||||
>
|
||||
<vxe-table-column sortable field="created_at" title="时间"></vxe-table-column>
|
||||
<vxe-table-column sortable field="created_at" :title="$t('created_at')"></vxe-table-column>
|
||||
<vxe-table-column
|
||||
field="username"
|
||||
title="用户"
|
||||
:title="$t('user')"
|
||||
:filters="[]"
|
||||
:filter-method="filterUsernameMethod"
|
||||
></vxe-table-column>
|
||||
<vxe-table-column
|
||||
field="operate_type"
|
||||
:filters="[
|
||||
{ value: 0, label: '新增' },
|
||||
{ value: 1, label: '删除' },
|
||||
{ value: 3, label: '修改' },
|
||||
{ value: 0, label: $t('new') },
|
||||
{ value: 1, label: $t('delete') },
|
||||
{ value: 3, label: $t('update') },
|
||||
]"
|
||||
:filter-method="filterOperateMethod"
|
||||
title="操作"
|
||||
:title="$t('operation')"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ operateTypeMap[row.operate_type] }}
|
||||
|
@ -77,17 +77,17 @@
|
|||
</vxe-table-column>
|
||||
<vxe-table-column
|
||||
field="attr_alias"
|
||||
title="属性"
|
||||
:title="$t('cmdb.attribute')"
|
||||
:filters="[]"
|
||||
:filter-method="filterAttrMethod"
|
||||
></vxe-table-column>
|
||||
<vxe-table-column field="old" title="旧"></vxe-table-column>
|
||||
<vxe-table-column field="new" title="新"></vxe-table-column>
|
||||
<vxe-table-column field="old" :title="$t('cmdb.history.old')"></vxe-table-column>
|
||||
<vxe-table-column field="new" :title="$t('cmdb.history.new')"></vxe-table-column>
|
||||
</vxe-table>
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="tab_4">
|
||||
<span slot="tab"><ops-icon type="itsm_auto_trigger" />触发历史</span>
|
||||
<span slot="tab"><ops-icon type="itsm_auto_trigger" />{{ $t('cmdb.history.triggerHistory') }}</span>
|
||||
<div :style="{ padding: '24px', height: 'calc(100vh - 44px)' }">
|
||||
<TriggerTable :ci_id="ci._id" />
|
||||
</div>
|
||||
|
@ -125,13 +125,7 @@ export default {
|
|||
},
|
||||
},
|
||||
data() {
|
||||
const operateTypeMap = {
|
||||
0: '新增',
|
||||
1: '删除',
|
||||
2: '修改',
|
||||
}
|
||||
return {
|
||||
operateTypeMap,
|
||||
visible: false,
|
||||
ci: {},
|
||||
attributeGroups: [],
|
||||
|
@ -146,6 +140,14 @@ export default {
|
|||
windowHeight() {
|
||||
return this.$store.state.windowHeight
|
||||
},
|
||||
|
||||
operateTypeMap() {
|
||||
return {
|
||||
0: this.$t('new'),
|
||||
1: this.$t('delete'),
|
||||
2: this.$t('update'),
|
||||
}
|
||||
},
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
:headerStyle="{ borderBottom: 'none' }"
|
||||
>
|
||||
<div class="custom-drawer-bottom-action">
|
||||
<a-button @click="handleClose">取消</a-button>
|
||||
<a-button type="primary" @click="createInstance">提交</a-button>
|
||||
<a-button @click="handleClose">{{ $t('cancel') }}</a-button>
|
||||
<a-button type="primary" @click="createInstance">{{ $t('submit') }}</a-button>
|
||||
</div>
|
||||
<template v-if="action === 'create'">
|
||||
<template v-for="group in attributesByGroup">
|
||||
|
@ -24,7 +24,7 @@
|
|||
/>
|
||||
</template>
|
||||
<template v-if="parentsType && parentsType.length">
|
||||
<a-divider style="font-size:14px;margin:14px 0;font-weight:700;">模型关系</a-divider>
|
||||
<a-divider style="font-size:14px;margin:14px 0;font-weight:700;">{{ $t('cmdb.menu.citypeRelation') }}</a-divider>
|
||||
<a-form>
|
||||
<a-row :gutter="24" align="top" type="flex">
|
||||
<a-col :span="12" v-for="item in parentsType" :key="item.id">
|
||||
|
@ -40,7 +40,7 @@
|
|||
{{ attr.alias || attr.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-input placeholder="多个值使用,分割" v-model="parentsForm[item.name].value" style="width: 50%" />
|
||||
<a-input :placeholder="$t('cmdb.ci.tips1')" v-model="parentsForm[item.name].value" style="width: 50%" />
|
||||
</a-input-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
@ -50,11 +50,11 @@
|
|||
</template>
|
||||
<template v-if="action === 'update'">
|
||||
<a-form :form="form">
|
||||
<p>可根据需要修改字段,当值为<strong>空</strong>时,则该字段<strong>置空</strong></p>
|
||||
<p>{{ $t('cmdb.ci.tips2') }}</p>
|
||||
<a-row :gutter="24" v-for="list in batchUpdateLists" :key="list.name">
|
||||
<a-col :span="11">
|
||||
<a-form-item>
|
||||
<el-select showSearch size="small" filterable v-model="list.name" placeholder="请选择需要修改的字段">
|
||||
<el-select showSearch size="small" filterable v-model="list.name" :placeholder="$t('cmdb.ci.tips3')">
|
||||
<el-option
|
||||
v-for="attr in attributeList"
|
||||
:key="attr.name"
|
||||
|
@ -71,7 +71,7 @@
|
|||
<a-select
|
||||
:style="{ width: '100%' }"
|
||||
v-decorator="[list.name, { rules: [{ required: false }] }]"
|
||||
placeholder="请选择"
|
||||
:placeholder="$t('placeholder2')"
|
||||
v-if="getFieldType(list.name).split('%%')[0] === 'select'"
|
||||
:mode="getFieldType(list.name).split('%%')[1] === 'multiple' ? 'multiple' : 'default'"
|
||||
showSearch
|
||||
|
@ -119,7 +119,7 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-button type="primary" ghost icon="plus" @click="handleAdd">新增修改字段</a-button>
|
||||
<a-button type="primary" ghost icon="plus" @click="handleAdd">{{ $t('cmdb.ci.newUpdateField') }}</a-button>
|
||||
</a-form>
|
||||
</template>
|
||||
<JsonEditor ref="jsonEditor" @jsonEditorOk="jsonEditorOk" />
|
||||
|
@ -153,7 +153,6 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
valueTypeMap,
|
||||
action: '',
|
||||
form: this.$form.createForm(this),
|
||||
visible: false,
|
||||
|
@ -171,7 +170,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
title() {
|
||||
return this.action === 'create' ? '创建 ' : '批量修改 '
|
||||
return this.action === 'create' ? this.$t('create') + ' ' : this.$t('cmdb.ci.batchUpdate') + ' '
|
||||
},
|
||||
typeId() {
|
||||
if (this.typeIdFromRelation) {
|
||||
|
@ -179,6 +178,9 @@ export default {
|
|||
}
|
||||
return this.$router.currentRoute.meta.typeId
|
||||
},
|
||||
valueTypeMap() {
|
||||
return valueTypeMap()
|
||||
},
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
|
@ -210,7 +212,7 @@ export default {
|
|||
(attr) => !attrHasGroupIds.includes(attr.id) && !attr.is_computed
|
||||
)
|
||||
if (otherGroupAttr.length) {
|
||||
_attributesByGroup.push({ id: -1, name: '其他', attributes: otherGroupAttr })
|
||||
_attributesByGroup.push({ id: -1, name: this.$t('other'), attributes: otherGroupAttr })
|
||||
}
|
||||
this.attributesByGroup = _attributesByGroup
|
||||
})
|
||||
|
@ -283,7 +285,7 @@ export default {
|
|||
}
|
||||
})
|
||||
addCI(values).then((res) => {
|
||||
_this.$message.success('新增成功!')
|
||||
_this.$message.success(this.$t('addSuccess'))
|
||||
_this.visible = false
|
||||
_this.$emit('reload', { ci_id: res.ci_id })
|
||||
})
|
||||
|
@ -332,7 +334,7 @@ export default {
|
|||
} else if (_find.value_type === '0' || _find.value_type === '1') {
|
||||
return 'input_number'
|
||||
} else if (_find.value_type === '4' || _find.value_type === '3') {
|
||||
return valueTypeMap[_find.value_type]
|
||||
return this.valueTypeMap[_find.value_type]
|
||||
} else {
|
||||
return 'input'
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
visible = false
|
||||
}
|
||||
"
|
||||
title="属性说明"
|
||||
:title="$t('cmdb.ci.attributeDesc')"
|
||||
width="72%"
|
||||
:bodyStyle="{ height: '100vh' }"
|
||||
>
|
||||
|
@ -18,7 +18,7 @@
|
|||
:style="{ display: 'inline-block', width: '244px' }"
|
||||
class="ops-input ops-input-radius"
|
||||
type="search"
|
||||
placeholder="搜索 名称 | 别名"
|
||||
:placeholder="$t('cmdb.ci.tips5')"
|
||||
@keyup="searchAttributes"
|
||||
>
|
||||
<a-icon type="search" slot="suffix" />
|
||||
|
@ -56,8 +56,8 @@
|
|||
: index === 2
|
||||
? valueTypeFilters
|
||||
: [
|
||||
{ label: '是', value: true },
|
||||
{ label: '否', value: false },
|
||||
{ label: $t('yes'), value: true },
|
||||
{ label: $t('no'), value: false },
|
||||
]
|
||||
"
|
||||
type="html"
|
||||
|
@ -82,78 +82,11 @@ import { valueTypeMap } from '@/modules/cmdb/utils/const'
|
|||
export default {
|
||||
name: 'MetadataDrawer',
|
||||
data() {
|
||||
const columns = [
|
||||
{
|
||||
field: 'name',
|
||||
title: '名称',
|
||||
width: 150,
|
||||
align: 'left',
|
||||
help: null,
|
||||
},
|
||||
{
|
||||
field: 'alias',
|
||||
title: '别名',
|
||||
width: 150,
|
||||
align: 'left',
|
||||
help: null,
|
||||
},
|
||||
{
|
||||
field: 'value_type',
|
||||
title: '类型',
|
||||
width: 100,
|
||||
align: 'left',
|
||||
help: null,
|
||||
},
|
||||
{
|
||||
field: 'is_index',
|
||||
title: '是否索引',
|
||||
width: 110,
|
||||
help: '加快检索, 可以全文搜索, 无需使用条件过滤\n\n json目前不支持建索引 \n\n文本字符长度超过190不能建索引',
|
||||
},
|
||||
{
|
||||
field: 'default_show',
|
||||
title: '默认显示',
|
||||
width: 110,
|
||||
help: '订阅CI,默认显示在table里的属性',
|
||||
},
|
||||
{
|
||||
field: 'is_unique',
|
||||
title: '是否唯一',
|
||||
width: 110,
|
||||
help: null,
|
||||
},
|
||||
{
|
||||
field: 'is_choice',
|
||||
title: '是否选择',
|
||||
width: 110,
|
||||
help: '表现形式是下拉框, 值必须在预定义值里',
|
||||
},
|
||||
{
|
||||
field: 'is_list',
|
||||
title: '是否列表',
|
||||
width: 110,
|
||||
help: '多值, 比如内网IP',
|
||||
},
|
||||
{
|
||||
field: 'is_sortable',
|
||||
title: '可排序',
|
||||
width: 100,
|
||||
help: '仅针对前端',
|
||||
},
|
||||
{
|
||||
field: 'is_computed',
|
||||
title: '计算属性',
|
||||
width: 110,
|
||||
help: '模型的其他属性通过表达式的方式计算出来\n\n一个代码片段计算返回的值',
|
||||
},
|
||||
]
|
||||
return {
|
||||
columns,
|
||||
visible: false,
|
||||
list: [],
|
||||
tableData: [],
|
||||
loading: false,
|
||||
valueTypeMap,
|
||||
valueTypeFilters: [],
|
||||
searchKey: '',
|
||||
}
|
||||
|
@ -162,6 +95,76 @@ export default {
|
|||
windowHeight() {
|
||||
return this.$store.state.windowHeight
|
||||
},
|
||||
valueTypeMap() {
|
||||
return valueTypeMap()
|
||||
},
|
||||
columns() {
|
||||
return [
|
||||
{
|
||||
field: 'name',
|
||||
title: this.$t('name'),
|
||||
width: 150,
|
||||
align: 'left',
|
||||
help: null,
|
||||
},
|
||||
{
|
||||
field: 'alias',
|
||||
title: this.$t('alias'),
|
||||
width: 150,
|
||||
align: 'left',
|
||||
help: null,
|
||||
},
|
||||
{
|
||||
field: 'value_type',
|
||||
title: this.$t('type'),
|
||||
width: 100,
|
||||
align: 'left',
|
||||
help: null,
|
||||
},
|
||||
{
|
||||
field: 'is_index',
|
||||
title: this.$t('cmdb.ciType.isIndex'),
|
||||
width: 110,
|
||||
help: this.$t('cmdb.ci.tips6'),
|
||||
},
|
||||
{
|
||||
field: 'default_show',
|
||||
title: this.$t('cmdb.ciType.defaultShow'),
|
||||
width: 110,
|
||||
help: this.$t('cmdb.ciType.defaultShowTips'),
|
||||
},
|
||||
{
|
||||
field: 'is_unique',
|
||||
title: this.$t('cmdb.ciType.isUnique'),
|
||||
width: 110,
|
||||
help: null,
|
||||
},
|
||||
{
|
||||
field: 'is_choice',
|
||||
title: this.$t('cmdb.ciType.isChoice'),
|
||||
width: 110,
|
||||
help: this.$t('cmdb.ci.tips7'),
|
||||
},
|
||||
{
|
||||
field: 'is_list',
|
||||
title: this.$t('cmdb.ciType.list'),
|
||||
width: 110,
|
||||
help: this.$t('cmdb.ci.tips8'),
|
||||
},
|
||||
{
|
||||
field: 'is_sortable',
|
||||
title: this.$t('cmdb.ciType.isSortable'),
|
||||
width: 100,
|
||||
help: this.$t('cmdb.ci.tips9'),
|
||||
},
|
||||
{
|
||||
field: 'is_computed',
|
||||
title: this.$t('cmdb.ciType.computedAttribute'),
|
||||
width: 110,
|
||||
help: this.$t('cmdb.ci.tips10'),
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
created: function() {
|
||||
this.valueTypeFilters = Object.keys(this.valueTypeMap).map((key) => {
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
rules: [{ required: attr.is_required }],
|
||||
},
|
||||
]"
|
||||
placeholder="请选择"
|
||||
:placeholder="$t('placeholder2')"
|
||||
v-if="attr.is_choice"
|
||||
:mode="attr.is_list ? 'multiple' : 'default'"
|
||||
showSearch
|
||||
|
@ -113,7 +113,7 @@
|
|||
rules: [{ required: attr.is_required }],
|
||||
},
|
||||
]"
|
||||
placeholder="请选择"
|
||||
:placeholder="$t('placeholder2')"
|
||||
v-else-if="attr.is_list"
|
||||
mode="tags"
|
||||
showSearch
|
||||
|
@ -263,7 +263,7 @@ export default {
|
|||
if (!_.isEqual(this.ci[this.attr.name], newData)) {
|
||||
await updateCI(this.ci._id, { [`${this.attr.name}`]: newData })
|
||||
.then(() => {
|
||||
this.$message.success('更新成功!')
|
||||
this.$message.success(this.$t('updateSuccess'))
|
||||
this.$emit('updateCIByself', { [`${this.attr.name}`]: newData }, this.attr.name)
|
||||
})
|
||||
.catch(() => {
|
||||
|
@ -286,7 +286,7 @@ export default {
|
|||
if (!_.isEqual(this.ci[this.attr.name], jsonData)) {
|
||||
updateCI(this.ci._id, { [`${this.attr.name}`]: jsonData })
|
||||
.then(() => {
|
||||
this.$message.success('更新成功!')
|
||||
this.$message.success(this.$t('updateSuccess'))
|
||||
this.$emit('updateCIByself', { [`${this.attr.name}`]: jsonData }, this.attr.name)
|
||||
})
|
||||
.catch(() => {
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
<div class="ci-detail-relation">
|
||||
<a-radio-group v-model="activeKey" size="small" @change="handleChangeActiveKey">
|
||||
<a-radio-button value="1">
|
||||
拓扑
|
||||
{{ $t('cmdb.ci.topo') }}
|
||||
</a-radio-button>
|
||||
<a-radio-button value="2">
|
||||
表格
|
||||
{{ $t('cmdb.ci.table') }}
|
||||
</a-radio-button>
|
||||
</a-radio-group>
|
||||
<CiDetailRelationTopo ref="ciDetailRelationTopo" v-if="activeKey === '1'" />
|
||||
|
@ -24,7 +24,7 @@
|
|||
><a-icon
|
||||
type="plus-square"
|
||||
/></a>
|
||||
<span v-if="!canEdit[parent.id]">(当前模型关系为多对多,请前往关系视图进行增删操作)</span>
|
||||
<span v-if="!canEdit[parent.id]">({{ $t('cmdb.ci.m2mTips') }})</span>
|
||||
</div>
|
||||
<vxe-grid
|
||||
v-if="firstCIs[parent.name]"
|
||||
|
@ -39,7 +39,7 @@
|
|||
class="ops-stripe-table"
|
||||
>
|
||||
<template #operation_default="{ row }">
|
||||
<a-popconfirm arrowPointAtCenter title="确认删除关系?" @confirm="deleteRelation(row._id, ciId)">
|
||||
<a-popconfirm arrowPointAtCenter :title="$t('cmdb.ci.confirmDeleteRelation')" @confirm="deleteRelation(row._id, ciId)">
|
||||
<a
|
||||
:disabled="!canEdit[parent.id]"
|
||||
:style="{
|
||||
|
@ -68,7 +68,7 @@
|
|||
><a-icon
|
||||
type="plus-square"
|
||||
/></a>
|
||||
<span v-if="!canEdit[child.id]">(当前模型关系为多对多,请前往关系视图进行增删操作)</span>
|
||||
<span v-if="!canEdit[child.id]">({{ $t('cmdb.ci.m2mTips') }})</span>
|
||||
</div>
|
||||
<vxe-grid
|
||||
v-if="secondCIs[child.name]"
|
||||
|
@ -82,7 +82,7 @@
|
|||
class="ops-stripe-table"
|
||||
>
|
||||
<template #operation_default="{ row }">
|
||||
<a-popconfirm arrowPointAtCenter title="确认删除关系?" @confirm="deleteRelation(ciId, row._id)">
|
||||
<a-popconfirm arrowPointAtCenter :title="$t('cmdb.ci.confirmDeleteRelation')" @confirm="deleteRelation(ciId, row._id)">
|
||||
<a
|
||||
:disabled="!canEdit[child.id]"
|
||||
:style="{
|
||||
|
@ -338,7 +338,7 @@ export default {
|
|||
firstCIColumns[item.id].push({
|
||||
key: 'p_operation',
|
||||
field: 'operation',
|
||||
title: '操作',
|
||||
title: this.$t('operation'),
|
||||
width: '60px',
|
||||
fixed: 'right',
|
||||
slots: {
|
||||
|
@ -379,7 +379,7 @@ export default {
|
|||
secondCIColumns[item.id].push({
|
||||
key: 'c_operation',
|
||||
field: 'operation',
|
||||
title: '操作',
|
||||
title: this.$t('operation'),
|
||||
width: '60px',
|
||||
fixed: 'right',
|
||||
slots: {
|
||||
|
|
|
@ -91,7 +91,7 @@ export default {
|
|||
const newNodes = []
|
||||
const newEdges = []
|
||||
if (!res.result.length) {
|
||||
this.$message.info('无层级关系!')
|
||||
this.$message.info(this.$t('cmdb.ci.noLevel'))
|
||||
return
|
||||
}
|
||||
const ci_types_list = this.ci_types()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* eslint-disable no-useless-constructor */
|
||||
import { TreeNode } from 'butterfly-dag'
|
||||
import i18n from '@/lang'
|
||||
|
||||
import $ from 'jquery'
|
||||
|
||||
|
@ -31,7 +32,7 @@ class BaseNode extends TreeNode {
|
|||
container.append(uniqueDom)
|
||||
|
||||
if (opts.options.side && (!opts.options.children.length && !(opts.options.edges && opts.options.edges.length && opts.options.edges.find(e => e.source === opts.options.side && e.sourceNode === opts.options.id)))) {
|
||||
const addIcon = $(`<i aria-label="图标: plus-square" class="anticon anticon-plus-square add-icon-${opts.options.side}"><svg viewBox="64 64 896 896" data-icon="plus-square" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class=""><path d="M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"></path><path d="M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"></path></svg></i>`)
|
||||
const addIcon = $(`<i aria-label="${i18n.t('icon')}: plus-square" class="anticon anticon-plus-square add-icon-${opts.options.side}"><svg viewBox="64 64 896 896" data-icon="plus-square" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class=""><path d="M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"></path><path d="M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"></path></svg></i>`)
|
||||
container.append(addIcon)
|
||||
addIcon.on('click', () => {
|
||||
if (opts.options.side === 'left') {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<a-form :form="form">
|
||||
<a-divider style="font-size: 14px; margin: 14px 0; font-weight: 700">{{ group.name || '其他' }}</a-divider>
|
||||
<a-divider style="font-size:14px;margin:14px 0;font-weight:700;">{{ group.name || $t('other') }}</a-divider>
|
||||
<a-row :gutter="24" align="top" type="flex">
|
||||
<a-col
|
||||
:span="12"
|
||||
|
@ -21,11 +21,11 @@
|
|||
v-decorator="[
|
||||
attr.name,
|
||||
{
|
||||
rules: [{ required: attr.is_required, message: `请选择${attr.alias || attr.name}` }],
|
||||
rules: [{ required: attr.is_required, message: $t('placeholder2') + `${attr.alias || attr.name}` }],
|
||||
initialValue: attr.default && attr.default.default ? attr.default.default : attr.is_list ? [] : null,
|
||||
},
|
||||
]"
|
||||
placeholder="请选择"
|
||||
:placeholder="$t('placeholder2')"
|
||||
v-if="attr.is_choice"
|
||||
:mode="attr.is_list ? 'multiple' : 'default'"
|
||||
showSearch
|
||||
|
@ -60,7 +60,7 @@
|
|||
v-decorator="[
|
||||
attr.name,
|
||||
{
|
||||
rules: [{ required: attr.is_required, message: `请选择${attr.alias || attr.name}` }],
|
||||
rules: [{ required: attr.is_required, message: $t('placeholder2') + `${attr.alias || attr.name}` }],
|
||||
initialValue: attr.default && attr.default.default ? attr.default.default : attr.is_list ? [] : null,
|
||||
},
|
||||
]"
|
||||
|
@ -70,7 +70,7 @@
|
|||
v-decorator="[
|
||||
attr.name,
|
||||
{
|
||||
rules: [{ required: attr.is_required, message: `请输入${attr.alias || attr.name}` }],
|
||||
rules: [{ required: attr.is_required, message: $t('placeholder1') + `${attr.alias || attr.name}` }],
|
||||
initialValue: attr.default && attr.default.default ? attr.default.default : null,
|
||||
},
|
||||
]"
|
||||
|
@ -81,7 +81,7 @@
|
|||
v-decorator="[
|
||||
attr.name,
|
||||
{
|
||||
rules: [{ required: attr.is_required, message: `请选择${attr.alias || attr.name}` }],
|
||||
rules: [{ required: attr.is_required, message: $t('placeholder2') + `${attr.alias || attr.name}` }],
|
||||
initialValue: attr.default && attr.default.default ? moment(attr.default.default) : null,
|
||||
},
|
||||
]"
|
||||
|
@ -96,7 +96,7 @@
|
|||
attr.name,
|
||||
{
|
||||
validateTrigger: ['submit'],
|
||||
rules: [{ required: attr.is_required, message: `请输入${attr.alias || attr.name}` }],
|
||||
rules: [{ required: attr.is_required, message: $t('placeholder1') + `${attr.alias || attr.name}` }],
|
||||
initialValue: attr.default && attr.default.default ? JSON.stringify(attr.default.default) : '',
|
||||
},
|
||||
]"
|
||||
|
@ -109,7 +109,7 @@
|
|||
attr.name,
|
||||
{
|
||||
validateTrigger: ['submit'],
|
||||
rules: [{ required: attr.is_required, message: `请输入${attr.alias || attr.name}` }],
|
||||
rules: [{ required: attr.is_required, message: $t('placeholder1') + `${attr.alias || attr.name}` }],
|
||||
initialValue: attr.default && attr.default.default ? attr.default.default : null,
|
||||
},
|
||||
]"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
visible = false
|
||||
}
|
||||
"
|
||||
title="字段设置"
|
||||
:title="$t('cmdb.ci.attributeSettings')"
|
||||
>
|
||||
<CustomTransfer
|
||||
ref="customTransfer"
|
||||
|
@ -17,16 +17,16 @@
|
|||
width: '230px',
|
||||
height: '500px',
|
||||
}"
|
||||
:titles="['未选属性', '已选属性']"
|
||||
:titles="[$t('cmdb.components.unselectAttributes'), $t('cmdb.components.selectAttributes')]"
|
||||
:render="item => item.title"
|
||||
:targetKeys="selectedAttrList"
|
||||
@change="handleChange"
|
||||
@selectChange="selectChange"
|
||||
>
|
||||
<span slot="notFoundContent">没数据</span>
|
||||
<span slot="notFoundContent">{{ $t('noData') }}</span>
|
||||
</CustomTransfer>
|
||||
<div class="custom-drawer-bottom-action">
|
||||
<a-button @click="handleSubmit" type="primary">确定</a-button>
|
||||
<a-button @click="handleSubmit" type="primary">{{ $t('confirm') }}</a-button>
|
||||
</div>
|
||||
</CustomDrawer>
|
||||
</template>
|
||||
|
@ -79,16 +79,17 @@ export default {
|
|||
this.selectedAttrList = targetKeys
|
||||
},
|
||||
handleSubmit() {
|
||||
const that = this
|
||||
if (this.selectedAttrList.length) {
|
||||
subscribeCIType(this.typeId, this.selectedAttrList).then(res => {
|
||||
this.$message.success('订阅成功!')
|
||||
this.$message.success(this.$t('cmdb.components.subSuccess'))
|
||||
this.visible = false
|
||||
this.$emit('refresh')
|
||||
})
|
||||
} else {
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: '必须至少选择一个字段',
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('cmdb.ci.tips4'),
|
||||
})
|
||||
}
|
||||
},
|
||||
|
|
|
@ -75,12 +75,12 @@ export default {
|
|||
return [item, !!this.fixedList.includes(item)]
|
||||
})
|
||||
).then((res) => {
|
||||
this.$message.success('订阅成功!')
|
||||
this.$message.success(this.$t('cmdb.components.subSuccess'))
|
||||
this.visible = false
|
||||
this.$emit('refresh')
|
||||
})
|
||||
} else {
|
||||
this.$message.error('请至少选择一个字段!')
|
||||
this.$message.error(this.$t('cmdb.ci.tips4'))
|
||||
}
|
||||
},
|
||||
setTargetKeys(targetKeys) {
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
<Discovery :isSelected="true" :style="{ maxHeight: '75vh', overflow: 'auto' }" />
|
||||
<template #footer>
|
||||
<a-space>
|
||||
<a-button @click="handleCancel">取消</a-button>
|
||||
<a-button type="primary" @click="handleOK">确认</a-button>
|
||||
<a-button type="primary" @click="addPlugin">新建plugin</a-button>
|
||||
<a-button @click="handleCancel">{{ $t('cancel') }}</a-button>
|
||||
<a-button type="primary" @click="handleOK">{{ $t('confirm') }}</a-button>
|
||||
<a-button type="primary" @click="addPlugin">{{ $t('cmdb.ciType.addPlugin') }}</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-modal>
|
||||
|
@ -55,7 +55,7 @@ export default {
|
|||
await Promise.all(promises)
|
||||
.then((res) => {
|
||||
this.getCITypeDiscovery(res[0].id)
|
||||
this.$message.success('添加成功')
|
||||
this.$message.success(this.$t('addSuccess'))
|
||||
})
|
||||
.catch(() => {
|
||||
this.getCITypeDiscovery()
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
slot="tabBarExtraContent"
|
||||
:style="{ cursor: 'pointer' }"
|
||||
>
|
||||
<ops-icon type="icon-xianxing-tianjia" :style="{ color: '#2F54EB' }" /><a>添加</a>
|
||||
<ops-icon type="icon-xianxing-tianjia" :style="{ color: '#2F54EB' }" /><a>{{ $t('add') }}</a>
|
||||
</a-space>
|
||||
</a-tabs>
|
||||
</div>
|
||||
|
@ -40,7 +40,7 @@
|
|||
}"
|
||||
>
|
||||
<img slot="image" :src="require('@/assets/data_empty.png')" />
|
||||
<span slot="description"> 暂无数据 </span>
|
||||
<span slot="description"> {{ $t('noData') }} </span>
|
||||
<a-button
|
||||
@click="
|
||||
() => {
|
||||
|
@ -52,7 +52,7 @@
|
|||
icon="plus"
|
||||
class="ops-button-primary"
|
||||
>
|
||||
添加
|
||||
{{ $t('add') }}
|
||||
</a-button>
|
||||
</a-empty>
|
||||
<ADModal ref="adModal" :CITypeId="CITypeId" @addPlugin="openEditDrawer(null, 'add', 'agent')" />
|
||||
|
@ -158,10 +158,10 @@ export default {
|
|||
e.stopPropagation()
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: `确认删除 【${item?.extra_option?.alias || this.getADCITypeParam(item.adr_id)}】`,
|
||||
title: that.$t('cmdb.ciType.confirmDeleteADT', { pluginName: `${item?.extra_option?.alias || this.getADCITypeParam(item.adr_id)}` }),
|
||||
content: (h) => (
|
||||
<div>
|
||||
<a-checkbox v-model={that.deletePlugin}>删除插件</a-checkbox>
|
||||
<a-checkbox v-model={that.deletePlugin}>{that.$t('cmdb.ciType.deletePlugin')}</a-checkbox>
|
||||
</div>
|
||||
),
|
||||
onOk() {
|
||||
|
@ -169,7 +169,7 @@ export default {
|
|||
if (that.currentTab === item.id) {
|
||||
that.currentTab = ''
|
||||
}
|
||||
that.$message.success('删除成功!')
|
||||
that.$message.success(that.$t('deleteSuccess'))
|
||||
that.getCITypeDiscovery()
|
||||
if (that.deletePlugin) {
|
||||
await deleteDiscovery(item.adr_id).finally(() => {
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
>
|
||||
<a-space>
|
||||
<ops-icon type="icon-xianxing-edit" />
|
||||
<span>编辑</span>
|
||||
<span>{{ $t('edit') }}</span>
|
||||
</a-space>
|
||||
</a>
|
||||
<div>别名:<a-input v-model="alias" style="width:200px;" /></div>
|
||||
<div class="attr-ad-header">字段映射</div>
|
||||
<div>{{ $t('alias') }}:<a-input v-model="alias" style="width:200px;" /></div>
|
||||
<div class="attr-ad-header">{{ $t('cmdb.ciType.attributeMap') }}</div>
|
||||
<vxe-table
|
||||
v-if="adrType === 'agent'"
|
||||
ref="xTable"
|
||||
|
@ -26,13 +26,13 @@
|
|||
:data="tableData"
|
||||
:style="{ width: '700px', marginBottom: '20px' }"
|
||||
>
|
||||
<vxe-colgroup title="自动发现">
|
||||
<vxe-column field="name" title="名称"> </vxe-column>
|
||||
<vxe-column field="type" title="类型"> </vxe-column>
|
||||
<vxe-column field="desc" title="描述"> </vxe-column>
|
||||
<vxe-colgroup :title="$t('cmdb.ciType.autoDiscovery')">
|
||||
<vxe-column field="name" :title="$t('name')"> </vxe-column>
|
||||
<vxe-column field="type" :title="$t('type')"> </vxe-column>
|
||||
<vxe-column field="desc" :title="$t('desc')"> </vxe-column>
|
||||
</vxe-colgroup>
|
||||
<vxe-colgroup title="模型属性">
|
||||
<vxe-column field="attr" title="名称" :edit-render="{}">
|
||||
<vxe-colgroup :title="$t('cmdb.ciType.attributes')">
|
||||
<vxe-column field="attr" :title="$t('name')" :edit-render="{}">
|
||||
<template #default="{row}">
|
||||
{{ row.attr }}
|
||||
</template>
|
||||
|
@ -76,18 +76,18 @@
|
|||
</a-form-model>
|
||||
<a-form :form="form3" v-if="adrType === 'snmp'" class="attr-ad-snmp-form">
|
||||
<a-col :span="24">
|
||||
<a-form-item label="节点" :labelCol="{ span: 2 }" :wrapperCol="{ span: 20 }">
|
||||
<a-form-item :label="$t('cmdb.ciType.node')" :labelCol="{ span: 2 }" :wrapperCol="{ span: 20 }">
|
||||
<MonitorNodeSetting ref="monitorNodeSetting" :initNodes="nodes" :form="form3" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-form>
|
||||
<div class="attr-ad-header">执行配置</div>
|
||||
<div class="attr-ad-header">{{ $t('cmdb.ciType.adExecConfig') }}</div>
|
||||
<a-form-model :model="form" :labelCol="{ span: 2 }" :wrapperCol="{ span: 20 }">
|
||||
<a-form-model-item label="执行机器">
|
||||
<a-form-model-item :label="$t('cmdb.ciType.adExecTarget')">
|
||||
<CustomRadio v-model="agent_type" :radioList="agentTypeRadioList">
|
||||
<a-input
|
||||
:style="{ width: '300px' }"
|
||||
placeholder="请输入以0x开头的16进制OneAgent ID"
|
||||
:placeholder="$t('cmdb.ciType.oneagentIdTips')"
|
||||
v-show="agent_type === 'agent_id'"
|
||||
slot="extra_agent_id"
|
||||
v-model="form.agent_id"
|
||||
|
@ -96,26 +96,26 @@
|
|||
:style="{ width: '300px' }"
|
||||
v-show="agent_type === 'query_expr'"
|
||||
slot="extra_query_expr"
|
||||
placeholder="从CMDB选择"
|
||||
:placeholder="$t('cmdb.ciType.selectFromCMDBTips')"
|
||||
v-model="form.query_expr"
|
||||
>
|
||||
<a @click="handleOpenCmdb" slot="suffix"><a-icon type="menu"/></a>
|
||||
</a-input>
|
||||
</CustomRadio>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="自动入库">
|
||||
<a-form-model-item :label="$t('cmdb.ciType.adAutoInLib')">
|
||||
<a-switch v-model="form.auto_accept" />
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
<div class="attr-ad-header">采集频率</div>
|
||||
<div class="attr-ad-header">{{ $t('cmdb.ciType.adInterval') }}</div>
|
||||
<CustomRadio :radioList="radioList" v-model="interval">
|
||||
<span v-show="interval === 'interval'" slot="extra_interval">
|
||||
<a-input-number v-model="intervalValue" :min="1" /> 秒
|
||||
<a-input-number v-model="intervalValue" :min="1" /> {{ $t('seconds') }}
|
||||
</span>
|
||||
</CustomRadio>
|
||||
|
||||
<div class="attr-ad-footer">
|
||||
<a-button type="primary" @click="handleSave">保存</a-button>
|
||||
<a-button type="primary" @click="handleSave">{{ $t('save') }}</a-button>
|
||||
</div>
|
||||
<CMDBExprDrawer ref="cmdbDrawer" @copySuccess="copySuccess" />
|
||||
</div>
|
||||
|
@ -160,11 +160,7 @@ export default {
|
|||
},
|
||||
},
|
||||
data() {
|
||||
const radioList = [
|
||||
{ value: 'interval', label: '按间隔' },
|
||||
]
|
||||
return {
|
||||
radioList,
|
||||
tableData: [],
|
||||
form: {
|
||||
agent_id: '',
|
||||
|
@ -209,14 +205,20 @@ export default {
|
|||
const { permissions = [] } = this.userRoles
|
||||
if ((permissions.includes('cmdb_admin') || permissions.includes('admin')) && this.adrType !== 'http') {
|
||||
return [
|
||||
{ value: 'all', label: '所有节点' },
|
||||
{ value: 'agent_id', label: '指定节点' },
|
||||
{ value: 'query_expr', label: '从CMDB中选择 ' },
|
||||
{ value: 'all', label: this.$t('cmdb.ciType.allNodes') },
|
||||
{ value: 'agent_id', label: this.$t('cmdb.ciType.specifyNodes') },
|
||||
{ value: 'query_expr', label: this.$t('cmdb.ciType.selectFromCMDBTips') },
|
||||
]
|
||||
}
|
||||
return [
|
||||
{ value: 'agent_id', label: '指定节点' },
|
||||
{ value: 'query_expr', label: '从CMDB中选择 ' },
|
||||
{ value: 'agent_id', label: this.$t('cmdb.ciType.specifyNodes') },
|
||||
{ value: 'query_expr', label: this.$t('cmdb.ciType.selectFromCMDBTips') },
|
||||
]
|
||||
},
|
||||
radioList() {
|
||||
return [
|
||||
{ value: 'interval', label: this.$t('cmdb.ciType.byInterval') },
|
||||
// { value: 'cron', label: '按cron', layout: 'vertical' },
|
||||
]
|
||||
},
|
||||
},
|
||||
|
@ -352,14 +354,14 @@ export default {
|
|||
if (this.agent_type === 'agent_id' || this.agent_type === 'all') {
|
||||
params.query_expr = ''
|
||||
if (this.agent_type === 'agent_id' && !params.agent_id) {
|
||||
this.$message.error('请填写指定节点!')
|
||||
this.$message.error(this.$t('cmdb.ciType.specifyNodesTips'))
|
||||
return
|
||||
}
|
||||
}
|
||||
if (this.agent_type === 'query_expr' || this.agent_type === 'all') {
|
||||
params.agent_id = ''
|
||||
if (this.agent_type === 'query_expr' && !params.query_expr) {
|
||||
this.$message.error('请从cmdb中选择!')
|
||||
this.$message.error(this.$t('cmdb.ciType.selectFromCMDBTips'))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -370,7 +372,7 @@ export default {
|
|||
params.extra_option.alias = alias
|
||||
}
|
||||
putCITypeDiscovery(currentAdt.id, params).then((res) => {
|
||||
this.$message.success('保存成功')
|
||||
this.$message.success(this.$t('saveSuccess'))
|
||||
this.$emit('handleSave')
|
||||
})
|
||||
},
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
<div :class="{ 'attribute-card-name': true, 'attribute-card-name-default-show': property.default_show }">
|
||||
{{ property.alias || property.name }}
|
||||
</div>
|
||||
<div v-if="property.is_password" class="attribute-card_value-type">密码</div>
|
||||
<div v-else-if="property.is_link" class="attribute-card_value-type">链接</div>
|
||||
<div v-if="property.is_password" class="attribute-card_value-type">{{ $t('cmdb.ciType.password') }}</div>
|
||||
<div v-else-if="property.is_link" class="attribute-card_value-type">{{ $t('cmdb.ciType.link') }}</div>
|
||||
<div v-else class="attribute-card_value-type">{{ valueTypeMap[property.value_type] }}</div>
|
||||
</div>
|
||||
<div
|
||||
|
@ -53,7 +53,7 @@
|
|||
|
||||
<a-space class="attribute-card-operation">
|
||||
<a v-if="!isStore"><a-icon type="edit" @click="handleEdit"/></a>
|
||||
<a-tooltip title="所有CI触发计算">
|
||||
<a-tooltip :title="$t('cmdb.ciType.computeForAllCITips')">
|
||||
<a v-if="!isStore && property.is_computed"><a-icon type="redo" @click="handleCalcComputed"/></a>
|
||||
</a-tooltip>
|
||||
<a style="color:red;"><a-icon type="delete" @click="handleDelete"/></a>
|
||||
|
@ -106,36 +106,40 @@ export default {
|
|||
},
|
||||
attributes: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
const propertyList = [
|
||||
{
|
||||
label: '是否唯一',
|
||||
property: 'is_unique',
|
||||
},
|
||||
{
|
||||
label: '是否选择',
|
||||
property: 'is_choice',
|
||||
},
|
||||
{
|
||||
label: '默认显示',
|
||||
property: 'default_show',
|
||||
},
|
||||
{
|
||||
label: '可排序',
|
||||
property: 'is_sortable',
|
||||
},
|
||||
{
|
||||
label: '是否索引',
|
||||
property: 'is_index',
|
||||
},
|
||||
]
|
||||
return {
|
||||
valueTypeMap,
|
||||
propertyList,
|
||||
}
|
||||
return {}
|
||||
},
|
||||
computed: {
|
||||
valueTypeMap() {
|
||||
return valueTypeMap()
|
||||
},
|
||||
propertyList() {
|
||||
return [
|
||||
{
|
||||
label: this.$t('cmdb.ciType.isUnique'),
|
||||
property: 'is_unique',
|
||||
},
|
||||
{
|
||||
label: this.$t('cmdb.ciType.isChoice'),
|
||||
property: 'is_choice',
|
||||
},
|
||||
{
|
||||
label: this.$t('cmdb.ciType.defaultShow'),
|
||||
property: 'default_show',
|
||||
},
|
||||
{
|
||||
label: this.$t('cmdb.ciType.isSortable'),
|
||||
property: 'is_sortable',
|
||||
},
|
||||
{
|
||||
label: this.$t('cmdb.ciType.isIndex'),
|
||||
property: 'is_index',
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getPropertyStyle,
|
||||
|
@ -145,17 +149,17 @@ export default {
|
|||
handleDelete() {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: `确认删除 【${that.property.alias || that.property.name}】?`,
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('cmdb.ciType.confirmDelete', { name: `${that.property.alias || that.property.name}` }),
|
||||
onOk() {
|
||||
if (that.isStore) {
|
||||
deleteAttributesById(that.property.id).then(() => {
|
||||
that.$message.success('删除成功!')
|
||||
that.$message.success(that.$t('deleteSuccess'))
|
||||
that.$emit('ok')
|
||||
})
|
||||
} else {
|
||||
deleteCITypeAttributesById(that.CITypeId, { attr_id: [that.property.id] }).then(() => {
|
||||
that.$message.success('删除成功!')
|
||||
that.$message.success(that.$t('deleteSuccess'))
|
||||
that.$emit('ok')
|
||||
})
|
||||
}
|
||||
|
@ -169,11 +173,11 @@ export default {
|
|||
handleCalcComputed() {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: `确认触发所有CI的计算?`,
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('cmdb.ciType.confirmcomputeForAllCITips'),
|
||||
onOk() {
|
||||
calcComputedAttribute(that.property.id).then(() => {
|
||||
that.$message.success('触发成功!')
|
||||
that.$message.success(that.$t('cmdb.ciType.computeSuccess'))
|
||||
})
|
||||
},
|
||||
})
|
||||
|
|
|
@ -11,20 +11,20 @@
|
|||
wrapClassName="attribute-edit-form"
|
||||
>
|
||||
<a-form :form="form" :layout="formLayout">
|
||||
<a-divider style="font-size:14px;margin-top:6px;">基础设置</a-divider>
|
||||
<a-divider style="font-size:14px;margin-top:6px;">{{ $t('cmdb.ciType.basicConfig') }}</a-divider>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="属性名(英文)">
|
||||
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" :label="$t('cmdb.ciType.AttributeName')">
|
||||
<a-input
|
||||
:disabled="true"
|
||||
name="name"
|
||||
placeholder="英文"
|
||||
:placeholder="$t('cmdb.ciType.English')"
|
||||
v-decorator="[
|
||||
'name',
|
||||
{
|
||||
rules: [
|
||||
{ required: true, message: '请输入属性名' },
|
||||
{ required: true, message: $t('cmdb.ciType.inputAttributeName') },
|
||||
{
|
||||
message: '不能以数字开头,可以是英文 数字以及下划线 (_)',
|
||||
message: $t('cmdb.ciType.attributeNameTips'),
|
||||
pattern: RegExp('^(?!\\d)[a-zA-Z_0-9]+$'),
|
||||
},
|
||||
],
|
||||
|
@ -35,12 +35,12 @@
|
|||
</a-col>
|
||||
<a-col
|
||||
:span="12"
|
||||
><a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="别名">
|
||||
><a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" :label="$t('alias')">
|
||||
<a-input name="alias" v-decorator="['alias', { rules: [] }]" /> </a-form-item
|
||||
></a-col>
|
||||
<a-col
|
||||
:span="12"
|
||||
><a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="数据类型">
|
||||
><a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" :label="$t('cmdb.ciType.DataType')">
|
||||
<a-select
|
||||
:disabled="true"
|
||||
name="value_type"
|
||||
|
@ -56,7 +56,7 @@
|
|||
<a-form-item
|
||||
:label-col="{ span: currentValueType === '6' ? 4 : 8 }"
|
||||
:wrapper-col="{ span: currentValueType === '6' ? 18 : 12 }"
|
||||
label="默认值"
|
||||
:label="$t('cmdb.ciType.defaultValue')"
|
||||
>
|
||||
<template>
|
||||
<a-select
|
||||
|
@ -73,7 +73,7 @@
|
|||
@select="selectIntDefaultValue"
|
||||
>
|
||||
<a-select-option key="$auto_inc_id">
|
||||
自增ID
|
||||
{{ $t('cmdb.ciType.autoIncID') }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-input-number
|
||||
|
@ -100,13 +100,13 @@
|
|||
@select="changeDefaultForDatetime"
|
||||
>
|
||||
<a-select-option key="$created_at">
|
||||
创建时间
|
||||
{{ $t('createdAt') }}
|
||||
</a-select-option>
|
||||
<a-select-option key="$updated_at">
|
||||
更新时间
|
||||
{{ $t('updatedAt') }}
|
||||
</a-select-option>
|
||||
<a-select-option key="$custom_time">
|
||||
自定义时间
|
||||
{{ $t('cmdb.ciType.customTime') }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<template v-else-if="currentValueType === '4' || currentValueType === '3'">
|
||||
|
@ -124,10 +124,10 @@
|
|||
<a><a-icon type="down" /> </a>
|
||||
<a-menu slot="overlay" @click="onClick">
|
||||
<a-menu-item key="$created_at">
|
||||
<a>创建时间</a>
|
||||
<a>{{ $t('createdAt') }}</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item key="$updated_at">
|
||||
<a>更新时间</a>
|
||||
<a>{{ $t('updatedAt') }}</a>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
|
@ -150,7 +150,7 @@
|
|||
<a-form-item
|
||||
:label-col="horizontalFormItemLayout.labelCol"
|
||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||
label="必须"
|
||||
:label="$t('required')"
|
||||
>
|
||||
<a-switch
|
||||
@change="(checked) => onChange(checked, 'is_required')"
|
||||
|
@ -160,7 +160,7 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6" v-if="currentValueType !== '6' && currentValueType !== '7'">
|
||||
<a-form-item :label-col="{ span: 8 }" :wrapper-col="horizontalFormItemLayout.wrapperCol" label="唯一">
|
||||
<a-form-item :label-col="{ span: 8 }" :wrapper-col="horizontalFormItemLayout.wrapperCol" :label="$t('cmdb.ciType.unique')">
|
||||
<a-switch
|
||||
:disabled="isShowComputedArea"
|
||||
@change="onChange"
|
||||
|
@ -178,8 +178,8 @@
|
|||
<template slot="label">
|
||||
<span
|
||||
style="position:relative;white-space:pre;"
|
||||
>{{ `索引` }}
|
||||
<a-tooltip title="字段可被用于检索,加速查询">
|
||||
>{{ $t('cmdb.ciType.index') }}
|
||||
<a-tooltip :title="$t('cmdb.ciType.indexTips')">
|
||||
<a-icon
|
||||
style="position:absolute;top:3px;left:-17px;color:#2f54eb;"
|
||||
type="question-circle"
|
||||
|
@ -210,8 +210,8 @@
|
|||
<template slot="label">
|
||||
<span
|
||||
style="position:relative;white-space:pre;"
|
||||
>{{ `显示` }}
|
||||
<a-tooltip title="CI实例表格默认展示该字段">
|
||||
>{{ $t('cmdb.ciType.defaultShow') }}
|
||||
<a-tooltip :title="$t('cmdb.ciType.defaultShowTips')">
|
||||
<a-icon
|
||||
style="position:absolute;top:3px;left:-17px;color:#2f54eb;"
|
||||
type="question-circle"
|
||||
|
@ -237,7 +237,7 @@
|
|||
<a-form-item
|
||||
:label-col="currentValueType === '2' ? horizontalFormItemLayout.labelCol : { span: 8 }"
|
||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||
label="排序"
|
||||
:label="$t('cmdb.ciType.isSortable')"
|
||||
>
|
||||
<a-switch
|
||||
:disabled="isShowComputedArea"
|
||||
|
@ -256,8 +256,8 @@
|
|||
<template slot="label">
|
||||
<span
|
||||
style="position:relative;white-space:pre;"
|
||||
>{{ `多值` }}
|
||||
<a-tooltip title="字段的值是1个或者多个,接口返回的值的类型是list">
|
||||
>{{ $t('cmdb.ciType.list') }}
|
||||
<a-tooltip :title="$t('cmdb.ciType.listTips')">
|
||||
<a-icon
|
||||
style="position:absolute;top:3px;left:-17px;color:#2f54eb;"
|
||||
type="question-circle"
|
||||
|
@ -280,15 +280,15 @@
|
|||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-divider style="font-size:14px;margin-top:6px;">高级设置</a-divider>
|
||||
<a-divider style="font-size:14px;margin-top:6px;">{{ $t('cmdb.ciType.advancedSettings') }}</a-divider>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }" label="字体">
|
||||
<a-form-item :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }" :label="$t('cmdb.ciType.font')">
|
||||
<FontArea ref="fontArea" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24" v-if="!['6', '7'].includes(currentValueType)">
|
||||
<a-form-item :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }" label="预定义值">
|
||||
<a-form-item :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }" :label="$t('cmdb.ciType.choiceValue')">
|
||||
<PreValueArea
|
||||
v-if="drawerVisible"
|
||||
:canDefineScript="canDefineScript"
|
||||
|
@ -302,10 +302,10 @@
|
|||
<template slot="label">
|
||||
<span
|
||||
style="position:relative;white-space:pre;"
|
||||
>{{ `计算属性` }}
|
||||
>{{ $t('cmdb.ciType.computedAttribute') }}
|
||||
<a-tooltip
|
||||
:title="
|
||||
`该属性的值是通过模型的其它属性构建的表达式或者执行一段代码的方式计算而来,属性的引用方法为: {{ 属性名 }}`
|
||||
$t('cmdb.ciType.computedAttributeTips')
|
||||
"
|
||||
>
|
||||
<a-icon
|
||||
|
@ -343,8 +343,8 @@
|
|||
<a-input name="id" type="hidden" v-decorator="['id', { rules: [] }]" />
|
||||
</a-form-item>
|
||||
<div class="custom-drawer-bottom-action">
|
||||
<a-button @click="onClose">取消</a-button>
|
||||
<a-button @click="handleSubmit(false)" type="primary">确定</a-button>
|
||||
<a-button @click="onClose">{{ $t('cancel') }}</a-button>
|
||||
<a-button @click="handleSubmit(false)" type="primary">{{ $t('confirm') }}</a-button>
|
||||
</div>
|
||||
</a-form>
|
||||
</CustomDrawer>
|
||||
|
@ -380,8 +380,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
valueTypeMap,
|
||||
drawerTitle: '新增属性',
|
||||
drawerTitle: this.$t('cmdb.ciType.addAttribute'),
|
||||
drawerVisible: false,
|
||||
|
||||
formLayout: 'horizontal',
|
||||
|
@ -390,7 +389,7 @@ export default {
|
|||
|
||||
currentValueType: '0',
|
||||
default_value_json: {},
|
||||
default_value_json_right: true, // 当前json是否正确
|
||||
default_value_json_right: true, // Is the current json correct?
|
||||
|
||||
canDefineComputed: false,
|
||||
isShowComputedArea: false,
|
||||
|
@ -404,6 +403,9 @@ export default {
|
|||
},
|
||||
|
||||
computed: {
|
||||
valueTypeMap() {
|
||||
return valueTypeMap()
|
||||
},
|
||||
formItemLayout() {
|
||||
const { formLayout } = this
|
||||
return formLayout === 'horizontal'
|
||||
|
@ -434,7 +436,7 @@ export default {
|
|||
this.canDefineComputed = false
|
||||
}
|
||||
|
||||
this.drawerTitle = '新增属性'
|
||||
this.drawerTitle = this.$t('cmdb.ciType.addAttribute')
|
||||
this.drawerVisible = true
|
||||
},
|
||||
onClose() {
|
||||
|
@ -463,13 +465,13 @@ export default {
|
|||
})
|
||||
}
|
||||
if (checked && property === 'is_sortable') {
|
||||
this.$message.warning('选中排序,则必须也要选中!')
|
||||
this.$message.warning(this.$t('cmdb.ciType.addAttributeTips1'))
|
||||
this.form.setFieldsValue({
|
||||
is_required: true,
|
||||
})
|
||||
}
|
||||
if (!checked && property === 'is_required' && this.form.getFieldValue('is_sortable')) {
|
||||
this.$message.warning('选中排序,则必须也要选中!')
|
||||
this.$message.warning(this.$t('cmdb.ciType.addAttributeTips1'))
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({
|
||||
is_required: true,
|
||||
|
@ -492,7 +494,7 @@ export default {
|
|||
if (_record.is_link) {
|
||||
_record.value_type = '8'
|
||||
}
|
||||
this.drawerTitle = '编辑属性'
|
||||
this.drawerTitle = this.$t('cmdb.ciType.editAttribute')
|
||||
this.drawerVisible = true
|
||||
this.record = _record
|
||||
this.currentValueType = _record.value_type
|
||||
|
@ -624,7 +626,7 @@ export default {
|
|||
const computedAreaData = this.$refs.computedArea.getData()
|
||||
values = { ...values, ...computedAreaData }
|
||||
} else {
|
||||
// 如果是非计算属性,就看看有没有预定义值
|
||||
// If it is a non-computed attribute, check to see if there is a predefined value
|
||||
if (!['6', '7'].includes(values.value_type)) {
|
||||
const preValueAreaData = this.$refs.preValueArea.getData()
|
||||
values = { ...values, ...preValueAreaData }
|
||||
|
@ -652,7 +654,7 @@ export default {
|
|||
if (isCalcComputed) {
|
||||
await calcComputedAttribute(attrId)
|
||||
}
|
||||
this.$message.success(`更新成功`)
|
||||
this.$message.success(this.$t('updateSuccess'))
|
||||
this.handleOk()
|
||||
this.onClose()
|
||||
},
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
<a-modal wrapClassName="attrbute-store-wrapper" width="80%" :visible="visible" @cancel="handleCancel">
|
||||
<template slot="title">
|
||||
<div class="attrbute-store-header">
|
||||
<span>属性库</span>
|
||||
<span>{{ $t('cmdb.ciType.attributeLibray') }}</span>
|
||||
<div class="attrbute-store-search">
|
||||
<a-input-group compact>
|
||||
<a-select class="attrbute-store-search-select" v-model="searchKey">
|
||||
<a-select-option value="alias">
|
||||
别名
|
||||
{{ $t('alias') }}
|
||||
</a-select-option>
|
||||
<a-select-option value="name">
|
||||
名称
|
||||
{{ $t('name') }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-input
|
||||
|
@ -53,7 +53,7 @@
|
|||
</a-row>
|
||||
<a-empty v-else>
|
||||
<img slot="image" :src="require('@/assets/data_empty.png')" />
|
||||
<span slot="description"> 暂无数据 </span>
|
||||
<span slot="description"> {{ $t('noData') }} </span>
|
||||
</a-empty>
|
||||
</a-spin>
|
||||
<template slot="footer">
|
||||
|
@ -63,7 +63,7 @@
|
|||
show-quick-jumper
|
||||
:current="tablePage.currentPage"
|
||||
:total="tablePage.totalResult"
|
||||
:show-total="(total, range) => `当前展示 ${range[0]}-${range[1]} 条数据, 共 ${total} 条`"
|
||||
:show-total="(total, range) => $t('pagination.total', { total: total, range0: range[0], range1: range[1] })"
|
||||
:page-size="tablePage.pageSize"
|
||||
:default-current="1"
|
||||
@change="pageOrSizeChange"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<div>
|
||||
<a-modal v-model="addGroupModal" title="新增分组" @cancel="handleCancelCreateGroup" @ok="handleCreateGroup">
|
||||
<a-modal v-model="addGroupModal" :title="$t('cmdb.ciType.addGroup')" @cancel="handleCancelCreateGroup" @ok="handleCreateGroup">
|
||||
<span>
|
||||
<a-form-item label="名称" :label-col="{ span: 6 }" :wrapper-col="{ span: 16 }">
|
||||
<a-form-item :label="$t('name')" :label-col="{ span: 6 }" :wrapper-col="{ span: 16 }">
|
||||
<a-input type="text" v-model.trim="newGroupName" />
|
||||
</a-form-item>
|
||||
</span>
|
||||
|
@ -15,14 +15,14 @@
|
|||
size="small"
|
||||
class="ops-button-primary"
|
||||
icon="plus"
|
||||
>分组</a-button
|
||||
>{{ $t('cmdb.ciType.group') }}</a-button
|
||||
>
|
||||
<a-button
|
||||
type="primary"
|
||||
@click="handleOpenUniqueConstraint"
|
||||
size="small"
|
||||
class="ops-button-primary"
|
||||
>唯一校验</a-button
|
||||
>{{ $t('cmdb.ciType.uniqueConstraint') }}</a-button
|
||||
>
|
||||
</a-space>
|
||||
<div :key="CITypeGroup.id" v-for="(CITypeGroup, index) in CITypeGroups">
|
||||
|
@ -45,18 +45,18 @@
|
|||
ref="editGroupInput"
|
||||
v-model.trim="CITypeGroup.name"
|
||||
/>
|
||||
<a @click="handleSaveGroupName(index, CITypeGroup)" style="margin-right: 0.5rem">保存</a>
|
||||
<a @click="handleCancelGroupName(index, CITypeGroup)">取消</a>
|
||||
<a @click="handleSaveGroupName(index, CITypeGroup)" style="margin-right: 0.5rem">{{ $t('save') }}</a>
|
||||
<a @click="handleCancelGroupName(index, CITypeGroup)">{{ $t('cancel') }}</a>
|
||||
</span>
|
||||
</template>
|
||||
<a-space style="float: right">
|
||||
<a-tooltip v-if="index">
|
||||
<template slot="title">上移</template>
|
||||
<template slot="title">{{ $t('cmdb.ciType.up') }}</template>
|
||||
<a><a-icon type="arrow-up" v-if="index" @click="handleMoveGroup(index, index - 1)"/></a>
|
||||
</a-tooltip>
|
||||
|
||||
<a-tooltip v-if="index !== CITypeGroups.length - 1">
|
||||
<template slot="title">下移</template>
|
||||
<template slot="title">{{ $t('cmdb.ciType.up') }}</template>
|
||||
<a
|
||||
><a-icon
|
||||
type="arrow-down"
|
||||
|
@ -66,11 +66,11 @@
|
|||
</a-tooltip>
|
||||
|
||||
<a-tooltip>
|
||||
<template slot="title">添加属性</template>
|
||||
<template slot="title">{{ $t('cmdb.ciType.selectAttribute') }}</template>
|
||||
<a><a-icon type="plus" @click="handleAddGroupAttr(index)"/></a>
|
||||
</a-tooltip>
|
||||
<a-tooltip>
|
||||
<template slot="title">删除分组</template>
|
||||
<template slot="title">{{ $t('cmdb.ciType.deleteGroup') }}</template>
|
||||
<a style="color:red;"><a-icon type="delete" @click="handleDeleteGroup(CITypeGroup)"/></a>
|
||||
</a-tooltip>
|
||||
</a-space>
|
||||
|
@ -106,12 +106,12 @@
|
|||
</div>
|
||||
<div>
|
||||
<div :style="{ height: '32px', lineHeight: '32px', display: 'inline-block', fontSize: '14px' }">
|
||||
<span style="font-weight:700">其他</span>
|
||||
<span style="font-weight:700">{{ $t('other') }}</span>
|
||||
<span style="color: #c3cdd7;margin-left:5px;">({{ otherGroupAttributes.length }})</span>
|
||||
</div>
|
||||
<div style="float: right">
|
||||
<a-tooltip>
|
||||
<template slot="title">添加属性</template>
|
||||
<template slot="title">{{ $t('cmdb.ciType.selectAttribute') }}</template>
|
||||
<a @click="handleAddGroupAttr(undefined)"><a-icon type="plus"/></a>
|
||||
</a-tooltip>
|
||||
</div>
|
||||
|
@ -304,7 +304,7 @@ 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('cmdb.ciType.groupExisted'))
|
||||
} else {
|
||||
updateCITypeGroupById(CITypeGroup.id, {
|
||||
name: CITypeGroup.name,
|
||||
|
@ -313,7 +313,7 @@ export default {
|
|||
}).then((res) => {
|
||||
CITypeGroup.editable = false
|
||||
this.$set(this.CITypeGroups, index, CITypeGroup)
|
||||
this.$message.success('修改成功')
|
||||
this.$message.success(this.$t('updateSuccess'))
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -350,7 +350,7 @@ 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('operateSuccess'))
|
||||
const beforeGroup = this.CITypeGroups[beforeIndex]
|
||||
this.CITypeGroups[beforeIndex] = this.CITypeGroups[afterIndex]
|
||||
|
||||
|
@ -403,8 +403,8 @@ export default {
|
|||
handleDeleteGroup(group) {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: `确定要删除分组 【${group.name}】 吗?`,
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('cmdb.ciType.confirmDeleteGroup', { groupName: `${group.name}` }),
|
||||
onOk() {
|
||||
deleteCITypeGroupById(group.id).then((res) => {
|
||||
that.CITypeGroups = that.CITypeGroups.filter((g) => g.id !== group.id)
|
||||
|
@ -417,13 +417,13 @@ export default {
|
|||
console.log('changess')
|
||||
if (e.hasOwnProperty('moved') && e.moved.oldIndex !== e.moved.newIndex) {
|
||||
if (group === -1) {
|
||||
this.$message.error('其他分组中的属性不能进行排序,如需排序请先拖至自定义的分组!')
|
||||
this.$message.error(this.$t('cmdb.ciType.attributeSortedTips'))
|
||||
} 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('保存成功'))
|
||||
.then((res) => this.$message.success(this.$t('updateSuccess')))
|
||||
.catch(() => {
|
||||
this.abortDraggable()
|
||||
})
|
||||
|
@ -440,7 +440,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('保存成功'))
|
||||
.then((res) => this.$message.success(this.$t('saveSuccess')))
|
||||
.catch(() => {
|
||||
this.abortDraggable()
|
||||
})
|
||||
|
@ -456,9 +456,9 @@ export default {
|
|||
})
|
||||
},
|
||||
updatePropertyIndex() {
|
||||
const attributes = [] // 全部属性
|
||||
let attributeOrder = 0 // 属性组
|
||||
let groupOrder = 0 // 组排序
|
||||
const attributes = [] // All attributes
|
||||
let attributeOrder = 0 // attribute group
|
||||
let groupOrder = 0 // group sort
|
||||
const promises = []
|
||||
|
||||
this.CITypeGroups.forEach((group) => {
|
||||
|
@ -509,7 +509,7 @@ export default {
|
|||
|
||||
const that = this
|
||||
Promise.all(promises).then((values) => {
|
||||
that.$message.success(`修改成功`)
|
||||
that.$message.success(that.$t('updateSuccess'))
|
||||
that.getCITypeGroupData()
|
||||
that.modalVisible = false
|
||||
})
|
||||
|
|
|
@ -5,23 +5,23 @@
|
|||
:label-col="formItemLayout.labelCol"
|
||||
:wrapper-col="formItemLayout.wrapperCol"
|
||||
>
|
||||
<a-divider style="font-size:14px;margin-top:6px;">基础设置</a-divider>
|
||||
<a-divider style="font-size:14px;margin-top:6px;">{{ $t('cmdb.ciType.basicConfig') }}</a-divider>
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="属性名(英文)">
|
||||
<a-form-item :label="$t('cmdb.ciType.AttributeName')">
|
||||
<a-input
|
||||
name="name"
|
||||
placeholder="英文"
|
||||
:placeholder="$t('cmdb.ciType.English')"
|
||||
v-decorator="[
|
||||
'name',
|
||||
{
|
||||
rules: [
|
||||
{ required: true, message: '请输入属性名' },
|
||||
{ required: true, message: $t('cmdb.ciType.inputAttributeName') },
|
||||
{
|
||||
message: '不能以数字开头,可以是英文 数字以及下划线 (_)',
|
||||
message: $t('cmdb.ciType.attributeNameTips'),
|
||||
pattern: RegExp('^(?!\\d)[a-zA-Z_0-9]+$'),
|
||||
},
|
||||
{ message: '内置字段', pattern: RegExp('^(?!(id|_id|ci_id|type|_type|ci_type)$).*$') },
|
||||
{ message: $t('cmdb.ciType.buildinAttribute'), pattern: RegExp('^(?!(id|_id|ci_id|type|_type|ci_type)$).*$') },
|
||||
],
|
||||
},
|
||||
]"
|
||||
|
@ -29,14 +29,14 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="别名">
|
||||
<a-form-item :label="$t('alias')">
|
||||
<a-input name="alias" v-decorator="['alias', { rules: [] }]" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="数据类型">
|
||||
<a-form-item :label="$t('cmdb.ciType.DataType')">
|
||||
<a-select
|
||||
name="value_type"
|
||||
style="width: 100%"
|
||||
|
@ -56,7 +56,7 @@
|
|||
<a-form-item
|
||||
:label-col="{ span: currentValueType === '6' ? 4 : 8 }"
|
||||
:wrapper-col="{ span: currentValueType === '6' ? 18 : 15 }"
|
||||
label="默认值"
|
||||
:label="$t('cmdb.ciType.defaultValue')"
|
||||
>
|
||||
<template>
|
||||
<a-select
|
||||
|
@ -79,7 +79,7 @@
|
|||
@select="selectIntDefaultValue"
|
||||
>
|
||||
<a-select-option key="$auto_inc_id">
|
||||
自增ID
|
||||
{{ $t('cmdb.ciType.autoIncID') }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-input
|
||||
|
@ -100,13 +100,13 @@
|
|||
@select="changeDefaultForDatetime"
|
||||
>
|
||||
<a-select-option key="$created_at">
|
||||
创建时间
|
||||
{{ $t('createdAt') }}
|
||||
</a-select-option>
|
||||
<a-select-option key="$updated_at">
|
||||
更新时间
|
||||
{{ $t('updatedAt') }}
|
||||
</a-select-option>
|
||||
<a-select-option key="$custom_time">
|
||||
自定义时间
|
||||
{{ $t('cmdb.ciType.customTime') }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<template v-else-if="currentValueType === '4' || currentValueType === '3'">
|
||||
|
@ -124,10 +124,10 @@
|
|||
<a><a-icon type="down" /> </a>
|
||||
<a-menu slot="overlay" @click="onClick">
|
||||
<a-menu-item key="$created_at">
|
||||
<a>创建时间</a>
|
||||
<a>{{ $t('createdAt') }}</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item key="$updated_at">
|
||||
<a>更新时间</a>
|
||||
<a>{{ $t('updatedAt') }}</a>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
|
@ -152,7 +152,7 @@
|
|||
<a-form-item
|
||||
:label-col="horizontalFormItemLayout.labelCol"
|
||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||
label="必须"
|
||||
:label="$t('required')"
|
||||
>
|
||||
<a-switch
|
||||
@change="(checked) => onChange(checked, 'is_required')"
|
||||
|
@ -162,7 +162,7 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="6" v-if="currentValueType !== '6' && currentValueType !== '7'">
|
||||
<a-form-item :label-col="{ span: 8 }" :wrapper-col="horizontalFormItemLayout.wrapperCol" label="唯一">
|
||||
<a-form-item :label-col="{ span: 8 }" :wrapper-col="horizontalFormItemLayout.wrapperCol" :label="$t('cmdb.ciType.unique')">
|
||||
<a-switch
|
||||
:disabled="isShowComputedArea"
|
||||
@change="onChange"
|
||||
|
@ -176,8 +176,8 @@
|
|||
<template slot="label">
|
||||
<span
|
||||
style="position:relative;white-space:pre;"
|
||||
>{{ `索引` }}
|
||||
<a-tooltip title="字段可被用于检索,加速查询">
|
||||
>{{ $t('cmdb.ciType.index') }}
|
||||
<a-tooltip :title="$t('cmdb.ciType.indexTips')">
|
||||
<a-icon
|
||||
style="position:absolute;top:3px;left:-17px;color:#2f54eb;"
|
||||
type="question-circle"
|
||||
|
@ -208,8 +208,8 @@
|
|||
<template slot="label">
|
||||
<span
|
||||
style="position:relative;white-space:pre;"
|
||||
>{{ `显示` }}
|
||||
<a-tooltip title="CI实例表格默认展示该字段">
|
||||
>{{ $t('cmdb.ciType.defaultShow') }}
|
||||
<a-tooltip :title="$t('cmdb.ciType.defaultShowTips')">
|
||||
<a-icon
|
||||
style="position:absolute;top:3px;left:-17px;color:#2f54eb;"
|
||||
type="question-circle"
|
||||
|
@ -235,7 +235,7 @@
|
|||
<a-form-item
|
||||
:label-col="currentValueType === '2' ? horizontalFormItemLayout.labelCol : { span: 8 }"
|
||||
:wrapper-col="horizontalFormItemLayout.wrapperCol"
|
||||
label="排序"
|
||||
:label="$t('cmdb.ciType.isSortable')"
|
||||
>
|
||||
<a-switch
|
||||
:disabled="isShowComputedArea"
|
||||
|
@ -254,8 +254,8 @@
|
|||
<template slot="label">
|
||||
<span
|
||||
style="position:relative;white-space:pre;"
|
||||
>{{ `多值` }}
|
||||
<a-tooltip title="字段的值是1个或者多个,接口返回的值的类型是list">
|
||||
>{{ $t('cmdb.ciType.list') }}
|
||||
<a-tooltip :title="$t('cmdb.ciType.listTips')">
|
||||
<a-icon
|
||||
style="position:absolute;top:3px;left:-17px;color:#2f54eb;"
|
||||
type="question-circle"
|
||||
|
@ -278,15 +278,15 @@
|
|||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-divider style="font-size:14px;margin-top:6px;">高级设置</a-divider>
|
||||
<a-divider style="font-size:14px;margin-top:6px;">{{ $t('cmdb.ciType.advancedSettings') }}</a-divider>
|
||||
<a-row>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }" label="字体">
|
||||
<a-form-item :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }" :label="$t('cmdb.ciType.font')">
|
||||
<FontArea ref="fontArea" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24" v-if="!['6', '7'].includes(currentValueType)">
|
||||
<a-form-item :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }" label="预定义值">
|
||||
<a-form-item :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }" :label="$t('cmdb.ciType.choiceValue')">
|
||||
<PreValueArea ref="preValueArea" :canDefineScript="canDefineScript" :disabled="isShowComputedArea" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
@ -295,10 +295,10 @@
|
|||
<template slot="label">
|
||||
<span
|
||||
style="position:relative;white-space:pre;"
|
||||
>{{ `计算属性` }}
|
||||
>{{ $t('cmdb.ciType.computedAttribute') }}
|
||||
<a-tooltip
|
||||
:title="
|
||||
`该属性的值是通过模型的其它属性构建的表达式或者执行一段代码的方式计算而来,属性的引用方法为: {{ 属性名 }}`
|
||||
$t('cmdb.ciType.computedAttributeTips')
|
||||
"
|
||||
>
|
||||
<a-icon
|
||||
|
@ -326,9 +326,9 @@
|
|||
</a-col>
|
||||
</a-row>
|
||||
<a-form-item v-if="hasFooter" :wrapper-col="{ offset: 18 }">
|
||||
<a-button type="primary" @click="handleSubmit">新增</a-button>
|
||||
<a-button type="primary" @click="handleSubmit">{{ $t('new') }}</a-button>
|
||||
<a-divider type="vertical" />
|
||||
<a-button @click="handleClose">取消</a-button>
|
||||
<a-button @click="handleClose">{{ $t('cancel') }}</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</template>
|
||||
|
@ -357,7 +357,6 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
valueTypeMap,
|
||||
formItemLayout: {
|
||||
labelCol: { span: 8 },
|
||||
wrapperCol: { span: 15 },
|
||||
|
@ -369,7 +368,7 @@ export default {
|
|||
form: this.$form.createForm(this),
|
||||
currentValueType: '2',
|
||||
default_value_json: {},
|
||||
default_value_json_right: true, // 当前json是否正确
|
||||
default_value_json_right: true, // Is the current json correct?
|
||||
|
||||
canDefineComputed: false,
|
||||
isShowComputedArea: false,
|
||||
|
@ -378,6 +377,9 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
valueTypeMap() {
|
||||
return valueTypeMap()
|
||||
},
|
||||
canDefineScript() {
|
||||
return this.canDefineComputed
|
||||
},
|
||||
|
@ -423,7 +425,7 @@ export default {
|
|||
const computedAreaData = this.$refs.computedArea.getData()
|
||||
values = { ...values, ...computedAreaData }
|
||||
} else {
|
||||
// 如果是非计算属性,就看看有没有预定义值
|
||||
// If it is a non-computed attribute, check to see if there is a predefined value
|
||||
if (!['6', '7'].includes(values.value_type)) {
|
||||
const preValueAreaData = this.$refs.preValueArea.getData()
|
||||
values = { ...values, ...preValueAreaData }
|
||||
|
@ -431,9 +433,9 @@ export default {
|
|||
}
|
||||
const fontOptions = this.$refs.fontArea.getData()
|
||||
|
||||
// is_index进行操作,除了文本 索引隐藏掉 文本 索引默认是true
|
||||
// 框里的5种类型 is_index=true
|
||||
// json类型、密码、链接 is_index=false
|
||||
// is_index: except for text, the index is hidden, text index default is true
|
||||
// 5 types in the box, is_index=true
|
||||
// json, password, link is_index=false
|
||||
if (['6', '7', '8'].includes(values.value_type)) {
|
||||
values.is_index = false
|
||||
} else if (values.value_type !== '2') {
|
||||
|
@ -497,13 +499,13 @@ export default {
|
|||
})
|
||||
}
|
||||
if (checked && property === 'is_sortable') {
|
||||
this.$message.warning('选中排序,则必须也要选中!')
|
||||
this.$message.warning(this.$t('cmdb.ciType.addAttributeTips1'))
|
||||
this.form.setFieldsValue({
|
||||
is_required: true,
|
||||
})
|
||||
}
|
||||
if (!checked && property === 'is_required' && this.form.getFieldValue('is_sortable')) {
|
||||
this.$message.warning('选中排序,则必须也要选中!')
|
||||
this.$message.warning(this.$t('cmdb.ciType.addAttributeTips1'))
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({
|
||||
is_required: true,
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
<template>
|
||||
<a-card :bordered="false" :bodyStyle="{ padding: '0' }">
|
||||
<a-tabs :activeKey="activeKey" @change="changeTab" class="ops-tab" type="card">
|
||||
<a-tab-pane key="1" tab="模型属性">
|
||||
<a-tab-pane key="1" :tab="$t('cmdb.ciType.attributes')">
|
||||
<AttributesTable ref="attributesTable" :CITypeId="CITypeId" :CITypeName="CITypeName"></AttributesTable>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane forceRender key="2" tab="模型关联">
|
||||
<a-tab-pane forceRender key="2" :tab="$t('cmdb.ciType.relation')">
|
||||
<RelationTable :CITypeId="CITypeId" :CITypeName="CITypeName"></RelationTable>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="3" tab="触发器">
|
||||
<a-tab-pane key="3" :tab="$t('cmdb.ciType.trigger')">
|
||||
<TriggerTable ref="triggerTable" :CITypeId="CITypeId"></TriggerTable>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="4" tab="属性自动发现">
|
||||
<a-tab-pane key="4" :tab="$t('cmdb.ciType.attributeAD')">
|
||||
<AttrAD :CITypeId="CITypeId"></AttrAD>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="5" tab="关系自动发现">
|
||||
<a-tab-pane key="5" :tab="$t('cmdb.ciType.relationAD')">
|
||||
<RelationAD :CITypeId="CITypeId"></RelationAD>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="6" tab="权限设置">
|
||||
<a-tab-pane key="6" :tab="$t('cmdb.ciType.grant')">
|
||||
<GrantComp :CITypeId="CITypeId" resourceType="CIType" :resourceTypeName="CITypeName"></GrantComp>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<template>
|
||||
<a-tabs v-model="activeKey" size="small" :tabBarStyle="{ borderBottom: 'none' }">
|
||||
<a-tab-pane key="expr" :disabled="!canDefineComputed">
|
||||
<span style="font-size:12px;" slot="tab">表达式</span>
|
||||
<span style="font-size:12px;" slot="tab">{{ $t('cmdb.ciType.expr') }}</span>
|
||||
<a-textarea v-model="compute_expr" :placeholder="`{{a}}+{{b}}`" :rows="2" :disabled="!canDefineComputed" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="script" :disabled="!canDefineComputed">
|
||||
<span style="font-size:12px;" slot="tab">代码</span>
|
||||
<span style="font-size:12px;" slot="tab">{{ $t('cmdb.ciType.code') }}</span>
|
||||
<codemirror style="z-index: 9999" :options="cmOptions" v-model="compute_script"></codemirror>
|
||||
</a-tab-pane>
|
||||
<template slot="tabBarExtraContent" v-if="showCalcComputed">
|
||||
<a-button type="primary" size="small" @click="handleCalcComputed">
|
||||
应用
|
||||
{{ $t('cmdb.ciType.apply') }}
|
||||
</a-button>
|
||||
<a-tooltip title="所有CI触发计算">
|
||||
<a-tooltip :title="$t('cmdb.ciType.computeForAllCITips')">
|
||||
<a-icon type="question-circle" style="margin-left:5px" />
|
||||
</a-tooltip>
|
||||
</template>
|
||||
|
@ -76,8 +76,8 @@ export default {
|
|||
handleCalcComputed() {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: `确认触发将保存当前配置及触发所有CI的计算?`,
|
||||
title: this.$t('warning'),
|
||||
content: this.$t('cmdb.ciType.confirmcomputeForAllCITips'),
|
||||
onOk() {
|
||||
that.$emit('handleCalcComputed')
|
||||
},
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
<div class="ci-types-wrap" :style="{ height: `${windowHeight - 66}px` }">
|
||||
<div v-if="!CITypeGroups.length" class="ci-types-empty">
|
||||
<a-empty :image="emptyImage" description=""></a-empty>
|
||||
<a-button icon="plus" size="small" type="primary" @click="handleClickAddGroup">新增分组</a-button>
|
||||
<a-button icon="plus" size="small" type="primary" @click="handleClickAddGroup">{{
|
||||
$t('cmdb.ciType.addGroup')
|
||||
}}</a-button>
|
||||
</div>
|
||||
<SplitPane
|
||||
v-else
|
||||
|
@ -23,7 +25,7 @@
|
|||
icon="plus"
|
||||
@click="handleClickAddGroup"
|
||||
class="ops-button-primary"
|
||||
>分组</a-button
|
||||
>{{ $t('cmdb.ciType.group') }}</a-button
|
||||
>
|
||||
<a-space>
|
||||
<a
|
||||
|
@ -32,10 +34,10 @@
|
|||
$refs.attributeStore.open()
|
||||
}
|
||||
"
|
||||
>属性库</a
|
||||
>{{ $t('cmdb.ciType.attributeLibray') }}</a
|
||||
>
|
||||
<a-dropdown v-if="permissions.includes('admin') || permissions.includes('cmdb_admin')">
|
||||
<a><ops-icon type="ops-menu"/></a>
|
||||
<a><ops-icon type="ops-menu" /></a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="0">
|
||||
<a-upload
|
||||
|
@ -46,12 +48,12 @@
|
|||
action="/api/v0.1/ci_types/template/import/file"
|
||||
@change="changeUploadFile"
|
||||
>
|
||||
<a><a-icon type="upload"/></a><a> 导入</a>
|
||||
<a><a-icon type="upload" /></a><a> {{ $t('upload') }}</a>
|
||||
</a-upload>
|
||||
</a-menu-item>
|
||||
<a-menu-item key="1">
|
||||
<a-space>
|
||||
<a href="/api/v0.1/ci_types/template/export/file"><a-icon type="download" /> 导出</a>
|
||||
<a href="/api/v0.1/ci_types/template/export/file"><a-icon type="download" /> {{ $t('download') }}</a>
|
||||
</a-space>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
|
@ -61,33 +63,31 @@
|
|||
<draggable class="ci-types-left-content" :list="CITypeGroups" @end="handleChangeGroups" filter=".undraggable">
|
||||
<div v-for="g in CITypeGroups" :key="g.id || g.name">
|
||||
<div
|
||||
:class="
|
||||
`${currentGId === g.id && !currentCId ? 'selected' : ''} ci-types-left-group ${
|
||||
g.id === -1 ? 'undraggable' : ''
|
||||
}`
|
||||
"
|
||||
:class="`${currentGId === g.id && !currentCId ? 'selected' : ''} ci-types-left-group ${
|
||||
g.id === -1 ? 'undraggable' : ''
|
||||
}`"
|
||||
@click="handleClickGroup(g.id)"
|
||||
>
|
||||
<div>
|
||||
<OpsMoveIcon
|
||||
style="width: 17px; height: 17px; display: none; position: absolute; left: -3px; top: 10px"
|
||||
/>
|
||||
<span style="font-weight:700">{{ g.name || '其他' }}</span>
|
||||
<span style="font-weight: 700">{{ g.name || $t('other') }}</span>
|
||||
<span :style="{ color: '#c3cdd7' }">({{ g.ci_types.length }})</span>
|
||||
</div>
|
||||
<a-space>
|
||||
<a-tooltip>
|
||||
<template slot="title">在该组中新增CI模型</template>
|
||||
<a><a-icon type="plus" @click="handleCreate(g)"/></a>
|
||||
<template slot="title">{{ $t('cmdb.ciType.addCITypeInGroup') }}</template>
|
||||
<a><a-icon type="plus" @click="handleCreate(g)" /></a>
|
||||
</a-tooltip>
|
||||
<template v-if="g.id !== -1">
|
||||
<a-tooltip>
|
||||
<template slot="title">编辑组名称</template>
|
||||
<a><a-icon type="edit" @click="handleEditGroup(g)"/></a>
|
||||
<template slot="title">{{ $t('cmdb.ciType.editGroup') }}</template>
|
||||
<a><a-icon type="edit" @click="handleEditGroup(g)" /></a>
|
||||
</a-tooltip>
|
||||
<a-tooltip>
|
||||
<template slot="title">删除该组</template>
|
||||
<a style="color: red"><a-icon type="delete" @click="handleDeleteGroup(g)"/></a>
|
||||
<template slot="title">{{ $t('cmdb.ciType.deleteGroup') }}</template>
|
||||
<a style="color: red"><a-icon type="delete" @click="handleDeleteGroup(g)" /></a>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
</a-space>
|
||||
|
@ -130,15 +130,14 @@
|
|||
</div>
|
||||
<span class="ci-types-left-detail-title">{{ ci.alias || ci.name }}</span>
|
||||
<a-space class="ci-types-left-detail-action">
|
||||
<a><a-icon type="user-add" @click="(e) => handlePerm(e, ci)"/></a>
|
||||
<a><a-icon type="edit" @click="(e) => handleEdit(e, ci)"/></a>
|
||||
<a><a-icon type="user-add" @click="(e) => handlePerm(e, ci)" /></a>
|
||||
<a><a-icon type="edit" @click="(e) => handleEdit(e, ci)" /></a>
|
||||
<a
|
||||
v-if="permissions.includes('admin') || permissions.includes('cmdb_admin')"
|
||||
@click="(e) => handleDownloadCiType(e, ci)"
|
||||
><a-icon
|
||||
type="download"
|
||||
/></a>
|
||||
<a style="color: red" @click="(e) => handleDelete(e, ci)"><a-icon type="delete"/></a>
|
||||
@click="(e) => handleDownloadCiType(e, ci)">
|
||||
<a-icon type="download"/>
|
||||
</a>
|
||||
<a style="color: red" @click="(e) => handleDelete(e, ci)"><a-icon type="delete" /></a>
|
||||
</a-space>
|
||||
</div>
|
||||
</draggable>
|
||||
|
@ -151,13 +150,15 @@
|
|||
<CITypeDetail v-if="currentCId" :CITypeId="currentCId" :CITypeName="currentCName" />
|
||||
<div v-else class="ci-types-right-empty">
|
||||
<a-empty :image="emptyImage" description=""></a-empty>
|
||||
<a-button icon="plus" size="small" type="primary" @click="handleCreateCiFromEmpty">新增CI模型</a-button>
|
||||
<a-button icon="plus" size="small" type="primary" @click="handleCreateCiFromEmpty">{{
|
||||
$t('cmdb.ciType.addCIType')
|
||||
}}</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</SplitPane>
|
||||
<a-modal v-model="modalVisible" :title="modalTitle" @ok="handleSubmitEditGroup">
|
||||
<a-form-item label="名称" :label-col="{ span: 4 }" :wrapper-col="{ span: 16 }">
|
||||
<a-form-item :label="$t('name')" :label-col="{ span: 4 }" :wrapper-col="{ span: 16 }">
|
||||
<a-input v-model="editingInput" />
|
||||
</a-form-item>
|
||||
</a-modal>
|
||||
|
@ -167,7 +168,7 @@
|
|||
:visible="drawerVisible"
|
||||
@close="onClose"
|
||||
placement="right"
|
||||
width="820px"
|
||||
width="900px"
|
||||
:destroyOnClose="true"
|
||||
>
|
||||
<a-form
|
||||
|
@ -176,17 +177,17 @@
|
|||
:label-col="formItemLayout.labelCol"
|
||||
:wrapper-col="formItemLayout.wrapperCol"
|
||||
>
|
||||
<a-form-item label="模型名(英文)">
|
||||
<a-form-item :label="$t('cmdb.ciType.CITypeName')">
|
||||
<a-input
|
||||
name="name"
|
||||
placeholder="英文"
|
||||
:placeholder="$t('cmdb.ciType.English')"
|
||||
v-decorator="[
|
||||
'name',
|
||||
{
|
||||
rules: [
|
||||
{ required: true, message: '请输入属性名' },
|
||||
{ required: true, message: $t('cmdb.ciType.inputAttributeName') },
|
||||
{
|
||||
message: '不能以数字开头,可以是英文 数字以及下划线 (_)',
|
||||
message: $t('cmdb.ciType.attributeNameTips'),
|
||||
pattern: RegExp('^(?!\\d)[a-zA-Z_0-9]+$'),
|
||||
},
|
||||
],
|
||||
|
@ -194,18 +195,21 @@
|
|||
]"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="别名">
|
||||
<a-form-item :label="$t('alias')">
|
||||
<a-input name="alias" v-decorator="['alias', { rules: [] }]" />
|
||||
</a-form-item>
|
||||
<a-form-item label="图标">
|
||||
<a-form-item :label="$t('icon')">
|
||||
<IconArea class="ci_types-icon-area" ref="iconArea" />
|
||||
</a-form-item>
|
||||
<a-form-item label="默认排序" v-if="drawerTitle === '编辑模型'">
|
||||
<a-form-item :label="$t('cmdb.ciType.defaultSort')" v-if="drawerTitle === $t('cmdb.ciType.editCIType')">
|
||||
<el-select
|
||||
size="small"
|
||||
filterable
|
||||
clearable
|
||||
v-decorator="['default_order_attr', { rules: [{ required: false, message: '请选择默认排序字段' }] }]"
|
||||
v-decorator="[
|
||||
'default_order_attr',
|
||||
{ rules: [{ required: false, message: $t('cmdb.ciType.selectDefaultOrderAttr') }] },
|
||||
]"
|
||||
>
|
||||
<el-option
|
||||
:key="item.name"
|
||||
|
@ -214,29 +218,30 @@
|
|||
:label="item.alias || item.name"
|
||||
>
|
||||
<span> {{ item.alias || item.name }}</span>
|
||||
<span :title="item.name" style="font-size:10px;color:#afafaf;"> {{ item.name }}</span>
|
||||
<span :title="item.name" style="font-size: 10px; color: #afafaf"> {{ item.name }}</span>
|
||||
</el-option>
|
||||
<a-divider :style="{ margin: '5px 0' }" />
|
||||
<div :style="{ textAlign: 'right' }">
|
||||
<a-radio-group v-model="default_order_asc">
|
||||
<a-radio value="1">
|
||||
正序
|
||||
{{ $t('cmdb.ciType.asec') }}
|
||||
</a-radio>
|
||||
<a-radio value="2">
|
||||
倒序
|
||||
{{ $t('cmdb.ciType.desc') }}
|
||||
</a-radio>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
</el-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="唯一标识">
|
||||
<a-form-item :label="$t('cmdb.ciType.uniqueKey')">
|
||||
<el-select
|
||||
size="small"
|
||||
filterable
|
||||
optionFilterProp="children"
|
||||
name="unique_key"
|
||||
:filter-method="filterOption"
|
||||
v-decorator="['unique_key', { rules: [{ required: true, message: '请选择唯一标识' }] }]"
|
||||
v-decorator="['unique_key', { rules: [{ required: true, message: $t('cmdb.ciType.uniqueKeySelect') }] }]"
|
||||
:placeholder="$t('placeholder2')"
|
||||
>
|
||||
<el-option
|
||||
:key="item.id"
|
||||
|
@ -245,11 +250,11 @@
|
|||
:label="item.alias || item.name"
|
||||
>
|
||||
<span> {{ item.alias || item.name }}</span>
|
||||
<span :title="item.name" style="font-size:10px;color:#afafaf;"> {{ item.name }}</span>
|
||||
<span :title="item.name" style="font-size: 10px; color: #afafaf"> {{ item.name }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<a-divider type="vertical" />
|
||||
<a @click="handleCreatNewAttr">找不到想要的?</a>
|
||||
<a @click="handleCreatNewAttr">{{ $t('cmdb.ciType.notfound') }}</a>
|
||||
</a-form-item>
|
||||
<div v-if="newAttrAreaVisible" :style="{ padding: '15px 8px 0 8px', backgroundColor: '#fafafa' }">
|
||||
<create-new-attribute
|
||||
|
@ -262,8 +267,10 @@
|
|||
<a-input name="id" type="hidden" v-decorator="['id', { rules: [] }]" />
|
||||
</a-form-item>
|
||||
<div class="custom-drawer-bottom-action">
|
||||
<a-button @click="handleSubmit" :loading="loading" type="primary" style="margin-right: 1rem">确定</a-button>
|
||||
<a-button @click="onClose">取消</a-button>
|
||||
<a-button @click="handleSubmit" :loading="loading" type="primary" style="margin-right: 1rem">{{
|
||||
$t('confirm')
|
||||
}}</a-button>
|
||||
<a-button @click="onClose">{{ $t('cancel') }}</a-button>
|
||||
</div>
|
||||
</a-form>
|
||||
</CustomDrawer>
|
||||
|
@ -317,7 +324,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
emptyImage,
|
||||
modalTitle: '新增分组',
|
||||
modalTitle: this.$t('cmdb.ciType.addGroup'),
|
||||
modalVisible: false,
|
||||
editingGroup: null,
|
||||
editingInput: '',
|
||||
|
@ -329,7 +336,7 @@ export default {
|
|||
form: this.$form.createForm(this),
|
||||
drawerVisible: false,
|
||||
drawerTitle: '',
|
||||
selectGroup: {}, // 在当前group下新增ci type
|
||||
selectGroup: {}, // add CIType in group
|
||||
|
||||
formLayout: 'horizontal',
|
||||
newAttrAreaVisible: false,
|
||||
|
@ -394,7 +401,7 @@ export default {
|
|||
return null
|
||||
},
|
||||
filterAttributes() {
|
||||
// 唯一标识 排除掉choice password 计算属性 json
|
||||
// unique key, excludes: choice password computed json
|
||||
const _attributes = this.allAttributes.filter(
|
||||
(item) => !item.is_choice && !item.is_computed && !['6', '7'].includes(item.value_type)
|
||||
)
|
||||
|
@ -445,7 +452,7 @@ export default {
|
|||
this.$nextTick(() => {
|
||||
groups.forEach((g) => {
|
||||
if (!g.id) {
|
||||
// 给未分组增加一个假的id
|
||||
// Add a fake id to ungrouped
|
||||
g.id = -1
|
||||
}
|
||||
if (isResetCurrentId && !alreadyReset && g.ci_types && g.ci_types.length) {
|
||||
|
@ -468,7 +475,7 @@ export default {
|
|||
handleClickAddGroup() {
|
||||
this.editingGroup = {}
|
||||
this.editingInput = ''
|
||||
this.modalTitle = '新增分组'
|
||||
this.modalTitle = this.$t('cmdb.ciType.addGroup')
|
||||
this.modalVisible = true
|
||||
},
|
||||
async handleSubmitEditGroup() {
|
||||
|
@ -477,11 +484,11 @@ export default {
|
|||
name: this.editingInput,
|
||||
type_ids: this.editingGroup.ci_types.map((i) => i.id),
|
||||
})
|
||||
this.$message.success('更新成功!')
|
||||
this.$message.success(this.$t('updateSuccess'))
|
||||
} else {
|
||||
const { id } = await postCITypeGroup({ name: this.editingInput })
|
||||
this.currentId = `${id}%null%null`
|
||||
this.$message.success('新增成功!')
|
||||
this.$message.success(this.$t('addSuccess'))
|
||||
}
|
||||
this.modalVisible = false
|
||||
localStorage.setItem('ops_cityps_currentId', this.currentId)
|
||||
|
@ -502,7 +509,7 @@ export default {
|
|||
})
|
||||
},
|
||||
handleCreate(g) {
|
||||
this.drawerTitle = '新增模型'
|
||||
this.drawerTitle = this.$t('cmdb.ciType.addCIType')
|
||||
this.drawerVisible = true
|
||||
this.selectGroup = g
|
||||
this.$nextTick(() => {
|
||||
|
@ -510,7 +517,7 @@ export default {
|
|||
})
|
||||
},
|
||||
handleCreateCiFromEmpty() {
|
||||
this.drawerTitle = '新增模型'
|
||||
this.drawerTitle = this.$t('cmdb.ciType.addCIType')
|
||||
this.drawerVisible = true
|
||||
const _find = this.CITypeGroups.find((item) => item.id === this.currentGId)
|
||||
this.selectGroup = _find
|
||||
|
@ -521,21 +528,21 @@ export default {
|
|||
handleEditGroup(g) {
|
||||
this.editingGroup = g
|
||||
this.editingInput = g.name
|
||||
this.modalTitle = '修改分组'
|
||||
this.modalTitle = this.$t('cmdb.ciType.editGroup')
|
||||
this.modalVisible = true
|
||||
},
|
||||
async handleDeleteGroup(g) {
|
||||
if (g.ci_types && g.ci_types.length > 0) {
|
||||
this.$message.error('该分组下有数据, 不能删除!')
|
||||
this.$message.error(this.$t('cmdb.ciType.cannotDeleteGroupTips'))
|
||||
return
|
||||
}
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: `确定要删除分组 【${g.name}】 吗?`,
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('cmdb.ciType.confirmDeleteGroup', { groupName: `${g.name}` }),
|
||||
onOk() {
|
||||
deleteCITypeGroup(g.id).then((res) => {
|
||||
that.$message.info(`删除成功!`)
|
||||
that.$message.info(that.$t('deleteSuccess'))
|
||||
that.loadCITypes(true)
|
||||
})
|
||||
},
|
||||
|
@ -582,11 +589,12 @@ export default {
|
|||
end(g) {
|
||||
console.log('end', g)
|
||||
this.endId = g.id
|
||||
const that = this
|
||||
if (this.startId === g.id && g.id !== -1 && this.addId !== -1) {
|
||||
// 通过一个group内部换位置
|
||||
// Changing positions within a group
|
||||
putCITypeGroupByGId(g.id, { name: g.name, type_ids: g.ci_types.map((i) => i.id) })
|
||||
.then(() => {
|
||||
this.$message.success('保存成功!')
|
||||
this.$message.success(that.$t('saveSuccess'))
|
||||
})
|
||||
.catch(() => {
|
||||
this.loadCITypes(!this.currentId)
|
||||
|
@ -598,7 +606,7 @@ export default {
|
|||
})
|
||||
}
|
||||
if (this.startId === g.id && g.id !== -1 && this.addId === -1) {
|
||||
// 从一个group换到其他
|
||||
// Change from one group to another
|
||||
const changedCiTypes = this.startGroup.ci_types
|
||||
.filter((ciType) => {
|
||||
const _find = g.ci_types.find((gCiType) => ciType.id === gCiType.id)
|
||||
|
@ -610,7 +618,7 @@ export default {
|
|||
.map((item) => item.id)
|
||||
deleteCITypeGroup(g.id, { name: g.name, type_ids: changedCiTypes })
|
||||
.then(() => {
|
||||
this.$message.success('保存成功!')
|
||||
this.$message.success(that.$t('saveSuccess'))
|
||||
})
|
||||
.catch(() => {
|
||||
this.loadCITypes(!this.currentId)
|
||||
|
@ -625,11 +633,12 @@ export default {
|
|||
add(g) {
|
||||
console.log('add', g)
|
||||
this.addId = g.id
|
||||
const that = this
|
||||
if (g.id && g.id !== -1) {
|
||||
// 跨组换位置 不换到其他
|
||||
// Change positions across groups without changing to others
|
||||
putCITypeGroupByGId(g.id, { name: g.name, type_ids: g.ci_types.map((i) => i.id) })
|
||||
.then(() => {
|
||||
this.$message.success('保存成功!')
|
||||
this.$message.success(that.$t('saveSuccess'))
|
||||
})
|
||||
.catch(() => {
|
||||
this.loadCITypes(!this.currentId)
|
||||
|
@ -642,10 +651,11 @@ export default {
|
|||
}
|
||||
},
|
||||
async handleChangeCITypes(e, g) {
|
||||
const that = this
|
||||
if (g.id && g.id !== -1) {
|
||||
putCITypeGroupByGId(g.id, { name: g.name, type_ids: g.ci_types.map((i) => i.id) })
|
||||
.then(() => {
|
||||
this.$message.success('保存成功!')
|
||||
this.$message.success(that.$t('saveSuccess'))
|
||||
})
|
||||
.catch(() => {
|
||||
this.loadCITypes(!this.currentId)
|
||||
|
@ -653,9 +663,10 @@ export default {
|
|||
}
|
||||
},
|
||||
async handleChangeGroups() {
|
||||
const that = this
|
||||
putCITypeGroups({ group_ids: this.CITypeGroups.filter((c) => c.id).map((c) => c.id) })
|
||||
.then(() => {
|
||||
this.$message.success('保存成功!')
|
||||
this.$message.success(that.$t('saveSuccess'))
|
||||
})
|
||||
.catch(() => {
|
||||
this.loadCITypes(!this.currentId)
|
||||
|
@ -665,7 +676,7 @@ export default {
|
|||
const { type_id } = await createCIType(data).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
this.$message.success(`添加成功`)
|
||||
this.$message.success(this.$t('addSuccess'))
|
||||
if (this.selectGroup && this.selectGroup.id && this.selectGroup.id !== -1) {
|
||||
const ids = this.selectGroup.ci_types.map((i) => i.id)
|
||||
ids.push(type_id)
|
||||
|
@ -684,9 +695,10 @@ export default {
|
|||
}, 1000)
|
||||
},
|
||||
async updateCIType(CITypeId, data) {
|
||||
const that = this
|
||||
await updateCIType(CITypeId, data)
|
||||
.then((res) => {
|
||||
this.$message.success(`修改成功`)
|
||||
this.$message.success(that.$t('updateSuccess'))
|
||||
|
||||
const _currentId = this.currentId
|
||||
this.currentId = null
|
||||
|
@ -710,11 +722,11 @@ export default {
|
|||
e.stopPropagation()
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: `确定要删除模型 【${record.alias || record.name}】 吗?`,
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('cmdb.ciType.confirmDeleteCIType', { typeName: `${record.alias || record.name}` }),
|
||||
onOk() {
|
||||
deleteCIType(record.id).then((res) => {
|
||||
that.$message.success(`删除成功!`)
|
||||
that.$message.success(that.$t('deleteSuccess'))
|
||||
that.loadCITypes(true)
|
||||
that.resetRoute()
|
||||
})
|
||||
|
@ -727,7 +739,7 @@ export default {
|
|||
const x = new XMLHttpRequest()
|
||||
x.open('GET', `/api/v0.1/ci_types/${ci.id}/template/export`, true)
|
||||
x.responseType = 'blob'
|
||||
x.onload = function(e) {
|
||||
x.onload = function (e) {
|
||||
const url = window.URL.createObjectURL(x.response)
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
|
@ -746,7 +758,7 @@ export default {
|
|||
handleEdit(e, record) {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
this.drawerTitle = '编辑模型'
|
||||
this.drawerTitle = this.$t('cmdb.ciType.editCIType')
|
||||
this.drawerVisible = true
|
||||
getCITypeAttributesById(record.id).then((res) => {
|
||||
this.orderSelectionOptions = res.attributes.filter((item) => item.is_required)
|
||||
|
@ -796,21 +808,21 @@ export default {
|
|||
if (res.result) {
|
||||
this.$refs.cmdbGrant.open({ name: ci.name, cmdbGrantType: 'ci_type', CITypeId: ci.id })
|
||||
} else {
|
||||
this.$message.error('权限不足!')
|
||||
this.$message.error(this.$t('noPermission'))
|
||||
}
|
||||
})
|
||||
},
|
||||
changeUploadFile({ file, fileList, event }) {
|
||||
const key = 'upload'
|
||||
if (file.status === 'uploading') {
|
||||
this.$message.loading({ content: '正在导入中', key, duration: 0 })
|
||||
this.$message.loading({ content: this.$t('cmdb.ciType.uploading'), key, duration: 0 })
|
||||
}
|
||||
if (file.status === 'done') {
|
||||
this.$message.success({ content: '导入成功', key, duration: 2 })
|
||||
this.$message.success({ content: this.$t('uploadSuccess'), key, duration: 2 })
|
||||
this.reload()
|
||||
}
|
||||
if (file.status === 'error') {
|
||||
this.$message.error({ content: '导入失败,请稍后重试', key, duration: 2 })
|
||||
this.$message.error({ content: this.$t('cmdb.ciType.uploadFailed'), key, duration: 2 })
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
@ -18,18 +18,18 @@
|
|||
visible = false
|
||||
}
|
||||
"
|
||||
>取消</a-button
|
||||
>{{ $t('cancel') }}</a-button
|
||||
>
|
||||
<a-button :loading="confirmLoading" @click="handleSubmit(false)" type="primary">继续添加</a-button>
|
||||
<a-button :loading="confirmLoading" type="primary" @click="handleSubmit">确定</a-button>
|
||||
<a-button :loading="confirmLoading" @click="handleSubmit(false)" type="primary">{{ $t('cmdb.ciType.continueAdd') }}</a-button>
|
||||
<a-button :loading="confirmLoading" type="primary" @click="handleSubmit">{{ $t('confirm') }}</a-button>
|
||||
</template>
|
||||
<a-tabs v-model="activeKey">
|
||||
<a-tab-pane key="1" tab="新建属性">
|
||||
<a-tab-pane key="1" :tab="$t('cmdb.ciType.addAttribute')">
|
||||
<div :style="{ overflow: 'auto', maxHeight: '480px' }">
|
||||
<create-new-attribute ref="createNewAttribute" :hasFooter="false" @done="handleAddNewAttr" />
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" tab="已有属性" force-render>
|
||||
<a-tab-pane key="2" :tab="$t('cmdb.ciType.existedAttributes')" force-render>
|
||||
<AttributesTransfer
|
||||
:dataSource="unLinkdAttrs"
|
||||
:targetKeys="targetKeys"
|
||||
|
@ -67,7 +67,6 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
valueTypeMap,
|
||||
activeKey: '1',
|
||||
visible: false,
|
||||
attributes: [],
|
||||
|
@ -78,6 +77,9 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
valueTypeMap() {
|
||||
return valueTypeMap()
|
||||
},
|
||||
windowHeight() {
|
||||
return this.$store.state.windowHeight
|
||||
},
|
||||
|
@ -154,7 +156,7 @@ export default {
|
|||
},
|
||||
handleClose(isCloseModal = true) {
|
||||
this.$emit('ok')
|
||||
this.$message.success('添加成功!')
|
||||
this.$message.success(this.$t('addSuccess'))
|
||||
if (isCloseModal) {
|
||||
this.visible = false
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
:tabBarStyle="{ borderBottom: 'none' }"
|
||||
>
|
||||
<a-tab-pane key="define" :disabled="disabled">
|
||||
<span style="font-size:12px;" slot="tab">定义</span>
|
||||
<span style="font-size:12px;" slot="tab">{{ $t('define') }}</span>
|
||||
<PreValueTag type="add" :item="[]" @add="addNewValue" :disabled="disabled">
|
||||
<template #default>
|
||||
<a-button
|
||||
|
@ -17,7 +17,7 @@
|
|||
:disabled="disabled"
|
||||
size="small"
|
||||
>
|
||||
<a-icon type="plus" />添加</a-button
|
||||
<a-icon type="plus" />{{ $t('add') }}</a-button
|
||||
>
|
||||
</template>
|
||||
</PreValueTag>
|
||||
|
@ -41,9 +41,9 @@
|
|||
<template slot="label">
|
||||
<span
|
||||
style="position:relative;white-space:pre;"
|
||||
>{{ `过滤` }}
|
||||
>{{ $t('cmdb.ciType.filter') }}
|
||||
<a-tooltip
|
||||
title="返回的结果按字段来过滤,层级嵌套用##分隔,比如k1##k2,web请求返回{k1: [{k2: 1}, {k2: 2}]}, 解析结果为[1, 2]"
|
||||
:title="$t('cmdb.ciType.choiceWebhookTips')"
|
||||
>
|
||||
<a-icon
|
||||
style="position:absolute;top:3px;left:-17px;color:#2f54eb;"
|
||||
|
@ -59,12 +59,12 @@
|
|||
</a-form-model>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="choice_other" :disabled="disabled">
|
||||
<span style="font-size:12px;" slot="tab">其他模型属性</span>
|
||||
<span style="font-size:12px;" slot="tab">{{ $t('cmdb.ciType.choiceOther') }}</span>
|
||||
<a-row :gutter="[24, 24]">
|
||||
<a-col :span="12">
|
||||
<a-form-item
|
||||
:style="{ lineHeight: '24px', marginBottom: '5px' }"
|
||||
label="模型"
|
||||
:label="$t('cmdb.ciType.ciType')"
|
||||
:label-col="{ span: 4 }"
|
||||
:wrapper-col="{ span: 20 }"
|
||||
>
|
||||
|
@ -87,13 +87,13 @@
|
|||
searchable
|
||||
:options="ciTypeGroup"
|
||||
value-consists-of="LEAF_PRIORITY"
|
||||
placeholder="请选择CMDB模型"
|
||||
:placeholder="$t('cmdb.ciType.selectCIType')"
|
||||
:normalizer="
|
||||
(node) => {
|
||||
return {
|
||||
id: node.id || -1,
|
||||
label: node.alias || node.name || '其他',
|
||||
title: node.alias || node.name || '其他',
|
||||
label: node.alias || node.name || $t('other'),
|
||||
title: node.alias || node.name || $t('other'),
|
||||
children: node.ci_types,
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@
|
|||
<a-col :span="12" v-if="choice_other.type_ids && choice_other.type_ids.length">
|
||||
<a-form-item
|
||||
:style="{ marginBottom: '5px' }"
|
||||
label="属性"
|
||||
:label="$t('cmdb.ciType.attributes')"
|
||||
:label-col="{ span: 4 }"
|
||||
:wrapper-col="{ span: 20 }"
|
||||
>
|
||||
|
@ -133,13 +133,13 @@
|
|||
searchable
|
||||
:options="typeAttrs"
|
||||
value-consists-of="LEAF_PRIORITY"
|
||||
placeholder="请选择模型属性"
|
||||
:placeholder="$t('cmdb.ciType.selectCITypeAttributes')"
|
||||
:normalizer="
|
||||
(node) => {
|
||||
return {
|
||||
id: node.id || -1,
|
||||
label: node.alias || node.name || '其他',
|
||||
title: node.alias || node.name || '其他',
|
||||
label: node.alias || node.name || $t('other'),
|
||||
title: node.alias || node.name || $t('other'),
|
||||
}
|
||||
}
|
||||
"
|
||||
|
@ -161,7 +161,7 @@
|
|||
<a-form-item
|
||||
:style="{ marginBottom: '5px' }"
|
||||
class="pre-value-filter"
|
||||
label="筛选"
|
||||
:label="$t('cmdb.ciType.filter')"
|
||||
:label-col="{ span: 2 }"
|
||||
:wrapper-col="{ span: 22 }"
|
||||
>
|
||||
|
@ -177,7 +177,7 @@
|
|||
</a-row>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="script" :disabled="disabled || !canDefineScript">
|
||||
<span style="font-size:12px;" slot="tab">脚本</span>
|
||||
<span style="font-size:12px;" slot="tab">{{ $t('cmdb.ciType.code') }}</span>
|
||||
<CustomCodeMirror
|
||||
codeMirrorId="cmdb-pre-value"
|
||||
ref="codemirror"
|
||||
|
@ -232,7 +232,7 @@ export default {
|
|||
typeAttrs: [],
|
||||
filterExp: '',
|
||||
script:
|
||||
'class ChoiceValue(object):\n @staticmethod\n def values():\n """\n 执行入口, 返回预定义值\n :return: 返回一个列表, 值的类型同属性的类型\n 例如:\n return ["在线", "下线"]\n """\n return []',
|
||||
this.$t('cmdb.ciType.choiceScriptDemo'),
|
||||
cmOptions: {
|
||||
lineNumbers: true,
|
||||
mode: 'python',
|
||||
|
@ -250,7 +250,7 @@ export default {
|
|||
handler(newValue) {
|
||||
const dom = document.querySelector('#preValueArea .ant-tabs-ink-bar')
|
||||
if (newValue) {
|
||||
// 如果是disabled 把tab 的ink-bar也置灰
|
||||
// If it is disabled, the ink-bar of the tab will also be grayed out.
|
||||
dom.style.backgroundColor = '#00000040'
|
||||
} else {
|
||||
dom.style.backgroundColor = '#2f54eb'
|
||||
|
@ -282,7 +282,7 @@ export default {
|
|||
if (newValue) {
|
||||
const idx = this.valueList.findIndex((v) => v[0] === newValue)
|
||||
if (idx > -1) {
|
||||
this.$message.warning('当前值已存在!')
|
||||
this.$message.warning(this.$t('cmdb.ciType.valueExisted'))
|
||||
} else {
|
||||
this.valueList.push([newValue, { style: newStyle, icon: { ...newIcon } }])
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ export default {
|
|||
}
|
||||
const dom = document.querySelector('#preValueArea .ant-tabs-ink-bar')
|
||||
if (this.disabled) {
|
||||
// 如果是disabled 把tab 的ink-bar也置灰
|
||||
// If it is disabled, the ink-bar of the tab will also be grayed out.
|
||||
dom.style.backgroundColor = '#00000040'
|
||||
} else {
|
||||
dom.style.backgroundColor = '#2f54eb'
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
>
|
||||
</a-input>
|
||||
<div ref="preValueEdit" slot="content">
|
||||
<a-divider orientation="left" style="margin:8px 0;color:gray;font-size:10px;">图标</a-divider>
|
||||
<a-divider orientation="left" style="margin:8px 0;color:gray;font-size:10px;">{{ $t('icon') }}</a-divider>
|
||||
<IconArea ref="iconArea" />
|
||||
<a-divider orientation="left" style="margin:8px 0;color:gray;font-size:10px;">字体</a-divider>
|
||||
<a-divider orientation="left" style="margin:8px 0;color:gray;font-size:10px;">{{ $t('cmdb.ciType.font') }}</a-divider>
|
||||
<div :style="{ display: 'flex', justifyContent: 'space-around' }">
|
||||
<div
|
||||
@click="changeFontStyle('fontWeight', 'bold')"
|
||||
|
@ -37,7 +37,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<a-divider orientation="left" style="margin:8px 0;color:gray;font-size:10px;">颜色</a-divider>
|
||||
<a-divider orientation="left" style="margin:8px 0;color:gray;font-size:10px;">{{ $t('cmdb.ciType.color') }}</a-divider>
|
||||
<div :style="{ display: 'flex', justifyContent: 'space-around' }">
|
||||
<div class="attributes-font-color">
|
||||
<a-icon type="font-colors" /><el-color-picker
|
||||
|
@ -56,11 +56,11 @@
|
|||
</el-color-picker>
|
||||
</div>
|
||||
</div>
|
||||
<a-divider orientation="left" style="margin:8px 0;color:gray;font-size:10px;">操作</a-divider>
|
||||
<a-divider orientation="left" style="margin:8px 0;color:gray;font-size:10px;">{{ $t('operation') }}</a-divider>
|
||||
<div style="text-align:right;">
|
||||
<a-tooltip
|
||||
v-if="type !== 'add'"
|
||||
title="删除"
|
||||
:title="$t('delete')"
|
||||
><a
|
||||
><a-icon
|
||||
@click="handleDelete"
|
||||
|
@ -69,11 +69,11 @@
|
|||
type="delete"/></a
|
||||
></a-tooltip>
|
||||
<a-tooltip
|
||||
title="确定"
|
||||
:title="$t('confirm')"
|
||||
><a><a-icon @click="handleEditOk" style="margin-right:10px;color:green;" type="check"/></a
|
||||
></a-tooltip>
|
||||
<a-tooltip
|
||||
title="取消"
|
||||
:title="$t('cancel')"
|
||||
><a
|
||||
><a-icon
|
||||
@click="
|
||||
|
@ -137,6 +137,9 @@ import _ from 'lodash'
|
|||
import { ColorPicker } from 'element-ui'
|
||||
import { defautValueColor, defaultBGColors } from '../../utils/const'
|
||||
import IconArea from './iconArea.vue'
|
||||
import lang from 'element-ui/lib/locale/lang/en'
|
||||
import locale from 'element-ui/lib/locale'
|
||||
locale.use(lang)
|
||||
export default {
|
||||
name: 'PreValueTag',
|
||||
components: { ElColorPicker: ColorPicker, IconArea },
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
searchable
|
||||
:options="ciTypeADTAttributes"
|
||||
value-consists-of="LEAF_PRIORITY"
|
||||
placeholder="请选择属性"
|
||||
:placeholder="$t('cmdb.ciType.selectAttributes')"
|
||||
:normalizer="
|
||||
(node) => {
|
||||
return {
|
||||
|
@ -35,15 +35,15 @@
|
|||
searchable
|
||||
:options="ciTypeGroup"
|
||||
value-consists-of="LEAF_PRIORITY"
|
||||
placeholder="请选择模型"
|
||||
:placeholder="$t('cmdb.ciType.selectCIType')"
|
||||
:disableBranchNodes="true"
|
||||
@select="changeType(item)"
|
||||
:normalizer="
|
||||
(node) => {
|
||||
return {
|
||||
id: node.name || '其他',
|
||||
label: node.alias || node.name || '其他',
|
||||
title: node.alias || node.name || '其他',
|
||||
id: node.name || $t('other'),
|
||||
label: node.alias || node.name || $t('other'),
|
||||
title: node.alias || node.name || $t('other'),
|
||||
children: node.ci_types,
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@
|
|||
searchable
|
||||
:options="item.attributes"
|
||||
value-consists-of="LEAF_PRIORITY"
|
||||
placeholder="请选择属性"
|
||||
:placeholder="$t('cmdb.ciType.selectAttributes')"
|
||||
:normalizer="
|
||||
(node) => {
|
||||
return {
|
||||
|
@ -89,7 +89,7 @@
|
|||
</treeselect>
|
||||
</div>
|
||||
<div class="relation-ad-footer">
|
||||
<a-button type="primary" @click="handleSave">保存</a-button>
|
||||
<a-button type="primary" @click="handleSave">{{ $t('save') }}</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -148,7 +148,7 @@ export default {
|
|||
},
|
||||
getCITypeDiscovery() {
|
||||
getCITypeDiscovery(this.CITypeId).then(async (res) => {
|
||||
// 第一个下拉框的options
|
||||
// Options for the first drop-down box
|
||||
const _ciTypeADTAttributes = []
|
||||
res
|
||||
.filter((adt) => adt.adr_id)
|
||||
|
@ -160,7 +160,7 @@ export default {
|
|||
})
|
||||
console.log(_ciTypeADTAttributes)
|
||||
this.ciTypeADTAttributes = _.uniqBy(_ciTypeADTAttributes, 'name')
|
||||
// 第一个下拉框的options
|
||||
// Options for the first drop-down box
|
||||
const _find = res.find((adt) => !adt.adr_id)
|
||||
if (_find) {
|
||||
this.adt_id = _find.id
|
||||
|
@ -242,7 +242,7 @@ export default {
|
|||
} else {
|
||||
await postCITypeDiscovery(this.CITypeId, { relation: _relation })
|
||||
}
|
||||
this.$message.success('保存成功')
|
||||
this.$message.success(this.$t('saveSuccess'))
|
||||
this.getCITypeDiscovery()
|
||||
}
|
||||
},
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
size="small"
|
||||
class="ops-button-primary"
|
||||
icon="plus"
|
||||
>新增关系</a-button
|
||||
>{{ $t('cmdb.ciType.addRelation') }}</a-button
|
||||
>
|
||||
<vxe-table
|
||||
stripe
|
||||
|
@ -20,15 +20,15 @@
|
|||
class="ops-stripe-table"
|
||||
:row-class-name="rowClass"
|
||||
>
|
||||
<vxe-column field="source_ci_type_name" title="源模型英文名"></vxe-column>
|
||||
<vxe-column field="relation_type" title="关联类型">
|
||||
<vxe-column field="source_ci_type_name" :title="$t('cmdb.ciType.sourceCIType')"></vxe-column>
|
||||
<vxe-column field="relation_type" :title="$t('cmdb.ciType.relationType')">
|
||||
<template #default="{row}">
|
||||
<span style="color:#2f54eb" v-if="row.isParent">被</span>
|
||||
<span style="color:#2f54eb" v-if="row.isParent">{{ $t('cmdb.ciType.isParent') }}</span>
|
||||
{{ row.relation_type }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="alias" title="目标模型名"></vxe-column>
|
||||
<vxe-column field="constraint" title="关系约束">
|
||||
<vxe-column field="alias" :title="$t('cmdb.ciType.dstCIType')"></vxe-column>
|
||||
<vxe-column field="constraint" :title="$t('cmdb.ciType.relationConstraint')">
|
||||
<template #default="{row}">
|
||||
<span v-if="row.isParent && constraintMap[row.constraint]">{{
|
||||
constraintMap[row.constraint]
|
||||
|
@ -39,11 +39,11 @@
|
|||
<span v-else>{{ constraintMap[row.constraint] }}</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="operation" title="操作" width="100">
|
||||
<vxe-column field="operation" :title="$t('operation')" width="100">
|
||||
<template #default="{row}">
|
||||
<a-space v-if="!row.isParent && row.source_ci_type_id">
|
||||
<a @click="handleOpenGrant(row)"><a-icon type="user-add"/></a>
|
||||
<a-popconfirm title="确认删除?" @confirm="handleDelete(row)">
|
||||
<a-popconfirm :title="$t('cmdb.ciType.confirmDelete2')" @confirm="handleDelete(row)">
|
||||
<a style="color: red;"><a-icon type="delete"/></a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
|
@ -52,7 +52,7 @@
|
|||
<template #empty>
|
||||
<div>
|
||||
<img :style="{ width: '100px' }" :src="require('@/assets/data_empty.png')" />
|
||||
<div>暂无数据</div>
|
||||
<div>{{ $t('noData') }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</vxe-table>
|
||||
|
@ -65,21 +65,24 @@
|
|||
width="500px"
|
||||
>
|
||||
<a-form :form="form" @submit="handleSubmit" :label-col="{ span: 6 }" :wrapper-col="{ span: 14 }">
|
||||
<a-form-item label="源模型">
|
||||
<a-form-item :label="$t('cmdb.ciType.sourceCIType')">
|
||||
<a-select
|
||||
name="source_ci_type_id"
|
||||
v-decorator="['source_ci_type_id', { rules: [{ required: true, message: '请选择源模型' }] }]"
|
||||
v-decorator="[
|
||||
'source_ci_type_id',
|
||||
{ rules: [{ required: true, message: $t('cmdb.ciType.sourceCITypeTips') }] },
|
||||
]"
|
||||
>
|
||||
<a-select-option :value="CIType.id" :key="CIType.id" v-for="CIType in displayCITypes">{{
|
||||
CIType.alias
|
||||
}}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="目标模型">
|
||||
<a-form-item :label="$t('cmdb.ciType.dstCIType')">
|
||||
<a-select
|
||||
showSearch
|
||||
name="ci_type_id"
|
||||
v-decorator="['ci_type_id', { rules: [{ required: true, message: '请选择目标模型' }] }]"
|
||||
v-decorator="['ci_type_id', { rules: [{ required: true, message: $t('cmdb.ciType.dstCITypeTips') }] }]"
|
||||
:filterOption="filterOption"
|
||||
>
|
||||
<a-select-option :value="CIType.id" :key="CIType.id" v-for="CIType in CITypes">
|
||||
|
@ -88,10 +91,13 @@
|
|||
</a-select>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="关联关系">
|
||||
<a-form-item :label="$t('cmdb.ciType.relationType')">
|
||||
<a-select
|
||||
name="relation_type_id"
|
||||
v-decorator="['relation_type_id', { rules: [{ required: true, message: '请选择关联关系' }] }]"
|
||||
v-decorator="[
|
||||
'relation_type_id',
|
||||
{ rules: [{ required: true, message: $t('cmdb.ciType.relationTypeTips') }] },
|
||||
]"
|
||||
>
|
||||
<a-select-option :value="relationType.id" :key="relationType.id" v-for="relationType in relationTypes">{{
|
||||
relationType.name
|
||||
|
@ -99,11 +105,16 @@
|
|||
</a-select>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="关联约束">
|
||||
<a-select v-decorator="['constraint', { rules: [{ required: true, message: '请选择关联约束' }] }]">
|
||||
<a-select-option value="0">一对多</a-select-option>
|
||||
<a-select-option value="1">一对一</a-select-option>
|
||||
<a-select-option value="2">多对多</a-select-option>
|
||||
<a-form-item :label="$t('cmdb.ciType.relationConstraint')">
|
||||
<a-select
|
||||
v-decorator="[
|
||||
'constraint',
|
||||
{ rules: [{ required: true, message: $t('cmdb.ciType.relationConstraintTips') }] },
|
||||
]"
|
||||
>
|
||||
<a-select-option value="0">{{ $t('cmdb.ciType.one2Many') }}</a-select-option>
|
||||
<a-select-option value="1">{{ $t('cmdb.ciType.one2One') }}</a-select-option>
|
||||
<a-select-option value="2">{{ $t('cmdb.ciType.many2Many') }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
@ -145,11 +156,6 @@ export default {
|
|||
drawerTitle: '',
|
||||
CITypes: [],
|
||||
relationTypes: [],
|
||||
constraintMap: {
|
||||
'0': '一对多',
|
||||
'1': '一对一',
|
||||
'2': '多对多',
|
||||
},
|
||||
tableData: [],
|
||||
parentTableData: [],
|
||||
}
|
||||
|
@ -161,6 +167,13 @@ export default {
|
|||
windowHeight() {
|
||||
return this.$store.state.windowHeight
|
||||
},
|
||||
constraintMap() {
|
||||
return {
|
||||
'0': this.$t('cmdb.ciType.one2Many'),
|
||||
'1': this.$t('cmdb.ciType.one2One'),
|
||||
'2': this.$t('cmdb.ciType.many2Many'),
|
||||
}
|
||||
},
|
||||
},
|
||||
async mounted() {
|
||||
this.getCITypes()
|
||||
|
@ -209,7 +222,7 @@ export default {
|
|||
},
|
||||
handleDelete(record) {
|
||||
deleteRelation(record.source_ci_type_id, record.id).then((res) => {
|
||||
this.$message.success(`删除成功!`)
|
||||
this.$message.success(this.$t('deleteSuccess'))
|
||||
this.handleOk()
|
||||
})
|
||||
},
|
||||
|
@ -218,7 +231,7 @@ export default {
|
|||
},
|
||||
|
||||
handleCreate() {
|
||||
this.drawerTitle = '新增关系'
|
||||
this.drawerTitle = this.$t('cmdb.ciType.addRelation')
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({
|
||||
|
@ -241,7 +254,7 @@ export default {
|
|||
|
||||
createRelation(values.source_ci_type_id, values.ci_type_id, values.relation_type_id, values.constraint).then(
|
||||
(res) => {
|
||||
this.$message.success(`添加成功`)
|
||||
this.$message.success(this.$t('addSuccess'))
|
||||
this.onClose()
|
||||
this.handleOk()
|
||||
}
|
||||
|
|
|
@ -1,61 +1,70 @@
|
|||
<template>
|
||||
<CustomDrawer
|
||||
wrapClassName="trigger-form"
|
||||
:width="700"
|
||||
:width="910"
|
||||
:title="title"
|
||||
:visible="visible"
|
||||
@close="handleCancel"
|
||||
@ok="handleOk"
|
||||
>
|
||||
<div class="custom-drawer-bottom-action">
|
||||
<a-button type="primary" ghost @click="handleCancel">取消</a-button>
|
||||
<a-button v-if="triggerId" type="danger" @click="handleDetele">删除</a-button>
|
||||
<a-button @click="handleOk" type="primary">确定</a-button>
|
||||
<a-button type="primary" ghost @click="handleCancel">{{ $t('cancel') }}</a-button>
|
||||
<a-button v-if="triggerId" type="danger" @click="handleDetele">{{ $t('delete') }}</a-button>
|
||||
<a-button @click="handleOk" type="primary">{{ $t('confirm') }}</a-button>
|
||||
</div>
|
||||
<a-form-model ref="triggerForm" :model="form" :rules="rules" :label-col="{ span: 3 }" :wrapper-col="{ span: 18 }">
|
||||
<p><strong>基本信息</strong></p>
|
||||
<a-form-model-item label="名称" prop="name">
|
||||
<a-input v-model="form.name" placeholder="请输入名称" />
|
||||
<p>
|
||||
<strong>{{ $t('cmdb.ciType.basicInfo') }}</strong>
|
||||
</p>
|
||||
<a-form-model-item :label="$t('name')" prop="name">
|
||||
<a-input v-model="form.name" :placeholder="$t('cmdb.ciType.nameInputTips')" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="类型">
|
||||
<a-form-model-item :label="$t('type')">
|
||||
<a-radio-group v-model="category">
|
||||
<a-radio-button :value="1">
|
||||
数据变更
|
||||
{{ $t('cmdb.ciType.triggerDataChange') }}
|
||||
</a-radio-button>
|
||||
<a-radio-button :value="2">
|
||||
日期属性
|
||||
{{ $t('cmdb.ciType.triggerDate') }}
|
||||
</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="备注" prop="description">
|
||||
<a-input v-model="form.description" placeholder="请输入备注" />
|
||||
<a-form-model-item :label="$t('desc')" prop="description">
|
||||
<a-input v-model="form.description" :placeholder="$t('cmdb.ciType.descInput')" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="开启" prop="enable">
|
||||
<a-form-model-item :label="$t('cmdb.ciType.triggerEnable')" prop="enable">
|
||||
<a-switch v-model="form.enable" />
|
||||
</a-form-model-item>
|
||||
<template v-if="category === 1">
|
||||
<p><strong>触发条件</strong></p>
|
||||
<a-form-model-item label="事件" prop="action">
|
||||
<p>
|
||||
<strong>{{ $t('cmdb.ciType.triggerCondition') }}</strong>
|
||||
</p>
|
||||
<a-form-model-item :label="$t('cmdb.ciType.event')" prop="action">
|
||||
<a-radio-group v-model="form.action">
|
||||
<a-radio value="0">
|
||||
新增实例
|
||||
{{ $t('cmdb.ciType.addInstance') }}
|
||||
</a-radio>
|
||||
<a-radio value="1">
|
||||
删除实例
|
||||
{{ $t('cmdb.ciType.deleteInstance') }}
|
||||
</a-radio>
|
||||
<a-radio value="2">
|
||||
实例变更
|
||||
{{ $t('cmdb.ciType.changeInstance') }}
|
||||
</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item v-if="form.action === '2'" label="属性" prop="attr_ids">
|
||||
<a-select v-model="form.attr_ids" show-search mode="multiple" placeholder="请选择属性(多选)">
|
||||
<a-form-model-item v-if="form.action === '2'" :label="$t('cmdb.ciType.attributes')" prop="attr_ids">
|
||||
<a-select
|
||||
v-model="form.attr_ids"
|
||||
show-search
|
||||
mode="multiple"
|
||||
:placeholder="$t('cmdb.ciType.selectMutipleAttributes')"
|
||||
>
|
||||
<a-select-option v-for="attr in attrList" :key="attr.id" :value="attr.id">{{
|
||||
attr.alias || attr.name
|
||||
}}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="筛选" class="trigger-form-filter">
|
||||
<a-form-model-item :label="$t('cmdb.ciType.filter')" class="trigger-form-filter">
|
||||
<FilterComp
|
||||
ref="filterComp"
|
||||
:isDropdown="false"
|
||||
|
@ -67,7 +76,9 @@
|
|||
</template>
|
||||
</a-form-model>
|
||||
<template v-if="category === 2">
|
||||
<p><strong>触发条件</strong></p>
|
||||
<p>
|
||||
<strong>{{ $t('cmdb.ciType.triggerCondition') }}</strong>
|
||||
</p>
|
||||
<a-form-model
|
||||
ref="dateForm"
|
||||
:model="dateForm"
|
||||
|
@ -75,14 +86,14 @@
|
|||
:label-col="{ span: 3 }"
|
||||
:wrapper-col="{ span: 18 }"
|
||||
>
|
||||
<a-form-model-item label="属性" prop="attr_id">
|
||||
<a-select v-model="dateForm.attr_id" placeholder="请选择属性(单选)">
|
||||
<a-form-model-item :label="$t('cmdb.ciType.attributes')" prop="attr_id">
|
||||
<a-select v-model="dateForm.attr_id" :placeholder="$t('cmdb.ciType.selectSingleAttribute')">
|
||||
<a-select-option v-for="attr in canAddTriggerAttr" :key="attr.id" :value="attr.id">{{
|
||||
attr.alias || attr.name
|
||||
}}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="筛选" class="trigger-form-filter">
|
||||
<a-form-model-item :label="$t('cmdb.ciType.filter')" class="trigger-form-filter">
|
||||
<FilterComp
|
||||
ref="filterComp"
|
||||
:isDropdown="false"
|
||||
|
@ -91,22 +102,24 @@
|
|||
:expression="filterExp ? `q=${filterExp}` : ''"
|
||||
/>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="提前" prop="before_days">
|
||||
<a-form-model-item :label="$t('cmdb.ciType.beforeDays')" prop="before_days">
|
||||
<a-input-number v-model="dateForm.before_days" :min="0" />
|
||||
天
|
||||
{{ $t('cmdb.ciType.days') }}
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="发送时间" prop="notify_at">
|
||||
<a-form-model-item :label="$t('cmdb.ciType.notifyAt')" prop="notify_at">
|
||||
<a-time-picker v-model="dateForm.notify_at" format="HH:mm" valueFormat="HH:mm" />
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
</template>
|
||||
<p><strong>触发动作</strong></p>
|
||||
<p>
|
||||
<strong>{{ $t('cmdb.ciType.triggerAction') }}</strong>
|
||||
</p>
|
||||
<a-radio-group
|
||||
v-model="triggerAction"
|
||||
:style="{ width: '100%', display: 'flex', justifyContent: 'space-around', marginBottom: '10px' }"
|
||||
>
|
||||
<a-radio value="1">
|
||||
通知
|
||||
{{ $t('cmdb.ciType.notify') }}
|
||||
</a-radio>
|
||||
<a-radio value="2">
|
||||
Webhook
|
||||
|
@ -126,13 +139,13 @@
|
|||
<a-form-model-item label=" " :colon="false">
|
||||
<span class="trigger-tips">{{ tips }}</span>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="收件人" prop="employee_ids" class="trigger-form-employee">
|
||||
<a-form-model-item :label="$t('cmdb.ciType.receivers')" prop="employee_ids" class="trigger-form-employee">
|
||||
<EmployeeTreeSelect multiple v-model="notifies.employee_ids" />
|
||||
<div class="trigger-form-custom-email">
|
||||
<a-textarea
|
||||
v-if="showCustomEmail"
|
||||
v-model="notifies.custom_email"
|
||||
placeholder="请输入邮箱,多个邮箱用;分隔"
|
||||
:placeholder="$t('cmdb.ciType.emailTips')"
|
||||
:rows="1"
|
||||
/>
|
||||
<a-button
|
||||
|
@ -144,37 +157,41 @@
|
|||
type="primary"
|
||||
size="small"
|
||||
class="ops-button-primary"
|
||||
>{{ `${showCustomEmail ? '删除' : '添加'}自定义收件人` }}</a-button
|
||||
>{{ `${showCustomEmail ? $t('delete') : $t('add')}` }}{{ $t('cmdb.ciType.customEmail') }}</a-button
|
||||
>
|
||||
</div>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="通知标题" prop="subject">
|
||||
<a-input v-model="notifies.subject" placeholder="请输入通知标题" />
|
||||
<a-form-model-item :label="$t('cmdb.ciType.notifySubject')" prop="subject">
|
||||
<a-input v-model="notifies.subject" :placeholder="$t('cmdb.ciType.notifySubjectTips')" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="内容" prop="body" :wrapper-col="{ span: 21 }">
|
||||
<a-form-model-item :label="$t('cmdb.ciType.notifyContent')" prop="body" :wrapper-col="{ span: 21 }">
|
||||
<NoticeContent :needOld="category === 1 && form.action === '2'" :attrList="attrList" ref="noticeContent" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="通知方式" prop="method">
|
||||
<a-form-model-item :label="$t('cmdb.ciType.notifyMethod')" prop="method">
|
||||
<a-checkbox-group v-model="notifies.method">
|
||||
<a-row :style="{ marginTop: '4px' }" :gutter="[0, 12]">
|
||||
<a-col :span="6">
|
||||
<a-checkbox value="email"> <ops-icon type="email" style="margin-right:5px" />邮件 </a-checkbox>
|
||||
<a-checkbox value="email">
|
||||
<ops-icon type="email" style="margin-right:5px" />{{ $t('email') }}
|
||||
</a-checkbox>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-checkbox value="wechatApp">
|
||||
<ops-icon type="wechatApp" style="margin-right:5px" />企业微信
|
||||
<ops-icon type="wechatApp" style="margin-right:5px" />{{ $t('wechat') }}
|
||||
</a-checkbox>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-checkbox value="dingdingApp">
|
||||
<ops-icon type="dingdingApp" style="margin-right:5px" />钉钉
|
||||
<ops-icon type="dingdingApp" style="margin-right:5px" />{{ $t('dingding') }}
|
||||
</a-checkbox>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-checkbox value="feishuApp"> <ops-icon type="feishuApp" style="margin-right:5px" />飞书 </a-checkbox>
|
||||
<a-checkbox value="feishuApp">
|
||||
<ops-icon type="feishuApp" style="margin-right:5px" />{{ $t('feishu') }}
|
||||
</a-checkbox>
|
||||
</a-col>
|
||||
<a-col :span="4" :style="{ lineHeight: '32px' }">
|
||||
<ops-icon type="robot" style="margin-right:5px" />机器人:
|
||||
<ops-icon type="robot" style="margin-right:5px" />{{ $t('bot') }}:
|
||||
</a-col>
|
||||
<a-col :span="18">
|
||||
<treeselect
|
||||
|
@ -196,7 +213,7 @@
|
|||
searchable
|
||||
:options="appBot"
|
||||
value-consists-of="LEAF_PRIORITY"
|
||||
placeholder="请选择机器人"
|
||||
:placeholder="$t('cmdb.ciType.botSelect')"
|
||||
:normalizer="
|
||||
(node) => {
|
||||
return {
|
||||
|
@ -208,7 +225,7 @@
|
|||
"
|
||||
appendToBody
|
||||
:zIndex="1050"
|
||||
noChildrenText="暂无数据"
|
||||
:noChildrenText="$t('noData')"
|
||||
>
|
||||
<div
|
||||
:title="node.label"
|
||||
|
@ -297,24 +314,22 @@ export default {
|
|||
defaultForm,
|
||||
defaultDateForm,
|
||||
defaultNotify,
|
||||
tips: '标题、内容可以引用该模型的属性值,引用方法为: {{ attr_name }}',
|
||||
webhookTips: '请求参数可以引用该模型的属性值,引用方法为: {{ attr_name }}',
|
||||
visible: false,
|
||||
category: 1,
|
||||
form: _.cloneDeep(defaultForm),
|
||||
rules: {
|
||||
name: [{ required: true, message: '请填写名称' }],
|
||||
name: [{ required: true, message: this.$t('cmdb.ciType.nameInputTips') }],
|
||||
},
|
||||
dateForm: _.cloneDeep(defaultDateForm),
|
||||
dateFormRules: {
|
||||
attr_id: [{ required: true, message: '请选择属性' }],
|
||||
attr_id: [{ required: true, message: this.$t('cmdb.ciType.selectAttributes') }],
|
||||
},
|
||||
notifies: _.cloneDeep(defaultNotify),
|
||||
notifiesRules: {},
|
||||
WxUsers: [],
|
||||
filterValue: '',
|
||||
triggerId: null,
|
||||
title: '新增触发器',
|
||||
title: this.$t('cmdb.ciType.newTrigger'),
|
||||
attrList: [],
|
||||
filterExp: '',
|
||||
triggerAction: '1',
|
||||
|
@ -337,6 +352,12 @@ export default {
|
|||
}
|
||||
return this.dags
|
||||
},
|
||||
tips() {
|
||||
return this.$t('cmdb.ciType.refAttributeTips')
|
||||
},
|
||||
webhookTips() {
|
||||
return this.$t('cmdb.ciType.webhookRefAttributeTips')
|
||||
},
|
||||
},
|
||||
inject: {
|
||||
refresh: {
|
||||
|
@ -356,7 +377,7 @@ export default {
|
|||
this.getNoticeConfigAppBot()
|
||||
this.attrList = attrList
|
||||
this.triggerId = null
|
||||
this.title = '新增触发器'
|
||||
this.title = this.$t('cmdb.ciType.newTrigger')
|
||||
this.form = _.cloneDeep(this.defaultForm)
|
||||
this.dateForm = _.cloneDeep(this.defaultDateForm)
|
||||
this.notifies = _.cloneDeep(this.defaultNotify)
|
||||
|
@ -376,7 +397,7 @@ export default {
|
|||
this.attrList = attrList
|
||||
if (property.has_trigger) {
|
||||
this.triggerId = property.trigger.id
|
||||
this.title = `编辑触发器 ${property.alias || property.name}`
|
||||
this.title = this.$t('cmdb.ciType.editTriggerTitle', { name: `${property.alias || property.name}` })
|
||||
const { name, description, enable, action = '0', attr_ids, filter = '' } = property?.trigger?.option ?? {}
|
||||
this.filterExp = filter
|
||||
this.$nextTick(() => {
|
||||
|
@ -437,7 +458,7 @@ export default {
|
|||
this.notifies = { employee_ids, custom_email, subject, method: _method }
|
||||
}
|
||||
} else {
|
||||
this.title = `新增触发器 ${property.alias || property.name}`
|
||||
this.title = this.$t('cmdb.ciType.newTriggerTitle', { name: `${property.alias || property.name}` })
|
||||
this.triggerId = null
|
||||
this.form = _.cloneDeep(this.defaultForm)
|
||||
}
|
||||
|
@ -556,11 +577,11 @@ export default {
|
|||
handleDetele() {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: '确认删除该触发器吗?',
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('cmdb.ciType.confirmDeleteTrigger'),
|
||||
onOk() {
|
||||
deleteTrigger(that.CITypeId, that.triggerId).then(() => {
|
||||
that.$message.success('删除成功!')
|
||||
that.$message.success(that.$t('deleteSuccess'))
|
||||
that.handleCancel()
|
||||
if (that.refresh) {
|
||||
that.refresh()
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
size="small"
|
||||
class="ops-button-primary"
|
||||
icon="plus"
|
||||
>新增触发器</a-button
|
||||
>{{ $t('cmdb.ciType.newTrigger') }}</a-button
|
||||
>
|
||||
</div>
|
||||
<vxe-table
|
||||
<ops-table
|
||||
stripe
|
||||
:data="tableData"
|
||||
size="small"
|
||||
|
@ -20,40 +20,20 @@
|
|||
:max-height="windowHeight - 180"
|
||||
class="ops-stripe-table"
|
||||
>
|
||||
<vxe-column field="option.name" title="名称"></vxe-column>
|
||||
<vxe-column field="option.description" title="备注"></vxe-column>
|
||||
<vxe-column field="type" title="类型">
|
||||
<vxe-column field="option.name" :title="$t('name')"></vxe-column>
|
||||
<vxe-column field="option.description" :title="$t('desc')"></vxe-column>
|
||||
<vxe-column field="type" :title="$t('type')">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.attr_id">日期属性</span>
|
||||
<span v-else>数据变更</span>
|
||||
<span v-if="row.attr_id">{{ $t('cmdb.ciType.triggerDate') }}</span>
|
||||
<span v-else>{{ $t('cmdb.ciType.triggerDataChange') }}</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="option.enable" title="开启">
|
||||
<vxe-column field="option.enable" :title="$t('cmdb.ciType.triggerEnable')">
|
||||
<template #default="{ row }">
|
||||
<a-switch :checked="row.option.enable" @click="changeEnable(row)"></a-switch>
|
||||
</template>
|
||||
</vxe-column>
|
||||
|
||||
<!-- <vxe-column field="attr_name" title="属性名"></vxe-column>
|
||||
<vxe-column field="option.subject" title="主题"></vxe-column>
|
||||
<vxe-column field="option.body" title="内容"></vxe-column>
|
||||
<vxe-column field="option.wx_to" title="微信通知">
|
||||
<template #default="{ row }">
|
||||
<span v-for="(person, index) in row.option.wx_to" :key="person + index">[{{ person }}]</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="option.mail_to" title="邮件通知">
|
||||
<template #default="{ row }">
|
||||
<span v-for="(email, index) in row.option.mail_to" :key="email + index">[{{ email }}]</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="option.before_days" title="提前">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.option.before_days">{{ row.option.before_days }}天</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="option.notify_at" title="发送时间"></vxe-column> -->
|
||||
<vxe-column field="operation" title="操作" width="80px" align="center">
|
||||
<vxe-column field="operation" :title="$t('operation')" width="100px" align="center">
|
||||
<template #default="{ row }">
|
||||
<a-space>
|
||||
<a @click="handleEdit(row)"><a-icon type="edit"/></a>
|
||||
|
@ -61,7 +41,7 @@
|
|||
</a-space>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
</ops-table>
|
||||
<TriggerForm ref="triggerForm" :CITypeId="CITypeId" />
|
||||
</div>
|
||||
</template>
|
||||
|
@ -118,11 +98,11 @@ export default {
|
|||
handleDetele(id) {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: '确认删除该触发器吗?',
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('cmdb.ciType.confirmDeleteTrigger'),
|
||||
onOk() {
|
||||
deleteTrigger(that.CITypeId, id).then(() => {
|
||||
that.$message.success('删除成功!')
|
||||
that.$message.success(that.$t('deleteSuccess'))
|
||||
that.getTableData()
|
||||
})
|
||||
},
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
icon="plus"
|
||||
size="small"
|
||||
:style="{ marginBottom: '10px' }"
|
||||
>新增</a-button
|
||||
>{{ $t('new') }}</a-button
|
||||
>
|
||||
<vxe-table
|
||||
<ops-table
|
||||
:loading="loading"
|
||||
:data="tableData"
|
||||
:edit-config="{ trigger: 'manual', mode: 'row', showIcon: false, autoClear: false, showStatus: true }"
|
||||
|
@ -18,8 +18,10 @@
|
|||
ref="xTable"
|
||||
size="mini"
|
||||
keep-source
|
||||
stripe
|
||||
class="ops-stripe-table"
|
||||
>
|
||||
<vxe-column field="attr_ids" title="属性" :edit-render="{}">
|
||||
<vxe-column field="attr_ids" :title="$t('cmdb.ciType.attributes')" :edit-render="{}">
|
||||
<template #default="{ row }">
|
||||
<template v-for="(attr, index) in row.attr_ids">
|
||||
<span :key="attr" :style="{ color: '#2f54eb' }">{{ getDisplayName(attr) }}</span>
|
||||
|
@ -37,9 +39,9 @@
|
|||
</vxe-select>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column filed="opeartion" title="操作" width="100">
|
||||
<vxe-column filed="opeartion" :title="$t('operation')" width="100">
|
||||
<template #default="{ row }">
|
||||
<template v-if="$refs.xTable.isActiveByRow(row)">
|
||||
<template v-if="$refs.xTable.getVxetableRef().isActiveByRow(row)">
|
||||
<a-space>
|
||||
<a> <a-icon @click="saveRowEvent(row)" type="save"/></a>
|
||||
</a-space>
|
||||
|
@ -47,14 +49,14 @@
|
|||
<template v-else>
|
||||
<a-space>
|
||||
<a> <a-icon @click="editRowEvent(row)" type="edit"/></a>
|
||||
<a-popconfirm title="确认删除?" @confirm="removeRowEvent(row)">
|
||||
<a-popconfirm :title="$t('cmdb.ciType.confirmDelete2')" @confirm="removeRowEvent(row)">
|
||||
<a :style="{ color: 'red' }"> <a-icon type="delete"/></a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
</ops-table>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
|
@ -98,7 +100,7 @@ export default {
|
|||
})
|
||||
},
|
||||
async handleAddUnique(row) {
|
||||
const $table = this.$refs.xTable
|
||||
const $table = this.$refs.xTable.getVxetableRef()
|
||||
const record = {
|
||||
attr_ids: [],
|
||||
}
|
||||
|
@ -106,7 +108,7 @@ export default {
|
|||
await $table.setActiveRow(newRow)
|
||||
},
|
||||
saveRowEvent(row) {
|
||||
const $table = this.$refs.xTable
|
||||
const $table = this.$refs.xTable.getVxetableRef()
|
||||
$table.clearActived().then(() => {
|
||||
if (row.id) {
|
||||
updateUniqueConstraint(this.CITypeId, row.id, { attr_ids: row.attr_ids }).then((res) => {
|
||||
|
@ -120,12 +122,12 @@ export default {
|
|||
})
|
||||
},
|
||||
editRowEvent(row) {
|
||||
const $table = this.$refs.xTable
|
||||
const $table = this.$refs.xTable.getVxetableRef()
|
||||
$table.setActiveRow(row)
|
||||
},
|
||||
removeRowEvent(row) {
|
||||
deleteUniqueConstraint(this.CITypeId, row.id).then((res) => {
|
||||
this.$message.success('删除成功!')
|
||||
this.$message.success(this.$t('deleteSuccess'))
|
||||
this.getTableList()
|
||||
})
|
||||
},
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
<span>{{ row[`key${index}`] }}</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="value" title="数量"></vxe-column>
|
||||
<vxe-column field="value" :title="$t('cmdb.custom_dashboard.quantity')"></vxe-column>
|
||||
</template>
|
||||
</vxe-table>
|
||||
<div
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<a-modal
|
||||
width="1100px"
|
||||
:title="`${type === 'add' ? '新增' : '编辑'}图表`"
|
||||
width="1200px"
|
||||
:title="`${type === 'add' ? $t('cmdb.custom_dashboard.newChart') : $t('cmdb.custom_dashboard.editChart')}`"
|
||||
:visible="visible"
|
||||
@cancel="handleclose"
|
||||
@ok="handleok"
|
||||
|
@ -10,10 +10,10 @@
|
|||
<div class="chart-wrapper">
|
||||
<div class="chart-left">
|
||||
<a-form-model ref="chartForm" :model="form" :rules="rules" :label-col="{ span: 4 }" :wrapper-col="{ span: 18 }">
|
||||
<a-form-model-item label="标题" prop="name">
|
||||
<a-input v-model="form.name" placeholder="请输入图表标题"></a-input>
|
||||
<a-form-model-item :label="$t('cmdb.custom_dashboard.title')" prop="name">
|
||||
<a-input v-model="form.name" :placeholder="$t('cmdb.custom_dashboard.titleTips')"></a-input>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="类型" prop="category" v-if="chartType !== 'count' && chartType !== 'table'">
|
||||
<a-form-model-item :label="$t('type')" prop="category" v-if="chartType !== 'count' && chartType !== 'table'">
|
||||
<a-radio-group
|
||||
@change="
|
||||
() => {
|
||||
|
@ -28,7 +28,7 @@
|
|||
</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="类型" prop="tableCategory" v-if="chartType === 'table'">
|
||||
<a-form-model-item :label="$t('type')" prop="tableCategory" v-if="chartType === 'table'">
|
||||
<a-radio-group
|
||||
@change="
|
||||
() => {
|
||||
|
@ -39,16 +39,16 @@
|
|||
v-model="form.tableCategory"
|
||||
>
|
||||
<a-radio-button :value="1">
|
||||
计算指标
|
||||
{{ $t('cmdb.custom_dashboard.calcIndicators') }}
|
||||
</a-radio-button>
|
||||
<a-radio-button :value="2">
|
||||
资源数据
|
||||
{{ $t('cmdb.menu.ciTable') }}
|
||||
</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item
|
||||
v-if="(chartType !== 'table' && form.category !== 2) || (chartType === 'table' && form.tableCategory === 1)"
|
||||
label="模型"
|
||||
:label="$t('cmdb.ciType.ciType')"
|
||||
prop="type_ids"
|
||||
>
|
||||
<a-select
|
||||
|
@ -56,7 +56,7 @@
|
|||
optionFilterProp="children"
|
||||
@change="changeCIType"
|
||||
v-model="form.type_ids"
|
||||
placeholder="请选择模型"
|
||||
:placeholder="$t('cmdb.ciType.selectCIType')"
|
||||
mode="multiple"
|
||||
>
|
||||
<a-select-option v-for="ci_type in ci_types" :key="ci_type.id" :value="ci_type.id">{{
|
||||
|
@ -64,13 +64,13 @@
|
|||
}}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item v-else label="模型" prop="type_id">
|
||||
<a-form-model-item v-else :label="$t('cmdb.ciType.ciType')" prop="type_id">
|
||||
<a-select
|
||||
show-search
|
||||
optionFilterProp="children"
|
||||
@change="changeCIType"
|
||||
v-model="form.type_id"
|
||||
placeholder="请选择模型"
|
||||
:placeholder="$t('cmdb.ciType.selectCIType')"
|
||||
>
|
||||
<a-select-option v-for="ci_type in ci_types" :key="ci_type.id" :value="ci_type.id">{{
|
||||
ci_type.alias || ci_type.name
|
||||
|
@ -78,7 +78,7 @@
|
|||
</a-select>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item
|
||||
label="维度"
|
||||
:label="$t('cmdb.custom_dashboard.dimensions')"
|
||||
prop="attr_ids"
|
||||
v-if="(['bar', 'line', 'pie'].includes(chartType) && form.category === 1) || chartType === 'table'"
|
||||
>
|
||||
|
@ -86,7 +86,7 @@
|
|||
:filter-option="filterOption"
|
||||
@change="changeAttr"
|
||||
v-model="form.attr_ids"
|
||||
placeholder="请选择维度"
|
||||
:placeholder="$t('cmdb.custom_dashboard.selectDimensions')"
|
||||
mode="multiple"
|
||||
show-search
|
||||
>
|
||||
|
@ -100,7 +100,7 @@
|
|||
</a-form-model-item>
|
||||
<a-form-model-item
|
||||
prop="type_ids"
|
||||
label="关系模型"
|
||||
:label="$t('cmdb.custom_dashboard.childCIType')"
|
||||
v-if="['bar', 'line', 'pie'].includes(chartType) && form.category === 2"
|
||||
>
|
||||
<a-select
|
||||
|
@ -108,12 +108,12 @@
|
|||
optionFilterProp="children"
|
||||
mode="multiple"
|
||||
v-model="form.type_ids"
|
||||
placeholder="请选择模型"
|
||||
:placeholder="$t('cmdb.ciType.selectCIType')"
|
||||
>
|
||||
<a-select-opt-group
|
||||
v-for="(key, index) in Object.keys(level2children)"
|
||||
:key="key"
|
||||
:label="`层级${index + 1}`"
|
||||
:label="$t('cmdb.custom_dashboard.level') + `${index + 1}`"
|
||||
>
|
||||
<a-select-option
|
||||
@click="(e) => clickLevel2children(e, citype, index + 1)"
|
||||
|
@ -127,7 +127,11 @@
|
|||
</a-select>
|
||||
</a-form-model-item>
|
||||
<div :class="{ 'chart-left-preview': true, 'chart-left-preview-empty': !isShowPreview }">
|
||||
<span class="chart-left-preview-operation" @click="showPreview"><a-icon type="play-circle" /> 预览</span>
|
||||
<span
|
||||
class="chart-left-preview-operation"
|
||||
@click="showPreview"
|
||||
><a-icon type="play-circle" /> {{ $t('cmdb.custom_dashboard.preview') }}</span
|
||||
>
|
||||
<template v-if="isShowPreview">
|
||||
<div v-if="chartType !== 'count'" class="cmdb-dashboard-grid-item-title">
|
||||
<template v-if="form.showIcon && ciType">
|
||||
|
@ -190,14 +194,19 @@
|
|||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<a-form-model-item label="是否显示icon" prop="showIcon" :label-col="{ span: 5 }" :wrapper-col="{ span: 18 }">
|
||||
<a-form-model-item
|
||||
:label="$t('cmdb.custom_dashboard.showIcon')"
|
||||
prop="showIcon"
|
||||
:label-col="{ span: 5 }"
|
||||
:wrapper-col="{ span: 18 }"
|
||||
>
|
||||
<a-switch v-model="form.showIcon"></a-switch>
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
</div>
|
||||
|
||||
<div class="chart-right">
|
||||
<h4>图表类型</h4>
|
||||
<h4>{{ $t('cmdb.custom_dashboard.chartType') }}</h4>
|
||||
<div class="chart-right-type">
|
||||
<div
|
||||
:class="{ 'chart-right-type-box': true, 'chart-right-type-box-selected': chartType === t.value }"
|
||||
|
@ -209,7 +218,7 @@
|
|||
<span>{{ t.label }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<h4>数据筛选</h4>
|
||||
<h4>{{ $t('cmdb.custom_dashboard.dataFilter') }}</h4>
|
||||
<FilterComp
|
||||
ref="filterComp"
|
||||
:isDropdown="false"
|
||||
|
@ -217,9 +226,9 @@
|
|||
@setExpFromFilter="setExpFromFilter"
|
||||
:expression="filterExp ? `q=${filterExp}` : ''"
|
||||
/>
|
||||
<h4>格式</h4>
|
||||
<h4>{{ $t('cmdb.custom_dashboard.format') }}</h4>
|
||||
<a-form-model :colon="false" :label-col="{ span: 4 }" :wrapper-col="{ span: 20 }">
|
||||
<a-form-model-item label="字体颜色" v-if="chartType === 'count'">
|
||||
<a-form-model-item :label="$t('cmdb.custom_dashboard.fontColor')" v-if="chartType === 'count'">
|
||||
<ColorPicker
|
||||
v-model="fontColor"
|
||||
:colorList="[
|
||||
|
@ -235,7 +244,7 @@
|
|||
]"
|
||||
/>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="背景颜色" v-if="chartType === 'count'">
|
||||
<a-form-model-item :label="$t('cmdb.custom_dashboard.backgroundColor')" v-if="chartType === 'count'">
|
||||
<ColorPicker
|
||||
v-model="bgColor"
|
||||
:colorList="[
|
||||
|
@ -251,10 +260,10 @@
|
|||
]"
|
||||
/>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="图表颜色" v-else-if="chartType !== 'table'">
|
||||
<a-form-model-item :label="$t('cmdb.custom_dashboard.chartColor')" v-else-if="chartType !== 'table'">
|
||||
<ColorListPicker v-model="chartColor" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="图表长度(%)">
|
||||
<a-form-model-item :label="$t('cmdb.custom_dashboard.chartLength') + `(%)`">
|
||||
<a-radio-group class="chart-width" style="width:100%;" v-model="width">
|
||||
<a-radio-button :value="3">
|
||||
25
|
||||
|
@ -270,27 +279,23 @@
|
|||
</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="柱状图类型" v-if="chartType === 'bar'">
|
||||
<a-form-model-item :label="$t('cmdb.custom_dashboard.barType')" v-if="chartType === 'bar'">
|
||||
<a-radio-group v-model="barStack">
|
||||
<a-radio value="total">
|
||||
堆积柱状图
|
||||
{{ $t('cmdb.custom_dashboard.stackedBar') }}
|
||||
</a-radio>
|
||||
<a-radio value="">
|
||||
多系列柱状图
|
||||
{{ $t('cmdb.custom_dashboard.multipleSeriesBar') }}
|
||||
</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="方向" v-if="chartType === 'bar'">
|
||||
<a-form-model-item :label="$t('cmdb.custom_dashboard.direction')" v-if="chartType === 'bar'">
|
||||
<a-radio-group v-model="barDirection">
|
||||
<a-radio value="x">
|
||||
X轴
|
||||
</a-radio>
|
||||
<a-radio value="y">
|
||||
y轴
|
||||
</a-radio>
|
||||
<a-radio value="x"> X {{ $t('cmdb.custom_dashboard.axis') }} </a-radio>
|
||||
<a-radio value="y"> Y {{ $t('cmdb.custom_dashboard.axis') }} </a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="下方阴影" v-if="chartType === 'line'">
|
||||
<a-form-model-item :label="$t('cmdb.custom_dashboard.lowerShadow')" v-if="chartType === 'line'">
|
||||
<a-switch v-model="isShadow" />
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
|
@ -320,31 +325,7 @@ export default {
|
|||
},
|
||||
},
|
||||
data() {
|
||||
const chartTypeList = [
|
||||
{
|
||||
value: 'count',
|
||||
label: '指标',
|
||||
},
|
||||
{
|
||||
value: 'bar',
|
||||
label: '柱状图',
|
||||
},
|
||||
{
|
||||
value: 'line',
|
||||
label: '折线图',
|
||||
},
|
||||
{
|
||||
value: 'pie',
|
||||
label: '饼状图',
|
||||
},
|
||||
{
|
||||
value: 'table',
|
||||
label: '表格',
|
||||
},
|
||||
]
|
||||
return {
|
||||
dashboardCategory,
|
||||
chartTypeList,
|
||||
visible: false,
|
||||
attributes: [],
|
||||
type: 'add',
|
||||
|
@ -360,11 +341,11 @@ export default {
|
|||
},
|
||||
rules: {
|
||||
category: [{ required: true, trigger: 'change' }],
|
||||
name: [{ required: true, message: '请输入图表名称' }],
|
||||
type_id: [{ required: true, message: '请选择模型', trigger: 'change' }],
|
||||
type_ids: [{ required: true, message: '请选择模型', trigger: 'change' }],
|
||||
attr_ids: [{ required: true, message: '请选择模型属性', trigger: 'change' }],
|
||||
level: [{ required: true, message: '请输入关系层级' }],
|
||||
name: [{ required: true, message: this.$t('cmdb.custom_dashboard.titleTips') }],
|
||||
type_id: [{ required: true, message: this.$t('cmdb.ciType.selectCIType'), trigger: 'change' }],
|
||||
type_ids: [{ required: true, message: this.$t('cmdb.ciType.selectCIType'), trigger: 'change' }],
|
||||
attr_ids: [{ required: true, message: this.$t('cmdb.ciType.selectCITypeAttributes'), trigger: 'change' }],
|
||||
level: [{ required: true, message: this.$t('cmdb.custom_dashboard.levelTips') }],
|
||||
showIcon: [{ required: false }],
|
||||
},
|
||||
item: {},
|
||||
|
@ -372,7 +353,7 @@ export default {
|
|||
width: 3,
|
||||
fontColor: '#ffffff',
|
||||
bgColor: ['#6ABFFE', '#5375EB'],
|
||||
chartColor: '#5DADF2,#86DFB7,#5A6F96,#7BD5FF,#FFB980,#4D58D6,#D9B6E9,#8054FF', // 图表颜色
|
||||
chartColor: '#5DADF2,#86DFB7,#5A6F96,#7BD5FF,#FFB980,#4D58D6,#D9B6E9,#8054FF', // chart color
|
||||
isShowPreview: false,
|
||||
filterExp: undefined,
|
||||
previewData: null,
|
||||
|
@ -391,6 +372,33 @@ export default {
|
|||
}
|
||||
return null
|
||||
},
|
||||
chartTypeList() {
|
||||
return [
|
||||
{
|
||||
value: 'count',
|
||||
label: this.$t('cmdb.custom_dashboard.count'),
|
||||
},
|
||||
{
|
||||
value: 'bar',
|
||||
label: this.$t('cmdb.custom_dashboard.bar'),
|
||||
},
|
||||
{
|
||||
value: 'line',
|
||||
label: this.$t('cmdb.custom_dashboard.line'),
|
||||
},
|
||||
{
|
||||
value: 'pie',
|
||||
label: this.$t('cmdb.custom_dashboard.pie'),
|
||||
},
|
||||
{
|
||||
value: 'table',
|
||||
label: this.$t('cmdb.custom_dashboard.table'),
|
||||
},
|
||||
]
|
||||
},
|
||||
dashboardCategory() {
|
||||
return dashboardCategory()
|
||||
},
|
||||
},
|
||||
inject: ['layout'],
|
||||
methods: {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import i18n from '@/lang'
|
||||
|
||||
export const category_1_bar_options = (data, options) => {
|
||||
// 计算一级分类
|
||||
// Calculate first level classification
|
||||
const xData = Object.keys(data)
|
||||
// 计算共有多少二级分类
|
||||
// Calculate how many secondary categories there are
|
||||
const secondCategory = {}
|
||||
Object.keys(data).forEach(key => {
|
||||
if (Object.prototype.toString.call(data[key]) === '[object Object]') {
|
||||
|
@ -9,7 +11,7 @@ export const category_1_bar_options = (data, options) => {
|
|||
secondCategory[key1] = Array.from({ length: xData.length }).fill(0)
|
||||
})
|
||||
} else {
|
||||
secondCategory['其他'] = Array.from({ length: xData.length }).fill(0)
|
||||
secondCategory[i18n.t('other')] = Array.from({ length: xData.length }).fill(0)
|
||||
}
|
||||
})
|
||||
Object.keys(secondCategory).forEach(key => {
|
||||
|
@ -18,7 +20,7 @@ export const category_1_bar_options = (data, options) => {
|
|||
secondCategory[key][idx] = data[x][key]
|
||||
}
|
||||
if (typeof data[x] === 'number') {
|
||||
secondCategory['其他'][idx] = data[x]
|
||||
secondCategory[i18n.t('other')][idx] = data[x]
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -121,7 +123,7 @@ export const category_1_line_options = (data, options) => {
|
|||
}, {
|
||||
offset: 1, color: '#ffffff' // 100% 处的颜色
|
||||
}],
|
||||
global: false // 缺省为 false
|
||||
global: false // default is false
|
||||
}
|
||||
} : null
|
||||
}
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
export const dashboardCategory = {
|
||||
1: { label: '默认' },
|
||||
2: { label: '关系' }
|
||||
import i18n from '@/lang'
|
||||
|
||||
export const dashboardCategory = () => {
|
||||
return {
|
||||
1: { label: i18n.t('cmdb.custom_dashboard.default') },
|
||||
2: { label: i18n.t('cmdb.custom_dashboard.relation') }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
type="primary"
|
||||
icon="plus-circle"
|
||||
class="ops-button-primary"
|
||||
>新增图表</a-button
|
||||
>{{ $t('cmdb.custom_dashboard.newChart') }}</a-button
|
||||
>
|
||||
</div>
|
||||
<GridLayout
|
||||
|
@ -78,10 +78,10 @@
|
|||
></a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a @click="() => openChartForm('edit', item)"><a-icon style="margin-right:5px" type="edit" />编辑</a>
|
||||
<a @click="() => openChartForm('edit', item)"><a-icon style="margin-right:5px" type="edit" />{{ $t('edit') }}</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a @click="deleteChart(item)"><a-icon style="margin-right:5px" type="delete" />删除</a>
|
||||
<a @click="deleteChart(item)"><a-icon style="margin-right:5px" type="delete" />{{ $t('delete') }}</a>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
|
@ -116,7 +116,7 @@
|
|||
>
|
||||
定制仪表盘
|
||||
</a-button>
|
||||
<span v-else>管理员暂未定制仪表盘</span>
|
||||
<span v-else>{{ $t('cmdb.custom_dashboard.noCustomDashboard') }}</span>
|
||||
</div>
|
||||
<ChartForm ref="chartForm" @refresh="refresh" :ci_types="ci_types" :totalData="totalData" />
|
||||
</div>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
/></a>
|
||||
</a-space>
|
||||
<a v-else @click="handleEdit"><a-icon type="eye"/></a>
|
||||
<span>{{ rule.is_plugin ? 'Plugin' : '默认' }}</span>
|
||||
<span>{{ rule.is_plugin ? 'Plugin' : $t('cmdb.custom_dashboard.default') }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
@ -57,7 +57,7 @@ export default {
|
|||
return this.rule?.option?.icon ?? { color: '', name: 'caise-wuliji' }
|
||||
},
|
||||
isDeletable() {
|
||||
return !['物理机', '虚拟机', '网卡', '硬盘', 'server', 'vserver', 'NIC', 'harddisk'].includes(this.rule.name)
|
||||
return ![this.$t('cmdb.ad.server'), this.$t('cmdb.ad.vserver'), this.$t('cmdb.ad.nic'), this.$t('cmdb.ad.disk'), 'server', 'vserver', 'NIC', 'harddisk'].includes(this.rule.name)
|
||||
},
|
||||
},
|
||||
inject: {
|
||||
|
|
|
@ -8,21 +8,21 @@
|
|||
:label-col="{ span: 2 }"
|
||||
:wrapper-col="{ span: 20 }"
|
||||
>
|
||||
<a-divider :style="{ margin: '5px 0' }">基础设置</a-divider>
|
||||
<a-form-model-item label="名称" prop="name">
|
||||
<a-divider :style="{ margin: '5px 0' }">{{ $t('cmdb.ciType.basicConfig') }}</a-divider>
|
||||
<a-form-model-item :label="$t('name')" prop="name">
|
||||
<a-input v-model="form.name" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="图标" v-if="is_inner">
|
||||
<a-form-model-item :label="$t('icon')" v-if="is_inner">
|
||||
<CustomIconSelect v-model="customIcon" :style="{ marginTop: '6px' }" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="模式" prop="is_plugin">
|
||||
<a-form-model-item :label="$t('cmdb.ad.mode')" prop="is_plugin">
|
||||
<a-radio-group v-model="form.is_plugin" @change="changeIsPlugin" :disabled="!is_inner">
|
||||
<a-radio :value="false">默认</a-radio>
|
||||
<a-radio :value="false">{{ $t('cmdb.custom_dashboard.default') }}</a-radio>
|
||||
<a-radio :value="true">plugin</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-model-item>
|
||||
</a-form-model>
|
||||
<a-divider :style="{ margin: '5px 0' }">采集设置</a-divider>
|
||||
<a-divider :style="{ margin: '5px 0' }">{{ $t('cmdb.ad.collectSettings') }}</a-divider>
|
||||
<CustomCodeMirror
|
||||
codeMirrorId="cmdb-adt"
|
||||
v-if="form.is_plugin"
|
||||
|
@ -36,7 +36,7 @@
|
|||
type="primary"
|
||||
ghost
|
||||
@click="handleSubmit(true)"
|
||||
>更新字段</a-button
|
||||
>{{ $t('cmdb.ad.updateFields') }}</a-button
|
||||
>
|
||||
</div>
|
||||
<a-button
|
||||
|
@ -47,7 +47,7 @@
|
|||
icon="plus"
|
||||
:style="{ marginBottom: '10px' }"
|
||||
@click="insertEvent(-1)"
|
||||
>新增</a-button
|
||||
>{{ $t('new') }}</a-button
|
||||
>
|
||||
<vxe-table
|
||||
size="mini"
|
||||
|
@ -60,24 +60,24 @@
|
|||
:data="tableData"
|
||||
:edit-config="{ trigger: 'manual', mode: 'row' }"
|
||||
>
|
||||
<vxe-column field="name" title="名称" :edit-render="{ autofocus: '.vxe-input--inner' }">
|
||||
<vxe-column field="name" :title="$t('name')" :edit-render="{ autofocus: '.vxe-input--inner' }">
|
||||
<template #edit="{ row }">
|
||||
<vxe-input v-model="row.name" type="text"></vxe-input>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="type" title="类型" :edit-render="{}">
|
||||
<vxe-column field="type" :title="$t('type')" :edit-render="{}">
|
||||
<template #edit="{ row }">
|
||||
<vxe-select v-model="row.type" transfer>
|
||||
<vxe-option v-for="item in typeList" :key="item" :value="item" :label="item"></vxe-option>
|
||||
</vxe-select>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="desc" title="描述" :edit-render="{ autofocus: '.vxe-input--inner' }">
|
||||
<vxe-column field="desc" :title="$t('desc')" :edit-render="{ autofocus: '.vxe-input--inner' }">
|
||||
<template #edit="{ row }">
|
||||
<vxe-input v-model="row.desc" type="text"></vxe-input>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column title="操作" width="60" v-if="!form.is_plugin">
|
||||
<vxe-column :title="$t('operation')" width="60" v-if="!form.is_plugin">
|
||||
<template #default="{ row }">
|
||||
<a-space v-if="$refs.xTable.isActiveByRow(row)">
|
||||
<a @click="saveRowEvent(row)"><a-icon type="save"/></a>
|
||||
|
@ -92,8 +92,8 @@
|
|||
</vxe-table>
|
||||
|
||||
<div class="custom-drawer-bottom-action">
|
||||
<a-button @click="handleClose">取消</a-button>
|
||||
<a-button @click="handleSubmit(false)" type="primary">保存</a-button>
|
||||
<a-button @click="handleClose">{{ $t('cancel') }}</a-button>
|
||||
<a-button @click="handleSubmit(false)" type="primary">{{ $t('save') }}</a-button>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
|
@ -119,53 +119,7 @@ export default {
|
|||
},
|
||||
},
|
||||
data() {
|
||||
const default_plugin_script = `# -*- coding:utf-8 -*-
|
||||
|
||||
import json
|
||||
|
||||
|
||||
class AutoDiscovery(object):
|
||||
|
||||
@property
|
||||
def unique_key(self):
|
||||
"""
|
||||
|
||||
:return: 返回唯一属性的名字
|
||||
"""
|
||||
return
|
||||
|
||||
@staticmethod
|
||||
def attributes():
|
||||
"""
|
||||
定义属性字段
|
||||
:return: 返回属性字段列表, 列表项是(名称, 类型, 描述), 名称必须是英文
|
||||
类型: String Integer Float Date DateTime Time JSON
|
||||
例如:
|
||||
return [
|
||||
("ci_type", "String", "模型名称"),
|
||||
("private_ip", "String", "内网IP, 多值逗号分隔")
|
||||
]
|
||||
"""
|
||||
return []
|
||||
|
||||
@staticmethod
|
||||
def run():
|
||||
"""
|
||||
执行入口, 返回采集的属性值
|
||||
:return: 返回一个列表, 列表项是字典, 字典key是属性名称, value是属性值
|
||||
例如:
|
||||
return [dict(ci_type="server", private_ip="192.168.1.1")]
|
||||
"""
|
||||
return []
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
result = AutoDiscovery().run()
|
||||
if isinstance(result, list):
|
||||
print("AutoDiscovery::Result::{}".format(json.dumps(result)))
|
||||
else:
|
||||
print("ERROR: 采集返回必须是列表")
|
||||
`
|
||||
const default_plugin_script = this.$t('cmdb.ad.pluginScript')
|
||||
const typeList = ['String', 'Integer', 'Float', 'Date', 'DateTime', 'Time', 'JSON']
|
||||
return {
|
||||
default_plugin_script,
|
||||
|
@ -196,9 +150,9 @@ if __name__ == "__main__":
|
|||
return this.ruleData.name
|
||||
}
|
||||
if (this.type === 'edit') {
|
||||
return `编辑:${this.ruleData.name}`
|
||||
return this.$t('edit') + `:${this.ruleData.name}`
|
||||
}
|
||||
return '新建'
|
||||
return this.$t('new')
|
||||
},
|
||||
},
|
||||
inject: {
|
||||
|
@ -278,7 +232,7 @@ if __name__ == "__main__":
|
|||
cancelRowEvent(row) {
|
||||
const $table = this.$refs.xTable
|
||||
$table.clearActived().then(() => {
|
||||
// 还原行数据
|
||||
// Restore row data
|
||||
$table.revertData(row)
|
||||
})
|
||||
},
|
||||
|
@ -312,7 +266,7 @@ if __name__ == "__main__":
|
|||
this.tableData = res.attributes
|
||||
this.type = 'edit'
|
||||
this.ruleData = res
|
||||
this.$message.success('更新成功!')
|
||||
this.$message.success(this.$t('updateSuccess'))
|
||||
if (this.is_inner) {
|
||||
this.getDiscovery()
|
||||
}
|
||||
|
@ -321,7 +275,7 @@ if __name__ == "__main__":
|
|||
this.handleClose()
|
||||
console.log(this.is_inner)
|
||||
if (this.is_inner) {
|
||||
this.$message.success('保存成功!')
|
||||
this.$message.success(this.$t('saveSuccess'))
|
||||
this.getDiscovery()
|
||||
} else {
|
||||
this.$emit('updateNotInner', res)
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
<div :style="{ textAlign: 'right' }">
|
||||
<a-space v-if="!isSelected">
|
||||
<a-upload name="file" :multiple="false" accept=".json" :fileList="[]" :beforeUpload="beforeUpload">
|
||||
<a><a-icon type="upload" />规则导入</a>
|
||||
<a><a-icon type="upload" />{{ $t('cmdb.ad.upload') }}</a>
|
||||
</a-upload>
|
||||
<a @click="download"><a-icon type="download" />规则导出</a>
|
||||
<a @click="download"><a-icon type="download" />{{ $t('cmdb.ad.download') }}</a>
|
||||
</a-space>
|
||||
</div>
|
||||
<div v-for="{ type, label } in typeCategory" :key="type">
|
||||
|
@ -45,22 +45,26 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
typeCategory: [
|
||||
typeCategoryChildren: { agent: [], snmp: [], http: [] },
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
typeCategory() {
|
||||
return [
|
||||
{
|
||||
type: 'agent',
|
||||
label: '内置 & 插件',
|
||||
label: this.$t('cmdb.ad.agent'),
|
||||
},
|
||||
{
|
||||
type: 'snmp',
|
||||
label: '网络设备',
|
||||
label: this.$t('cmdb.ad.snmp'),
|
||||
},
|
||||
{
|
||||
type: 'http',
|
||||
label: '公有云资源',
|
||||
label: this.$t('cmdb.ad.http'),
|
||||
},
|
||||
],
|
||||
typeCategoryChildren: { agent: [], snmp: [], http: [] },
|
||||
}
|
||||
]
|
||||
},
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
|
@ -87,11 +91,11 @@ export default {
|
|||
deleteRule(rule) {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: `确认删除 【${rule.name}】?`,
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('confirmDelete', { name: `${rule.name}` }),
|
||||
onOk() {
|
||||
deleteDiscovery(rule.id).then(() => {
|
||||
that.$message.success('删除成功!')
|
||||
that.$message.success(that.$t('deleteSuccess'))
|
||||
that.getDiscovery()
|
||||
})
|
||||
},
|
||||
|
@ -99,13 +103,14 @@ export default {
|
|||
},
|
||||
download() {
|
||||
const x = new XMLHttpRequest()
|
||||
const that = this
|
||||
x.open('GET', `/api/v0.1/adr/template/export/file`, true)
|
||||
x.responseType = 'blob'
|
||||
x.onload = function(e) {
|
||||
const url = window.URL.createObjectURL(x.response)
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.download = `自动发现规则`
|
||||
a.download = that.$t('cmdb.ad.rule')
|
||||
a.click()
|
||||
}
|
||||
x.send()
|
||||
|
@ -120,13 +125,13 @@ export default {
|
|||
const state = Number(xhr.readyState)
|
||||
if (state === 4) {
|
||||
if (xhr.status === 200) {
|
||||
that.$message.success('上传成功')
|
||||
that.$message.success(that.$t('uploadSuccess'))
|
||||
that.getDiscovery()
|
||||
}
|
||||
}
|
||||
}
|
||||
xhr.ontimeout = function() {
|
||||
that.$httpError('超时错误')
|
||||
that.$httpError(that.$t('cmdb.ad.timeout'))
|
||||
}
|
||||
|
||||
xhr.send(formData)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<template #one>
|
||||
<div v-for="group in ci_types_list" :key="group.id">
|
||||
<div>
|
||||
<strong>{{ group.name || '其他' }}</strong
|
||||
<strong>{{ group.name || $t('other') }}</strong
|
||||
><span :style="{ color: 'rgb(195, 205, 215)' }">({{ group.ci_types.length }})</span>
|
||||
</div>
|
||||
<div
|
||||
|
@ -33,17 +33,17 @@
|
|||
<template #two>
|
||||
<div id="discovery-ci">
|
||||
<a-input-search
|
||||
placeholder="请查找"
|
||||
:placeholder="$t('cmdb.components.pleaseSearch')"
|
||||
class="ops-input ops-input-radius"
|
||||
:style="{ width: '200px', marginRight: '20px', marginBottom: '10px' }"
|
||||
@search="handleSearch"
|
||||
allowClear
|
||||
/>
|
||||
<div class="ops-list-batch-action" :style="{ marginBottom: '10px' }" v-show="!!selectedRowKeys.length">
|
||||
<span @click="batchAccept">入库</span>
|
||||
<span @click="batchAccept">{{ $t('cmdb.ad.accept') }}</span>
|
||||
<a-divider type="vertical" />
|
||||
<span @click="batchDelete">删除</span>
|
||||
<span>选取:{{ selectedRowKeys.length }} 项</span>
|
||||
<span @click="batchDelete">{{ $t('delete') }}</span>
|
||||
<span>{{ $t('cmdb.ci.selectRows', { rows: selectedRowKeys.length }) }}</span>
|
||||
</div>
|
||||
<ops-table
|
||||
show-overflow
|
||||
|
@ -79,33 +79,33 @@
|
|||
<vxe-column
|
||||
align="center"
|
||||
field="is_accept"
|
||||
title="是否入库"
|
||||
:title="$t('cmdb.ad.isAccpet')"
|
||||
v-bind="columns.length ? { width: '100px' } : { minWidth: '100px' }"
|
||||
:filters="[
|
||||
{ label: '是', value: true },
|
||||
{ label: '否', value: false },
|
||||
{ label: $t('yes'), value: true },
|
||||
{ label: $t('no'), value: false },
|
||||
]"
|
||||
>
|
||||
<template #default="{row}">
|
||||
{{ row.is_accept ? '是' : '否' }}
|
||||
{{ row.is_accept ? $t('yes') : $t('no') }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column
|
||||
field="accept_by"
|
||||
title="入库人"
|
||||
:title="$t('cmdb.ad.accpetBy')"
|
||||
v-bind="columns.length ? { width: '80px' } : { minWidth: '80px' }"
|
||||
:filters="[]"
|
||||
></vxe-column>
|
||||
<vxe-column
|
||||
field="accept_time"
|
||||
title="入库时间"
|
||||
:title="$t('cmdb.ad.acceptTime')"
|
||||
sortable
|
||||
v-bind="columns.length ? { width: '130px' } : { minWidth: '130px' }"
|
||||
></vxe-column>
|
||||
<vxe-column title="操作" v-bind="columns.length ? { width: '60px' } : { minWidth: '60px' }" align="center">
|
||||
<vxe-column :title="$t('operation')" v-bind="columns.length ? { width: '60px' } : { minWidth: '60px' }" align="center">
|
||||
<template #default="{row}">
|
||||
<a-space>
|
||||
<a-tooltip title="入库">
|
||||
<a-tooltip :title="$t('cmdb.ad.accept')">
|
||||
<a v-if="!row.is_accept" @click="accept(row)"><ops-icon type="icon-xianxing-edit"/></a>
|
||||
</a-tooltip>
|
||||
<a :style="{ color: 'red' }" @click="deleteADC(row)"><ops-icon type="icon-xianxing-delete"/></a>
|
||||
|
@ -115,7 +115,7 @@
|
|||
<template #empty>
|
||||
<div>
|
||||
<img :style="{ width: '200px' }" :src="require('@/assets/data_empty.png')" />
|
||||
<div>暂无数据</div>
|
||||
<div>{{ $t('noData') }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</ops-table>
|
||||
|
@ -242,11 +242,11 @@ export default {
|
|||
this.$refs.xTable.getVxetableRef().clearCheckboxReserve()
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: `确认入库?`,
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('cmdb.ad.confirmAccept'),
|
||||
onOk() {
|
||||
updateADCAccept(row.id).then(() => {
|
||||
that.$message.success('入库成功')
|
||||
that.$message.success(that.$t('cmdb.ad.accpetSuccess'))
|
||||
that.getAdc(false)
|
||||
})
|
||||
},
|
||||
|
@ -258,11 +258,11 @@ export default {
|
|||
this.$refs.xTable.getVxetableRef().clearCheckboxReserve()
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: `确认删除该条数据?`,
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('cmdb.ad.deleteADC'),
|
||||
onOk() {
|
||||
deleteAdc(row.id).then(() => {
|
||||
that.$message.success('删除成功')
|
||||
that.$message.success(that.$t('deleteSuccess'))
|
||||
that.getAdc(false)
|
||||
})
|
||||
},
|
||||
|
@ -273,7 +273,7 @@ export default {
|
|||
for (let i = 0; i < this.selectedRowKeys.length; i++) {
|
||||
await updateADCAccept(this.selectedRowKeys[i])
|
||||
}
|
||||
this.$message.success('入库成功')
|
||||
this.$message.success(this.$t('cmdb.ad.acceptSuccess'))
|
||||
this.getAdc(false)
|
||||
this.selectedRowKeys = []
|
||||
this.$refs.xTable.getVxetableRef().clearCheckboxRow()
|
||||
|
@ -283,13 +283,13 @@ export default {
|
|||
async batchDelete() {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: `确认删除这些数据?`,
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('cmdb.ad.batchDelete'),
|
||||
async onOk() {
|
||||
for (let i = 0; i < that.selectedRowKeys.length; i++) {
|
||||
await deleteAdc(that.selectedRowKeys[i])
|
||||
}
|
||||
that.$message.success('删除成功')
|
||||
that.$message.success(that.$t('deleteSuccess'))
|
||||
that.getAdc(false)
|
||||
that.selectedRowKeys = []
|
||||
that.$refs.xTable.getVxetableRef().clearCheckboxRow()
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<template>
|
||||
<div class="model-relation">
|
||||
<a-button @click="handleCreate" type="primary" style="margin-bottom: 15px;" icon="plus">新增关系</a-button>
|
||||
<a-button @click="handleCreate" type="primary" style="margin-bottom: 15px;" icon="plus">{{
|
||||
$t('cmdb.ciType.addRelation')
|
||||
}}</a-button>
|
||||
<model-relation-table ref="table"></model-relation-table>
|
||||
<a-modal
|
||||
:closable="false"
|
||||
|
@ -11,11 +13,14 @@
|
|||
width="500px"
|
||||
>
|
||||
<a-form :form="form" @submit="handleSubmit" :label-col="{ span: 6 }" :wrapper-col="{ span: 14 }">
|
||||
<a-form-item label="源模型">
|
||||
<a-form-item :label="$t('cmdb.ciType.sourceCIType')">
|
||||
<a-select
|
||||
showSearch
|
||||
name="source_ci_type_id"
|
||||
v-decorator="['source_ci_type_id', { rules: [{ required: true, message: '请选择源模型' }] }]"
|
||||
v-decorator="[
|
||||
'source_ci_type_id',
|
||||
{ rules: [{ required: true, message: $t('cmdb.ciType.sourceCITypeTips') }] },
|
||||
]"
|
||||
@change="handleSourceTypeChange"
|
||||
:filterOption="filterOption"
|
||||
>
|
||||
|
@ -24,11 +29,11 @@
|
|||
}}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="目标模型">
|
||||
<a-form-item :label="$t('cmdb.ciType.dstCIType')">
|
||||
<a-select
|
||||
showSearch
|
||||
name="ci_type_id"
|
||||
v-decorator="['ci_type_id', { rules: [{ required: true, message: '请选择目标模型' }] }]"
|
||||
v-decorator="['ci_type_id', { rules: [{ required: true, message: $t('cmdb.ciType.dstCITypeTips') }] }]"
|
||||
@change="handleTargetTypeChange"
|
||||
:filterOption="filterOption"
|
||||
>
|
||||
|
@ -38,10 +43,13 @@
|
|||
</a-select>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="关联关系">
|
||||
<a-form-item :label="$t('cmdb.ciType.relationType')">
|
||||
<a-select
|
||||
name="relation_type_id"
|
||||
v-decorator="['relation_type_id', { rules: [{ required: true, message: '请选择关联关系' }] }]"
|
||||
v-decorator="[
|
||||
'relation_type_id',
|
||||
{ rules: [{ required: true, message: $t('cmdb.ciType.relationTypeTips') }] },
|
||||
]"
|
||||
>
|
||||
<a-select-option :value="relationType.id" :key="relationType.id" v-for="relationType in relationTypes">{{
|
||||
relationType.name
|
||||
|
@ -49,11 +57,16 @@
|
|||
</a-select>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="关联约束">
|
||||
<a-select v-decorator="['constraint', { rules: [{ required: true, message: '请选择关联约束' }] }]">
|
||||
<a-select-option value="0">一对多</a-select-option>
|
||||
<a-select-option value="1">一对一</a-select-option>
|
||||
<a-select-option value="2">多对多</a-select-option>
|
||||
<a-form-item :label="$t('cmdb.ciType.relationConstraint')">
|
||||
<a-select
|
||||
v-decorator="[
|
||||
'constraint',
|
||||
{ rules: [{ required: true, message: $t('cmdb.ciType.relationConstraintTips') }] },
|
||||
]"
|
||||
>
|
||||
<a-select-option value="0">{{ $t('cmdb.ciType.one2Many') }}</a-select-option>
|
||||
<a-select-option value="1">{{ $t('cmdb.ciType.one2One') }}</a-select-option>
|
||||
<a-select-option value="2">{{ $t('cmdb.ciType.many2Many') }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
@ -66,7 +79,7 @@ import ModelRelationTable from './modules/modelRelationTable.vue'
|
|||
import { searchResourceType } from '@/modules/acl/api/resource'
|
||||
import { getCITypeGroupsConfig } from '@/modules/cmdb/api/ciTypeGroup'
|
||||
import { getCITypes } from '@/modules/cmdb/api/CIType'
|
||||
import { createRelation, deleteRelation, getRelationTypes } from '@/modules/cmdb/api/CITypeRelation'
|
||||
import { createRelation, deleteRelation, getCITypeChildren, getRelationTypes } from '@/modules/cmdb/api/CITypeRelation'
|
||||
export default {
|
||||
name: 'Index',
|
||||
components: {
|
||||
|
@ -85,16 +98,40 @@ export default {
|
|||
drawerTitle: '',
|
||||
CITypes: [],
|
||||
relationTypes: [],
|
||||
constraintMap: {
|
||||
'0': '一对多',
|
||||
'1': '一对一',
|
||||
'2': '多对多',
|
||||
},
|
||||
|
||||
sourceCITypeId: undefined,
|
||||
targetCITypeId: undefined,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
currentCId() {
|
||||
if (this.currentId) {
|
||||
if (this.currentId.split('%')[1] !== 'null') {
|
||||
return Number(this.currentId.split('%')[1])
|
||||
}
|
||||
return null
|
||||
}
|
||||
return null
|
||||
},
|
||||
displayCITypes() {
|
||||
return this.CITypes
|
||||
// return this.CITypes.filter((c) => c.id !== this.targetCITypeId)
|
||||
},
|
||||
displayTargetCITypes() {
|
||||
return this.CITypes
|
||||
// return this.CITypes.filter((c) => c.id !== this.sourceCITypeId)
|
||||
},
|
||||
CITypeId() {
|
||||
return this.currentCId
|
||||
},
|
||||
constraintMap() {
|
||||
return {
|
||||
'0': this.$t('cmdb.ciType.one2Many'),
|
||||
'1': this.$t('cmdb.ciType.one2One'),
|
||||
'2': this.$t('cmdb.ciType.many2Many'),
|
||||
}
|
||||
},
|
||||
},
|
||||
provide() {
|
||||
return {
|
||||
resource_type: () => {
|
||||
|
@ -116,26 +153,6 @@ export default {
|
|||
})
|
||||
this.loadCITypes(!_currentId)
|
||||
},
|
||||
computed: {
|
||||
currentCId() {
|
||||
if (this.currentId) {
|
||||
if (this.currentId.split('%')[1] !== 'null') {
|
||||
return Number(this.currentId.split('%')[1])
|
||||
}
|
||||
return null
|
||||
}
|
||||
return null
|
||||
},
|
||||
displayCITypes() {
|
||||
return this.CITypes
|
||||
},
|
||||
displayTargetCITypes() {
|
||||
return this.CITypes
|
||||
},
|
||||
CITypeId() {
|
||||
return this.currentCId
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
async loadCITypes(isResetCurrentId = false) {
|
||||
const groups = await getCITypeGroupsConfig({ need_other: true })
|
||||
|
@ -146,7 +163,6 @@ export default {
|
|||
this.$nextTick(() => {
|
||||
groups.forEach((g) => {
|
||||
if (!g.id) {
|
||||
// 给未分组增加一个假的id
|
||||
g.id = -1
|
||||
}
|
||||
if (isResetCurrentId && !alreadyReset && g.ci_types && g.ci_types.length) {
|
||||
|
@ -172,7 +188,7 @@ export default {
|
|||
})
|
||||
},
|
||||
handleCreate() {
|
||||
this.drawerTitle = '新增关系'
|
||||
this.drawerTitle = this.$t('cmdb.ciType.addRelation')
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue({
|
||||
|
@ -192,7 +208,7 @@ export default {
|
|||
if (!err) {
|
||||
createRelation(values.source_ci_type_id, values.ci_type_id, values.relation_type_id, values.constraint).then(
|
||||
(res) => {
|
||||
this.$message.success(`添加成功`)
|
||||
this.$message.success(this.$t('addSuccess'))
|
||||
this.onClose()
|
||||
this.handleOk()
|
||||
}
|
||||
|
@ -207,7 +223,7 @@ export default {
|
|||
},
|
||||
handleDelete(record) {
|
||||
deleteRelation(record.source_ci_type_id, record.id).then((res) => {
|
||||
this.$message.success(`删除成功!`)
|
||||
this.$message.success(this.$t('deleteSuccess'))
|
||||
|
||||
this.handleOk()
|
||||
})
|
||||
|
|
|
@ -11,22 +11,27 @@
|
|||
:data="tableData"
|
||||
:sort-config="{ defaultSort: { field: 'created_at', order: 'desc' } }"
|
||||
>
|
||||
<vxe-column field="created_at" title="创建时间" sortable width="159px"></vxe-column>
|
||||
<vxe-column field="parent.alias" title="源模型"></vxe-column>
|
||||
<vxe-column field="relation_type_id" title="关系" :filters="[{ data: '' }]" :filter-multiple="false">
|
||||
<vxe-column field="created_at" :title="$t('created_at')" sortable width="159px"></vxe-column>
|
||||
<vxe-column field="parent.alias" :title="$t('cmdb.ciType.sourceCIType')"></vxe-column>
|
||||
<vxe-column
|
||||
field="relation_type_id"
|
||||
:title="$t('cmdb.custom_dashboard.relation')"
|
||||
:filters="[{ data: '' }]"
|
||||
:filter-multiple="false"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<a-tag color="cyan">
|
||||
{{ row.relation_type.name }}
|
||||
</a-tag>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="child.alias" title="目标模型"></vxe-column>
|
||||
<vxe-column field="constraint" title="关联约束"></vxe-column>
|
||||
<vxe-column field="authorization" title="操作" width="89px">
|
||||
<vxe-column field="child.alias" :title="$t('cmdb.ciType.dstCIType')"></vxe-column>
|
||||
<vxe-column field="constraint" :title="$t('cmdb.ciType.relationConstraint')"></vxe-column>
|
||||
<vxe-column field="authorization" :title="$t('operation')" width="89px">
|
||||
<template #default="{ row }">
|
||||
<a-space>
|
||||
<a @click="handleOpenGrant(row)"><a-icon type="user-add"/></a>
|
||||
<a-popconfirm title="确认删除?" @confirm="deleteRelation(row)">
|
||||
<a-popconfirm :title="$t('cmdb.ciType.confirmDelete2')" @confirm="deleteRelation(row)">
|
||||
<a :style="{ color: 'red' }"><ops-icon type="icon-xianxing-delete"/></a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
|
@ -48,11 +53,6 @@ export default {
|
|||
drawerVisible: false,
|
||||
tableData: [],
|
||||
relationTypeList: null,
|
||||
constraintMap: {
|
||||
'0': '一对多',
|
||||
'1': '一对一',
|
||||
'2': '多对多',
|
||||
},
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
@ -65,6 +65,13 @@ export default {
|
|||
windowHeight() {
|
||||
return this.$store.state.windowHeight
|
||||
},
|
||||
constraintMap() {
|
||||
return {
|
||||
'0': this.$t('cmdb.ciType.one2Many'),
|
||||
'1': this.$t('cmdb.ciType.one2One'),
|
||||
'2': this.$t('cmdb.ciType.many2Many'),
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
async refresh() {
|
||||
|
@ -103,7 +110,8 @@ export default {
|
|||
},
|
||||
deleteRelation(row) {
|
||||
deleteRelation(row.parent_id, row.child_id).then((res) => {
|
||||
this.$message.success(`删除成功!`)
|
||||
this.$message.success(this.$t('deleteSuccess'))
|
||||
this.getRelationTypes()
|
||||
this.refresh()
|
||||
})
|
||||
},
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
<div>
|
||||
<a-card :bordered="false">
|
||||
<a-tabs default-active-key="1">
|
||||
<a-tab-pane key="1" tab="CI变更">
|
||||
<a-tab-pane key="1" :tab="$t('cmdb.history.ciChange')">
|
||||
<ci-table></ci-table>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" tab="关系变更">
|
||||
<a-tab-pane key="2" :tab="$t('cmdb.history.relationChange')">
|
||||
<relation-table></relation-table>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="3" tab="模型变更">
|
||||
<a-tab-pane key="3" :tab="$t('cmdb.history.ciTypeChange')">
|
||||
<type-table></type-table>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="4" tab="触发历史">
|
||||
<a-tab-pane key="4" :tab="$t('cmdb.history.triggerHistory')">
|
||||
<TriggerTable></TriggerTable>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
|
|
|
@ -20,33 +20,39 @@
|
|||
:data="tableData"
|
||||
:max-height="`${windowHeight - windowHeightMinus}px`"
|
||||
:span-method="mergeRowMethod"
|
||||
:scroll-y="{enabled: false}"
|
||||
:scroll-y="{ enabled: false }"
|
||||
class="ops-unstripe-table"
|
||||
>
|
||||
<vxe-column field="created_at" width="159px" title="操作时间"></vxe-column>
|
||||
<vxe-column field="user" width="100px" title="用户">
|
||||
<vxe-column field="created_at" width="159px" :title="$t('cmdb.history.opreateTime')"></vxe-column>
|
||||
<vxe-column field="user" width="100px" :title="$t('cmdb.history.user')">
|
||||
<template #header="{ column }">
|
||||
<span>{{ column.title }}</span>
|
||||
<a-popover trigger="click" placement="bottom">
|
||||
<a-icon class="filter" type="filter" theme="filled"/>
|
||||
<a-icon class="filter" type="filter" theme="filled" />
|
||||
<a slot="content">
|
||||
<a-input placeholder="输入筛选用户名" size="small" v-model="queryParams.username" style="width: 200px" allowClear/>
|
||||
<a-button type="link" class="filterButton" @click="filterUser">筛选</a-button>
|
||||
<a-button type="link" class="filterResetButton" @click="filterUserReset">重置</a-button>
|
||||
<a-input
|
||||
:placeholder="$t('cmdb.history.userTips')"
|
||||
size="small"
|
||||
v-model="queryParams.username"
|
||||
style="width: 200px"
|
||||
allowClear
|
||||
/>
|
||||
<a-button type="link" class="filterButton" @click="filterUser">{{ $t('cmdb.history.filter') }}</a-button>
|
||||
<a-button type="link" class="filterResetButton" @click="filterUserReset">{{ $t('reset') }}</a-button>
|
||||
</a>
|
||||
</a-popover>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="type_id" width="100px" title="模型"></vxe-column>
|
||||
<vxe-column field="operate_type" width="89px" title="操作">
|
||||
<vxe-column field="type_id" width="100px" :title="$t('cmdb.ciType.ciType')"></vxe-column>
|
||||
<vxe-column field="operate_type" width="89px" :title="$t('operation')">
|
||||
<template #header="{ column }">
|
||||
<span>{{ column.title }}</span>
|
||||
<a-popover trigger="click" placement="bottom">
|
||||
<a-icon class="filter" type="filter" theme="filled"/>
|
||||
<a-icon class="filter" type="filter" theme="filled" />
|
||||
<a slot="content">
|
||||
<a-select
|
||||
v-model="queryParams.operate_type"
|
||||
placeholder="选择筛选操作"
|
||||
:placeholder="$t('cmdb.history.filterOperate')"
|
||||
show-search
|
||||
style="width: 200px"
|
||||
:filter-option="filterOption"
|
||||
|
@ -58,19 +64,20 @@
|
|||
v-for="(choice, index) in ciTableAttrList[4].choice_value"
|
||||
>
|
||||
{{ Object.keys(choice)[0] }}
|
||||
</a-select-option
|
||||
>
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-button type="link" class="filterButton" @click="filterOperate">筛选</a-button>
|
||||
<a-button type="link" class="filterResetButton" @click="filterOperateReset">重置</a-button>
|
||||
<a-button type="link" class="filterButton" @click="filterOperate">{{
|
||||
$t('cmdb.history.filter')
|
||||
}}</a-button>
|
||||
<a-button type="link" class="filterResetButton" @click="filterOperateReset">{{ $t('reset') }}</a-button>
|
||||
</a>
|
||||
</a-popover>
|
||||
</template>
|
||||
<template #default="{ row }">
|
||||
<a-tag color="green" v-if="row.operate_type === '新增' ">
|
||||
<a-tag color="green" v-if="row.operate_type === $t('new')">
|
||||
{{ row.operate_type }}
|
||||
</a-tag>
|
||||
<a-tag color="orange" v-else-if="row.operate_type === '修改' ">
|
||||
<a-tag color="orange" v-else-if="row.operate_type === $t('update')">
|
||||
{{ row.operate_type }}
|
||||
</a-tag>
|
||||
<a-tag color="red" v-else>
|
||||
|
@ -78,14 +85,14 @@
|
|||
</a-tag>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="attr_alias" title="属性"></vxe-column>
|
||||
<vxe-column field="old" title="旧"></vxe-column>
|
||||
<vxe-column field="new" title="新"></vxe-column>
|
||||
<vxe-column field="attr_alias" :title="$t('cmdb.history.attribute')"></vxe-column>
|
||||
<vxe-column field="old" :title="$t('cmdb.history.old')"></vxe-column>
|
||||
<vxe-column field="new" :title="$t('cmdb.history.new')"></vxe-column>
|
||||
</vxe-table>
|
||||
<pager
|
||||
:current-page.sync="queryParams.page"
|
||||
:page-size.sync="queryParams.page_size"
|
||||
:page-sizes="[50,100,200]"
|
||||
:page-sizes="[50, 100, 200]"
|
||||
:total="total"
|
||||
:isLoading="loading"
|
||||
@change="onChange"
|
||||
|
@ -94,6 +101,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import Pager from './pager.vue'
|
||||
import SearchForm from './searchForm.vue'
|
||||
import { getCIHistoryTable, getUsers } from '@/modules/cmdb/api/history'
|
||||
|
@ -102,14 +110,10 @@ import { getCITypeAttributesById } from '@/modules/cmdb/api/CITypeAttr'
|
|||
export default {
|
||||
name: 'CiTable',
|
||||
components: { SearchForm, Pager },
|
||||
inject: ['reload'],
|
||||
data() {
|
||||
return {
|
||||
typeId: undefined,
|
||||
operateTypeMap: new Map([
|
||||
['0', '新增'],
|
||||
['1', '删除'],
|
||||
['2', '修改'],
|
||||
]),
|
||||
loading: true,
|
||||
typeList: null,
|
||||
userList: [],
|
||||
|
@ -122,86 +126,91 @@ export default {
|
|||
},
|
||||
ciTableAttrList: [
|
||||
{
|
||||
alias: '日期',
|
||||
alias: this.$t('cmdb.ciType.date'),
|
||||
is_choice: false,
|
||||
name: 'datetime',
|
||||
value_type: '3'
|
||||
value_type: '3',
|
||||
},
|
||||
{
|
||||
alias: '用户',
|
||||
alias: this.$t('cmdb.history.user'),
|
||||
is_choice: true,
|
||||
name: 'username',
|
||||
value_type: '2',
|
||||
choice_value: []
|
||||
choice_value: [],
|
||||
},
|
||||
{
|
||||
alias: '模型',
|
||||
alias: this.$t('cmdb.ciType.ciType'),
|
||||
is_choice: true,
|
||||
name: 'type_id',
|
||||
value_type: '2',
|
||||
choice_value: [],
|
||||
},
|
||||
{
|
||||
alias: '属性',
|
||||
alias: this.$t('cmdb.history.attribute'),
|
||||
is_choice: true,
|
||||
name: 'attr_id',
|
||||
value_type: '2',
|
||||
choice_value: []
|
||||
choice_value: [],
|
||||
},
|
||||
{
|
||||
alias: '操作',
|
||||
alias: this.$t('operation'),
|
||||
is_choice: true,
|
||||
name: 'operate_type',
|
||||
value_type: '2',
|
||||
choice_value: [
|
||||
{ '新增': 0 },
|
||||
{ '删除': 1 },
|
||||
{ '修改': 2 },
|
||||
]
|
||||
choice_value: [{ [this.$t('new')]: 0 }, { [this.$t('delete')]: 1 }, { [this.$t('update')]: 2 }],
|
||||
},
|
||||
{
|
||||
alias: 'CI_ID',
|
||||
is_choice: false,
|
||||
name: 'ci_id',
|
||||
value_type: '2'
|
||||
}
|
||||
value_type: '2',
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['locale']),
|
||||
windowHeight() {
|
||||
return this.$store.state.windowHeight
|
||||
},
|
||||
windowHeightMinus() {
|
||||
return this.isExpand ? 396 : 331
|
||||
}
|
||||
},
|
||||
operateTypeMap() {
|
||||
return new Map([
|
||||
['0', this.$t('new')],
|
||||
['1', this.$t('delete')],
|
||||
['2', this.$t('update')],
|
||||
])
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
locale() {
|
||||
this.reload()
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.$watch(
|
||||
function () {
|
||||
function() {
|
||||
return this.ciTableAttrList[3].choice_value
|
||||
},
|
||||
function () {
|
||||
function() {
|
||||
delete this.$refs.child.queryParams.attr_id
|
||||
}
|
||||
)
|
||||
await Promise.all([
|
||||
this.getUserList(),
|
||||
this.getTypes()
|
||||
])
|
||||
await Promise.all([this.getUserList(), this.getTypes()])
|
||||
await this.getTable(this.queryParams)
|
||||
},
|
||||
updated() {
|
||||
this.$refs.xTable.$el.querySelector('.vxe-table--body-wrapper').scrollTop = 0
|
||||
},
|
||||
methods: {
|
||||
// 获取表格数据
|
||||
async getTable(queryParams) {
|
||||
try {
|
||||
this.loading = true
|
||||
const res = await getCIHistoryTable(queryParams)
|
||||
const tempArr = []
|
||||
res.records.forEach(item => {
|
||||
res.records.forEach((item) => {
|
||||
item[0].type_id = this.handleTypeId(item[0].type_id)
|
||||
item[1].forEach((subItem) => {
|
||||
subItem.operate_type = this.handleOperateType(subItem.operate_type)
|
||||
|
@ -215,24 +224,22 @@ export default {
|
|||
this.loading = false
|
||||
}
|
||||
},
|
||||
// 获取用户列表
|
||||
async getUserList() {
|
||||
const res = await getUsers()
|
||||
this.userList = res.map(x => {
|
||||
this.userList = res.map((x) => {
|
||||
const username = x.nickname
|
||||
const obj = {
|
||||
[username]: username
|
||||
[username]: username,
|
||||
}
|
||||
return obj
|
||||
})
|
||||
this.ciTableAttrList[1].choice_value = this.userList
|
||||
},
|
||||
// 获取模型
|
||||
async getTypes() {
|
||||
const res = await getCITypes()
|
||||
const typesArr = []
|
||||
const typesMap = new Map()
|
||||
res.ci_types.forEach(item => {
|
||||
res.ci_types.forEach((item) => {
|
||||
const tempObj = {}
|
||||
tempObj[item.alias] = item.id
|
||||
if (item.alias) {
|
||||
|
@ -243,7 +250,6 @@ export default {
|
|||
this.typeList = typesMap
|
||||
this.ciTableAttrList[2].choice_value = typesArr
|
||||
},
|
||||
// 获取模型对应属性
|
||||
async getAttrs(type_id) {
|
||||
if (!type_id) {
|
||||
this.ciTableAttrList[3].choice_value = []
|
||||
|
@ -251,7 +257,7 @@ export default {
|
|||
}
|
||||
const res = await getCITypeAttributesById(type_id)
|
||||
const attrsArr = []
|
||||
res.attributes.forEach(item => {
|
||||
res.attributes.forEach((item) => {
|
||||
const tempObj = {}
|
||||
tempObj[item.alias] = item.id
|
||||
if (item.alias) {
|
||||
|
@ -272,12 +278,10 @@ export default {
|
|||
handleExpandChange(expand) {
|
||||
this.isExpand = expand
|
||||
},
|
||||
// 处理查询
|
||||
handleSearch(queryParams) {
|
||||
this.queryParams = queryParams
|
||||
this.getTable(this.queryParams)
|
||||
},
|
||||
// 重置表单
|
||||
searchFormReset() {
|
||||
this.queryParams = {
|
||||
page: 1,
|
||||
|
@ -287,21 +291,17 @@ export default {
|
|||
username: '',
|
||||
ci_id: undefined,
|
||||
attr_id: undefined,
|
||||
operate_type: undefined
|
||||
operate_type: undefined,
|
||||
}
|
||||
// 将属性options重置
|
||||
this.ciTableAttrList[3].choice_value = []
|
||||
this.getTable(this.queryParams)
|
||||
},
|
||||
// 转换operate_type
|
||||
handleOperateType(operate_type) {
|
||||
return this.operateTypeMap.get(operate_type)
|
||||
},
|
||||
// 转换type_id
|
||||
handleTypeId(type_id) {
|
||||
return this.typeList.get(type_id) ? this.typeList.get(type_id) : type_id
|
||||
},
|
||||
// 表单改变,重新获取属性列表
|
||||
searchFormChange(queryParams) {
|
||||
if (this.typeId !== queryParams.type_id) {
|
||||
this.typeId = queryParams.type_id
|
||||
|
@ -312,20 +312,14 @@ export default {
|
|||
this.$refs.child.queryParams.attr_id = undefined
|
||||
}
|
||||
},
|
||||
// 合并表格
|
||||
mergeRowMethod ({ row, _rowIndex, column, visibleData }) {
|
||||
mergeRowMethod({ row, _rowIndex, column, visibleData }) {
|
||||
const fields = ['created_at', 'user', 'type_id']
|
||||
// 单元格值 = 行[列.属性] 确定一格
|
||||
const cellValue = row[column.property]
|
||||
const created_at = row['created_at']
|
||||
// 如果单元格值不为空且作用域包含当前列
|
||||
if (column.property === 'created_at') {
|
||||
if (cellValue && fields.includes(column.property)) {
|
||||
// 前一行
|
||||
const prevRow = visibleData[_rowIndex - 1]
|
||||
// 下一行
|
||||
let nextRow = visibleData[_rowIndex + 1]
|
||||
// 如果前一行不为空且前一行单元格的值与cellValue相同
|
||||
if (prevRow && prevRow[column.property] === cellValue) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
} else {
|
||||
|
@ -340,11 +334,8 @@ export default {
|
|||
}
|
||||
} else if (column.property === 'user') {
|
||||
if (cellValue && fields.includes(column.property)) {
|
||||
// 前一行
|
||||
const prevRow = visibleData[_rowIndex - 1]
|
||||
// 下一行
|
||||
let nextRow = visibleData[_rowIndex + 1]
|
||||
// 如果前一行不为空且前一行单元格的值与cellValue相同
|
||||
if (prevRow && prevRow[column.property] === cellValue && prevRow['created_at'] === created_at) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
} else {
|
||||
|
@ -359,11 +350,8 @@ export default {
|
|||
}
|
||||
} else if (column.property === 'type_id') {
|
||||
if (cellValue && fields.includes(column.property)) {
|
||||
// 前一行
|
||||
const prevRow = visibleData[_rowIndex - 1]
|
||||
// 下一行
|
||||
let nextRow = visibleData[_rowIndex + 1]
|
||||
// 如果前一行不为空且前一行单元格的值与cellValue相同
|
||||
if (prevRow && prevRow[column.property] === cellValue && prevRow['created_at'] === created_at) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
} else {
|
||||
|
@ -401,20 +389,18 @@ export default {
|
|||
this.getTable(this.queryParams)
|
||||
},
|
||||
filterOption(input, option) {
|
||||
return (
|
||||
option.componentOptions.children[0].text.indexOf(input) >= 0
|
||||
)
|
||||
}
|
||||
}
|
||||
return option.componentOptions.children[0].text.indexOf(input) >= 0
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.filter{
|
||||
.filter {
|
||||
margin-left: 10px;
|
||||
color: #c0c4cc;
|
||||
cursor: pointer;
|
||||
&:hover{
|
||||
&:hover {
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
<a-dropdown class="dropdown" placement="topCenter" :trigger="['click']" :disabled="dropdownIsDisabled">
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item v-for="(size,index) in pageSizes" :key="index" @click="handleItemClick(size)">
|
||||
{{ size }}条/页
|
||||
{{ size }}{{ $t('cmdb.history.itemsPerPage') }}
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
<a-button size="small"> {{ pageSize }}条/页 <a-icon type="down" /> </a-button>
|
||||
<a-button size="small"> {{ pageSize }}{{ $t('cmdb.history.itemsPerPage') }} <a-icon type="down" /> </a-button>
|
||||
</a-dropdown>
|
||||
</a-space>
|
||||
</a-col>
|
||||
|
|
|
@ -21,27 +21,27 @@
|
|||
stripe
|
||||
class="ops-stripe-table"
|
||||
>
|
||||
<vxe-column field="created_at" width="159px" title="操作时间"></vxe-column>
|
||||
<vxe-column field="user" width="100px" title="用户">
|
||||
<vxe-column field="created_at" width="159px" :title="$t('cmdb.history.opreateTime')"></vxe-column>
|
||||
<vxe-column field="user" width="100px" :title="$t('cmdb.history.user')">
|
||||
<template #header="{ column }">
|
||||
<span>{{ column.title }}</span>
|
||||
<a-popover trigger="click" placement="bottom">
|
||||
<a-icon class="filter" type="filter" theme="filled" />
|
||||
<a slot="content">
|
||||
<a-input
|
||||
placeholder="输入筛选用户名"
|
||||
:placeholder="$t('cmdb.history.userTips')"
|
||||
size="small"
|
||||
v-model="queryParams.username"
|
||||
style="width: 200px"
|
||||
allowClear
|
||||
/>
|
||||
<a-button type="link" class="filterButton" @click="filterUser">筛选</a-button>
|
||||
<a-button type="link" class="filterResetButton" @click="filterUserReset">重置</a-button>
|
||||
<a-button type="link" class="filterButton" @click="filterUser">{{ $t('cmdb.history.filter') }}</a-button>
|
||||
<a-button type="link" class="filterResetButton" @click="filterUserReset">{{ $t('reset') }}</a-button>
|
||||
</a>
|
||||
</a-popover>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="operate_type" width="89px" title="操作">
|
||||
<vxe-column field="operate_type" width="89px" :title="$t('operation')">
|
||||
<template #header="{ column }">
|
||||
<span>{{ column.title }}</span>
|
||||
<a-popover trigger="click" placement="bottom">
|
||||
|
@ -49,7 +49,7 @@
|
|||
<a slot="content">
|
||||
<a-select
|
||||
v-model="queryParams.operate_type"
|
||||
placeholder="选择筛选操作"
|
||||
:placeholder="$t('cmdb.history.filterOperate')"
|
||||
show-search
|
||||
style="width: 200px"
|
||||
:filter-option="filterOption"
|
||||
|
@ -63,16 +63,18 @@
|
|||
{{ Object.keys(choice)[0] }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-button type="link" class="filterButton" @click="filterOperate">筛选</a-button>
|
||||
<a-button type="link" class="filterResetButton" @click="filterOperateReset">重置</a-button>
|
||||
<a-button type="link" class="filterButton" @click="filterOperate">{{
|
||||
$t('cmdb.history.filter')
|
||||
}}</a-button>
|
||||
<a-button type="link" class="filterResetButton" @click="filterOperateReset">{{ $t('reset') }}</a-button>
|
||||
</a>
|
||||
</a-popover>
|
||||
</template>
|
||||
<template #default="{ row }">
|
||||
<a-tag color="green" v-if="row.operate_type.includes('新增')">
|
||||
<a-tag color="green" v-if="row.operate_type.includes($t('new'))">
|
||||
{{ row.operate_type }}
|
||||
</a-tag>
|
||||
<a-tag color="orange" v-else-if="row.operate_type.includes('修改')">
|
||||
<a-tag color="orange" v-else-if="row.operate_type.includes($t('update'))">
|
||||
{{ row.operate_type }}
|
||||
</a-tag>
|
||||
<a-tag color="red" v-else>
|
||||
|
@ -80,7 +82,7 @@
|
|||
</a-tag>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="changeDescription" title="描述">
|
||||
<vxe-column field="changeDescription" :title="$t('desc')">
|
||||
<template #default="{ row }">
|
||||
<a-tag v-if="row && row.first">
|
||||
{{
|
||||
|
@ -91,18 +93,18 @@
|
|||
}`
|
||||
}}
|
||||
</a-tag>
|
||||
<a-tag v-if="row.changeDescription === '没有修改'">
|
||||
<a-tag v-if="row.changeDescription === $t('cmdb.history.noUpdate')">
|
||||
{{ row.relation_type_id }}
|
||||
</a-tag>
|
||||
<template v-else-if="row.operate_type.includes('修改')">
|
||||
<template v-else-if="row.operate_type.includes($t('update'))">
|
||||
<a-tag :key="index" color="orange" v-for="(tag, index) in row.changeArr">
|
||||
{{ tag }}
|
||||
</a-tag>
|
||||
</template>
|
||||
<a-tag color="green" v-else-if="row.operate_type.includes('新增')" :style="{ fontWeight: 'bolder' }">
|
||||
<a-tag color="green" v-else-if="row.operate_type.includes($t('new'))" :style="{ fontWeight: 'bolder' }">
|
||||
{{ row.relation_type_id }}
|
||||
</a-tag>
|
||||
<a-tag color="red" v-else-if="row.operate_type.includes('删除')">
|
||||
<a-tag color="red" v-else-if="row.operate_type.includes($t('delete'))">
|
||||
{{ row.relation_type_id }}
|
||||
</a-tag>
|
||||
<a-tag v-if="row && row.second">
|
||||
|
@ -130,6 +132,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import SearchForm from './searchForm'
|
||||
import Pager from './pager.vue'
|
||||
import { getCITypes } from '@/modules/cmdb/api/CIType'
|
||||
|
@ -138,6 +141,7 @@ import { getRelationTypes } from '@/modules/cmdb/api/relationType'
|
|||
export default {
|
||||
name: 'RelationTable',
|
||||
components: { SearchForm, Pager },
|
||||
inject: ['reload'],
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
|
@ -147,11 +151,6 @@ export default {
|
|||
relationTypeList: null,
|
||||
total: 0,
|
||||
userList: [],
|
||||
operateTypeMap: new Map([
|
||||
['0', '新增'],
|
||||
['1', '删除'],
|
||||
['2', '修改'],
|
||||
]),
|
||||
queryParams: {
|
||||
page: 1,
|
||||
page_size: 50,
|
||||
|
@ -164,13 +163,13 @@ export default {
|
|||
},
|
||||
relationTableAttrList: [
|
||||
{
|
||||
alias: '日期',
|
||||
alias: this.$t('cmdb.ciType.date'),
|
||||
is_choice: false,
|
||||
name: 'datetime',
|
||||
value_type: '3',
|
||||
},
|
||||
{
|
||||
alias: '用户',
|
||||
alias: this.$t('cmdb.history.user'),
|
||||
is_choice: true,
|
||||
name: 'username',
|
||||
value_type: '2',
|
||||
|
@ -191,36 +190,44 @@ export default {
|
|||
choice_value: [],
|
||||
},
|
||||
{
|
||||
alias: '操作',
|
||||
alias: this.$t('operation'),
|
||||
is_choice: true,
|
||||
name: 'operate_type',
|
||||
value_type: '2',
|
||||
choice_value: [{ 新增: 0 }, { 删除: 1 }, { 修改: 2 }],
|
||||
choice_value: [{ [this.$t('new')]: 0 }, { [this.$t('delete')]: 1 }, { [this.$t('update')]: 2 }],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
await Promise.all([
|
||||
this.getRelationTypes(),
|
||||
this.getUserList(),
|
||||
this.getTypes(),
|
||||
])
|
||||
await Promise.all([this.getRelationTypes(), this.getUserList(), this.getTypes()])
|
||||
await this.getTable(this.queryParams)
|
||||
},
|
||||
updated() {
|
||||
this.$refs.xTable.$el.querySelector('.vxe-table--body-wrapper').scrollTop = 0
|
||||
},
|
||||
computed: {
|
||||
...mapState(['locale']),
|
||||
windowHeight() {
|
||||
return this.$store.state.windowHeight
|
||||
},
|
||||
windowHeightMinus() {
|
||||
return this.isExpand ? 396 : 331
|
||||
},
|
||||
operateTypeMap() {
|
||||
return new Map([
|
||||
['0', this.$t('new')],
|
||||
['1', this.$t('delete')],
|
||||
['2', this.$t('update')],
|
||||
])
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
locale() {
|
||||
this.reload()
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 获取表格数据
|
||||
async getTable(queryParams) {
|
||||
try {
|
||||
this.loading = true
|
||||
|
@ -242,7 +249,6 @@ export default {
|
|||
this.loading = false
|
||||
}
|
||||
},
|
||||
// 获取用户列表
|
||||
async getUserList() {
|
||||
const res = await getUsers()
|
||||
this.userList = res.map((x) => {
|
||||
|
@ -254,7 +260,6 @@ export default {
|
|||
})
|
||||
this.relationTableAttrList[1].choice_value = this.userList
|
||||
},
|
||||
// 获取模型
|
||||
async getTypes() {
|
||||
const res = await getCITypes()
|
||||
const typesArr = []
|
||||
|
@ -268,7 +273,6 @@ export default {
|
|||
this.relationTableAttrList[2].choice_value = typesArr
|
||||
this.relationTableAttrList[3].choice_value = typesArr
|
||||
},
|
||||
// 获取关系
|
||||
async getRelationTypes() {
|
||||
const res = await getRelationTypes()
|
||||
const relationTypeMap = new Map()
|
||||
|
@ -289,12 +293,10 @@ export default {
|
|||
handleExpandChange(expand) {
|
||||
this.isExpand = expand
|
||||
},
|
||||
// 处理查询
|
||||
handleSearch(queryParams) {
|
||||
this.queryParams = queryParams
|
||||
this.getTable(queryParams)
|
||||
},
|
||||
// 重置表单
|
||||
searchFormReset() {
|
||||
this.queryParams = {
|
||||
page: 1,
|
||||
|
@ -308,28 +310,20 @@ export default {
|
|||
}
|
||||
this.getTable(this.queryParams)
|
||||
},
|
||||
// 转换operate_type
|
||||
handleOperateType(operate_type) {
|
||||
return this.operateTypeMap.get(operate_type)
|
||||
},
|
||||
// 转换relation_type_id
|
||||
handleRelationType(relation_type_id) {
|
||||
return this.relationTypeList.get(relation_type_id)
|
||||
},
|
||||
// 合并表格
|
||||
mergeRowMethod({ row, _rowIndex, column, visibleData }) {
|
||||
const fields = ['created_at', 'user']
|
||||
// 单元格值 = 行[列.属性] 确定一格
|
||||
const cellValue = row[column.property]
|
||||
const created_at = row['created_at']
|
||||
// 如果单元格值不为空且作用域包含当前列
|
||||
if (column.property === 'created_at') {
|
||||
if (cellValue && fields.includes(column.property)) {
|
||||
// 前一行
|
||||
const prevRow = visibleData[_rowIndex - 1]
|
||||
// 下一行
|
||||
let nextRow = visibleData[_rowIndex + 1]
|
||||
// 如果前一行不为空且前一行单元格的值与cellValue相同
|
||||
if (prevRow && prevRow[column.property] === cellValue) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
} else {
|
||||
|
@ -344,11 +338,8 @@ export default {
|
|||
}
|
||||
} else if (column.property === 'user') {
|
||||
if (cellValue && fields.includes(column.property)) {
|
||||
// 前一行
|
||||
const prevRow = visibleData[_rowIndex - 1]
|
||||
// 下一行
|
||||
let nextRow = visibleData[_rowIndex + 1]
|
||||
// 如果前一行不为空且前一行单元格的值与cellValue相同
|
||||
if (prevRow && prevRow[column.property] === cellValue && prevRow['created_at'] === created_at) {
|
||||
return { rowspan: 0, colspan: 0 }
|
||||
} else {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
>
|
||||
<a-select
|
||||
v-model="queryParams[attr.name]"
|
||||
placeholder="请选择"
|
||||
:placeholder="$t('cmdb.history.pleaseSelect')"
|
||||
v-if="attr.is_choice"
|
||||
show-search
|
||||
:filter-option="filterOption"
|
||||
|
@ -37,7 +37,7 @@
|
|||
@change="onChange"
|
||||
:style="{width:'100%'}"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
:placeholder="['开始时间', '结束时间']"
|
||||
:placeholder="[$t('cmdb.history.startTime'), $t('cmdb.history.endTime')]"
|
||||
:show-time="{
|
||||
hideDisabledOptions: true,
|
||||
defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],
|
||||
|
@ -65,7 +65,7 @@
|
|||
>
|
||||
<a-select
|
||||
v-model="queryParams[item.name]"
|
||||
placeholder="请选择"
|
||||
:placeholder="$t('cmdb.history.pleaseSelect')"
|
||||
v-if="item.is_choice"
|
||||
show-search
|
||||
:filter-option="filterOption"
|
||||
|
@ -84,7 +84,7 @@
|
|||
:style="{width:'100%'}"
|
||||
@change="onChange"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
:placeholder="['开始时间', '结束时间']"
|
||||
:placeholder="[$t('cmdb.history.startTime'), $t('cmdb.history.endTime')]"
|
||||
v-else-if="valueTypeMap[item.value_type] == 'date' || valueTypeMap[item.value_type] == 'datetime'"
|
||||
:show-time="{
|
||||
hideDisabledOptions: true,
|
||||
|
@ -99,13 +99,13 @@
|
|||
<a-row>
|
||||
<a-col :span="24" :style="{ textAlign: 'right' , marginBottom: '10px' }">
|
||||
<a-button type="primary" html-type="submit" @click="handleSearch">
|
||||
查询
|
||||
{{ $t('query') }}
|
||||
</a-button>
|
||||
<a-button :style="{ marginLeft: '8px' }" @click="handleReset">
|
||||
重置
|
||||
{{ $t('reset') }}
|
||||
</a-button>
|
||||
<a :style="{ marginLeft: '8px', fontSize: '12px' }" @click="toggle" v-if="attrList.length >= 4">
|
||||
{{ expand?'隐藏':'展开' }} <a-icon :type="expand ? 'up' : 'down'" />
|
||||
{{ expand?$t('hide'):$t('expand') }} <a-icon :type="expand ? 'up' : 'down'" />
|
||||
</a>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
@ -126,7 +126,6 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
valueTypeMap,
|
||||
expand: false,
|
||||
queryParams: {
|
||||
page: 1,
|
||||
|
@ -135,6 +134,11 @@ export default {
|
|||
date: undefined
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
valueTypeMap() {
|
||||
return valueTypeMap()
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
queryParams: {
|
||||
deep: true,
|
||||
|
|
|
@ -9,33 +9,33 @@
|
|||
:data="tableData"
|
||||
v-bind="ci_id ? { maxHeight: `${windowHeight - 94}px` } : { height: `${windowHeight - 225}px` }"
|
||||
>
|
||||
<vxe-column field="trigger_name" title="触发器名称"> </vxe-column>
|
||||
<vxe-column field="type" title="类型">
|
||||
<vxe-column field="trigger_name" :title="$t('cmdb.history.triggerName')"> </vxe-column>
|
||||
<vxe-column field="type" :title="$t('type')">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.trigger && row.trigger.attr_id">日期属性</span>
|
||||
<span v-else-if="row.trigger && !row.trigger.attr_id">数据变更</span>
|
||||
<span v-if="row.trigger && row.trigger.attr_id">{{ $t('cmdb.ciType.triggerDate') }}</span>
|
||||
<span v-else-if="row.trigger && !row.trigger.attr_id">{{ $t('cmdb.ciType.triggerDataChange') }}</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column title="事件">
|
||||
<vxe-column :title="$t('cmdb.history.event')">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.operate_type === '0'">新增实例</span>
|
||||
<span v-else-if="row.operate_type === '1'">删除实例</span>
|
||||
<span v-else-if="row.operate_type === '2'">实例变更</span>
|
||||
<span v-if="row.operate_type === '0'">{{ $t('cmdb.ciType.addInstance') }}</span>
|
||||
<span v-else-if="row.operate_type === '1'">{{ $t('cmdb.ciType.deleteInstance') }}</span>
|
||||
<span v-else-if="row.operate_type === '2'">{{ $t('cmdb.ciType.changeInstance') }}</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column title="动作">
|
||||
<vxe-column :title="$t('cmdb.history.action')">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.webhook">Webhook</span>
|
||||
<span v-else-if="row.notify">通知</span>
|
||||
<span v-else-if="row.notify">{{ $t('cmdb.ciType.notify') }}</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column title="状态">
|
||||
<vxe-column :title="$t('cmdb.history.status')">
|
||||
<template #default="{ row }">
|
||||
<a-tag color="green" v-if="row.is_ok">已完成</a-tag>
|
||||
<a-tag color="red" v-else>未完成</a-tag>
|
||||
<a-tag color="green" v-if="row.is_ok">{{ $t('cmdb.history.done') }}</a-tag>
|
||||
<a-tag color="red" v-else>{{ $t('cmdb.history.undone') }}</a-tag>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column title="触发时间">
|
||||
<vxe-column :title="$t('cmdb.history.triggerTime')">
|
||||
<template #default="{row}">
|
||||
{{ row.updated_at || row.created_at }}
|
||||
</template>
|
||||
|
@ -49,7 +49,7 @@
|
|||
:page-size-options="pageSizeOptions"
|
||||
:current="tablePage.currentPage"
|
||||
:total="tablePage.totalResult"
|
||||
:show-total="(total, range) => `共 ${total} 条记录`"
|
||||
:show-total="(total, range) => $t('cmdb.history.totalItems', { total: total })"
|
||||
:page-size="tablePage.pageSize"
|
||||
:default-current="1"
|
||||
@change="pageOrSizeChange"
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
:max-height="`${windowHeight - windowHeightMinus}px`"
|
||||
row-id="_XID"
|
||||
size="small"
|
||||
:row-config="{isHover: true}"
|
||||
:row-config="{ isHover: true }"
|
||||
stripe
|
||||
class="ops-stripe-table"
|
||||
>
|
||||
<vxe-column field="created_at" width="159px" title="操作时间"></vxe-column>
|
||||
<vxe-column field="user" width="116px" title="用户"></vxe-column>
|
||||
<vxe-column field="operate_type" width="135px" title="操作">
|
||||
<vxe-column field="created_at" width="159px" :title="$t('cmdb.history.opreateTime')"></vxe-column>
|
||||
<vxe-column field="user" width="116px" :title="$t('cmdb.history.user')"></vxe-column>
|
||||
<vxe-column field="operate_type" width="135px" :title="$t('operation')">
|
||||
<template #header="{ column }">
|
||||
<span>{{ column.title }}</span>
|
||||
<a-popover trigger="click" placement="bottom">
|
||||
|
@ -28,7 +28,7 @@
|
|||
<a slot="content">
|
||||
<a-select
|
||||
v-model="queryParams.operate_type"
|
||||
placeholder="选择筛选操作"
|
||||
:placeholder="$t('cmdb.history.filterOperate')"
|
||||
show-search
|
||||
style="width: 200px"
|
||||
:filter-option="filterOption"
|
||||
|
@ -42,16 +42,18 @@
|
|||
{{ Object.keys(choice)[0] }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-button type="link" class="filterButton" @click="filterOperate">筛选</a-button>
|
||||
<a-button type="link" class="filterResetButton" @click="filterOperateReset">重置</a-button>
|
||||
<a-button type="link" class="filterButton" @click="filterOperate">{{
|
||||
$t('cmdb.history.filter')
|
||||
}}</a-button>
|
||||
<a-button type="link" class="filterResetButton" @click="filterOperateReset">{{ $t('reset') }}</a-button>
|
||||
</a>
|
||||
</a-popover>
|
||||
</template>
|
||||
<template #default="{ row }">
|
||||
<a-tag color="green" v-if="row.operate_type.includes('新增')">
|
||||
<a-tag color="green" v-if="row.operate_type.includes($t('new'))">
|
||||
{{ row.operate_type }}
|
||||
</a-tag>
|
||||
<a-tag color="orange" v-else-if="row.operate_type.includes('修改')">
|
||||
<a-tag color="orange" v-else-if="row.operate_type.includes($t('update'))">
|
||||
{{ row.operate_type }}
|
||||
</a-tag>
|
||||
<a-tag color="red" v-else>
|
||||
|
@ -59,25 +61,25 @@
|
|||
</a-tag>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="type_id" title="模型" width="150px">
|
||||
<vxe-column field="type_id" :title="$t('cmdb.ciType.ciType')" width="150px">
|
||||
<template #default="{ row }">
|
||||
{{ row.operate_type === '删除模型' ? row.change.alias : row.type_id }}
|
||||
{{ row.operate_type === $t('cmdb.history.deleteCIType') ? row.change.alias : row.type_id }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="changeDescription" title="描述">
|
||||
<vxe-column field="changeDescription" :title="$t('desc')">
|
||||
<template #default="{ row }">
|
||||
<p style="color:rgba(0, 0, 0, 0.65);" v-if="row.changeDescription === '没有修改'">
|
||||
<p style="color:rgba(0, 0, 0, 0.65);" v-if="row.changeDescription === $t('cmdb.history.noUpdate')">
|
||||
{{ row.changeDescription }}
|
||||
</p>
|
||||
<template v-else-if="row.operate_type.includes('修改')">
|
||||
<template v-else-if="row.operate_type.includes($t('update'))">
|
||||
<p :key="index" style="color:#fa8c16;" v-for="(tag, index) in row.changeArr">
|
||||
{{ tag }}
|
||||
</p>
|
||||
</template>
|
||||
<p class="more-tag" style="color:#52c41a;" v-else-if="row.operate_type.includes('新增')">
|
||||
<p class="more-tag" style="color:#52c41a;" v-else-if="row.operate_type.includes($t('new'))">
|
||||
{{ row.changeDescription }}
|
||||
</p>
|
||||
<p style="color:#f5222d;" v-else-if="row.operate_type.includes('删除')">
|
||||
<p style="color:#f5222d;" v-else-if="row.operate_type.includes($t('delete'))">
|
||||
{{ row.changeDescription }}
|
||||
</p>
|
||||
</template>
|
||||
|
@ -94,7 +96,7 @@
|
|||
:page-size="pageSize"
|
||||
@change="onChange"
|
||||
@showSizeChange="onShowSizeChange"
|
||||
:show-total="(total) => `共 ${total} 条记录`"
|
||||
:show-total="(total) => $t('cmdb.history.totalItems', { total: total })"
|
||||
>
|
||||
</a-pagination>
|
||||
</a-col>
|
||||
|
@ -104,6 +106,7 @@
|
|||
|
||||
<script>
|
||||
import _ from 'lodash'
|
||||
import { mapState } from 'vuex'
|
||||
import SearchForm from './searchForm'
|
||||
import { getCITypesTable, getUsers } from '@/modules/cmdb/api/history'
|
||||
import { getCITypes } from '@/modules/cmdb/api/CIType'
|
||||
|
@ -111,59 +114,13 @@ import { getRelationTypes } from '@/modules/cmdb/api/relationType'
|
|||
export default {
|
||||
name: 'TypeTable',
|
||||
components: { SearchForm },
|
||||
inject: ['reload'],
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
relationTypeList: null,
|
||||
operateTypeMap: new Map([
|
||||
['0', '新增模型'],
|
||||
['1', '修改模型'],
|
||||
['2', '删除模型'],
|
||||
['3', '新增属性'],
|
||||
['4', '修改属性'],
|
||||
['5', '删除属性'],
|
||||
['6', '新增触发器'],
|
||||
['7', '修改触发器'],
|
||||
['8', '删除触发器'],
|
||||
['9', '新增联合唯一'],
|
||||
['10', '修改联合唯一'],
|
||||
['11', '删除联合唯一'],
|
||||
['12', '新增关系'],
|
||||
['13', '删除关系'],
|
||||
]),
|
||||
typeList: null,
|
||||
userList: [],
|
||||
typeTableAttrList: [
|
||||
{
|
||||
alias: '模型',
|
||||
is_choice: true,
|
||||
name: 'type_id',
|
||||
value_type: '2',
|
||||
choice_value: [],
|
||||
},
|
||||
{
|
||||
alias: '操作',
|
||||
is_choice: true,
|
||||
name: 'operate_type',
|
||||
value_type: '2',
|
||||
choice_value: [
|
||||
{ 新增模型: 0 },
|
||||
{ 修改模型: 1 },
|
||||
{ 删除模型: 2 },
|
||||
{ 新增属性: 3 },
|
||||
{ 修改属性: 4 },
|
||||
{ 删除属性: 5 },
|
||||
{ 新增触发器: 6 },
|
||||
{ 修改触发器: 7 },
|
||||
{ 删除触发器: 8 },
|
||||
{ 新增联合唯一: 9 },
|
||||
{ 修改联合唯一: 10 },
|
||||
{ 删除联合唯一: 11 },
|
||||
{ 新增关系: 12 },
|
||||
{ 删除关系: 13 },
|
||||
],
|
||||
},
|
||||
],
|
||||
pageSizeOptions: ['50', '100', '200'],
|
||||
isExpand: false,
|
||||
current: 1,
|
||||
|
@ -177,26 +134,72 @@ export default {
|
|||
type_id: undefined,
|
||||
operate_type: undefined,
|
||||
},
|
||||
typeTableAttrList: [
|
||||
{
|
||||
alias: this.$t('cmdb.ciType.ciType'),
|
||||
is_choice: true,
|
||||
name: 'type_id',
|
||||
value_type: '2',
|
||||
choice_value: [],
|
||||
},
|
||||
{
|
||||
alias: this.$t('operation'),
|
||||
is_choice: true,
|
||||
name: 'operate_type',
|
||||
value_type: '2',
|
||||
choice_value: [
|
||||
{ [this.$t('cmdb.history.addCIType')]: 0 },
|
||||
{ [this.$t('cmdb.history.updateCIType')]: 1 },
|
||||
{ [this.$t('cmdb.history.deleteCIType')]: 2 },
|
||||
{ [this.$t('cmdb.history.addAttribute')]: 3 },
|
||||
{ [this.$t('cmdb.history.updateAttribute')]: 4 },
|
||||
{ [this.$t('cmdb.history.deleteAttribute')]: 5 },
|
||||
{ [this.$t('cmdb.history.addTrigger')]: 6 },
|
||||
{ [this.$t('cmdb.history.updateTrigger')]: 7 },
|
||||
{ [this.$t('cmdb.history.deleteTrigger')]: 8 },
|
||||
{ [this.$t('cmdb.history.addUniqueConstraint')]: 9 },
|
||||
{ [this.$t('cmdb.history.updateUniqueConstraint')]: 10 },
|
||||
{ [this.$t('cmdb.history.deleteUniqueConstraint')]: 11 },
|
||||
{ [this.$t('cmdb.history.addRelation')]: 12 },
|
||||
{ [this.$t('cmdb.history.deleteRelation')]: 13 },
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
await Promise.all([
|
||||
this.getRelationTypes(),
|
||||
this.getTypes(),
|
||||
this.getUserList(),
|
||||
])
|
||||
await Promise.all([this.getRelationTypes(), this.getTypes(), this.getUserList()])
|
||||
await this.getTable(this.queryParams)
|
||||
},
|
||||
updated() {
|
||||
this.$refs.xTable.$el.querySelector('.vxe-table--body-wrapper').scrollTop = 0
|
||||
},
|
||||
computed: {
|
||||
...mapState(['locale']),
|
||||
windowHeight() {
|
||||
return this.$store.state.windowHeight
|
||||
},
|
||||
windowHeightMinus() {
|
||||
return this.isExpand ? 396 : 335
|
||||
},
|
||||
operateTypeMap() {
|
||||
return new Map([
|
||||
['0', this.$t('cmdb.history.addCIType')],
|
||||
['1', this.$t('cmdb.history.updateCIType')],
|
||||
['2', this.$t('cmdb.history.deleteCIType')],
|
||||
['3', this.$t('cmdb.history.addAttribute')],
|
||||
['4', this.$t('cmdb.history.updateAttribute')],
|
||||
['5', this.$t('cmdb.history.deleteAttribute')],
|
||||
['6', this.$t('cmdb.history.addTrigger')],
|
||||
['7', this.$t('cmdb.history.updateTrigger')],
|
||||
['8', this.$t('cmdb.history.deleteTrigger')],
|
||||
['9', this.$t('cmdb.history.addUniqueConstraint')],
|
||||
['10', this.$t('cmdb.history.updateUniqueConstraint')],
|
||||
['11', this.$t('cmdb.history.deleteUniqueConstraint')],
|
||||
['12', this.$t('cmdb.history.addRelation')],
|
||||
['13', this.$t('cmdb.history.deleteRelation')],
|
||||
])
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
current(val) {
|
||||
|
@ -205,9 +208,11 @@ export default {
|
|||
pageSize(val) {
|
||||
this.queryParams.page_size = val
|
||||
},
|
||||
locale() {
|
||||
this.reload()
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 获取表格数据
|
||||
async getTable(queryParams) {
|
||||
try {
|
||||
this.loading = true
|
||||
|
@ -228,7 +233,6 @@ export default {
|
|||
this.loading = false
|
||||
}
|
||||
},
|
||||
// 获取模型
|
||||
async getTypes() {
|
||||
const res = await getCITypes()
|
||||
const typesArr = []
|
||||
|
@ -242,10 +246,8 @@ export default {
|
|||
}
|
||||
})
|
||||
this.typeList = typesMap
|
||||
// 设置模型options选项
|
||||
this.typeTableAttrList[0].choice_value = typesArr
|
||||
},
|
||||
// 获取用户列表
|
||||
async getUserList() {
|
||||
const res = await getUsers()
|
||||
const userListMap = new Map()
|
||||
|
@ -254,7 +256,6 @@ export default {
|
|||
})
|
||||
this.userList = userListMap
|
||||
},
|
||||
// 获取关系
|
||||
async getRelationTypes() {
|
||||
const res = await getRelationTypes()
|
||||
const relationTypeMap = new Map()
|
||||
|
@ -275,13 +276,11 @@ export default {
|
|||
handleExpandChange(expand) {
|
||||
this.isExpand = expand
|
||||
},
|
||||
// 处理查询
|
||||
handleSearch(queryParams) {
|
||||
this.current = 1
|
||||
this.queryParams = queryParams
|
||||
this.getTable(this.queryParams)
|
||||
},
|
||||
// 重置表单
|
||||
searchFormReset() {
|
||||
this.queryParams = {
|
||||
page: 1,
|
||||
|
@ -291,31 +290,26 @@ export default {
|
|||
}
|
||||
this.getTable(this.queryParams)
|
||||
},
|
||||
// 转换operate_type
|
||||
handleOperateType(operate_type) {
|
||||
return this.operateTypeMap.get(operate_type)
|
||||
},
|
||||
// 转换type_id
|
||||
handleTypeId(type_id) {
|
||||
return this.typeList.get(type_id) ? this.typeList.get(type_id) : type_id
|
||||
},
|
||||
// 转换uid
|
||||
handleUID(uid) {
|
||||
return this.userList.get(uid)
|
||||
},
|
||||
// 转换relation_type_id
|
||||
handleRelationType(relation_type_id) {
|
||||
return this.relationTypeList.get(relation_type_id)
|
||||
},
|
||||
// 处理改变描述
|
||||
handleChangeDescription(item, operate_type) {
|
||||
switch (operate_type) {
|
||||
// 新增模型
|
||||
// add CIType
|
||||
case '0': {
|
||||
item.changeDescription = '新增模型:' + item.change.alias
|
||||
item.changeDescription = this.$t('cmdb.history.addCIType') + ': ' + item.change.alias
|
||||
break
|
||||
}
|
||||
// 修改模型
|
||||
// update CIType
|
||||
case '1': {
|
||||
item.changeArr = []
|
||||
for (const key in item.change.old) {
|
||||
|
@ -323,30 +317,30 @@ export default {
|
|||
const oldVal = item.change.old[key]
|
||||
if (!_.isEqual(newVal, oldVal) && key !== 'updated_at') {
|
||||
if (oldVal === null) {
|
||||
const str = ` [ ${key} : 改为 ${newVal || '""'} ] `
|
||||
const str = ` [ ${key} : ${newVal || '""'} ] `
|
||||
item.changeDescription += str
|
||||
item.changeArr.push(str)
|
||||
} else {
|
||||
const str = ` [ ${key} : 由 ${oldVal || '""'} 改为 ${newVal || '""'} ] `
|
||||
item.changeDescription += ` [ ${key} : 由 ${oldVal || '""'} 改为 ${newVal || '""'} ] `
|
||||
const str = ` [ ${key} : ${oldVal || '""'} -> ${newVal || '""'} ] `
|
||||
item.changeDescription += ` [ ${key} : ${oldVal || '""'} -> ${newVal || '""'} ] `
|
||||
item.changeArr.push(str)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!item.changeDescription) item.changeDescription = '没有修改'
|
||||
if (!item.changeDescription) item.changeDescription = this.$t('cmdb.history.noModifications')
|
||||
break
|
||||
}
|
||||
// 删除模型
|
||||
// delete CIType
|
||||
case '2': {
|
||||
item.changeDescription = `删除模型:${item.change.alias}`
|
||||
item.changeDescription = this.$t('cmdb.history.addCIType') + ': ' + `${item.change.alias}`
|
||||
break
|
||||
}
|
||||
// 新增属性
|
||||
// add Attribute
|
||||
case '3': {
|
||||
item.changeDescription = `属性名:${item.change.alias}`
|
||||
item.changeDescription = `${this.$t('cmdb.history.attr')}:${item.change.alias}`
|
||||
break
|
||||
}
|
||||
// 修改属性
|
||||
// update Attribute
|
||||
case '4': {
|
||||
item.changeArr = []
|
||||
for (const key in item.change.old) {
|
||||
|
@ -363,74 +357,86 @@ export default {
|
|||
if (Object.prototype.toString.call(oldStr) === '[object Object]') {
|
||||
oldStr = JSON.stringify(oldStr)
|
||||
}
|
||||
const str = `${key} : ${oldStr ? `由 ${oldStr || '""'} ` : ''} 改为 ${newStr || '""'}`
|
||||
const str = `${key} : ${oldStr ? ` ${oldStr || '""'} ` : ''} -> ${newStr || '""'}`
|
||||
item.changeDescription += ` [ ${str} ] `
|
||||
item.changeArr.push(str)
|
||||
}
|
||||
}
|
||||
if (!item.changeDescription) item.changeDescription = '没有修改'
|
||||
if (!item.changeDescription) item.changeDescription = this.$t('cmdb.history.noModifications')
|
||||
break
|
||||
}
|
||||
// 删除属性
|
||||
// delete Attribute
|
||||
case '5': {
|
||||
item.changeDescription = `删除:${item.change.alias}`
|
||||
item.changeDescription = `${this.$t('delete')}:${item.change.alias}`
|
||||
break
|
||||
}
|
||||
// 新增触发器
|
||||
// add trigger
|
||||
case '6': {
|
||||
item.changeDescription = `属性ID:${item.change.attr_id},提前:${item.change.option.before_days}天,主题:${item.change.option.subject}\n内容:${item.change.option.body}\n通知时间:${item.change.option.notify_at}`
|
||||
item.changeDescription = this.$t('cmdb.history.noModifications', {
|
||||
attr_id: item.change.attr_id,
|
||||
before_days: item.change.option.before_days,
|
||||
subject: item.change.option.subject,
|
||||
body: item.change.option.body,
|
||||
notify_at: item.change.option.notify_at,
|
||||
})
|
||||
break
|
||||
}
|
||||
// 修改触发器
|
||||
// update trigger
|
||||
case '7': {
|
||||
item.changeArr = []
|
||||
for (const key in item.change.old.option) {
|
||||
const newVal = item.change.new.option[key]
|
||||
const oldVal = item.change.old.option[key]
|
||||
if (!_.isEqual(newVal, oldVal) && key !== 'updated_at') {
|
||||
const str = ` [ ${key} : 由 ${oldVal} 改为 ${newVal} ] `
|
||||
const str = ` [ ${key} : ${oldVal} -> ${newVal} ] `
|
||||
item.changeDescription += str
|
||||
item.changeArr.push(str)
|
||||
}
|
||||
}
|
||||
if (!item.changeDescription) item.changeDescription = '没有修改'
|
||||
if (!item.changeDescription) item.changeDescription = this.$t('cmdb.history.noModifications')
|
||||
break
|
||||
}
|
||||
// 删除触发器
|
||||
// delete trigger
|
||||
case '8': {
|
||||
item.changeDescription = `属性ID:${item.change.attr_id},提前:${item.change.option.before_days}天,主题:${item.change.option.subject}\n内容:${item.change.option.body}\n通知时间:${item.change.option.notify_at}`
|
||||
item.changeDescription = this.$t('cmdb.history.noModifications', {
|
||||
attr_id: item.change.attr_id,
|
||||
before_days: item.change.option.before_days,
|
||||
subject: item.change.option.subject,
|
||||
body: item.change.option.body,
|
||||
notify_at: item.change.option.notify_at,
|
||||
})
|
||||
break
|
||||
}
|
||||
// 新增联合唯一
|
||||
// add unique constraint
|
||||
case '9': {
|
||||
item.changeDescription = `属性id:[${item.change.attr_ids}]`
|
||||
item.changeDescription = `${this.$t('cmdb.history.attrId')}:[${item.change.attr_ids}]`
|
||||
break
|
||||
}
|
||||
// 修改联合唯一
|
||||
// update unique constraint
|
||||
case '10': {
|
||||
item.changeArr = []
|
||||
const oldVal = item.change.old.attr_ids
|
||||
const newVal = item.change.new.attr_ids
|
||||
const str = `属性id:[${oldVal}] -> [${newVal}]`
|
||||
const str = `${this.$t('cmdb.history.attrId')}:[${oldVal}] -> [${newVal}]`
|
||||
item.changeDescription = str
|
||||
item.changeArr.push(str)
|
||||
break
|
||||
}
|
||||
// 删除联合唯一
|
||||
// delete unique constraint
|
||||
case '11': {
|
||||
item.changeDescription = `属性id:[${item.change.attr_ids}]`
|
||||
item.changeDescription = `${this.$t('cmdb.history.attrId')}:[${item.change.attr_ids}]`
|
||||
break
|
||||
}
|
||||
// 新增关系
|
||||
// add relation
|
||||
case '12': {
|
||||
item.changeDescription = `新增:${item.change.parent.alias} -> ${this.handleRelationType(
|
||||
item.changeDescription = `${this.$t('new')}:${item.change.parent.alias} -> ${this.handleRelationType(
|
||||
item.change.relation_type_id
|
||||
)} -> ${item.change.child.alias}`
|
||||
break
|
||||
}
|
||||
// 删除关系
|
||||
// delete relation
|
||||
case '13': {
|
||||
item.changeDescription = `删除:${item.change.parent_id.alias} -> ${this.handleRelationType(
|
||||
item.changeDescription = `${this.$t('delete')}:${item.change.parent_id.alias} -> ${this.handleRelationType(
|
||||
item.change.relation_type_id
|
||||
)} -> ${item.change.child.alias}`
|
||||
break
|
||||
|
@ -470,7 +476,7 @@ export default {
|
|||
.more-tag {
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
p {
|
||||
margin-bottom: 0;
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
<div class="cmdb-preference" :style="{ height: `${windowHeight - 40}px` }">
|
||||
<div class="cmdb-preference-left">
|
||||
<div class="cmdb-preference-left-card">
|
||||
<span class="cmdb-preference-left-card-title">我的订阅</span>
|
||||
<span class="cmdb-preference-left-card-title">{{ $t('cmdb.preference.mySub') }}</span>
|
||||
<span
|
||||
class="cmdb-preference-left-card-content"
|
||||
><ops-icon type="cmdb-ci" :style="{ marginRight: '5px' }" />资源数据:
|
||||
><ops-icon type="cmdb-ci" :style="{ marginRight: '5px' }" />{{ $t('cmdb.menu.ciTable') }}:
|
||||
<a-badge
|
||||
showZero
|
||||
:count="self.instance.length"
|
||||
|
@ -20,7 +20,7 @@
|
|||
>
|
||||
<span
|
||||
class="cmdb-preference-left-card-content"
|
||||
><ops-icon type="cmdb-tree" :style="{ marginRight: '5px' }" />资源层级:
|
||||
><ops-icon type="cmdb-tree" :style="{ marginRight: '5px' }" />{{ $t('cmdb.menu.ciTree') }}:
|
||||
<a-badge
|
||||
showZero
|
||||
:count="self.tree.length"
|
||||
|
@ -66,14 +66,14 @@
|
|||
</div>
|
||||
<span class="cmdb-preference-group-content-title">{{ ciType.alias || ciType.name }}</span>
|
||||
<span class="cmdb-preference-group-content-action">
|
||||
<a-tooltip title="取消订阅">
|
||||
<a-tooltip :title="$t('cmdb.preference.cancelSub')">
|
||||
<span
|
||||
@click="unsubscribe(ciType, group.type)"
|
||||
><ops-icon type="cmdb-preference-cancel-subscribe" />
|
||||
</span>
|
||||
</a-tooltip>
|
||||
<a-divider type="vertical" :style="{ margin: '0 3px' }" />
|
||||
<a-tooltip title="编辑订阅">
|
||||
<a-tooltip :title="$t('cmdb.preference.editSub')">
|
||||
<span
|
||||
@click="openSubscribeSetting(ciType, `${index + 1}`)"
|
||||
><ops-icon
|
||||
|
@ -126,7 +126,8 @@
|
|||
<div class="cmdb-preference-colleague">
|
||||
<template v-if="type_id2users[item.id] && type_id2users[item.id].length">
|
||||
<span
|
||||
>{{ type_id2users[item.id].length > 99 ? '99+' : type_id2users[item.id].length }}位同事已订阅</span
|
||||
>{{ type_id2users[item.id].length > 99 ? '99+' : type_id2users[item.id].length
|
||||
}}{{ $t('cmdb.preference.peopleSub') }}</span
|
||||
>
|
||||
<span class="cmdb-preference-colleague-name">
|
||||
<span v-for="uid in type_id2users[item.id].slice(0, 4)" :key="uid">
|
||||
|
@ -135,11 +136,11 @@
|
|||
<span class="cmdb-preference-colleague-ellipsis" v-if="type_id2users[item.id].length > 4">...</span>
|
||||
</span>
|
||||
</template>
|
||||
<span v-else :style="{ marginLeft: 'auto' }">暂无同事订阅</span>
|
||||
<span v-else :style="{ marginLeft: 'auto' }">{{ $t('cmdb.preference.noSub') }}</span>
|
||||
</div>
|
||||
<div class="cmdb-preference-progress">
|
||||
<div class="cmdb-preference-progress-info">
|
||||
<span>自动发现</span>
|
||||
<span>{{ $t('cmdb.menu.ad') }}</span>
|
||||
<span>{{ item.integrity }}%</span>
|
||||
</div>
|
||||
<div class="cmdb-preference-progress-gray">
|
||||
|
@ -148,15 +149,13 @@
|
|||
</div>
|
||||
<a-divider :style="{ margin: '10px 0 3px 0' }" />
|
||||
<div class="cmdb-preference-footor-subscribed" v-if="item.is_subscribed">
|
||||
<span
|
||||
><a-icon type="clock-circle" :style="{ marginRight: '3px' }" />{{ getsubscribedDays(item) }}订阅</span
|
||||
>
|
||||
<span><a-icon type="clock-circle" :style="{ marginRight: '3px' }" />{{ getsubscribedDays(item) }}</span>
|
||||
<span>
|
||||
<a-tooltip title="取消订阅">
|
||||
<a-tooltip :title="$t('cmdb.preference.cancelSub')">
|
||||
<span @click="unsubscribe(item)"><ops-icon type="cmdb-preference-cancel-subscribe" /> </span>
|
||||
</a-tooltip>
|
||||
<a-divider type="vertical" :style="{ margin: '0 3px' }" />
|
||||
<a-tooltip title="编辑订阅">
|
||||
<a-tooltip :title="$t('cmdb.preference.editSub')">
|
||||
<span @click="openSubscribeSetting(item)"><ops-icon type="cmdb-preference-subscribe"/></span>
|
||||
</a-tooltip>
|
||||
</span>
|
||||
|
@ -164,7 +163,9 @@
|
|||
<div v-else class="cmdb-preference-footor-unsubscribed">
|
||||
<span
|
||||
@click="openSubscribeSetting(item)"
|
||||
><ops-icon :style="{ marginRight: '3px' }" type="cmdb-preference-subscribe" />订阅</span
|
||||
><ops-icon :style="{ marginRight: '3px' }" type="cmdb-preference-subscribe" />{{
|
||||
$t('cmdb.preference.sub')
|
||||
}}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -242,7 +243,7 @@ export default {
|
|||
}
|
||||
if (!group.id) {
|
||||
group.id = -1
|
||||
group.name = '其他'
|
||||
group.name = this.$t('other')
|
||||
}
|
||||
})
|
||||
this.citypeData = ciTypeGroup
|
||||
|
@ -251,7 +252,7 @@ export default {
|
|||
this.type_id2users = type_id2users
|
||||
const _myPreferences = [
|
||||
{
|
||||
name: '资源数据',
|
||||
name: this.$t('cmdb.menu.ciTable'),
|
||||
ci_types: self.instance.map((item) => {
|
||||
const _find = pref.find((ci) => ci.id === item)
|
||||
return _find
|
||||
|
@ -260,7 +261,7 @@ export default {
|
|||
type: 'ci',
|
||||
},
|
||||
{
|
||||
name: '资源层级',
|
||||
name: this.$t('cmdb.menu.ciTree'),
|
||||
ci_types: self.tree.map((item) => {
|
||||
const _find = pref.find((ci) => ci.id === item)
|
||||
return _find
|
||||
|
@ -285,23 +286,28 @@ export default {
|
|||
moment.duration(moment().diff(moment(subscribedTime)))
|
||||
const day = moment().diff(moment(subscribedTime), 'day')
|
||||
if (day > 0 && day < 1) {
|
||||
return `${moment().diff(moment(subscribedTime), 'hour')}小时前`
|
||||
return `${moment().diff(moment(subscribedTime), 'hour')}` + this.$t('cmdb.preference.hoursAgo')
|
||||
} else if (day >= 1 && day <= 31) {
|
||||
return `${day}天前`
|
||||
return `${day} ` + this.$t('cmdb.preference.daysAgo')
|
||||
} else if (day > 31 && day < 365) {
|
||||
return `${moment().diff(moment(subscribedTime), 'month')}月前`
|
||||
return `${moment().diff(moment(subscribedTime), 'month')}` + this.$t('cmdb.preference.monthsAgo')
|
||||
} else if (day >= 365) {
|
||||
return `${moment().diff(moment(subscribedTime), 'year')}年前`
|
||||
return `${moment().diff(moment(subscribedTime), 'year')}` + this.$t('cmdb.preference.yearsAgo')
|
||||
}
|
||||
return '刚刚'
|
||||
return this.$t('cmdb.preference.just')
|
||||
},
|
||||
unsubscribe(ciType, type = 'all') {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: `确认取消订阅 ${ciType.alias || ciType.name} ${
|
||||
type !== 'all' ? `的${type === 'ci' ? '资源数据' : '资源层级'}` : ''
|
||||
} 吗?`,
|
||||
title: that.$t('warning'),
|
||||
content:
|
||||
that.$t('cmdb.preference.confirmcancelSub') +
|
||||
` ${ciType.alias || ciType.name} ${
|
||||
type !== 'all'
|
||||
? that.$t('cmdb.preference.of') +
|
||||
`${type === 'ci' ? this.$t('cmdb.menu.ciTable') : that.$t('cmdb.menu.ciTree')}`
|
||||
: ''
|
||||
} ?`,
|
||||
onOk() {
|
||||
const promises = []
|
||||
if (type === 'all' || type === 'ci') {
|
||||
|
@ -320,7 +326,7 @@ export default {
|
|||
localStorage.setItem('ops_ci_typeid', '')
|
||||
}
|
||||
}
|
||||
that.$message.success('取消订阅成功')
|
||||
that.$message.success(that.$t('cmdb.preference.cancelSubSuccess'))
|
||||
that.resetRoute()
|
||||
})
|
||||
},
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
isEdit = true
|
||||
}
|
||||
"
|
||||
>新增业务关系</a-button
|
||||
>{{ $t('cmdb.preference_relation.newServiceTree') }}</a-button
|
||||
>
|
||||
<template v-else>
|
||||
<a-input v-model="newRelationViewName" placeholder="新增业务关系名"></a-input>
|
||||
<a-checkbox v-model="is_public">公开</a-checkbox>
|
||||
<a-button type="primary" size="small" @click="handleSaveRelationViews">保存</a-button>
|
||||
<a-input v-model="newRelationViewName" :placeholder="$t('cmdb.preference_relation.serviceTreeName')"></a-input>
|
||||
<a-checkbox v-model="is_public">{{ $t('cmdb.preference_relation.public') }}</a-checkbox>
|
||||
<a-button type="primary" size="small" @click="handleSaveRelationViews">{{ $t('save') }}</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
size="small"
|
||||
|
@ -29,10 +29,10 @@
|
|||
newRelationViewName = ''
|
||||
}
|
||||
"
|
||||
>取消</a-button
|
||||
>{{ $t('cancel') }}</a-button
|
||||
>
|
||||
</template>
|
||||
<a-button type="primary" size="small" @click="handleSave">保存布局</a-button>
|
||||
<a-button type="primary" size="small" @click="handleSave">{{ $t('cmdb.preference_relation.saveLayout') }}</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
<SeeksRelationGraph v-if="isPullConfig" ref="ciTypeRelationGraph" :options="graphOptions">
|
||||
|
@ -59,7 +59,7 @@
|
|||
>
|
||||
<div class="relation-views">
|
||||
<h3 :style="{ padding: '10px 0 0 20px' }">{{ view }}</h3>
|
||||
<a-popconfirm :title="`确认删除 ${view}?`" @confirm="confirmDelete(view)">
|
||||
<a-popconfirm :title="$t('cmdb.ciType.confirmDelete', { name: `${view}` })" @confirm="confirmDelete(view)">
|
||||
<a class="relation-views-close"><a-icon type="close"/></a>
|
||||
</a-popconfirm>
|
||||
<div :style="{ height: '250px' }">
|
||||
|
@ -246,7 +246,7 @@ export default {
|
|||
if (e.target.checked) {
|
||||
const graph = this.$refs.ciTypeRelationGraph
|
||||
if (!graph.getNodeById(node.id).targetTo.length) {
|
||||
this.$message.warning(`${node.text} 不存在子节点,不能形成业务关系,请重新选择!`)
|
||||
this.$message.warning(`${node.text} ` + this.$t('cmdb.preference_relation.childNodesNotFound'))
|
||||
return
|
||||
}
|
||||
if (!this.checkedNodes.length) {
|
||||
|
@ -278,7 +278,7 @@ export default {
|
|||
const idFrom = startNode.targetFrom.findIndex((item) => item.id === node.id)
|
||||
const idTo = endNode.targetTo.findIndex((item) => item.id === node.id)
|
||||
if (idFrom <= -1 && idTo <= -1) {
|
||||
this.$message.warning(`${node.text} 不能与当前选中节点形成视图,请重新选择!`)
|
||||
this.$message.warning(`${node.text} ` + this.$t('cmdb.preference_relation.tips1'))
|
||||
return
|
||||
}
|
||||
if (idFrom > -1) {
|
||||
|
@ -290,11 +290,11 @@ export default {
|
|||
},
|
||||
async handleSaveRelationViews() {
|
||||
if (!this.newRelationViewName) {
|
||||
this.$message.warning('请输入新增业务关系名!')
|
||||
this.$message.warning(this.$t('cmdb.preference_relation.tips2'))
|
||||
return
|
||||
}
|
||||
if (this.checkedNodes.length < 2) {
|
||||
this.$message.warning('请选择至少两个节点!')
|
||||
this.$message.warning(this.$t('cmdb.preference_relation.tips3'))
|
||||
return
|
||||
}
|
||||
// eslint-disable-next-line camelcase
|
||||
|
@ -341,7 +341,7 @@ export default {
|
|||
}
|
||||
}),
|
||||
}).then((res) => {
|
||||
this.$message.success('保存成功!')
|
||||
this.$message.success(this.$t('saveSuccess'))
|
||||
})
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<template>
|
||||
<CustomDrawer
|
||||
:closable="false"
|
||||
:title="drawerTitle"
|
||||
:title="$t('cmdb.preference_relation.newServiceTree')"
|
||||
:visible="drawerVisible"
|
||||
@close="onClose"
|
||||
placement="right"
|
||||
width="30%"
|
||||
>
|
||||
<a-form :form="form" :layout="formLayout" @submit="handleSubmit">
|
||||
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="业务关系名">
|
||||
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" :label="$t('cmdb.preference_relation.serviceTreeName')">
|
||||
<a-input
|
||||
name="name"
|
||||
placeholder
|
||||
v-decorator="['name', { rules: [{ required: true, message: '请输入类型名' }] }]"
|
||||
v-decorator="['name', { rules: [{ required: true, message: $t('cmdb.preference_relation.tips2')}] }]"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
|||
</a-form-item>
|
||||
|
||||
<div class="custom-drawer-bottom-action">
|
||||
<a-button @click="onClose">取消</a-button>
|
||||
<a-button @click="handleSubmit" type="primary">提交</a-button>
|
||||
<a-button @click="onClose">{{ $t('cancel') }}</a-button>
|
||||
<a-button @click="handleSubmit" type="primary">{{ $t('submit') }}</a-button>
|
||||
</div>
|
||||
</a-form>
|
||||
</CustomDrawer>
|
||||
|
@ -35,7 +35,6 @@ export default {
|
|||
name: 'RelationViewForm',
|
||||
data() {
|
||||
return {
|
||||
drawerTitle: '新增业务关系',
|
||||
drawerVisible: false,
|
||||
formLayout: 'vertical',
|
||||
crIds: [],
|
||||
|
@ -95,7 +94,7 @@ export default {
|
|||
createRelationView(data) {
|
||||
data.cr_ids = this.crIds
|
||||
subscribeRelationView(data).then(res => {
|
||||
this.$message.success('新增成功!')
|
||||
this.$message.success(this.$t('addSuccess'))
|
||||
this.onClose()
|
||||
this.$emit('refresh')
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<a-card :bordered="false">
|
||||
<div class="action-btn">
|
||||
<a-button @click="handleCreate" type="primary" style="margin-bottom: 15px;">新增关系类型</a-button>
|
||||
<a-button @click="handleCreate" type="primary" style="margin-bottom: 15px;">{{ $t('cmdb.relation_type.addRelationType') }}</a-button>
|
||||
</div>
|
||||
<vxe-table
|
||||
ref="relationTypeTable"
|
||||
|
@ -16,20 +16,20 @@
|
|||
>
|
||||
<vxe-table-column
|
||||
field="name"
|
||||
title="名称"
|
||||
:title="$t('name')"
|
||||
:edit-render="{ name: 'input', attrs: { type: 'text' }, events: { keyup: customCloseEdit } }"
|
||||
></vxe-table-column>
|
||||
<vxe-table-column field="updateTime" title="更新时间">
|
||||
<vxe-table-column field="updateTime" :title="$t('updated_at')">
|
||||
<template #default="{row}">
|
||||
{{ row.updated_at || row.created_at }}
|
||||
</template>
|
||||
</vxe-table-column>
|
||||
<vxe-table-column field="operation" title="操作" align="center">
|
||||
<vxe-table-column field="operation" :title="$t('operation')" align="center">
|
||||
<template #default="{row}">
|
||||
<template>
|
||||
<a><a-icon type="edit" @click="handleEdit(row)"/></a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm title="确认删除吗?" @confirm="handleDelete(row)" okText="是" cancelText="否">
|
||||
<a-popconfirm :title="$t('confirmDelete')" @confirm="handleDelete(row)" :okText="$t('yes')" :cancelText="$t('no')">
|
||||
<a :style="{ color: 'red' }"><a-icon type="delete"/></a>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
|
@ -50,6 +50,7 @@ import {
|
|||
|
||||
export default {
|
||||
name: 'RelationType',
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
|
@ -97,14 +98,14 @@ export default {
|
|||
},
|
||||
updateRelationType(id, data) {
|
||||
updateRelationType(id, data).then((res) => {
|
||||
this.$message.success('更新成功!')
|
||||
this.$message.success(this.$t('updateSuccess'))
|
||||
this.loadData()
|
||||
})
|
||||
},
|
||||
|
||||
createRelationType(data) {
|
||||
addRelationType(data).then((res) => {
|
||||
this.$message.success('新增成功!')
|
||||
this.$message.success(this.$t('addSuccess'))
|
||||
this.loadData()
|
||||
})
|
||||
},
|
||||
|
@ -113,12 +114,12 @@ export default {
|
|||
},
|
||||
deleteRelationType(id) {
|
||||
deleteRelationType(id).then((res) => {
|
||||
this.$message.success('删除成功!')
|
||||
this.$message.success(this.$t('deleteSuccess'))
|
||||
this.loadData()
|
||||
})
|
||||
},
|
||||
customCloseEdit(value, $event) {
|
||||
// 回车结束编辑
|
||||
// enter, close edit
|
||||
if ($event.keyCode === 13) {
|
||||
const $table = this.$refs.relationTypeTable
|
||||
$table.clearActived()
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div v-if="relationViews.name2id && relationViews.name2id.length" class="relation-views-wrapper">
|
||||
<div class="cmdb-views-header">
|
||||
<span class="cmdb-views-header-title">{{ $route.meta.name }}</span>
|
||||
<a-button size="small" icon="user-add" type="primary" ghost @click="handlePerm">授权</a-button>
|
||||
<a-button size="small" icon="user-add" type="primary" ghost @click="handlePerm">{{ $t('grant') }}</a-button>
|
||||
</div>
|
||||
<SplitPane
|
||||
:min="200"
|
||||
|
@ -63,19 +63,19 @@
|
|||
type="primary"
|
||||
size="small"
|
||||
@click="$refs.create.handleOpen(true, 'create')"
|
||||
>新建</a-button
|
||||
>{{ $t('create') }}</a-button
|
||||
>
|
||||
|
||||
<div class="ops-list-batch-action" v-if="isLeaf && isShowBatchIcon">
|
||||
<template v-if="selectedRowKeys.length">
|
||||
<span @click="$refs.create.handleOpen(true, 'update')">修改</span>
|
||||
<span @click="$refs.create.handleOpen(true, 'update')">{{ $t('update') }}</span>
|
||||
<a-divider type="vertical" />
|
||||
<span @click="openBatchDownload">下载</span>
|
||||
<span @click="openBatchDownload">{{ $t('download') }}</span>
|
||||
<a-divider type="vertical" />
|
||||
<span @click="batchDelete">删除实例</span>
|
||||
<span @click="batchDelete">{{ $t('cmdb.ciType.deleteInstance') }}</span>
|
||||
<a-divider type="vertical" />
|
||||
<span @click="batchDeleteCIRelation">删除关系</span>
|
||||
<span>选取:{{ selectedRowKeys.length }} 项</span>
|
||||
<span @click="batchDeleteCIRelation">{{ $t('cmdb.history.deleteRelation') }}</span>
|
||||
<span>{{ $t('cmdb.ci.selectRows', { rows: selectedRowKeys.length }) }}</span>
|
||||
</template>
|
||||
</div>
|
||||
<PreferenceSearch
|
||||
|
@ -141,7 +141,7 @@
|
|||
:getPopupContainer="(trigger) => trigger.parentElement"
|
||||
:style="{ width: '100%', height: '32px' }"
|
||||
v-model="row[col.field]"
|
||||
placeholder="请选择"
|
||||
:placeholder="$t('placeholder2')"
|
||||
v-if="col.is_choice"
|
||||
:showArrow="false"
|
||||
:mode="col.is_list ? 'multiple' : 'default'"
|
||||
|
@ -176,7 +176,7 @@
|
|||
:getPopupContainer="(trigger) => trigger.parentElement"
|
||||
:style="{ width: '100%', height: '32px' }"
|
||||
v-model="row[col.field]"
|
||||
placeholder="请选择"
|
||||
:placeholder="$t('placeholder2')"
|
||||
v-else-if="col.is_list"
|
||||
:showArrow="false"
|
||||
mode="tags"
|
||||
|
@ -256,9 +256,9 @@
|
|||
</template>
|
||||
</template>
|
||||
</vxe-table-column>
|
||||
<vxe-column align="left" field="operate" fixed="right" width="80">
|
||||
<vxe-column align="left" field="operate" fixed="right" width="120">
|
||||
<template #header>
|
||||
<span>操作</span>
|
||||
<span>{{ $t('operation') }}</span>
|
||||
<EditAttrsPopover
|
||||
:typeId="Number(currentTypeId[0])"
|
||||
class="operation-icon"
|
||||
|
@ -270,13 +270,13 @@
|
|||
<a @click="$refs.detail.create(row.ci_id || row._id)">
|
||||
<a-icon type="unordered-list" />
|
||||
</a>
|
||||
<a-tooltip title="添加关系">
|
||||
<a-tooltip :title="$t('cmdb.ci.addRelation')">
|
||||
<a @click="$refs.detail.create(row.ci_id || row._id, 'tab_2', '2')">
|
||||
<a-icon type="retweet" />
|
||||
</a>
|
||||
</a-tooltip>
|
||||
<template v-if="isLeaf">
|
||||
<a-tooltip title="删除实例">
|
||||
<a-tooltip :title="$t('cmdb.ciType.deleteInstance')">
|
||||
<a @click="deleteCI(row)" :style="{ color: 'red' }">
|
||||
<a-icon type="delete" />
|
||||
</a>
|
||||
|
@ -286,10 +286,10 @@
|
|||
</template>
|
||||
</vxe-column>
|
||||
<template #empty>
|
||||
<div v-if="loading" style="height: 200px; line-height: 200px">加载中...</div>
|
||||
<div v-if="loading" style="height: 200px; line-height: 200px">{{ $t('loading') }}</div>
|
||||
<div v-else>
|
||||
<img :style="{ width: '200px' }" :src="require('@/assets/data_empty.png')" />
|
||||
<div>暂无数据</div>
|
||||
<div>{{ $t('noData') }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</vxe-table>
|
||||
|
@ -303,12 +303,19 @@
|
|||
:page-size="pageSize"
|
||||
:page-size-options="pageSizeOptions"
|
||||
@showSizeChange="onShowSizeChange"
|
||||
:show-total="(total, range) => `当前${range[0]}-${range[1]} 共 ${total}条记录`"
|
||||
:show-total="
|
||||
(total, range) =>
|
||||
$t('pagination.total', {
|
||||
range0: range[0],
|
||||
range1: range[1],
|
||||
total,
|
||||
})
|
||||
"
|
||||
:style="{ alignSelf: 'flex-end', marginRight: '12px' }"
|
||||
>
|
||||
<template slot="buildOptionText" slot-scope="props">
|
||||
<span v-if="props.value !== '100000'">{{ props.value }}条/页</span>
|
||||
<span v-if="props.value === '100000'">全部</span>
|
||||
<span v-if="props.value !== '100000'">{{ props.value }}{{ $t('cmdb.history.itemsPerPage') }}</span>
|
||||
<span v-if="props.value === '100000'">{{ $t('cmdb.components.all') }}</span>
|
||||
</template>
|
||||
</a-pagination>
|
||||
</div>
|
||||
|
@ -317,7 +324,7 @@
|
|||
</SplitPane>
|
||||
</div>
|
||||
<a-alert
|
||||
message="管理员 还未配置业务关系, 或者你无权限访问!"
|
||||
:message="$t('cmdb.serviceTreealert1')"
|
||||
banner
|
||||
v-else-if="relationViews.name2id && !relationViews.name2id.length"
|
||||
></a-alert>
|
||||
|
@ -497,11 +504,11 @@ export default {
|
|||
},
|
||||
inject: ['reload'],
|
||||
watch: {
|
||||
'$route.path': function (newPath, oldPath) {
|
||||
'$route.path': function(newPath, oldPath) {
|
||||
this.viewId = this.$route.params.viewId
|
||||
this.reload()
|
||||
},
|
||||
pageNo: function (newPage, oldPage) {
|
||||
pageNo: function(newPage, oldPage) {
|
||||
this.loadData({ pageNo: newPage }, undefined, this.sortByTable)
|
||||
},
|
||||
},
|
||||
|
@ -1010,15 +1017,15 @@ export default {
|
|||
const that = this
|
||||
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
title: that.$t('warning'),
|
||||
content: (h) => (
|
||||
<div>
|
||||
确认删除 <strong>{Object.values(firstCIObj)[0]}</strong>?
|
||||
{that.$t('confirmDelete2', { name: Object.values(firstCIObj)[0] })}
|
||||
</div>
|
||||
),
|
||||
onOk() {
|
||||
deleteCIRelationView(_tempTreeParent[0], _tempTree[0], { ancestor_ids }).then((res) => {
|
||||
that.$message.success('删除成功!')
|
||||
that.$message.success(that.$t('deleteSuccess'))
|
||||
setTimeout(() => {
|
||||
that.reload()
|
||||
}, 500)
|
||||
|
@ -1038,10 +1045,10 @@ export default {
|
|||
const currentShowType = this.showTypes.find((item) => item.id === Number(this.currentTypeId[0]))
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
title: that.$t('warning'),
|
||||
content: (h) => (
|
||||
<div>
|
||||
确认将选中的 <strong>{currentShowType.alias || currentShowType.name}</strong> 从当前关系中删除?
|
||||
{that.$t('cmdb.serviceTreedeleteRelationConfirm', { name: currentShowType.alias || currentShowType.name })}
|
||||
</div>
|
||||
),
|
||||
onOk() {
|
||||
|
@ -1101,7 +1108,7 @@ export default {
|
|||
})
|
||||
})
|
||||
} else {
|
||||
this.$message.error('权限不足!')
|
||||
this.$message.error(this.$t('noPermission'))
|
||||
}
|
||||
})
|
||||
},
|
||||
|
@ -1242,7 +1249,7 @@ export default {
|
|||
if (JSON.stringify(data) !== '{}') {
|
||||
updateCI(row.ci_id || row._id, data)
|
||||
.then(() => {
|
||||
this.$message.success('保存成功!')
|
||||
this.$message.success(this.$t('saveSuccess'))
|
||||
$table.reloadRow(row, null)
|
||||
const _initialInstanceList = _.cloneDeep(this.initialInstanceList)
|
||||
_initialInstanceList[rowIndex] = {
|
||||
|
@ -1266,11 +1273,11 @@ export default {
|
|||
deleteCI(record) {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: '确认删除?',
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('confirmDelete'),
|
||||
onOk() {
|
||||
deleteCI(record.ci_id || record._id).then((res) => {
|
||||
that.$message.success('删除成功!')
|
||||
that.$message.success(that.$t('deleteSuccess'))
|
||||
that.loadData({}, 'refreshNumber')
|
||||
})
|
||||
},
|
||||
|
@ -1298,8 +1305,8 @@ export default {
|
|||
batchUpdateFromCreateInstance(values) {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: '确认要批量修改吗 ?',
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('cmdb.ci.batchUpdateConfirm'),
|
||||
onOk() {
|
||||
that.loading = true
|
||||
const payload = {}
|
||||
|
@ -1320,7 +1327,7 @@ export default {
|
|||
})
|
||||
Promise.all(promises)
|
||||
.then((res) => {
|
||||
that.$message.success('批量修改成功')
|
||||
that.$message.success(that.$t('updateSuccess'))
|
||||
that.$refs.create.visible = false
|
||||
})
|
||||
.catch((e) => {
|
||||
|
@ -1371,8 +1378,8 @@ export default {
|
|||
batchDelete() {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: '确认删除?',
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('confirmDelete'),
|
||||
onOk() {
|
||||
that.loading = true
|
||||
const promises = that.selectedRowKeys.map((c) => {
|
||||
|
@ -1382,7 +1389,7 @@ export default {
|
|||
})
|
||||
Promise.all(promises)
|
||||
.then((res) => {
|
||||
that.$message.success('删除成功')
|
||||
that.$message.success(that.$t('deleteSuccess'))
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e)
|
||||
|
@ -1445,10 +1452,10 @@ export default {
|
|||
const text = `q=_type:${this.currentTypeId[0]}${exp ? `,${exp}` : ''}${fuzzySearch ? `,*${fuzzySearch}*` : ''}`
|
||||
this.$copyText(text)
|
||||
.then(() => {
|
||||
this.$message.success('复制成功!')
|
||||
this.$message.success(this.$t('copySuccess'))
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.error('复制失败!')
|
||||
this.$message.error(this.$t('cmdb.serviceTreecopyFailed'))
|
||||
})
|
||||
},
|
||||
},
|
||||
|
|
|
@ -11,12 +11,24 @@
|
|||
>
|
||||
<div :style="{ width: '100%' }" id="add-table-modal">
|
||||
<a-spin :spinning="loading">
|
||||
<!-- <a-input
|
||||
v-model="expression"
|
||||
class="ci-searchform-expression"
|
||||
:style="{ width, marginBottom: '10px' }"
|
||||
:placeholder="placeholder"
|
||||
@focus="
|
||||
() => {
|
||||
isFocusExpression = true
|
||||
}
|
||||
"
|
||||
/> -->
|
||||
<SearchForm
|
||||
ref="searchForm"
|
||||
:typeId="addTypeId"
|
||||
:preferenceAttrList="preferenceAttrList"
|
||||
@refresh="handleSearch"
|
||||
/>
|
||||
<!-- <a @click="handleSearch"><a-icon type="search"/></a> -->
|
||||
<vxe-table
|
||||
ref="xTable"
|
||||
row-id="_id"
|
||||
|
@ -52,7 +64,14 @@
|
|||
:total="totalNumber"
|
||||
show-quick-jumper
|
||||
:page-size="50"
|
||||
:show-total="(total, range) => `当前${range[0]}-${range[1]} 共 ${total}条记录`"
|
||||
:show-total="
|
||||
(total, range) =>
|
||||
$t('pagination.total', {
|
||||
range0: range[0],
|
||||
range1: range[1],
|
||||
total,
|
||||
})
|
||||
"
|
||||
:style="{ textAlign: 'right', marginTop: '10px' }"
|
||||
@change="handleChangePage"
|
||||
/>
|
||||
|
@ -94,7 +113,7 @@ export default {
|
|||
return this.$store.state.windowHeight - 250
|
||||
},
|
||||
placeholder() {
|
||||
return this.isFocusExpression ? '例:q=os_version:centos&sort=os_version' : '表达式搜索'
|
||||
return this.isFocusExpression ? this.$t('cmdb.serviceTreetips1') : this.$t('cmdb.serviceTreetips2')
|
||||
},
|
||||
width() {
|
||||
return this.isFocusExpression ? '500px' : '100px'
|
||||
|
@ -103,6 +122,7 @@ export default {
|
|||
watch: {},
|
||||
methods: {
|
||||
async openModal(ciObj, ciId, addTypeId, type, ancestor_ids = undefined) {
|
||||
console.log(ciObj, ciId, addTypeId, type)
|
||||
this.visible = true
|
||||
this.ciObj = ciObj
|
||||
this.ciId = ciId
|
||||
|
@ -121,6 +141,10 @@ export default {
|
|||
},
|
||||
async fetchData(isInit) {
|
||||
this.loading = true
|
||||
// if (isInit) {
|
||||
// const subscribed = await getSubscribeAttributes(this.addTypeId)
|
||||
// this.preferenceAttrList = subscribed.attributes // 已经订阅的全部列
|
||||
// }
|
||||
let sort, fuzzySearch, expression, exp
|
||||
if (!isInit) {
|
||||
fuzzySearch = this.$refs['searchForm'].fuzzySearch
|
||||
|
@ -179,7 +203,7 @@ export default {
|
|||
await batchUpdateCIRelationParents(ciIds, [this.ciId])
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.$message.success('添加成功!')
|
||||
this.$message.success(this.$t('addSuccess'))
|
||||
this.handleClose()
|
||||
this.$emit('reload')
|
||||
}, 500)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<a-dropdown :trigger="['contextmenu']">
|
||||
<a-menu slot="overlay" @click="({ key: menuKey }) => this.onContextMenuClick(this.treeKey, menuKey)">
|
||||
<a-menu-item v-for="item in menuList" :key="item.id">新增{{ item.alias }}</a-menu-item>
|
||||
<a-menu-item v-if="showDelete" key="delete">删除节点</a-menu-item>
|
||||
<a-menu-item v-for="item in menuList" :key="item.id">{{ $t('new') }} {{ item.alias }}</a-menu-item>
|
||||
<a-menu-item v-if="showDelete" key="delete">{{ $t('cmdb.serviceTree.deleteNode') }}</a-menu-item>
|
||||
</a-menu>
|
||||
<div
|
||||
:style="{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div id="resource_search" :style="{ height: fromCronJob ? `${windowHeight - 48}px` : `${windowHeight - 90}px` }">
|
||||
<div class="cmdb-views-header">
|
||||
<span>
|
||||
<span class="cmdb-views-header-title">资源搜索</span>
|
||||
<span class="cmdb-views-header-title">{{ $t('cmdb.menu.ciSearch') }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div :style="{ backgroundColor: '#fff', padding: '12px', borderRadius: '15px' }">
|
||||
|
@ -24,7 +24,9 @@
|
|||
alignItems: 'center',
|
||||
}"
|
||||
>
|
||||
<a-button icon="download" type="primary" ghost size="small" @click="handleExport">导出</a-button>
|
||||
<a-button icon="download" type="primary" ghost size="small" @click="handleExport">{{
|
||||
$t('download')
|
||||
}}</a-button>
|
||||
<PreferenceSearch
|
||||
ref="preferenceSearch"
|
||||
@getQAndSort="getQAndSort"
|
||||
|
@ -68,7 +70,7 @@
|
|||
>
|
||||
<vxe-column
|
||||
v-if="instanceList.length"
|
||||
title="模型"
|
||||
:title="$t('cmdb.ciType.ciType')"
|
||||
field="ci_type_alias"
|
||||
:width="100"
|
||||
fixed="left"
|
||||
|
@ -149,12 +151,14 @@
|
|||
</vxe-colgroup>
|
||||
|
||||
<template #empty>
|
||||
<div v-if="loading" style="height: 200px; line-height: 200px">加载中...</div>
|
||||
<div v-else>
|
||||
<div>
|
||||
<img :style="{ width: '200px' }" :src="require('@/assets/data_empty.png')" />
|
||||
<div>暂无数据</div>
|
||||
<div>{{ $t('noData') }}</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #loading>
|
||||
<div style="height: 200px; line-height: 200px">{{ $t('loading') }}</div>
|
||||
</template>
|
||||
</vxe-table>
|
||||
<div :style="{ textAlign: 'right', marginTop: '4px' }">
|
||||
<a-pagination
|
||||
|
@ -166,7 +170,14 @@
|
|||
:page-size="pageSize"
|
||||
:page-size-options="pageSizeOptions"
|
||||
@showSizeChange="onShowSizeChange"
|
||||
:show-total="(total, range) => `当前${range[0]}-${range[1]} 共 ${total}条记录`"
|
||||
:show-total="
|
||||
(total, range) =>
|
||||
$t('pagination.total', {
|
||||
range0: range[0],
|
||||
range1: range[1],
|
||||
total,
|
||||
})
|
||||
"
|
||||
@change="
|
||||
(page) => {
|
||||
currentPage = page
|
||||
|
@ -175,8 +186,8 @@
|
|||
"
|
||||
>
|
||||
<template slot="buildOptionText" slot-scope="props">
|
||||
<span v-if="props.value !== '100000'">{{ props.value }}条/页</span>
|
||||
<span v-if="props.value === '100000'">全部</span>
|
||||
<span v-if="props.value !== '100000'">{{ props.value }}{{ $t('itemsPerPage') }}</span>
|
||||
<span v-if="props.value === '100000'">{{ $t('all') }}</span>
|
||||
</template>
|
||||
</a-pagination>
|
||||
</div>
|
||||
|
@ -444,9 +455,11 @@ export default {
|
|||
return {}
|
||||
},
|
||||
handleExport() {
|
||||
// this.$refs.xTable.openExport()
|
||||
this.$refs.batchDownload.open({
|
||||
preferenceAttrList: [{ id: `ci_type_alias`, value: 'ci_type_alias', label: '模型' }, ...this.columnsGroup],
|
||||
preferenceAttrList: [
|
||||
{ id: `ci_type_alias`, value: 'ci_type_alias', label: this.$t('cmdb.ciType.ciType') },
|
||||
...this.columnsGroup,
|
||||
],
|
||||
})
|
||||
},
|
||||
batchDownload({ filename, type, checkedKeys }) {
|
||||
|
@ -517,11 +530,11 @@ export default {
|
|||
}${fuzzySearch ? `,*${fuzzySearch}*` : ''}`
|
||||
this.$copyText(text)
|
||||
.then(() => {
|
||||
this.$message.success('复制成功!')
|
||||
this.$message.success(this.$t('copySuccess'))
|
||||
this.$emit('copySuccess', text)
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.error('复制失败!')
|
||||
this.$message.error(this.$t('cmdb.ci.copyFailed'))
|
||||
})
|
||||
},
|
||||
},
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<div :style="{ marginBottom: '-24px' }">
|
||||
<div v-if="!subscribeTreeViewCiTypesLoading && subscribeTreeViewCiTypes.length === 0">
|
||||
<a-alert message="请先到 我的订阅 页面完成订阅!" banner></a-alert>
|
||||
<a-alert :message="$t('cmdb.tree.tips1')" banner></a-alert>
|
||||
</div>
|
||||
<div class="tree-views">
|
||||
<div class="tree-views" v-else>
|
||||
<div class="cmdb-views-header">
|
||||
<span>
|
||||
<span class="cmdb-views-header-title">{{ currentCiTypeName }}</span>
|
||||
|
@ -15,16 +15,12 @@
|
|||
"
|
||||
class="cmdb-views-header-metadata"
|
||||
><a-icon type="info-circle" />
|
||||
属性说明
|
||||
{{ $t('cmdb.components.attributeDesc') }}
|
||||
</span>
|
||||
</span>
|
||||
<a-button
|
||||
size="small"
|
||||
icon="plus"
|
||||
type="primary"
|
||||
@click="$refs.create.handleOpen(true, 'create')"
|
||||
>新建</a-button
|
||||
>
|
||||
<a-button size="small" icon="plus" type="primary" @click="$refs.create.handleOpen(true, 'create')">{{
|
||||
$t('create')
|
||||
}}</a-button>
|
||||
</div>
|
||||
<SplitPane
|
||||
:min="200"
|
||||
|
@ -82,12 +78,12 @@
|
|||
</span>
|
||||
<span class="tree-views-left-header-name">{{ ciType.alias || ciType.name }}</span>
|
||||
<div class="actions">
|
||||
<a-tooltip title="取消订阅">
|
||||
<a-tooltip :title="$t('cmdb.preference.cancelSub')">
|
||||
<div class="action" @click="(e) => cancelSubscribe(e, ciType)">
|
||||
<a-icon type="star" />
|
||||
</div>
|
||||
</a-tooltip>
|
||||
<a-tooltip title="订阅设置">
|
||||
<a-tooltip :title="$t('cmdb.tree.subSettings')">
|
||||
<div class="action" @click="(e) => subscribeSetting(e, ciType)">
|
||||
<a-icon type="setting" />
|
||||
</div>
|
||||
|
@ -132,12 +128,12 @@
|
|||
/>
|
||||
<div class="ops-list-batch-action">
|
||||
<template v-if="selectedRowKeys.length">
|
||||
<span @click="$refs.create.handleOpen(true, 'update')">修改</span>
|
||||
<span @click="$refs.create.handleOpen(true, 'update')">{{ $t('update') }}</span>
|
||||
<a-divider type="vertical" />
|
||||
<span @click="openBatchDownload">下载</span>
|
||||
<span @click="openBatchDownload">{{ $t('download') }}</span>
|
||||
<a-divider type="vertical" />
|
||||
<span @click="batchDelete">删除</span>
|
||||
<span>选取:{{ selectedRowKeys.length }} 项</span>
|
||||
<span @click="batchDelete">{{ $t('delete') }}</span>
|
||||
<span>{{ $t('cmdb.ci.selectRows', { rows: selectedRowKeys.length }) }}</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -199,7 +195,7 @@
|
|||
:getPopupContainer="(trigger) => trigger.parentElement"
|
||||
:style="{ width: '100%', height: '32px' }"
|
||||
v-model="row[col.field]"
|
||||
placeholder="请选择"
|
||||
:placeholder="$t('placeholder2')"
|
||||
v-if="col.is_choice"
|
||||
:showArrow="false"
|
||||
:mode="col.is_list ? 'multiple' : 'default'"
|
||||
|
@ -234,7 +230,7 @@
|
|||
:getPopupContainer="(trigger) => trigger.parentElement"
|
||||
:style="{ width: '100%', height: '32px' }"
|
||||
v-model="row[col.field]"
|
||||
placeholder="请选择"
|
||||
:placeholder="$t('placeholder2')"
|
||||
v-else-if="col.is_list"
|
||||
:showArrow="false"
|
||||
mode="tags"
|
||||
|
@ -314,9 +310,9 @@
|
|||
</template>
|
||||
</template>
|
||||
</vxe-table-column>
|
||||
<vxe-table-column align="left" field="operate" fixed="right" width="80">
|
||||
<vxe-table-column align="left" field="operate" fixed="right" width="120">
|
||||
<template #header>
|
||||
<span>操作</span>
|
||||
<span>{{ $t('operation') }}</span>
|
||||
<EditAttrsPopover :typeId="Number(typeId)" class="operation-icon" @refresh="refreshAfterEditAttrs" />
|
||||
</template>
|
||||
<template #default="{ row }">
|
||||
|
@ -324,13 +320,13 @@
|
|||
<a @click="$refs.detail.create(row.ci_id || row._id)">
|
||||
<a-icon type="unordered-list" />
|
||||
</a>
|
||||
<a-tooltip title="添加关系">
|
||||
<a-tooltip :title="$t('cmdb.ci.addRelation')">
|
||||
<a @click="$refs.detail.create(row.ci_id || row._id, 'tab_2', '2')">
|
||||
<a-icon type="retweet" />
|
||||
</a>
|
||||
</a-tooltip>
|
||||
<template>
|
||||
<a-tooltip title="删除实例">
|
||||
<a-tooltip :title="$t('cmdb.ciType.deleteInstance')">
|
||||
<a @click="deleteCI(row)" :style="{ color: 'red' }">
|
||||
<a-icon type="delete" />
|
||||
</a>
|
||||
|
@ -340,14 +336,14 @@
|
|||
</template>
|
||||
</vxe-table-column>
|
||||
<template #empty>
|
||||
<div v-if="loading" style="height: 200px; line-height: 200px">加载中...</div>
|
||||
<div v-if="loading" style="height: 200px; line-height: 200px">{{ $t('loading') }}</div>
|
||||
<div v-else>
|
||||
<img :style="{ width: '200px' }" :src="require('@/assets/data_empty.png')" />
|
||||
<div>暂无数据</div>
|
||||
<div>{{ $t('noData') }}</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #loading>
|
||||
<div style="height: 200px; line-height: 200px">{{ loadTip || '加载中...' }}</div>
|
||||
<div style="height: 200px; line-height: 200px">{{ loadTip || $t('loading') }}</div>
|
||||
</template>
|
||||
</ops-table>
|
||||
<div :style="{ textAlign: 'right', marginTop: '4px' }">
|
||||
|
@ -359,7 +355,14 @@
|
|||
show-quick-jumper
|
||||
:page-size="pageSize"
|
||||
:page-size-options="pageSizeOptions"
|
||||
:show-total="(total, range) => `当前${range[0]}-${range[1]} 共 ${total}条记录`"
|
||||
:show-total="
|
||||
(total, range) =>
|
||||
$t('pagination.total', {
|
||||
range0: range[0],
|
||||
range1: range[1],
|
||||
total,
|
||||
})
|
||||
"
|
||||
:style="{ alignSelf: 'flex-end' }"
|
||||
@showSizeChange="onShowSizeChange"
|
||||
@change="
|
||||
|
@ -370,8 +373,8 @@
|
|||
"
|
||||
>
|
||||
<template slot="buildOptionText" slot-scope="props">
|
||||
<span v-if="props.value !== '100000'">{{ props.value }}条/页</span>
|
||||
<span v-if="props.value === '100000'">全部</span>
|
||||
<span v-if="props.value !== '100000'">{{ props.value }}{{ $t('itemsPerPage') }}</span>
|
||||
<span v-if="props.value === '100000'">{{ $t('all') }}</span>
|
||||
</template>
|
||||
</a-pagination>
|
||||
</div>
|
||||
|
@ -516,7 +519,7 @@ export default {
|
|||
},
|
||||
},
|
||||
watch: {
|
||||
'$route.path': function (newPath, oldPath) {
|
||||
'$route.path': function(newPath, oldPath) {
|
||||
this.newLoad = true
|
||||
this.typeId = this.$route.params.typeId
|
||||
this.initPage()
|
||||
|
@ -539,9 +542,6 @@ export default {
|
|||
},
|
||||
inject: ['reload'],
|
||||
async created() {
|
||||
// const res = await getSubscribeTreeView()
|
||||
// this.subscribeTreeViewCiTypes = res
|
||||
// await this.initPage()
|
||||
await this.getTreeViews()
|
||||
},
|
||||
mounted() {
|
||||
|
@ -780,15 +780,13 @@ export default {
|
|||
e.preventDefault()
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
title: that.$t('warning'),
|
||||
content: (h) => (
|
||||
<div>
|
||||
确认要取消订阅 <span style={{ fontWeight: 700, color: 'black' }}>{ciType.alias || ciType.name}</span>?
|
||||
</div>
|
||||
<div>{that.$t('cmdb.preference.confirmcancelSub2', { name: ciType.alias || ciType.name })}</div>
|
||||
),
|
||||
onOk() {
|
||||
subscribeTreeView(ciType.type_id, []).then(() => {
|
||||
that.$message.success('取消订阅成功')
|
||||
that.$message.success(that.$t('cmdb.preference.cancelSubSuccess'))
|
||||
if (Number(that.$route.params.typeId) === Number(ciType.type_id)) {
|
||||
that.$router.history.push('/cmdb/treeviews')
|
||||
that.reload()
|
||||
|
@ -902,34 +900,17 @@ export default {
|
|||
deleteCI(record) {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: '确认删除?',
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('confirmDelete'),
|
||||
onOk() {
|
||||
deleteCI(record.ci_id || record._id).then((res) => {
|
||||
that.$message.success('删除成功!')
|
||||
that.$message.success(that.$t('deleteSuccess'))
|
||||
that.reload()
|
||||
})
|
||||
},
|
||||
})
|
||||
},
|
||||
onSelectChange(e) {
|
||||
/* const current = records.map((i) => i._id)
|
||||
|
||||
const cached = new Set(this.selectedRowKeys)
|
||||
if (checked) {
|
||||
current.forEach((i) => {
|
||||
cached.add(i)
|
||||
})
|
||||
} else {
|
||||
if (row) {
|
||||
cached.delete(row._id)
|
||||
} else {
|
||||
this.instanceList.map((row) => {
|
||||
cached.delete(row._id)
|
||||
})
|
||||
}
|
||||
}
|
||||
this.selectedRowKeys = Array.from(cached) */
|
||||
const xTable = this.$refs.xTable.getVxetableRef()
|
||||
const records = [...xTable.getCheckboxRecords(), ...xTable.getCheckboxReserveRecords()]
|
||||
this.selectedRowKeys = records.map((i) => i.ci_id || i._id)
|
||||
|
@ -1001,7 +982,7 @@ export default {
|
|||
if (JSON.stringify(data) !== '{}') {
|
||||
updateCI(row._id, data)
|
||||
.then(() => {
|
||||
this.$message.success('保存成功!')
|
||||
this.$message.success(this.$t('saveSuccess'))
|
||||
const arr1 = this.treeViewsLevels.map((item) => item.name)
|
||||
const arr2 = Object.keys(data)
|
||||
const arr3 = arr1.filter((item) => {
|
||||
|
@ -1054,10 +1035,7 @@ export default {
|
|||
this.$refs.jsonEditor.open(column, row)
|
||||
},
|
||||
async openBatchDownload() {
|
||||
this.$refs.batchDownload.open({
|
||||
preferenceAttrList: this.currentAttrList,
|
||||
ciTypeName: this.$route.meta.title || this.$route.meta.name,
|
||||
})
|
||||
this.$refs.batchDownload.open({ preferenceAttrList: this.currentAttrList, ciTypeName: this.currentCiTypeName })
|
||||
},
|
||||
batchDownload({ filename, type, checkedKeys }) {
|
||||
console.log(filename, type)
|
||||
|
@ -1090,8 +1068,8 @@ export default {
|
|||
batchDelete() {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: '确认删除?',
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('confirmDelete'),
|
||||
onOk() {
|
||||
that.batchDeleteAsync()
|
||||
},
|
||||
|
@ -1101,7 +1079,7 @@ export default {
|
|||
let successNum = 0
|
||||
let errorNum = 0
|
||||
this.loading = true
|
||||
this.loadTip = `正在删除...`
|
||||
this.loadTip = this.$t('cmdb.ci.batchDeleting')
|
||||
const floor = Math.ceil(this.selectedRowKeys.length / 6)
|
||||
for (let i = 0; i < floor; i++) {
|
||||
const itemList = this.selectedRowKeys.slice(6 * i, 6 * i + 6)
|
||||
|
@ -1117,7 +1095,11 @@ export default {
|
|||
})
|
||||
})
|
||||
.finally(() => {
|
||||
this.loadTip = `正在删除,共${this.selectedRowKeys.length}个,成功${successNum}个,失败${errorNum}个`
|
||||
this.loadTip = this.$t('cmdb.ci.batchDeleting2', {
|
||||
total: this.selectedRowKeys.length,
|
||||
successNum: successNum,
|
||||
errorNum: errorNum,
|
||||
})
|
||||
})
|
||||
}
|
||||
this.loading = false
|
||||
|
@ -1130,8 +1112,8 @@ export default {
|
|||
batchUpdateFromCreateInstance(values) {
|
||||
const that = this
|
||||
this.$confirm({
|
||||
title: '警告',
|
||||
content: '确认要批量修改吗 ?',
|
||||
title: that.$t('warning'),
|
||||
content: that.$t('cmdb.ci.batchUpdateConfirm'),
|
||||
onOk() {
|
||||
that.batchUpdateAsync(values)
|
||||
},
|
||||
|
@ -1141,7 +1123,7 @@ export default {
|
|||
let successNum = 0
|
||||
let errorNum = 0
|
||||
this.loading = true
|
||||
this.loadTip = `正在批量修改...`
|
||||
this.loadTip = this.$t('cmdb.ci.batchUpdateInProgress')
|
||||
const payload = {}
|
||||
Object.keys(values).forEach((key) => {
|
||||
if (values[key] || values[key] === 0) {
|
||||
|
@ -1163,7 +1145,11 @@ export default {
|
|||
errorNum += 1
|
||||
})
|
||||
.finally(() => {
|
||||
this.loadTip = `正在批量修改,共${this.selectedRowKeys.length}个,成功${successNum}个,失败${errorNum}个`
|
||||
this.loadTip = this.$t('cmdb.ci.batchUpdateInProgress2', {
|
||||
total: this.selectedRowKeys.length,
|
||||
successNum: successNum,
|
||||
errorNum: errorNum,
|
||||
})
|
||||
})
|
||||
}
|
||||
this.loading = false
|
||||
|
@ -1217,10 +1203,10 @@ export default {
|
|||
const text = `q=_type:${this.typeId}${exp ? `,${exp}` : ''}${fuzzySearch ? `,*${fuzzySearch}*` : ''}`
|
||||
this.$copyText(text)
|
||||
.then(() => {
|
||||
this.$message.success('复制成功!')
|
||||
this.$message.success(this.$t('copySuccess'))
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.error('复制失败!')
|
||||
this.$message.error(this.$t('cmdb.ci.copyFailed'))
|
||||
})
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue