# 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 now = new Date()
const projectInfoRaw = await kvStore.getItem<XmInfoLike>(PROJECT_INFO_DB_KEY) const projectInfoRaw = await kvStore.getItem<XmInfoLike>(PROJECT_INFO_DB_KEY)
const projectName = isNonEmptyString(projectInfoRaw?.projectName) ? sanitizeFileNamePart(projectInfoRaw.projectName) : '造价项目' const projectName = isNonEmptyString(projectInfoRaw?.projectName) ? sanitizeFileNamePart(projectInfoRaw.projectName) : '造价项目'
const fileName = `${projectName}-报表-${formatExportTimestamp(now)}` const fileName = `${formatExportTimestamp(now)}-${projectName}预算文件`
const blobUrl = await exportFile(fileName, () => buildExportReportPayload(), () => { const blobUrl = await exportFile(fileName, () => buildExportReportPayload(), () => {
showReportExportProgress(30, '正在生成报表文件...') showReportExportProgress(30, '正在生成报表文件...')
}) })

View File

@ -47,7 +47,7 @@ export const TYPE_LABEL_MAP: Record<number, WorkType> = {
2: '日常顾问', 2: '日常顾问',
3: '专项顾问', 3: '专项顾问',
4: '附加工作', 4: '附加工作',
5:'自定义' 5: '自定义'
} }
export const industryTypeList = [ export const industryTypeList = [
{ id: '0', name: '公路工程', type: 'isRoad' }, { id: '0', name: '公路工程', type: 'isRoad' },
@ -838,7 +838,6 @@ export async function exportFile(fileName: string, data: any | (() => Promise<an
// 按模板生成最终工作簿:填充封面、目录、各分表及汇总数据。 // 按模板生成最终工作簿:填充封面、目录、各分表及汇总数据。
async function generateTemplate(data) { 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: '下标' }] }; // 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]; 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) { 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.horizontal = 'center';
sheet_1.getRow(ci.services.length + 3 + i).getCell(4).style.alignment.wrapText = true; 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) => { ci.services.forEach((si, sindex) => {
let siTextArr = paragraphLineBreakFor1112(` ${ciTastNum}${si.process == null ? '' : (si.process == 1 ? '审核' : '编制')}${serviceList[si.id].name},具体工作内容包括:`, ctx); let flag = false;
siTextArr.forEach(ti => { 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) => { cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => {
descRowNum++; descRowNum++;
targetRow.getCell(1).value = ti; targetRow.getCell(1).value = ti;
ciTastNum++; ciTastNum++;
}); });
}); });
const serviceTaskTexts = normalizeTaskTexts(si.tasks); tsi.text.forEach((sti, stindex) => {
if (serviceTaskTexts.length) {
serviceTaskTexts.forEach((sti, stindex) => {
let stiTextArr = paragraphLineBreakFor1112(` ${stindex + 1}${sti}`, ctx); let stiTextArr = paragraphLineBreakFor1112(` ${stindex + 1}${sti}`, ctx);
stiTextArr.forEach(ti => { stiTextArr.forEach(ti => {
cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => { 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) => { cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => {
descRowNum++; descRowNum++;
targetRow.getCell(1).value = ' 1×××××。'; targetRow.getCell(1).value = ' 1×××××。';
@ -2397,9 +2411,8 @@ async function generateTemplate(data) {
ciTastNum++; ciTastNum++;
}); });
}); });
const serviceTaskTexts = normalizeTaskTexts(si.tasks); if (si.tasks?.length) {
if (serviceTaskTexts.length) { si.tasks.forEach((sti, stindex) => {
serviceTaskTexts.forEach((sti, stindex) => {
let stiTextArr = paragraphLineBreakFor1112(` ${stindex + 1}${sti}`, ctx); let stiTextArr = paragraphLineBreakFor1112(` ${stindex + 1}${sti}`, ctx);
stiTextArr.forEach(ti => { stiTextArr.forEach(ti => {
cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => { cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {