修改下载文件的文件名称及增加无数据时点击下载文件的提示,及报错提示
This commit is contained in:
parent
5306706954
commit
5ae562ff7a
|
@ -4,7 +4,7 @@
|
||||||
<!-- <search-form :items="formItems" v-model="queryParam" @search="searchQuery"> -->
|
<!-- <search-form :items="formItems" v-model="queryParam" @search="searchQuery"> -->
|
||||||
<search-form :items="formItems" v-model="queryParam" @search="searchQueryData">
|
<search-form :items="formItems" v-model="queryParam" @search="searchQueryData">
|
||||||
<a-space style="float: right" class="btn-group" slot="additional">
|
<a-space style="float: right" class="btn-group" slot="additional">
|
||||||
<a-button @click="handleEdit" type="primary" :disabled="dataSource.length==0">
|
<a-button @click="handleEdit" type="primary">
|
||||||
<img class="icon-edit" src="@/assets/images/global/edit.png" alt="" />
|
<img class="icon-edit" src="@/assets/images/global/edit.png" alt="" />
|
||||||
Excel
|
Excel
|
||||||
</a-button>
|
</a-button>
|
||||||
|
@ -134,27 +134,35 @@ export default {
|
||||||
// },
|
// },
|
||||||
methods: {
|
methods: {
|
||||||
handleExcel() {
|
handleExcel() {
|
||||||
// this.queryParam = {
|
if (this.dataSource.length>0) {
|
||||||
// dataType: "S",
|
// this.queryParam = {
|
||||||
// startTime: "2023-07-01",
|
// dataType: "S",
|
||||||
// endTime: "2023-07-14",
|
// startTime: "2023-07-01",
|
||||||
// stationIds: [209],
|
// endTime: "2023-07-14",
|
||||||
// spectralQualifie:"FULL"
|
// stationIds: [209],
|
||||||
// }
|
// spectralQualifie:"FULL"
|
||||||
let params = {
|
// }
|
||||||
...this.queryParam,
|
let params = {
|
||||||
pageType:this.pageType
|
...this.queryParam,
|
||||||
|
pageType:this.pageType
|
||||||
|
}
|
||||||
|
getFileAction("/webStatistics/radionuclideExport", params).then(res => {
|
||||||
|
if (res.code && res.code == 500) {
|
||||||
|
this.$message.warning("This operation fails. Contact your system administrator")
|
||||||
|
} else {
|
||||||
|
const blob = new Blob([res], { type: "application/vnd.ms-excel" })
|
||||||
|
let link = document.createElement('a')
|
||||||
|
link.href = window.URL.createObjectURL(blob)
|
||||||
|
link.download = "BLANKPHD"
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
URL.revokeObjectURL(link.href)
|
||||||
|
document.body.removeChild(link)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.warning("No downloadable data")
|
||||||
}
|
}
|
||||||
getFileAction("/webStatistics/radionuclideExport", params).then(res => {
|
|
||||||
const blob = new Blob([res], { type: "application/vnd.ms-excel" })
|
|
||||||
let link = document.createElement('a')
|
|
||||||
link.href = window.URL.createObjectURL(blob)
|
|
||||||
link.download = "asf"
|
|
||||||
document.body.appendChild(link)
|
|
||||||
link.click()
|
|
||||||
URL.revokeObjectURL(link.href)
|
|
||||||
document.body.removeChild(link)
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
searchQueryData() {
|
searchQueryData() {
|
||||||
this.isImmediate = false
|
this.isImmediate = false
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<a-card v-if="!isDetail" :bordered="false" style="margin-left: 20px">
|
<a-card v-if="!isDetail" :bordered="false" style="margin-left: 20px">
|
||||||
<search-form :items="formItems" v-model="queryParam" @search="searchQueryData">
|
<search-form :items="formItems" v-model="queryParam" @search="searchQueryData">
|
||||||
<a-space style="float: right" class="btn-group" slot="additional">
|
<a-space style="float: right" class="btn-group" slot="additional">
|
||||||
<a-button @click="handleExcel" type="primary" :disabled="dataSource.length==0">
|
<a-button @click="handleExcel" type="primary">
|
||||||
<img class="icon-edit" src="@/assets/images/global/edit.png" alt="" />
|
<img class="icon-edit" src="@/assets/images/global/edit.png" alt="" />
|
||||||
Excel
|
Excel
|
||||||
</a-button>
|
</a-button>
|
||||||
|
@ -90,28 +90,39 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
handleExcel() {
|
handleExcel() {
|
||||||
this.queryParam = {
|
if (this.dataSource.length>0) {
|
||||||
dataType: "S",
|
// this.queryParam = {
|
||||||
startTime: "2023-07-01",
|
// dataType: "S",
|
||||||
endTime: "2023-07-14",
|
// startTime: "2023-07-01",
|
||||||
stationIds: [209],
|
// endTime: "2023-07-14",
|
||||||
spectralQualifie:"FULL"
|
// stationIds: [209],
|
||||||
|
// spectralQualifie:"FULL"
|
||||||
|
// }
|
||||||
|
let params = {
|
||||||
|
...this.queryParam,
|
||||||
|
pageType:this.pageType
|
||||||
|
}
|
||||||
|
getFileAction("/webStatistics/radionuclideExport", params).then(res => {
|
||||||
|
if (res.code && res.code == 500) {
|
||||||
|
this.$message.warning("This operation fails. Contact your system administrator")
|
||||||
|
} else {
|
||||||
|
const blob = new Blob([res], { type: "application/vnd.ms-excel" })
|
||||||
|
let link = document.createElement('a')
|
||||||
|
link.href = window.URL.createObjectURL(blob)
|
||||||
|
link.download = this.fileName
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
URL.revokeObjectURL(link.href)
|
||||||
|
document.body.removeChild(link)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.warning("No downloadable data")
|
||||||
}
|
}
|
||||||
let params = {
|
|
||||||
...this.queryParam,
|
|
||||||
pageType:this.pageType
|
|
||||||
}
|
|
||||||
getFileAction("/webStatistics/radionuclideExport", params).then(res => {
|
|
||||||
const blob = new Blob([res], { type: "application/vnd.ms-excel" })
|
|
||||||
let link = document.createElement('a')
|
|
||||||
link.href = window.URL.createObjectURL(blob)
|
|
||||||
link.download = "asf"
|
|
||||||
document.body.appendChild(link)
|
|
||||||
link.click()
|
|
||||||
URL.revokeObjectURL(link.href)
|
|
||||||
document.body.removeChild(link)
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
searchQueryData() {
|
searchQueryData() {
|
||||||
this.isImmediate = false
|
this.isImmediate = false
|
||||||
|
|
Loading…
Reference in New Issue
Block a user