修改了企业的 导出功能

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 () {
return axios({
url: api.icsCustomerStaff + '/exportTemplate',
method: 'post',
method: 'get',
data: { }
})
}

View File

@ -587,7 +587,8 @@ export default {
roomList: [], //
tenantEnable: false,
parkEnable: false,
mdl: {}
mdl: {},
}
},
filters: {
@ -618,6 +619,7 @@ export default {
this.getUserDetail();
},
methods: {
//
getUserDetail() {
getInfo().then(res => {
@ -775,26 +777,24 @@ export default {
})
},
exportTemplate() {
exportTemplate().then(res => {
console.log(res)
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)
const baseURL = process.env.VUE_APP_API_BASE_URL
window.open(`${baseURL}/admin/staff/exportTemplate`)
},
// 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) {