|
|
@ -16,7 +16,7 @@ async function makeDir (dir) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async function simpleExcelDown ({ data = [], header = [], fileName = moment().format('YYYY-MM-DD HH:mm:ss') } = {}) { |
|
|
|
async function simpleExcelDown ({ data = [], header = [], fileName = moment().format('YYYY-MM-DD HH:mm:ss'), exp } = {}) { |
|
|
|
const fileDirPath = path.join(__dirname, `../../downloadFiles`) |
|
|
|
makeDir(fileDirPath) |
|
|
|
const file = new xlsx.File(); |
|
|
@ -57,6 +57,33 @@ async function simpleExcelDown ({ data = [], header = [], fileName = moment().fo |
|
|
|
for (let h of header) { |
|
|
|
const cell = row.addCell(); |
|
|
|
cell.value = data[i][h.key]; |
|
|
|
|
|
|
|
if (exp == 'patrol' || exp == 'maintenance') { |
|
|
|
if (h.key == 'projectType') { |
|
|
|
let type = data[i][h.key] |
|
|
|
if (type == 'road') { |
|
|
|
cell.value = '道路' |
|
|
|
} else if (type == 'birdge') { |
|
|
|
cell.value = '桥梁' |
|
|
|
} else if (type == 'culvert') { |
|
|
|
cell.value = '涵洞' |
|
|
|
} else if (type == 'other') { |
|
|
|
cell.value = '其他' |
|
|
|
} |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
if (h.key == 'reportType') { |
|
|
|
let type = data[i][h.key] |
|
|
|
if (type == 'patrol') { |
|
|
|
cell.value = '巡查' |
|
|
|
} else if (type == 'conserve') { |
|
|
|
cell.value = '养护' |
|
|
|
} |
|
|
|
continue |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
cell.style = style |
|
|
|
} |
|
|
|
} |
|
|
|