fix: 修改endpoint 的搜索条件

This commit is contained in:
zhangyu
2021-10-19 10:18:11 +08:00
parent c362cf7a2d
commit c4183fddbf

View File

@@ -484,27 +484,19 @@ export default {
}, },
reloadTable (obj) { reloadTable (obj) {
const params = JSON.parse(JSON.stringify(obj)) const params = JSON.parse(JSON.stringify(obj))
if (this.detailType === 'view') { delete this.searchCheckBox.metricsStates
const obj = {} delete this.searchCheckBox.logsStates
params.modelIds = params.modelIdsDetail.map(item => item.split('-')[1])
params.fieldsDetail.forEach(item => {
const arr = item.split('-')
if (obj[arr[0]]) {
obj[arr[0]].push(arr[1])
} else {
obj[arr[0]] = [arr[1]]
}
})
params.fields = JSON.stringify(obj)
if (params.fields === '{}') {
params.fields = ''
}
delete params.modelIdsDetail
delete params.fieldsDetail
}
Object.keys(params).forEach(key => { Object.keys(params).forEach(key => {
if (typeof params[key] === 'string') { if (typeof params[key] === 'string') {
this.searchCheckBox[key] = params[key] ? params[key] : null if (key === 'state') {
const state = JSON.parse(params[key])
if (state.metrics) {
this.searchCheckBox.metricsStates = state.metrics.join(',')
}
if (state.logs) {
this.searchCheckBox.logsStates = state.logs.join(',')
}
}
} else { } else {
params[key] && params[key].length > 0 ? this.searchCheckBox[key] = params[key].join(',') : this.searchCheckBox[key] = null params[key] && params[key].length > 0 ? this.searchCheckBox[key] = params[key].join(',') : this.searchCheckBox[key] = null
} }