|
|
@@ -630,7 +630,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
async mounted () {
|
|
|
- const { stateList, hideSysDeviceNo, tabList } = await getSetting('device')
|
|
|
+ const { stateList, hideSysDeviceNo, tabList } = await getSetting('device') || {}
|
|
|
if (stateList) {
|
|
|
console.debug('stateList', stateList)
|
|
|
this.stateList = stateList
|
|
|
@@ -1049,15 +1049,20 @@ export default {
|
|
|
} else {
|
|
|
const attachmentId = 'device_maintainProject'
|
|
|
const res = await download({ attachmentId })
|
|
|
- // const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
|
|
|
- const a = document.createElement('a')
|
|
|
- a.style.display = 'none'
|
|
|
- // a.href = URL.createObjectURL(blob)
|
|
|
- a.href = res.request.responseURL
|
|
|
- // a.download = '设备维护项目导入模版'
|
|
|
- document.body.appendChild(a)
|
|
|
- a.click()
|
|
|
- document.body.removeChild(a)
|
|
|
+ // 判断 ArrayBuffer 的大小,主要用于兼容没有文件的情况
|
|
|
+ if (res.data?.byteLength === 0) {
|
|
|
+ this.xlsx([], this.projectColums, '设备维护项目模板' + this.getTimeStamp())
|
|
|
+ } else {
|
|
|
+ // const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
|
|
|
+ const a = document.createElement('a')
|
|
|
+ a.style.display = 'none'
|
|
|
+ // a.href = URL.createObjectURL(blob)
|
|
|
+ a.href = res.request.responseURL
|
|
|
+ // a.download = '设备维护项目导入模板'
|
|
|
+ document.body.appendChild(a)
|
|
|
+ a.click()
|
|
|
+ document.body.removeChild(a)
|
|
|
+ }
|
|
|
}
|
|
|
this.$message.success('导出维护项目成功!')
|
|
|
},
|