Commit 7422b763 authored by YuY's avatar YuY

设备入库功能练习

parent 872e65f2
......@@ -30,7 +30,7 @@ export function updatadevice_t(data) {
/* 导出库存信息*/
export function exportWarehouse(query) {
return request({
// url: '/system/user/export',
url: '/wbwarehouse-test/export',
method: 'get',
params: query,
responseType: 'blob'
......
......@@ -229,7 +229,7 @@
</template>
<script>
import { listdevice_t, getDetailById_t, updatadevice_t } from '@/api/magnagement'
import {listdevice_t, getDetailById_t, updatadevice_t, exportWarehouse} from '@/api/magnagement'
import { resetForm } from '@/utils/common'
import { getToken } from '@/utils/auth'
......@@ -421,18 +421,18 @@ export default {
type: 'warning'
}).then(function() {
console.log('导出', queryParams)
// return exportUser(queryParams).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);
// })
return exportWarehouse(queryParams).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);
})
})
},
/** 导入按钮操作 */
......
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