108
108
109
109
<script >
110
110
import {
111
- isEmpty , hasIn , cloneDeep , remove , intersection , find
111
+ isEmpty , hasIn , cloneDeep , remove , intersection , find , findIndex
112
112
} from ' lodash'
113
113
import Vue from ' vue'
114
114
import TagMapConfig from ' ./tag-map-config.vue'
@@ -159,7 +159,7 @@ export default {
159
159
render : (h , params ) => (
160
160
< Input
161
161
value= {params .row .name }
162
- disabled= {this .isOperationBoxDisabled (params .row )}
162
+ disabled= {this .isOperationBoxDisabled (params .row , ' paramList ' , params . index )}
163
163
placeholder= {this .$t (' m_metric_key_placeholder' )}
164
164
onInput= {v => {
165
165
this .changeVal (' param_list' , params .index , ' name' , v)
@@ -184,7 +184,7 @@ export default {
184
184
< / div>
185
185
< Input
186
186
value= {params .row .regular }
187
- disabled= {this .isOperationBoxDisabled (params .row )}
187
+ disabled= {this .isOperationBoxDisabled (params .row , ' paramList ' , params . index )}
188
188
onInput= {v => {
189
189
this .changeVal (' param_list' , params .index , ' regular' , v)
190
190
}}
@@ -226,7 +226,7 @@ export default {
226
226
< Button
227
227
size= " small"
228
228
type= " primary"
229
- disabled= {this .isOperationBoxDisabled (params .row )}
229
+ disabled= {this .isOperationBoxDisabled (params .row , ' paramList ' , params . index )}
230
230
icon= " md-create"
231
231
onClick= {() => this .editTagMapping (params .index )}
232
232
>
@@ -246,7 +246,7 @@ export default {
246
246
size= " small"
247
247
type= " error"
248
248
style= " margin-right:5px;"
249
- disabled= {this .isOperationBoxDisabled (params .row ) || this .configInfo .param_list .length === 1 }
249
+ disabled= {this .isOperationBoxDisabled (params .row , ' paramList ' , params . index ) || this .configInfo .param_list .length === 1 }
250
250
onClick= {() => this .deleteAction (' param_list' , params .index )}
251
251
>
252
252
< Icon type= " md-trash" size= " 16" >< / Icon>
@@ -263,7 +263,7 @@ export default {
263
263
render : (h , params ) => (
264
264
< div class = " color_system" >
265
265
< ColorPicker value= {params .row .color_group || ' ' }
266
- disabled= {this .isOperationBoxDisabled (params .row , ' metricList' )}
266
+ disabled= {this .isOperationBoxDisabled (params .row , ' metricList' , params . index )}
267
267
on- on- open- change= {
268
268
isShow => this .changeColorGroup (isShow, this .configInfo .metric_list [params .index ], ' color_group' )
269
269
}
@@ -285,7 +285,7 @@ export default {
285
285
< Input
286
286
clearable
287
287
value= {params .row .display_name }
288
- disabled= {this .isOperationBoxDisabled (params .row , ' metricList' )}
288
+ disabled= {this .isOperationBoxDisabled (params .row , ' metricList' , params . index )}
289
289
onInput= {v => {
290
290
this .changeVal (' metric_list' , params .index , ' display_name' , v)
291
291
}}
@@ -306,7 +306,7 @@ export default {
306
306
< Input
307
307
clearable
308
308
value= {params .row .metric }
309
- disabled= {this .isOperationBoxDisabled (params .row , ' metricList' )}
309
+ disabled= {this .isOperationBoxDisabled (params .row , ' metricList' , params . index )}
310
310
placeholder= {this .$t (' m_metric_key_placeholder' )}
311
311
onInput= {v => {
312
312
this .changeVal (' metric_list' , params .index , ' metric' , v)
@@ -328,7 +328,7 @@ export default {
328
328
)
329
329
},
330
330
{
331
- title: this .$t (' m_statistical_parameters' ),
331
+ title: this .$t (' m_statistical_parameters' ), // 统计参数
332
332
key: ' log_param_name' ,
333
333
width: 130 ,
334
334
renderHeader : () => (
@@ -348,7 +348,7 @@ export default {
348
348
filterable
349
349
clearable
350
350
value= {params .row .log_param_name }
351
- disabled= {this .isOperationBoxDisabled (params .row , ' metricList' )}
351
+ disabled= {this .isOperationBoxDisabled (params .row , ' metricList' , params . index )}
352
352
on- on- change= {v => {
353
353
this .changeVal (' metric_list' , params .index , ' log_param_name' , v)
354
354
}}
@@ -377,7 +377,7 @@ export default {
377
377
< Select
378
378
filterable
379
379
value= {params .row .tag_config }
380
- disabled= {this .isOperationBoxDisabled (params .row , ' metricList' )}
380
+ disabled= {this .isOperationBoxDisabled (params .row , ' metricList' , params . index )}
381
381
multiple
382
382
on- on- change= {v => {
383
383
this .changeVal (' metric_list' , params .index , ' tag_config' , v)
@@ -430,7 +430,7 @@ export default {
430
430
< Select
431
431
filterable
432
432
clearable
433
- disabled= {params .row .log_param_name === ' ' || this .isOperationBoxDisabled (params .row , ' metricList' )}
433
+ disabled= {params .row .log_param_name === ' ' || this .isOperationBoxDisabled (params .row , ' metricList' , params . index )}
434
434
value= {params .row .agg_type }
435
435
on- on- change= {v => {
436
436
this .changeVal (' metric_list' , params .index , ' agg_type' , v)
@@ -452,7 +452,7 @@ export default {
452
452
render : (h , params ) =>
453
453
(
454
454
< i- switch value={params .row .auto_alarm }
455
- disabled= {this .isOperationBoxDisabled (params .row , ' metricList' )}
455
+ disabled= {this .isOperationBoxDisabled (params .row , ' metricList' , params . index )}
456
456
on- on- change= {val => {
457
457
if (! val) {
458
458
Vue .set (this .configInfo .metric_list [params .index ], ' range_config' , cloneDeep (initRangeConfigMap))
@@ -471,7 +471,7 @@ export default {
471
471
? (
472
472
< Select
473
473
value= {params .row .range_config .operator }
474
- disabled= {this .isOperationBoxDisabled (params .row , ' metricList' )}
474
+ disabled= {this .isOperationBoxDisabled (params .row , ' metricList' , params . index )}
475
475
on- on- change= {v => {
476
476
this .configInfo .metric_list [params .index ].range_config .operator = v
477
477
}}
@@ -494,7 +494,7 @@ export default {
494
494
render : (h , params ) => params .row .auto_alarm ? (
495
495
< Input
496
496
value= {params .row .range_config .threshold }
497
- disabled= {this .isOperationBoxDisabled (params .row , ' metricList' )}
497
+ disabled= {this .isOperationBoxDisabled (params .row , ' metricList' , params . index )}
498
498
on- on- change= {v => {
499
499
this .configInfo .metric_list [params .index ].range_config .threshold = v .target .value
500
500
}}
@@ -510,7 +510,7 @@ export default {
510
510
render : (h , params ) => params .row .auto_alarm ? (
511
511
< Input
512
512
value= {params .row .range_config .time }
513
- disabled= {this .isOperationBoxDisabled (params .row , ' metricList' )}
513
+ disabled= {this .isOperationBoxDisabled (params .row , ' metricList' , params . index )}
514
514
on- on- change= {v => {
515
515
this .configInfo .metric_list [params .index ].range_config .time = v .target .value
516
516
}}
@@ -526,7 +526,7 @@ export default {
526
526
render : (h , params ) => params .row .auto_alarm ? (
527
527
< Select
528
528
value= {params .row .range_config .time_unit }
529
- disabled= {this .isOperationBoxDisabled (params .row , ' metricList' )}
529
+ disabled= {this .isOperationBoxDisabled (params .row , ' metricList' , params . index )}
530
530
on- on- change= {v => {
531
531
this .configInfo .metric_list [params .index ].range_config .time_unit = v
532
532
}}
@@ -549,7 +549,7 @@ export default {
549
549
render : (h , params ) => (
550
550
< div style= " text-align: left; cursor: pointer;display: inline-flex;" >
551
551
< Button
552
- disabled= {this .configInfo .metric_list .length === 1 || this .isOperationBoxDisabled (params .row , ' metricList' )}
552
+ disabled= {this .configInfo .metric_list .length === 1 || this .isOperationBoxDisabled (params .row , ' metricList' , params . index )}
553
553
size= " small"
554
554
type= " error"
555
555
style= " margin-right:5px;"
@@ -935,9 +935,11 @@ export default {
935
935
responseData .forEach (item => {
936
936
this .isNumericValue [item .name ] = ! this .isNumericString (item .demo_match_value )
937
937
})
938
- // this.configInfo.metric_list.forEach(item => {
939
- // item.agg_type = ''
940
- // })
938
+ this .configInfo .metric_list .forEach ((item , index ) => {
939
+ if (! this .isOperationBoxDisabled (item, ' metricList' , index)) {
940
+ item .agg_type = ' '
941
+ }
942
+ })
941
943
}, {isNeedloading: false })
942
944
},
943
945
isNumericString (str ) {
@@ -1007,37 +1009,40 @@ export default {
1007
1009
})
1008
1010
}
1009
1011
},
1010
- isOperationBoxDisabled (item , type = ' paramList' ) {
1012
+ isOperationBoxDisabled (item , type = ' paramList' , index = - 2 ) {
1011
1013
if (this .view ) {
1012
1014
return true
1013
1015
}
1014
1016
if (this .isInTemplatePage ) {
1015
1017
return false
1016
1018
}
1017
1019
if (! isEmpty (item) && type) {
1018
- return type === ' paramList' ? this .isParamsListItemDisabled (this .templateParamList , item) : this .isMetricItemDisabled (this .templateMetricList , item)
1020
+ return type === ' paramList' ? this .isParamsListItemDisabled (this .templateParamList , item, index ) : this .isMetricItemDisabled (this .templateMetricList , item, index )
1019
1021
}
1020
1022
return this .isBaseCustomeTemplateEdit || this .isBaseCustomeTemplateCopy || this .isBaseCustomeTemplateAdd
1021
1023
1022
1024
},
1023
- isParamsListItemDisabled (list , item ) {
1024
- const findItem = find (list, {
1025
+ isParamsListItemDisabled (list , item , index = - 2 ) {
1026
+ const compareObj = {
1025
1027
name: item .name ,
1026
1028
regular: item .regular ,
1027
1029
demo_match_value: item .demo_match_value
1028
- })
1029
- return ! isEmpty (findItem)
1030
+ }
1031
+ const findItem = find (list, compareObj)
1032
+
1033
+ return ! isEmpty (findItem) && index === findIndex (list, compareObj)
1030
1034
},
1031
- isMetricItemDisabled (list , item ) {
1032
- const findItem = find (list, {
1035
+ isMetricItemDisabled (list , item , index = - 2 ) {
1036
+ const compareObj = {
1033
1037
color_group: item .color_group ,
1034
1038
display_name: item .display_name ,
1035
1039
metric: item .metric ,
1036
1040
log_param_name: item .log_param_name ,
1037
1041
agg_type: item .agg_type ,
1038
1042
auto_alarm: item .auto_alarm
1039
- })
1040
- return ! isEmpty (findItem)
1043
+ }
1044
+ const findItem = find (list, compareObj)
1045
+ return ! isEmpty (findItem) && index === findIndex (list, compareObj)
1041
1046
}
1042
1047
},
1043
1048
components: {
0 commit comments