|
@@ -349,6 +349,7 @@ import image02 from '@/assets/images/device/02.png'
|
|
|
import image03 from '@/assets/images/device/03.png'
|
|
import image03 from '@/assets/images/device/03.png'
|
|
|
import image04 from '@/assets/images/device/04.png'
|
|
import image04 from '@/assets/images/device/04.png'
|
|
|
import { getImage } from '@/api/platform/file/attachment'
|
|
import { getImage } from '@/api/platform/file/attachment'
|
|
|
|
|
+import { download } from '@/api/platform/file/attachment'
|
|
|
|
|
|
|
|
import xlsx from 'xlsx'
|
|
import xlsx from 'xlsx'
|
|
|
import fs from 'file-saver'
|
|
import fs from 'file-saver'
|
|
@@ -629,7 +630,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
async mounted () {
|
|
async mounted () {
|
|
|
- const { stateList, hideSysDeviceNo, tabList } = await getSetting('device')
|
|
|
|
|
|
|
+ const { stateList, hideSysDeviceNo, tabList } = await getSetting('device') || {}
|
|
|
if (stateList) {
|
|
if (stateList) {
|
|
|
console.debug('stateList', stateList)
|
|
console.debug('stateList', stateList)
|
|
|
this.stateList = stateList
|
|
this.stateList = stateList
|
|
@@ -1044,8 +1045,25 @@ export default {
|
|
|
const sql = `select b.yuan_she_bei_bian as yuanSheBeiBian,b.she_bei_ming_cheng_ as sheBeiMingCheng,a.parent_id_,a.wei_hu_xiang_mu_c as weiHuXiangMuC,a.wei_hu_ri_qi_ as weiHuRiQi,a.wei_hu_lei_xing_ as weiHuLeiXing,a.ri_qi_shu_zi_ as riQiShuZi from t_whzqjxm a,t_sbdj b where a.parent_id_=b.id_ and a.parent_id_ in (${selection.map(i => `'${i}'`).join(',')})`
|
|
const sql = `select b.yuan_she_bei_bian as yuanSheBeiBian,b.she_bei_ming_cheng_ as sheBeiMingCheng,a.parent_id_,a.wei_hu_xiang_mu_c as weiHuXiangMuC,a.wei_hu_ri_qi_ as weiHuRiQi,a.wei_hu_lei_xing_ as weiHuLeiXing,a.ri_qi_shu_zi_ as riQiShuZi from t_whzqjxm a,t_sbdj b where a.parent_id_=b.id_ and a.parent_id_ in (${selection.map(i => `'${i}'`).join(',')})`
|
|
|
const { variables: { data }} = await this.$common.request('sql', sql)
|
|
const { variables: { data }} = await this.$common.request('sql', sql)
|
|
|
exportData = data
|
|
exportData = data
|
|
|
|
|
+ this.xlsx(exportData, this.projectColums, '设备维护项目数据' + this.getTimeStamp())
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const attachmentId = 'device_maintainProject'
|
|
|
|
|
+ const res = await download({ attachmentId })
|
|
|
|
|
+ // 判断 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.xlsx(exportData, this.projectColums, '设备维护项目数据' + this.getTimeStamp())
|
|
|
|
|
this.$message.success('导出维护项目成功!')
|
|
this.$message.success('导出维护项目成功!')
|
|
|
},
|
|
},
|
|
|
// value 转 key
|
|
// value 转 key
|