fix: 修改alertmessage 选择单条 导出未传参数的问题

This commit is contained in:
zhangyu
2021-11-26 15:40:27 +08:00
parent d3dff4c5fe
commit 9b8b5daa7e

View File

@@ -974,8 +974,21 @@ export default {
const searchLabel = Object.assign({}, this.searchLabel) const searchLabel = Object.assign({}, this.searchLabel)
searchLabel.format = this.importBox.format searchLabel.format = this.importBox.format
delete searchLabel.statistics delete searchLabel.statistics
if (this.searchCheckBox) {
Object.keys(this.searchCheckBox).forEach(key => {
if (searchLabel[key]) {
if (searchLabel[key].prototype.toString.call(val) === '[object Object]') {
Object.assign(searchLabel[key], this.searchCheckBox[key])
} else if (searchLabel[key].prototype.toString.call(val) === '[object Array]') {
searchLabel[key].concat(this.searchCheckBox[key])
}
} else {
searchLabel[key] = this.searchCheckBox[key]
}
})
}
this.$set(searchLabel, 'language', localStorage.getItem('nz-language') ? localStorage.getItem('nz-language') : 'en') this.$set(searchLabel, 'language', localStorage.getItem('nz-language') ? localStorage.getItem('nz-language') : 'en')
this.exportExcel({ ...searchLabel, state: this.state }) this.exportExcel('alert/message/export', { ...searchLabel, state: this.state })
this.closeDialog() this.closeDialog()
}, },
exportAll () { exportAll () {
@@ -983,8 +996,21 @@ export default {
temp.pageSize = -1 temp.pageSize = -1
delete temp.statistics delete temp.statistics
temp.format = this.importBox.format temp.format = this.importBox.format
if (this.searchCheckBox) {
Object.keys(this.searchCheckBox).forEach(key => {
if (temp[key]) {
if (temp[key].prototype.toString.call(val) === '[object Object]') {
Object.assign(temp[key], this.searchCheckBox[key])
} else if (temp[key].prototype.toString.call(val) === '[object Array]') {
temp[key].concat(this.searchCheckBox[key])
}
} else {
temp[key] = this.searchCheckBox[key]
}
})
}
this.$set(temp, 'language', localStorage.getItem('nz-language') ? localStorage.getItem('nz-language') : 'en') this.$set(temp, 'language', localStorage.getItem('nz-language') ? localStorage.getItem('nz-language') : 'en')
this.exportExcel({ ...temp, state: this.state }) this.exportExcel('alert/message/export', { ...temp, state: this.state })
this.closeDialog() this.closeDialog()
}, },
getTimeString () { getTimeString () {
@@ -1001,7 +1027,7 @@ export default {
formatNum (num) { formatNum (num) {
return num > 9 ? num : '0' + num return num > 9 ? num : '0' + num
}, },
exportExcel (params) { exportExcel (url, params, fileName) {
for (const item in params) { for (const item in params) {
if (params[item]) { if (params[item]) {
if (item === 'alertMessageState') { if (item === 'alertMessageState') {
@@ -1103,16 +1129,16 @@ export default {
const params = JSON.parse(JSON.stringify(this.searchLabel)) const params = JSON.parse(JSON.stringify(this.searchLabel))
params.format = this.importBox.format params.format = this.importBox.format
delete params.statistics delete params.statistics
if (this.params2) { if (this.searchCheckBox) {
Object.keys(this.params2).forEach(key => { Object.keys(this.searchCheckBox).forEach(key => {
if (params[key]) { if (params[key]) {
if (params[key].prototype.toString.call(val) === '[object Object]') { if (params[key].prototype.toString.call(val) === '[object Object]') {
Object.assign(params[key], this.params2[key]) Object.assign(params[key], this.searchCheckBox[key])
} else if (params[key].prototype.toString.call(val) === '[object Array]') { } else if (params[key].prototype.toString.call(val) === '[object Array]') {
params[key].concat(this.params2[key]) params[key].concat(this.searchCheckBox[key])
} }
} else { } else {
params[key] = this.params2[key] params[key] = this.searchCheckBox[key]
} }
}) })
} }