diff --git a/cmdb-ui/src/modules/cmdb/components/cmdbTypeSelect/cmdbTypeSelectAntd.vue b/cmdb-ui/src/modules/cmdb/components/cmdbTypeSelect/cmdbTypeSelectAntd.vue new file mode 100644 index 0000000..21fd008 --- /dev/null +++ b/cmdb-ui/src/modules/cmdb/components/cmdbTypeSelect/cmdbTypeSelectAntd.vue @@ -0,0 +1,108 @@ + + + + + diff --git a/cmdb-ui/src/modules/cmdb/views/ci_types/relationTable.vue b/cmdb-ui/src/modules/cmdb/views/ci_types/relationTable.vue index d270b5a..ccbe371 100644 --- a/cmdb-ui/src/modules/cmdb/views/ci_types/relationTable.vue +++ b/cmdb-ui/src/modules/cmdb/views/ci_types/relationTable.vue @@ -171,23 +171,12 @@ - - - {{ CIType.alias || CIType.name }} - ({{ CIType.name }}) - - + /> @@ -285,12 +274,14 @@ import { getCITypes } from '@/modules/cmdb/api/CIType' import { getCITypeAttributesById } from '@/modules/cmdb/api/CITypeAttr' import { v4 as uuidv4 } from 'uuid' -import CMDBGrant from '../../components/cmdbGrant' +import CMDBGrant from '@/modules/cmdb/components/cmdbGrant' +import CMDBTypeSelectAntd from '@/modules/cmdb/components/cmdbTypeSelect/cmdbTypeSelectAntd' export default { name: 'RelationTable', components: { CMDBGrant, + CMDBTypeSelectAntd }, props: { CITypeId: { @@ -513,13 +504,6 @@ export default { cmdbGrantType: 'type_relation', }) }, - filterOption(input, option) { - const inputValue = input.toLowerCase() - const alias = option.componentOptions.children[0].text.toLowerCase() - const name = option.componentOptions.children[1]?.elm?.innerHTML?.toLowerCase?.() ?? '' - - return alias.indexOf(inputValue) >= 0 || name.indexOf(inputValue) >= 0 - }, rowClass({ row }) { if (row.isDivider) return 'relation-table-divider' if (row.isParent) return 'relation-table-parent' @@ -604,9 +588,11 @@ export default { this.modalAttrList.forEach((item) => { item.childAttrId = undefined }) - getCITypeAttributesById(value).then((res) => { - this.modalChildAttributes = res?.attributes ?? [] - }) + if (value) { + getCITypeAttributesById(value).then((res) => { + this.modalChildAttributes = res?.attributes ?? [] + }) + } }, filterAttributes(attributes) { // filter password/json/is_list/longText/bool/reference diff --git a/cmdb-ui/src/modules/cmdb/views/custom_dashboard/chartForm.vue b/cmdb-ui/src/modules/cmdb/views/custom_dashboard/chartForm.vue index f7950a1..cf0472e 100644 --- a/cmdb-ui/src/modules/cmdb/views/custom_dashboard/chartForm.vue +++ b/cmdb-ui/src/modules/cmdb/views/custom_dashboard/chartForm.vue @@ -51,31 +51,21 @@ :label="$t('cmdb.ciType.ciType')" prop="type_ids" > - - {{ - ci_type.alias || ci_type.name - }} - + :CITypeGroup="CITypeGroup" + :placeholder="$t('cmdb.ciType.selectCIType')" + @change="changeCIType" + /> - - {{ - ci_type.alias || ci_type.name - }} - + @change="changeCIType" + /> import Chart from './chart.vue' import { dashboardCategory } from './constant' -import { postCustomDashboard, putCustomDashboard, postCustomDashboardPreview } from '../../api/customDashboard' -import { getCITypeAttributesByTypeIds, getCITypeCommonAttributesByTypeIds } from '../../api/CITypeAttr' -import { getRecursive_level2children } from '../../api/CITypeRelation' -import { getLastLayout } from '../../utils/helper' +import { postCustomDashboard, putCustomDashboard, postCustomDashboardPreview } from '@/modules/cmdb/api/customDashboard' +import { getCITypeAttributesByTypeIds, getCITypeCommonAttributesByTypeIds } from '@/modules/cmdb/api/CITypeAttr' +import { getRecursive_level2children } from '@/modules/cmdb/api/CITypeRelation' +import { getCITypeGroupsConfig } from '@/modules/cmdb/api/ciTypeGroup' +import { getLastLayout } from '@/modules/cmdb/utils/helper' + import FilterComp from '@/components/CMDBFilterComp' import ColorPicker from './colorPicker.vue' import ColorListPicker from './colorListPicker.vue' +import CMDBTypeSelectAntd from '@/modules/cmdb/components/cmdbTypeSelect/cmdbTypeSelectAntd' export default { name: 'ChartForm', - components: { Chart, FilterComp, ColorPicker, ColorListPicker }, + components: { + Chart, + FilterComp, + ColorPicker, + ColorListPicker, + CMDBTypeSelectAntd + }, props: { ci_types: { type: Array, @@ -365,6 +364,7 @@ export default { level2children: {}, isShadow: false, changeCITypeRequestValue: null, + CITypeGroup: [] } }, computed: { @@ -484,6 +484,7 @@ export default { showIcon, tableCategory: ret === 'cis' ? 2 : 1, } + this.getCITypeGroup() }, handleclose() { this.attributes = [] @@ -491,6 +492,9 @@ export default { this.isShowPreview = false this.visible = false }, + async getCITypeGroup() { + this.CITypeGroup = await getCITypeGroupsConfig({ need_other: true }) + }, changeCIType(value) { this.form.attr_ids = [] this.commonAttributes = [] diff --git a/cmdb-ui/src/modules/cmdb/views/model_relation/index.vue b/cmdb-ui/src/modules/cmdb/views/model_relation/index.vue index 3e52885..903d83a 100644 --- a/cmdb-ui/src/modules/cmdb/views/model_relation/index.vue +++ b/cmdb-ui/src/modules/cmdb/views/model_relation/index.vue @@ -14,35 +14,26 @@ > - - - {{ CIType.alias || CIType.name }} - ({{ CIType.name }}) - - + /> - - - {{ CIType.alias || CIType.name }} - ({{ CIType.name }}) - - + /> @@ -127,7 +118,6 @@