fix: 修改 endpoint 导出时 未带checkBox的参数
This commit is contained in:
@@ -106,6 +106,7 @@ export default {
|
||||
},
|
||||
exportUrl: { type: String, default: '' },
|
||||
params: { type: Object },
|
||||
params2: { type: Object },
|
||||
exportFileName: { type: String },
|
||||
importUrl: { type: String, default: '' }, // 为空时不显示导入按钮
|
||||
link: { type: Object }, // 为空时不显示导出按钮
|
||||
@@ -241,6 +242,19 @@ export default {
|
||||
},
|
||||
exportCur () {
|
||||
const params = JSON.parse(JSON.stringify(this.params))
|
||||
if (this.params2){
|
||||
Object.keys(this.params2).forEach(key=>{
|
||||
if ( params[key] ) {
|
||||
if ( params[key].prototype.toString.call(val) === '[object Object]' ){
|
||||
Object.assign(params[key],this.params2[key])
|
||||
} else if (params[key].prototype.toString.call(val) === '[object Array]'){
|
||||
params[key].concat(this.params2[key])
|
||||
}
|
||||
} else {
|
||||
params[key] = this.params2[key]
|
||||
}
|
||||
})
|
||||
}
|
||||
if (this.exportUrl.indexOf('panel') > -1) {
|
||||
params.pageSize = -1
|
||||
delete params.start_time
|
||||
@@ -254,6 +268,19 @@ export default {
|
||||
},
|
||||
exportAll () {
|
||||
const params = JSON.parse(JSON.stringify(this.params))
|
||||
if (this.params2){
|
||||
Object.keys(this.params2).forEach(key=>{
|
||||
if ( params[key] ) {
|
||||
if ( params[key].prototype.toString.call(val) === '[object Object]' ){
|
||||
Object.assign(params[key],this.params2[key])
|
||||
} else if (params[key].prototype.toString.call(val) === '[object Array]'){
|
||||
params[key].concat(this.params2[key])
|
||||
}
|
||||
} else {
|
||||
params[key] = this.params2[key]
|
||||
}
|
||||
})
|
||||
}
|
||||
params.pageSize = -1
|
||||
if (this.exportUrl.indexOf('panel') > -1) {
|
||||
delete params.start_time
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
ref="export"
|
||||
id="endpoint-template-list"
|
||||
:params="searchLabel"
|
||||
:params2="searchCheckBox"
|
||||
:permissions="{import: 'monitor_endpoint_add', export: 'monitor_module_view'}"
|
||||
class="top-tool-export margin-l-10 margin-r-10"
|
||||
export-file-name="expression-template"
|
||||
@@ -201,7 +202,8 @@ export default {
|
||||
projectIds: [],
|
||||
moduleIds: [],
|
||||
states: []
|
||||
}
|
||||
},
|
||||
searchCheckBox: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -256,16 +258,7 @@ export default {
|
||||
...this.searchLabel,
|
||||
...this.searchCheckBox
|
||||
}
|
||||
if (this.searchLabel.projectIds) {
|
||||
localStorage.setItem('endpointProjectId', this.searchLabel.projectIds)
|
||||
if (params.projectIds) {
|
||||
params.projectIds += ',' + this.searchLabel.projectIds
|
||||
} else {
|
||||
params.projectIds = this.searchLabel.projectIds
|
||||
}
|
||||
} else {
|
||||
localStorage.removeItem('endpointProjectId')
|
||||
}
|
||||
this.tools.loading = true
|
||||
this.$get(this.url, params).then(response => {
|
||||
this.tools.loading = false
|
||||
@@ -334,22 +327,14 @@ export default {
|
||||
},
|
||||
created () {
|
||||
if (localStorage.getItem('endpointProjectId')) {
|
||||
this.searchLabel.projectIds = localStorage.getItem('endpointProjectId')
|
||||
this.selectValue.projectIds = [Number(localStorage.getItem('endpointProjectId'))]
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
if (localStorage.getItem('endpointProjectId')) {
|
||||
this.$refs.dataList.$refs.searchInput.select_list.push({
|
||||
id: 11,
|
||||
name: 'project id',
|
||||
type: 'input',
|
||||
label: 'projectIds',
|
||||
disabled: false,
|
||||
val: localStorage.getItem('endpointProjectId')
|
||||
})
|
||||
this.$refs.dataList.$refs.searchInput.sreach_num = 1
|
||||
this.selectValue.projectIds = [Number(localStorage.getItem('endpointProjectId'))]
|
||||
// this.$refs.clickSearch.selectValueOut.projectIds = [localStorage.getItem('endpointProjectId')]
|
||||
}
|
||||
|
||||
this.getTitleSearch()
|
||||
},
|
||||
watch: {
|
||||
|
||||
Reference in New Issue
Block a user