修改了企业的 导出功能

This commit is contained in:
chendaze 2024-04-04 14:14:01 +08:00
parent 1797392206
commit c317aa1af1
2 changed files with 21 additions and 21 deletions

View File

@ -141,7 +141,7 @@ export function importData (data) {
export function exportTemplate () { export function exportTemplate () {
return axios({ return axios({
url: api.icsCustomerStaff + '/exportTemplate', url: api.icsCustomerStaff + '/exportTemplate',
method: 'post', method: 'get',
data: { } data: { }
}) })
} }

View File

@ -587,7 +587,8 @@ export default {
roomList: [], // roomList: [], //
tenantEnable: false, tenantEnable: false,
parkEnable: false, parkEnable: false,
mdl: {} mdl: {},
} }
}, },
filters: { filters: {
@ -618,6 +619,7 @@ export default {
this.getUserDetail(); this.getUserDetail();
}, },
methods: { methods: {
// //
getUserDetail() { getUserDetail() {
getInfo().then(res => { getInfo().then(res => {
@ -775,26 +777,24 @@ export default {
}) })
}, },
exportTemplate() { exportTemplate() {
exportTemplate().then(res => { const baseURL = process.env.VUE_APP_API_BASE_URL
console.log(res) window.open(`${baseURL}/admin/staff/exportTemplate`)
this.downloadFile(res)
})
},
downloadFile(data) {
let fileName = '客户导入模板'
let link = document.createElement('a')
let blob = new Blob([data], { type: 'application/vnd.ms-excel;charset=utf-8' })
console.log(blob)
link.style.display = 'none'
link.download = fileName + '.xlsx'
link.href = URL.createObjectURL(blob)
// link.setAttribute('download', fileName+'.xlsx');
document.body.appendChild(link)
link.click()
URL.revokeObjectURL(link.href) // URL
document.body.removeChild(link)
}, },
// downloadFile(data) {
// let fileName = ''
//
// let link = document.createElement('a')
// let blob = new Blob([data], { type: 'application/vnd.ms-excel;charset=utf-8' })
// console.log(blob)
// link.style.display = 'none'
// link.download = fileName + '.xlsx'
// link.href = URL.createObjectURL(blob)
// // link.setAttribute('download', fileName+'.xlsx');
// document.body.appendChild(link)
// link.click()
// URL.revokeObjectURL(link.href) // URL
// document.body.removeChild(link)
// },
customRequest(file) { customRequest(file) {