diff --git a/api/app/lib/controllers/data/index.js b/api/app/lib/controllers/data/index.js index ab91d22d..8112a750 100644 --- a/api/app/lib/controllers/data/index.js +++ b/api/app/lib/controllers/data/index.js @@ -104,7 +104,7 @@ async function dataExport (ctx) { header.sort((a, b) => { return a.index - b.index }) const fileName = `${modalOption.n}_${moment().format('YYYYMMDDHHmmss')}` + '.csv' - const filePath = await xlsxDownload.simpleExcelDown({ data: exportData, header, fileName: fileName }) + const filePath = await xlsxDownload.simpleExcelDown({ data: exportData, header, fileName: fileName, exp }) const fileData = fs.readFileSync(filePath); ctx.status = 200; diff --git a/api/app/lib/models/report.js b/api/app/lib/models/report.js index 3d1d39c6..0a49fba5 100644 --- a/api/app/lib/models/report.js +++ b/api/app/lib/models/report.js @@ -21,7 +21,7 @@ module.exports = dc => { type: DataTypes.STRING, allowNull: false, defaultValue: null, - comment: "上报类型 巡查:patrol / 养护:conserve", + comment: "上报类型", primaryKey: false, field: "report_type", autoIncrement: false @@ -31,7 +31,7 @@ module.exports = dc => { type: DataTypes.STRING, allowNull: false, defaultValue: null, - comment: "工程类型 道路:road / 桥梁:birdge / 涵洞:culvert", + comment: "工程类型", primaryKey: false, field: "project_type", autoIncrement: false diff --git a/api/log/development.log b/api/log/development.log index af888562..048eb327 100644 --- a/api/log/development.log +++ b/api/log/development.log @@ -10691,3 +10691,9 @@ headers: {} 2022-07-30 16:59:14.475 - debug: [FS-LOGGER] Init. 2022-07-30 16:59:14.573 - info: [FS-ATTACHMENT] Inject attachment mw into router. 2022-07-30 16:59:14.573 - info: [FS-AUTH] Inject auth and api mv into router. +2022-07-30 17:19:58.438 - debug: [FS-LOGGER] Init. +2022-07-30 17:19:58.538 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2022-07-30 17:19:58.539 - info: [FS-AUTH] Inject auth and api mv into router. +2022-07-30 17:48:40.061 - debug: [FS-LOGGER] Init. +2022-07-30 17:48:40.152 - info: [FS-ATTACHMENT] Inject attachment mw into router. +2022-07-30 17:48:40.152 - info: [FS-AUTH] Inject auth and api mv into router. diff --git a/api/utils/xlsxDownload.js b/api/utils/xlsxDownload.js index 08b51045..61c68e0c 100644 --- a/api/utils/xlsxDownload.js +++ b/api/utils/xlsxDownload.js @@ -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 } } diff --git a/web/client/src/sections/fillion/components/maintenanceTable.js b/web/client/src/sections/fillion/components/maintenanceTable.js index 0e00c751..937169ac 100644 --- a/web/client/src/sections/fillion/components/maintenanceTable.js +++ b/web/client/src/sections/fillion/components/maintenanceTable.js @@ -12,6 +12,7 @@ import moment from 'moment'; const DetailForm = (props) => { const { visible, data, handleClose, loading } = props; + const [qndmn] = useState(localStorage.getItem('qndmn')); const keyList = [ { key: '编号', name: 'id' }, { key: '工程类型', name: 'projectType' }, @@ -37,7 +38,7 @@ const DetailForm = (props) => { { data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => { return