|
@@ -79,6 +79,7 @@ import { verifyMusicalList } from '@/api/orderManager'
|
|
import axios from 'axios'
|
|
import axios from 'axios'
|
|
import qs from 'qs'
|
|
import qs from 'qs'
|
|
import { getToken } from '@/utils/auth'
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
+import load from '@/utils/loading'
|
|
export default {
|
|
export default {
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
@@ -145,21 +146,33 @@ export default {
|
|
cancelButtonText: '取消',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
type: 'warning'
|
|
}).then(() => {
|
|
}).then(() => {
|
|
|
|
+ load.startLoading()
|
|
axios(options).then(res => {
|
|
axios(options).then(res => {
|
|
let blob = new Blob([res.data], {
|
|
let blob = new Blob([res.data], {
|
|
// type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
|
|
// type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
|
|
type: 'application/vnd.ms-excel;charset=utf-8'
|
|
type: 'application/vnd.ms-excel;charset=utf-8'
|
|
//word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
|
|
//word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
|
|
})
|
|
})
|
|
- let objectUrl = URL.createObjectURL(blob)
|
|
|
|
- let link = document.createElement("a")
|
|
|
|
- let nowTime = new Date()
|
|
|
|
- let ymd = nowTime.getFullYear() + '' + (nowTime.getMonth() + 1) + '' + nowTime.getDate() + '' + nowTime.getHours() + '' + nowTime.getMinutes()
|
|
|
|
- let fname = this.$route.query.id + '-' + ymd + '发放清单' //下载文件的名字
|
|
|
|
- link.href = objectUrl
|
|
|
|
- link.setAttribute("download", fname)
|
|
|
|
- document.body.appendChild(link)
|
|
|
|
- link.click()
|
|
|
|
|
|
+ let text = (new Response(blob)).text()
|
|
|
|
+ text.then(res => {
|
|
|
|
+ // 判断是否报错
|
|
|
|
+ if(res.indexOf('code') != -1) {
|
|
|
|
+ let json = JSON.parse(res)
|
|
|
|
+ this.$message.error(json.msg)
|
|
|
|
+ } else {
|
|
|
|
+ let objectUrl = URL.createObjectURL(blob)
|
|
|
|
+ let link = document.createElement("a")
|
|
|
|
+ let nowTime = new Date()
|
|
|
|
+ let ymd = nowTime.getFullYear() + '' + (nowTime.getMonth() + 1) + '' + nowTime.getDate() + '' + nowTime.getHours() + '' + nowTime.getMinutes()
|
|
|
|
+ let fname = this.$route.query.id + '-' + ymd + '发放清单' //下载文件的名字
|
|
|
|
+ link.href = objectUrl
|
|
|
|
+ link.setAttribute("download", fname)
|
|
|
|
+ document.body.appendChild(link)
|
|
|
|
+ link.click()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ load.endLoading();
|
|
|
|
+
|
|
})
|
|
})
|
|
}).catch(() => { })
|
|
}).catch(() => { })
|
|
},
|
|
},
|
|
@@ -182,21 +195,32 @@ export default {
|
|
cancelButtonText: '取消',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
type: 'warning'
|
|
}).then(() => {
|
|
}).then(() => {
|
|
|
|
+ load.startLoading()
|
|
axios(options).then(res => {
|
|
axios(options).then(res => {
|
|
let blob = new Blob([res.data], {
|
|
let blob = new Blob([res.data], {
|
|
// type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
|
|
// type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
|
|
type: 'application/vnd.ms-excel;charset=utf-8'
|
|
type: 'application/vnd.ms-excel;charset=utf-8'
|
|
//word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
|
|
//word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
|
|
})
|
|
})
|
|
- let objectUrl = URL.createObjectURL(blob)
|
|
|
|
- let link = document.createElement("a")
|
|
|
|
- let nowTime = new Date()
|
|
|
|
- let ymd = nowTime.getFullYear() + '' + (nowTime.getMonth() + 1) + '' + nowTime.getDate() + '' + nowTime.getHours() + '' + nowTime.getMinutes()
|
|
|
|
- let fname = this.$route.query.id + '-' + ymd + '分发清单' //下载文件的名字
|
|
|
|
- link.href = objectUrl
|
|
|
|
- link.setAttribute("download", fname)
|
|
|
|
- document.body.appendChild(link)
|
|
|
|
- link.click()
|
|
|
|
|
|
+ let text = (new Response(blob)).text()
|
|
|
|
+ text.then(res => {
|
|
|
|
+ // 判断是否报错
|
|
|
|
+ if(res.indexOf('code') != -1) {
|
|
|
|
+ let json = JSON.parse(res)
|
|
|
|
+ this.$message.error(json.msg)
|
|
|
|
+ } else {
|
|
|
|
+ let objectUrl = URL.createObjectURL(blob)
|
|
|
|
+ let link = document.createElement("a")
|
|
|
|
+ let nowTime = new Date()
|
|
|
|
+ let ymd = nowTime.getFullYear() + '' + (nowTime.getMonth() + 1) + '' + nowTime.getDate() + '' + nowTime.getHours() + '' + nowTime.getMinutes()
|
|
|
|
+ let fname = this.$route.query.id + '-' + ymd + '分发清单' //下载文件的名字
|
|
|
|
+ link.href = objectUrl
|
|
|
|
+ link.setAttribute("download", fname)
|
|
|
|
+ document.body.appendChild(link)
|
|
|
|
+ link.click()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ load.endLoading();
|
|
})
|
|
})
|
|
}).catch(() => { })
|
|
}).catch(() => { })
|
|
}
|
|
}
|