feat(ui): dcim - update rack list filter

This commit is contained in:
songlh
2024-11-27 11:14:21 +08:00
parent ccc45bec0f
commit 1a2929c44d
2 changed files with 18 additions and 3 deletions

View File

@@ -19,6 +19,7 @@
<a-select <a-select
class="dcim-main-row-select" class="dcim-main-row-select"
:getPopupContainer="(trigger) => trigger.parentElement"
v-model="currentRackType" v-model="currentRackType"
> >
<a-icon slot="suffixIcon" type="caret-down" /> <a-icon slot="suffixIcon" type="caret-down" />
@@ -26,6 +27,7 @@
v-for="(item) in rackTypeSelectOption" v-for="(item) in rackTypeSelectOption"
:key="item.value" :key="item.value"
:value="item.value" :value="item.value"
:class="item.value === 'unitAbnormal' ? 'dcim-main-row-select-unitAbnormal' : ''"
> >
{{ item.label }} {{ item.label }}
</a-select-option> </a-select-option>
@@ -142,7 +144,7 @@ export default {
value: 'table', value: 'table',
icon: 'monitor-list_view' icon: 'monitor-list_view'
} }
], ]
} }
}, },
computed: { computed: {
@@ -164,6 +166,11 @@ export default {
}) })
} }
selectOption.push({
value: 'unitAbnormal',
label: this.$t('cmdb.dcim.unitAbnormal')
})
return selectOption return selectOption
}, },
filterRackList() { filterRackList() {
@@ -174,8 +181,12 @@ export default {
} }
if (this.currentRackType !== 'all') { if (this.currentRackType !== 'all') {
if (this.currentRackType === 'unitAbnormal') {
rackList = rackList.filter((item) => item.u_slot_abnormal)
} else {
rackList = rackList.filter((item) => item.rack_type === this.currentRackType) rackList = rackList.filter((item) => item.rack_type === this.currentRackType)
} }
}
return rackList return rackList
} }
@@ -312,6 +323,10 @@ export default {
width: 120px; width: 120px;
margin-left: 22px; margin-left: 22px;
flex-shrink: 0; flex-shrink: 0;
/deep/ &-unitAbnormal {
border-top: dashed 1px #e8e8e8;
}
} }
&-right { &-right {

View File

@@ -198,7 +198,7 @@ export default {
}, },
async getRackData() { async getRackData() {
await this.getAttrList(DCIM_CITYPE_NAME.RACK, DCIM_CITYPE_NAME.RACK) await this.getAttrList(DCIM_CITYPE_NAME.RACK, DCIM_TYPE.RACK)
const CITypeRes = await getCIType(DCIM_CITYPE_NAME.RACK) const CITypeRes = await getCIType(DCIM_CITYPE_NAME.RACK)
this.rackCITYpe = CITypeRes?.ci_types?.[0] || {} this.rackCITYpe = CITypeRes?.ci_types?.[0] || {}