mirror of https://github.com/veops/cmdb.git
fix(ui): some bugs (#512)
This commit is contained in:
parent
a903738cdc
commit
c92a3a5f31
|
@ -49,6 +49,8 @@
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import '@wangeditor/editor/dist/css/style.css'
|
import '@wangeditor/editor/dist/css/style.css'
|
||||||
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
||||||
|
import { i18nChangeLanguage } from '@wangeditor/editor'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'NoticeContent',
|
name: 'NoticeContent',
|
||||||
components: { Editor, Toolbar },
|
components: { Editor, Toolbar },
|
||||||
|
@ -76,6 +78,10 @@ export default {
|
||||||
if (editor == null) return
|
if (editor == null) return
|
||||||
editor.destroy() // When the component is destroyed, destroy the editor in time
|
editor.destroy() // When the component is destroyed, destroy the editor in time
|
||||||
},
|
},
|
||||||
|
beforeCreate() {
|
||||||
|
const locale = this.$i18n.locale === 'zh' ? 'zh-CN' : 'en'
|
||||||
|
i18nChangeLanguage(locale)
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onCreated(editor) {
|
onCreated(editor) {
|
||||||
this.editor = Object.seal(editor) // Be sure to use Object.seal(), otherwise an error will be reported
|
this.editor = Object.seal(editor) // Be sure to use Object.seal(), otherwise an error will be reported
|
||||||
|
|
|
@ -198,6 +198,9 @@ export default {
|
||||||
if (this.type === 'resourceSearch') {
|
if (this.type === 'resourceSearch') {
|
||||||
this.getCITypeGroups()
|
this.getCITypeGroups()
|
||||||
}
|
}
|
||||||
|
if (this.typeId) {
|
||||||
|
this.currenCiType = [this.typeId]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// toggleAdvanced() {
|
// toggleAdvanced() {
|
||||||
|
|
|
@ -4,6 +4,7 @@ const cmdb_en = {
|
||||||
configTable: 'Config Table',
|
configTable: 'Config Table',
|
||||||
menu: {
|
menu: {
|
||||||
views: 'Views',
|
views: 'Views',
|
||||||
|
resources: 'Resources',
|
||||||
config: 'Configuration',
|
config: 'Configuration',
|
||||||
backend: 'Management',
|
backend: 'Management',
|
||||||
ciTable: 'Resource Views',
|
ciTable: 'Resource Views',
|
||||||
|
@ -69,9 +70,9 @@ const cmdb_en = {
|
||||||
adAutoInLib: 'Save as CI auto',
|
adAutoInLib: 'Save as CI auto',
|
||||||
adInterval: 'Collection frequency',
|
adInterval: 'Collection frequency',
|
||||||
byInterval: 'by interval',
|
byInterval: 'by interval',
|
||||||
allNodes: 'All nodes',
|
allNodes: 'All Instances',
|
||||||
specifyNodes: 'Specify Node',
|
specifyNodes: 'Specify Instance',
|
||||||
specifyNodesTips: 'Please fill in the specify node!',
|
specifyNodesTips: 'Please fill in the specify instance!',
|
||||||
username: 'Username',
|
username: 'Username',
|
||||||
password: 'Password',
|
password: 'Password',
|
||||||
link: 'Link',
|
link: 'Link',
|
||||||
|
@ -144,7 +145,7 @@ const cmdb_en = {
|
||||||
triggerDataChange: 'Data changes',
|
triggerDataChange: 'Data changes',
|
||||||
triggerDate: 'Date attribute',
|
triggerDate: 'Date attribute',
|
||||||
triggerEnable: 'Turn on',
|
triggerEnable: 'Turn on',
|
||||||
descInput: 'Please enter remarks',
|
descInput: 'Please enter descriptions',
|
||||||
triggerCondition: 'Triggering conditions',
|
triggerCondition: 'Triggering conditions',
|
||||||
addInstance: 'Add new instance',
|
addInstance: 'Add new instance',
|
||||||
deleteInstance: 'Delete instance',
|
deleteInstance: 'Delete instance',
|
||||||
|
|
|
@ -4,8 +4,9 @@ const cmdb_zh = {
|
||||||
configTable: '配置表格',
|
configTable: '配置表格',
|
||||||
menu: {
|
menu: {
|
||||||
views: '视图',
|
views: '视图',
|
||||||
|
resources: '资源',
|
||||||
config: '配置',
|
config: '配置',
|
||||||
backend: '管理端',
|
backend: '管理',
|
||||||
ciTable: '资源数据',
|
ciTable: '资源数据',
|
||||||
ciTree: '资源层级',
|
ciTree: '资源层级',
|
||||||
ciSearch: '资源搜索',
|
ciSearch: '资源搜索',
|
||||||
|
@ -69,9 +70,9 @@ const cmdb_zh = {
|
||||||
adAutoInLib: '自动入库',
|
adAutoInLib: '自动入库',
|
||||||
adInterval: '采集频率',
|
adInterval: '采集频率',
|
||||||
byInterval: '按间隔',
|
byInterval: '按间隔',
|
||||||
allNodes: '所有节点',
|
allNodes: '所有实例',
|
||||||
specifyNodes: '指定节点',
|
specifyNodes: '指定实例',
|
||||||
specifyNodesTips: '请填写指定节点!',
|
specifyNodesTips: '请填写指定实例!',
|
||||||
username: '用户名',
|
username: '用户名',
|
||||||
password: '密码',
|
password: '密码',
|
||||||
link: '链接',
|
link: '链接',
|
||||||
|
@ -144,7 +145,7 @@ const cmdb_zh = {
|
||||||
triggerDataChange: '数据变更',
|
triggerDataChange: '数据变更',
|
||||||
triggerDate: '日期属性',
|
triggerDate: '日期属性',
|
||||||
triggerEnable: '开启',
|
triggerEnable: '开启',
|
||||||
descInput: '请输入备注',
|
descInput: '请输入描述',
|
||||||
triggerCondition: '触发条件',
|
triggerCondition: '触发条件',
|
||||||
addInstance: '新增实例',
|
addInstance: '新增实例',
|
||||||
deleteInstance: '删除实例',
|
deleteInstance: '删除实例',
|
||||||
|
|
|
@ -19,7 +19,7 @@ const genCmdbRoutes = async () => {
|
||||||
{
|
{
|
||||||
path: '/cmdb/disabled1',
|
path: '/cmdb/disabled1',
|
||||||
name: 'cmdb_disabled1',
|
name: 'cmdb_disabled1',
|
||||||
meta: { title: 'cmdb.menu.views', disabled: true },
|
meta: { title: 'cmdb.menu.resources', disabled: true },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/cmdb/resourceviews',
|
path: '/cmdb/resourceviews',
|
||||||
|
|
|
@ -107,6 +107,7 @@
|
||||||
v-decorator="[list.name, { rules: [{ required: false }] }]"
|
v-decorator="[list.name, { rules: [{ required: false }] }]"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:format="getFieldType(list.name) == '4' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss'"
|
:format="getFieldType(list.name) == '4' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss'"
|
||||||
|
:valueFormat="getFieldType(list.name) == '4' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss'"
|
||||||
v-if="getFieldType(list.name) === '4' || getFieldType(list.name) === '3'"
|
v-if="getFieldType(list.name) === '4' || getFieldType(list.name) === '3'"
|
||||||
:showTime="getFieldType(list.name) === '4' ? false : { format: 'HH:mm:ss' }"
|
:showTime="getFieldType(list.name) === '4' ? false : { format: 'HH:mm:ss' }"
|
||||||
/>
|
/>
|
||||||
|
@ -370,7 +371,7 @@ export default {
|
||||||
return 'select%%multiple'
|
return 'select%%multiple'
|
||||||
}
|
}
|
||||||
return 'select'
|
return 'select'
|
||||||
} else if (_find.value_type === '0' || _find.value_type === '1') {
|
} else if ((_find.value_type === '0' || _find.value_type === '1') && !_find.is_list) {
|
||||||
return 'input_number'
|
return 'input_number'
|
||||||
} else if (_find.value_type === '4' || _find.value_type === '3') {
|
} else if (_find.value_type === '4' || _find.value_type === '3') {
|
||||||
return _find.value_type
|
return _find.value_type
|
||||||
|
|
|
@ -182,7 +182,7 @@ export default {
|
||||||
const edges = []
|
const edges = []
|
||||||
this.parentCITypes.forEach((parent) => {
|
this.parentCITypes.forEach((parent) => {
|
||||||
const _findCiType = ci_types_list.find((item) => item.id === parent.id)
|
const _findCiType = ci_types_list.find((item) => item.id === parent.id)
|
||||||
if (this.firstCIs[parent.name]) {
|
if (this.firstCIs[parent.name] && _findCiType) {
|
||||||
const unique_id = _findCiType.show_id || _findCiType.unique_id
|
const unique_id = _findCiType.show_id || _findCiType.unique_id
|
||||||
const _findUnique = parent.attributes.find((attr) => attr.id === unique_id)
|
const _findUnique = parent.attributes.find((attr) => attr.id === unique_id)
|
||||||
const unique_name = _findUnique?.name
|
const unique_name = _findUnique?.name
|
||||||
|
@ -225,7 +225,7 @@ export default {
|
||||||
})
|
})
|
||||||
this.childCITypes.forEach((child) => {
|
this.childCITypes.forEach((child) => {
|
||||||
const _findCiType = ci_types_list.find((item) => item.id === child.id)
|
const _findCiType = ci_types_list.find((item) => item.id === child.id)
|
||||||
if (this.secondCIs[child.name]) {
|
if (this.secondCIs[child.name] && _findCiType) {
|
||||||
const unique_id = _findCiType.show_id || _findCiType.unique_id
|
const unique_id = _findCiType.show_id || _findCiType.unique_id
|
||||||
const _findUnique = child.attributes.find((attr) => attr.id === unique_id)
|
const _findUnique = child.attributes.find((attr) => attr.id === unique_id)
|
||||||
const unique_name = _findUnique?.name
|
const unique_name = _findUnique?.name
|
||||||
|
|
|
@ -112,7 +112,7 @@
|
||||||
<a-tab-pane key="tab_5">
|
<a-tab-pane key="tab_5">
|
||||||
<span slot="tab"><ops-icon type="itsm-association" />{{ $t('cmdb.ci.relITSM') }}</span>
|
<span slot="tab"><ops-icon type="itsm-association" />{{ $t('cmdb.ci.relITSM') }}</span>
|
||||||
<div :style="{ padding: '24px', height: '100%' }">
|
<div :style="{ padding: '24px', height: '100%' }">
|
||||||
<related-itsm-table :ci_id="ci._id" :ciHistory="ciHistory" :itsmInstalled="itsmInstalled" />
|
<RelatedItsmTable ref="relatedITSMTable" :ci_id="ci._id" :ciHistory="ciHistory" :itsmInstalled="itsmInstalled" :attrList="attrList" />
|
||||||
</div>
|
</div>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
|
@ -140,8 +140,6 @@ import CiDetailRelation from './ciDetailRelation.vue'
|
||||||
import TriggerTable from '../../operation_history/modules/triggerTable.vue'
|
import TriggerTable from '../../operation_history/modules/triggerTable.vue'
|
||||||
import RelatedItsmTable from './ciDetailRelatedItsmTable.vue'
|
import RelatedItsmTable from './ciDetailRelatedItsmTable.vue'
|
||||||
import CiRollbackForm from './ciRollbackForm.vue'
|
import CiRollbackForm from './ciRollbackForm.vue'
|
||||||
import { sleep } from '@/utils/util'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CiDetailTab',
|
name: 'CiDetailTab',
|
||||||
components: {
|
components: {
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
</div>
|
</div>
|
||||||
<SearchForm
|
<SearchForm
|
||||||
ref="search"
|
ref="search"
|
||||||
type="resourceSearch"
|
:type="type"
|
||||||
|
:typeId="typeId"
|
||||||
@refresh="handleSearch"
|
@refresh="handleSearch"
|
||||||
:preferenceAttrList="allAttributesList"
|
:preferenceAttrList="allAttributesList"
|
||||||
@updateAllAttributesList="updateAllAttributesList"
|
@updateAllAttributesList="updateAllAttributesList"
|
||||||
|
@ -205,7 +206,7 @@ import _ from 'lodash'
|
||||||
import SearchForm from '../../components/searchForm/SearchForm.vue'
|
import SearchForm from '../../components/searchForm/SearchForm.vue'
|
||||||
import { searchCI } from '../../api/ci'
|
import { searchCI } from '../../api/ci'
|
||||||
import { searchAttributes, getCITypeAttributesByTypeIds, getCITypeAttributesById } from '../../api/CITypeAttr'
|
import { searchAttributes, getCITypeAttributesByTypeIds, getCITypeAttributesById } from '../../api/CITypeAttr'
|
||||||
import { getCITypes } from '../../api/CIType'
|
import { getCITypes, getCIType } from '../../api/CIType'
|
||||||
import { getSubscribeAttributes } from '../../api/preference'
|
import { getSubscribeAttributes } from '../../api/preference'
|
||||||
import { getCITableColumns } from '../../utils/helper'
|
import { getCITableColumns } from '../../utils/helper'
|
||||||
import EditAttrsPopover from '../ci/modules/editAttrsPopover.vue'
|
import EditAttrsPopover from '../ci/modules/editAttrsPopover.vue'
|
||||||
|
@ -221,6 +222,14 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
typeId: {
|
||||||
|
type: Number,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
default: 'resourceSearch'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -250,8 +259,14 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getAllAttr()
|
if (this.typeId) {
|
||||||
this.getAllCiTypes()
|
this.getCIType(this.typeId)
|
||||||
|
this.getAttrsByType(this.typeId)
|
||||||
|
this.loadInstance()
|
||||||
|
} else {
|
||||||
|
this.getAllAttr()
|
||||||
|
this.getAllCiTypes()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getAllCiTypes() {
|
getAllCiTypes() {
|
||||||
|
@ -259,6 +274,17 @@ export default {
|
||||||
this.ciTypes = res.ci_types
|
this.ciTypes = res.ci_types
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getCIType(typeId) {
|
||||||
|
getCIType(typeId).then((res) => {
|
||||||
|
this.ciTypes = res.ci_types
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async getAttrsByType(typeId) {
|
||||||
|
await getCITypeAttributesById(typeId).then((res) => {
|
||||||
|
this.allAttributesList = res.attributes
|
||||||
|
this.originAllAttributesList = res.attributes
|
||||||
|
})
|
||||||
|
},
|
||||||
async getAllAttr() {
|
async getAllAttr() {
|
||||||
await searchAttributes({ page_size: 9999 }).then((res) => {
|
await searchAttributes({ page_size: 9999 }).then((res) => {
|
||||||
this.allAttributesList = res.attributes
|
this.allAttributesList = res.attributes
|
||||||
|
|
Loading…
Reference in New Issue