Commit 22f736b4 by 怪兽?别跑

质检周报接口

1 parent 970c7550
...@@ -88,3 +88,11 @@ export function qualityWeeklyTable(id, data) { ...@@ -88,3 +88,11 @@ export function qualityWeeklyTable(id, data) {
params: data params: data
}) })
} }
// 质检周报 详情列表导出
export function getTableExport(data) {
return request({
url: service + '/qi/weekly/detail/list/export/' + id,
params: data
})
}
...@@ -153,20 +153,20 @@ ...@@ -153,20 +153,20 @@
}) })
.then(() => { .then(() => {
this.exportLoading = true this.exportLoading = true
return getTableExport(Object.assign({}, this.tableSearch)) return getTableExport(this.id, Object.assign({}, this.query))
}) })
.then((res) => { .then((res) => {
if (!res) return if (!res) return
const blob = new Blob([res], { type: 'application/vnd.ms-excel' }) // 构造一个blob对象来处理数据,并设置文件类型 const blob = new Blob([res], { type: 'application/vnd.ms-excel' }) // 构造一个blob对象来处理数据,并设置文件类型
if (window.navigator.msSaveOrOpenBlob) { if (window.navigator.msSaveOrOpenBlob) {
//兼容IE10 //兼容IE10
navigator.msSaveBlob(blob, '商品分析') navigator.msSaveBlob(blob, '质检详情')
} else { } else {
const href = URL.createObjectURL(blob) //创建新的URL表示指定的blob对象 const href = URL.createObjectURL(blob) //创建新的URL表示指定的blob对象
const a = document.createElement('a') //创建a标签 const a = document.createElement('a') //创建a标签
a.style.display = 'none' a.style.display = 'none'
a.href = href // 指定下载链接 a.href = href // 指定下载链接
a.download = dateFormat(new Date(), 'yyyy-MM-dd') + '_商品分析.xlsx' //指定下载文件名 a.download = dateFormat(new Date(), 'yyyy-MM-dd') + '-质检详情.xlsx' //指定下载文件名
a.click() //触发下载 a.click() //触发下载
URL.revokeObjectURL(a.href) //释放URL对象 URL.revokeObjectURL(a.href) //释放URL对象
} }
...@@ -243,7 +243,6 @@ ...@@ -243,7 +243,6 @@
}) })
}, },
getTableFn(data) { getTableFn(data) {
this.tableSearch = data
this.loading = true this.loading = true
// this.query.id = this.id // this.query.id = this.id
this.query.beginTime = data.beginTime this.query.beginTime = data.beginTime
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!