File tree Expand file tree Collapse file tree
cmdb-ui/src/modules/cmdb/views/ci Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -133,19 +133,23 @@ export default {
133133 return CIType
134134 },
135135 filterPreferenceGroup () {
136+ if (! this ? .preferenceGroup ? .length ) {
137+ return []
138+ }
139+
136140 if (! this .searchValue ) {
137141 return this .preferenceGroup
138142 }
139143
140144 const preferenceGroup = _ .cloneDeep (this .preferenceGroup )
141145 preferenceGroup .forEach ((group ) => {
142- if (group .name .indexOf (this .searchValue ) !== - 1 ) {
146+ if (group? .name ? .indexOf ? . (this .searchValue ) >= 0 ) {
143147 return
144148 }
145149
146- group .children = group .children .filter ((item ) => item? .alias ? .indexOf ? .(this .searchValue ) !== - 1 || item? .name ? .indexOf (this .searchValue ) !== - 1 )
150+ group .children = group? .children ? .filter ? . ((item ) => item? .alias ? .indexOf ? .(this .searchValue ) >= 0 || item? .name ? .indexOf ? . (this .searchValue ) >= 0 ) || []
147151 })
148- return preferenceGroup .filter ((group ) => group .children .length )
152+ return preferenceGroup .filter ((group ) => group? .children ? .length )
149153 },
150154 },
151155 provide () {
You can’t perform that action at this time.
0 commit comments