diff --git a/public/标准文件转代码Data.xlsx b/public/标准文件转代码Data.xlsx index 0b8e14f..c642477 100644 Binary files a/public/标准文件转代码Data.xlsx and b/public/标准文件转代码Data.xlsx differ diff --git a/src/layout/tab.vue b/src/layout/tab.vue index ef652ef..13e4e76 100644 --- a/src/layout/tab.vue +++ b/src/layout/tab.vue @@ -1822,7 +1822,7 @@ const exportReport = async () => { const now = new Date() const projectInfoRaw = await kvStore.getItem(PROJECT_INFO_DB_KEY) const projectName = isNonEmptyString(projectInfoRaw?.projectName) ? sanitizeFileNamePart(projectInfoRaw.projectName) : '造价项目' - const fileName = `${projectName}-报表-${formatExportTimestamp(now)}` + const fileName = `${formatExportTimestamp(now)}-${projectName}预算文件` const blobUrl = await exportFile(fileName, () => buildExportReportPayload(), () => { showReportExportProgress(30, '正在生成报表文件...') }) diff --git a/src/sql.ts b/src/sql.ts index bcffd9d..700c742 100644 --- a/src/sql.ts +++ b/src/sql.ts @@ -42,12 +42,12 @@ const normalizeTaskTexts = (tasks: unknown): string[] => { export type WorkType = '基本工作' | '可选工作' | '日常顾问' | '专项顾问' | '附加工作' | '自定义' export const TYPE_LABEL_MAP: Record = { - 0: '基本工作', - 1: '可选工作', - 2: '日常顾问', - 3: '专项顾问', - 4: '附加工作', - 5:'自定义' + 0: '基本工作', + 1: '可选工作', + 2: '日常顾问', + 3: '专项顾问', + 4: '附加工作', + 5: '自定义' } export const industryTypeList = [ { id: '0', name: '公路工程', type: 'isRoad' }, @@ -838,7 +838,6 @@ export async function exportFile(fileName: string, data: any | (() => Promise { - let siTextArr = paragraphLineBreakFor1112(` (${ciTastNum})${si.process == null ? '' : (si.process == 1 ? '审核' : '编制')}${serviceList[si.id].name},具体工作内容包括:`, ctx); - siTextArr.forEach(ti => { - cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => { - descRowNum++; - targetRow.getCell(1).value = ti; - ciTastNum++; - }); - }); - const serviceTaskTexts = normalizeTaskTexts(si.tasks); - if (serviceTaskTexts.length) { - serviceTaskTexts.forEach((sti, stindex) => { - let stiTextArr = paragraphLineBreakFor1112(` ${stindex + 1})${sti}。`, ctx); - stiTextArr.forEach(ti => { - cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => { - descRowNum++; - targetRow.getCell(1).value = ti; + let flag = false; + if (si.tasks?.length) { + si.tasks.forEach(tsi => { + if (tsi.text?.length) { + flag = true; + let sx = tsi.serviceid == null ? { id: si.id, process: si.process } : { id: tsi.serviceid, process: tsi.process }; + let tsiTextArr = paragraphLineBreakFor1112(` (${ciTastNum})${sx.process == null ? '完成' : (sx.process == 1 ? '审核' : '编制')}${serviceList[sx.id].name},具体工作内容包括:`, ctx); + tsiTextArr.forEach(ti => { + cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => { + descRowNum++; + targetRow.getCell(1).value = ti; + ciTastNum++; + }); }); + tsi.text.forEach((sti, stindex) => { + let stiTextArr = paragraphLineBreakFor1112(` ${stindex + 1})${sti}。`, ctx); + stiTextArr.forEach(ti => { + cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => { + descRowNum++; + targetRow.getCell(1).value = ti; + }); + }); + }); + } + }); + } + if (!flag) { + let siTextArr = paragraphLineBreakFor1112(` (${ciTastNum})${si.process == null ? '完成' : (si.process == 1 ? '审核' : '编制')}${serviceList[si.id].name},具体工作内容包括:`, ctx); + siTextArr.forEach(ti => { + cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => { + descRowNum++; + targetRow.getCell(1).value = ti; + ciTastNum++; }); }); - } else { cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => { descRowNum++; targetRow.getCell(1).value = ' 1)×××××。'; @@ -2397,9 +2411,8 @@ async function generateTemplate(data) { ciTastNum++; }); }); - const serviceTaskTexts = normalizeTaskTexts(si.tasks); - if (serviceTaskTexts.length) { - serviceTaskTexts.forEach((sti, stindex) => { + if (si.tasks?.length) { + si.tasks.forEach((sti, stindex) => { let stiTextArr = paragraphLineBreakFor1112(` ${stindex + 1})${sti}。`, ctx); stiTextArr.forEach(ti => { cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {