|
43 | 43 | v-else-if="property['bk_property_type'] === 'bool'"
|
44 | 44 | v-model="condition[property['bk_obj_id']][property['bk_property_id']]['value']">
|
45 | 45 | </cmdb-form-bool-input>
|
46 |
| - <cmdb-form-associate-input class="filter-field-value filter-field-associate fr" |
47 |
| - v-else-if="['singleasst', 'multiasst'].includes(property['bk_property_type'])" |
48 |
| - v-model="condition[property['bk_obj_id']][property['bk_property_id']]['value']"> |
49 |
| - </cmdb-form-associate-input> |
| 46 | + <cmdb-search-input class="filter-field-value fr" |
| 47 | + v-else-if="['singlechar', 'longchar'].includes(property.bk_property_type)" |
| 48 | + v-model="condition[property.bk_obj_id][property.bk_property_id].value"> |
| 49 | + </cmdb-search-input> |
50 | 50 | <component class="filter-field-value fr" :class="`filter-field-${property['bk_property_type']}`"
|
51 | 51 | v-else
|
52 | 52 | :is="`cmdb-form-${property['bk_property_type']}`"
|
|
313 | 313 | }
|
314 | 314 | // 填充必要模型查询参数
|
315 | 315 | const requiredObj = ['biz', 'host', 'set', 'module']
|
316 |
| - const normalProperties = this.customFieldProperties.filter(property => !['singleasst', 'multiasst'].includes(property['bk_property_type'])) |
317 | 316 | requiredObj.forEach(objId => {
|
318 | 317 | const objParams = {
|
319 | 318 | 'bk_obj_id': objId,
|
320 | 319 | condition: [],
|
321 | 320 | fields: []
|
322 | 321 | }
|
323 |
| - const objProperties = normalProperties.filter(property => property['bk_obj_id'] === objId) |
| 322 | + const objProperties = this.customFieldProperties.filter(property => property['bk_obj_id'] === objId) |
324 | 323 | objProperties.forEach(property => {
|
325 | 324 | const propertyCondition = this.condition[objId][property['bk_property_id']]
|
326 | 325 | // 必要模型参数合法时,填充对应模型的condition
|
|
329 | 328 | if (propertyCondition.operator === '$in') {
|
330 | 329 | let splitValue = [...(new Set(value.split(',').map(val => val.trim())))]
|
331 | 330 | value = splitValue.length > 1 ? [...splitValue, value] : splitValue
|
| 331 | + } else if (propertyCondition.operator === '$multilike') { |
| 332 | + value = value.split('\n').filter(str => str.trim().length).map(str => str.trim()) |
332 | 333 | }
|
333 | 334 | objParams.condition.push({
|
334 | 335 | ...propertyCondition,
|
|
377 | 378 | getPropertyCondition (property) {
|
378 | 379 | const objId = property['bk_obj_id']
|
379 | 380 | const propertyId = property['bk_property_id']
|
| 381 | + const propertyType = property.bk_property_type |
| 382 | + let operator = '$eq' |
| 383 | + if (['bk_set_name', 'bk_module_name'].includes(propertyId)) { |
| 384 | + operator = '$in' |
| 385 | + } else if (['singlechar', 'longchar'].includes(propertyType)) { |
| 386 | + operator = '$multilike' |
| 387 | + } |
380 | 388 | const condition = {
|
381 | 389 | field: propertyId,
|
382 |
| - operator: '', |
| 390 | + operator: operator, |
383 | 391 | value: ''
|
384 | 392 | }
|
385 | 393 | const collectionConditon = (this.applyingConditions[objId] || []).find(condition => condition.field === propertyId)
|
|
578 | 586 | &.sticky {
|
579 | 587 | border-top: 1px solid $cmdbBorderColor;
|
580 | 588 | padding: 10px 20px 0;
|
| 589 | + z-index: 101; |
581 | 590 | }
|
582 | 591 | .collection-button.collecting {
|
583 | 592 | color: #ffb400;
|
|
0 commit comments