# Conflicts:
#	src/sql.ts
This commit is contained in:
wintsa 2026-03-19 17:25:11 +08:00
commit c04ed4acb1
3 changed files with 42 additions and 29 deletions

View File

@ -1822,7 +1822,7 @@ const exportReport = async () => {
const now = new Date()
const projectInfoRaw = await kvStore.getItem<XmInfoLike>(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, '正在生成报表文件...')
})

View File

@ -838,7 +838,6 @@ export async function exportFile(fileName: string, data: any | (() => Promise<an
// 按模板生成最终工作簿:填充封面、目录、各分表及汇总数据。
async function generateTemplate(data) {
// data.contracts[0].services[0].tasks = [{ text: '依据本项目在招标阶段确认的设计图纸工程量,结合工程量清单计量支付规则,对设计工程量进行复核,包括构件工程量、明细表工程量和汇总表工程量,同时与相关方核对工程量', '依据核对后确认的设计图纸数量,细化与合并招标工程量清单或合同工程量清单,建立各维度清单间的数据链接,与相关单位完成核对与确认', '依据确定的招标工程量清单或合同工程量清单,拆解与合并相应的清单费用,与相关单位完成核对与确认', '现场勘查与测量现场实施工程量'}];
// const downTextTmp = { richText: [{ font: { charset: 134, color: { theme: 1 }, italic: true, name: '宋体', size: 10 }, text: '常规' }, { font: { charset: 134, color: { theme: 1 }, italic: true, name: 'Calibri', size: 10, vertAlign: 'subscript' }, text: '下标' }] };
// 编制说明 → 工作内容的前后默认项
let prefixIDs = [6, 7, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27];
@ -1649,7 +1648,7 @@ async function generateTemplate(data) {
if (sheet_1.getRow(ci.services.length + 3 + i).getCell(4).style.alignment) {
sheet_1.getRow(ci.services.length + 3 + i).getCell(4).style.alignment.horizontal = 'center';
sheet_1.getRow(ci.services.length + 3 + i).getCell(4).style.alignment.wrapText = true;
if (i != 1 && i != endRows && sheet_1.getRow(ci.services.length + 3 + i).getCell(2).value) sheet_1.getRow(ci.services.length + 3 + i).getCell(9).style.font.size = 22;
if (i != 1 && i != endRows && sheet_1.getRow(ci.services.length + 3 + i).getCell(2).value) sheet_1.getRow(ci.services.length + 3 + i).getCell(10).style.font.size = 22;
}
}
});
@ -2239,17 +2238,21 @@ async function generateTemplate(data) {
});
}
ci.services.forEach((si, sindex) => {
let siTextArr = paragraphLineBreakFor1112(` ${ciTastNum}${si.process == null ? '' : (si.process == 1 ? '审核' : '编制')}${serviceList[si.id].name},具体工作内容包括:`, ctx);
siTextArr.forEach(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++;
});
});
const serviceTaskTexts = normalizeTaskTexts(si.tasks);
if (serviceTaskTexts.length) {
serviceTaskTexts.forEach((sti, stindex) => {
tsi.text.forEach((sti, stindex) => {
let stiTextArr = paragraphLineBreakFor1112(` ${stindex + 1}${sti}`, ctx);
stiTextArr.forEach(ti => {
cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => {
@ -2258,7 +2261,18 @@ async function generateTemplate(data) {
});
});
});
} else {
}
});
}
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++;
});
});
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) => {