Commit 5595f724 authored by YLKCNK's avatar YLKCNK

下载库存导出模板

parent b0c5b511
......@@ -52,7 +52,7 @@ export function importExcel(data) {
})
}
// 下载错误文件
// 下载文件
export function uploadFalseFile(params) {
params = Qs.stringify(params)
return request({
......@@ -63,6 +63,16 @@ export function uploadFalseFile(params) {
})
}
// 下载用户导入模板
export function importTemplate(params) {
return request({
url: '/wbwarehouse-test/importTemplate',
method: 'get',
responseType: 'blob',
params
})
}
// 查询设备列表
export function listdevice(query) {
return request({
......
......@@ -235,7 +235,8 @@ import {
updatadevice_t,
exportWarehouse,
importExcel,
uploadFalseFile
uploadFalseFile,
importTemplate
} from '@/api/magnagement'
import { resetForm } from '@/utils/common'
......@@ -451,6 +452,21 @@ export default {
this.upload.title = '库存信息导入'
this.upload.open = true
},
/** 下载模板操作 */
importTemplate() {
importTemplate().then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '库存导入模板' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
// this.download(response.msg);
})
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment