|
@@ -150,8 +150,9 @@
|
|
|
import Detail from './inventory-detail'
|
|
|
import {getInventoryList} from '@/api/warehouse'
|
|
|
import PreviewComponent from '@/views/modules/common/preview-component'
|
|
|
+ import {downloadUrl} from '@/api/file'
|
|
|
|
|
|
- export default {
|
|
|
+export default {
|
|
|
name: 'stock-order',
|
|
|
components: {PreviewComponent, inventoryAdd, inventoryBegin, Detail},
|
|
|
data () {
|
|
@@ -273,42 +274,11 @@
|
|
|
},
|
|
|
// 导出文件
|
|
|
exportExcel (inventoryId) {
|
|
|
- this.$http({
|
|
|
- url: this.$http.adornUrl('/biz-service/inventory-checking-ctl/exportExcel'),
|
|
|
- method: 'get',
|
|
|
- params: this.$http.adornParams({
|
|
|
- 'inventoryId': inventoryId
|
|
|
- }),
|
|
|
- responseType: 'blob'
|
|
|
- }).then((res) => {
|
|
|
- let data = res.data
|
|
|
- // console.log(res)
|
|
|
- if (!data) {
|
|
|
- return
|
|
|
- }
|
|
|
- debugger
|
|
|
- let blob = new Blob([data])
|
|
|
- // let blob = new Blob([data])
|
|
|
- console.log(blob)
|
|
|
- const a = document.createElement('a')
|
|
|
- const url = window.URL.createObjectURL(blob)
|
|
|
-
|
|
|
- // 设置文件名
|
|
|
- let contentDisposition
|
|
|
- if (res.headers['content-disposition']) contentDisposition = res.headers['content-disposition']
|
|
|
- if (res.headers['Content-Disposition']) contentDisposition = res.headers['Content-Disposition']
|
|
|
- const pat = new RegExp('filename=([^;]+\\.[^\\.;]+)')
|
|
|
- const result = pat.exec(decodeURI(contentDisposition))
|
|
|
- let _fileName = result && result[1]
|
|
|
-
|
|
|
- a.style.display = 'none'
|
|
|
- a.href = url
|
|
|
- a.setAttribute('download', _fileName)
|
|
|
- document.body.appendChild(a)
|
|
|
- a.click() // 执行下载
|
|
|
- window.URL.revokeObjectURL(url)
|
|
|
- document.body.removeChild(a)
|
|
|
- }).catch((error) => { console.log(error) })
|
|
|
+ if (!inventoryId) {
|
|
|
+ this.$message.error('参数不正确!')
|
|
|
+ }
|
|
|
+ let url = this.$http.adornUrl('/biz-service/inventory-checking-ctl/exportExcel')
|
|
|
+ window.open(url + '?inventoryId=' + inventoryId, '_blank')
|
|
|
},
|
|
|
// 导入文件
|
|
|
importExcel () {
|