|
51 | 51 | :label="$t('cmdb.ciType.ciType')" |
52 | 52 | prop="type_ids" |
53 | 53 | > |
54 | | - <a-select |
55 | | - show-search |
56 | | - optionFilterProp="children" |
57 | | - @change="changeCIType" |
| 54 | + <CMDBTypeSelectAntd |
58 | 55 | v-model="form.type_ids" |
59 | | - :placeholder="$t('cmdb.ciType.selectCIType')" |
60 | 56 | mode="multiple" |
61 | | - > |
62 | | - <a-select-option v-for="ci_type in ci_types" :key="ci_type.id" :value="ci_type.id">{{ |
63 | | - ci_type.alias || ci_type.name |
64 | | - }}</a-select-option> |
65 | | - </a-select> |
| 57 | + :CITypeGroup="CITypeGroup" |
| 58 | + :placeholder="$t('cmdb.ciType.selectCIType')" |
| 59 | + @change="changeCIType" |
| 60 | + /> |
66 | 61 | </a-form-model-item> |
67 | 62 | <a-form-model-item v-else :label="$t('cmdb.ciType.ciType')" prop="type_id"> |
68 | | - <a-select |
69 | | - show-search |
70 | | - optionFilterProp="children" |
71 | | - @change="changeCIType" |
| 63 | + <CMDBTypeSelectAntd |
72 | 64 | v-model="form.type_id" |
| 65 | + :CITypeGroup="CITypeGroup" |
73 | 66 | :placeholder="$t('cmdb.ciType.selectCIType')" |
74 | | - > |
75 | | - <a-select-option v-for="ci_type in ci_types" :key="ci_type.id" :value="ci_type.id">{{ |
76 | | - ci_type.alias || ci_type.name |
77 | | - }}</a-select-option> |
78 | | - </a-select> |
| 67 | + @change="changeCIType" |
| 68 | + /> |
79 | 69 | </a-form-model-item> |
80 | 70 | <a-form-model-item |
81 | 71 | :label="$t('cmdb.custom_dashboard.dimensions')" |
|
309 | 299 | <script> |
310 | 300 | import Chart from './chart.vue' |
311 | 301 | import { dashboardCategory } from './constant' |
312 | | -import { postCustomDashboard, putCustomDashboard, postCustomDashboardPreview } from '../../api/customDashboard' |
313 | | -import { getCITypeAttributesByTypeIds, getCITypeCommonAttributesByTypeIds } from '../../api/CITypeAttr' |
314 | | -import { getRecursive_level2children } from '../../api/CITypeRelation' |
315 | | -import { getLastLayout } from '../../utils/helper' |
| 302 | +import { postCustomDashboard, putCustomDashboard, postCustomDashboardPreview } from '@/modules/cmdb/api/customDashboard' |
| 303 | +import { getCITypeAttributesByTypeIds, getCITypeCommonAttributesByTypeIds } from '@/modules/cmdb/api/CITypeAttr' |
| 304 | +import { getRecursive_level2children } from '@/modules/cmdb/api/CITypeRelation' |
| 305 | +import { getCITypeGroupsConfig } from '@/modules/cmdb/api/ciTypeGroup' |
| 306 | +import { getLastLayout } from '@/modules/cmdb/utils/helper' |
| 307 | +
|
316 | 308 | import FilterComp from '@/components/CMDBFilterComp' |
317 | 309 | import ColorPicker from './colorPicker.vue' |
318 | 310 | import ColorListPicker from './colorListPicker.vue' |
| 311 | +import CMDBTypeSelectAntd from '@/modules/cmdb/components/cmdbTypeSelect/cmdbTypeSelectAntd' |
319 | 312 |
|
320 | 313 | export default { |
321 | 314 | name: 'ChartForm', |
322 | | - components: { Chart, FilterComp, ColorPicker, ColorListPicker }, |
| 315 | + components: { |
| 316 | + Chart, |
| 317 | + FilterComp, |
| 318 | + ColorPicker, |
| 319 | + ColorListPicker, |
| 320 | + CMDBTypeSelectAntd |
| 321 | + }, |
323 | 322 | props: { |
324 | 323 | ci_types: { |
325 | 324 | type: Array, |
@@ -365,6 +364,7 @@ export default { |
365 | 364 | level2children: {}, |
366 | 365 | isShadow: false, |
367 | 366 | changeCITypeRequestValue: null, |
| 367 | + CITypeGroup: [] |
368 | 368 | } |
369 | 369 | }, |
370 | 370 | computed: { |
@@ -484,13 +484,17 @@ export default { |
484 | 484 | showIcon, |
485 | 485 | tableCategory: ret === 'cis' ? 2 : 1, |
486 | 486 | } |
| 487 | + this.getCITypeGroup() |
487 | 488 | }, |
488 | 489 | handleclose() { |
489 | 490 | this.attributes = [] |
490 | 491 | this.$refs.chartForm.clearValidate() |
491 | 492 | this.isShowPreview = false |
492 | 493 | this.visible = false |
493 | 494 | }, |
| 495 | + async getCITypeGroup() { |
| 496 | + this.CITypeGroup = await getCITypeGroupsConfig({ need_other: true }) |
| 497 | + }, |
494 | 498 | changeCIType(value) { |
495 | 499 | this.form.attr_ids = [] |
496 | 500 | this.commonAttributes = [] |
|
0 commit comments