优化成果报表导出功能
This commit is contained in:
1 parent
5a11b7431f
commit
e71a454d8c
4 files changed
+518
-29
No files matched your search
+151
-29
@@ -152,7 +152,8 @@ export const expertList = {
|
||||
};
|
||||
|
||||
export const additionalWorkList = [
|
||||
{ id:'1',
|
||||
{
|
||||
id: '1',
|
||||
code: {
|
||||
richText: [
|
||||
{ font: { charset: 134, color: { theme: 1 }, italic: true, name: '宋体', size: 10 }, text: 'C' },
|
||||
@@ -161,7 +162,8 @@ export const additionalWorkList = [
|
||||
},
|
||||
name: '人员驻场服务及其他附加工作'
|
||||
},
|
||||
{id:'2',
|
||||
{
|
||||
id: '2',
|
||||
code: {
|
||||
richText: [
|
||||
{ font: { charset: 134, color: { theme: 1 }, italic: true, name: '宋体', size: 10 }, text: 'C' },
|
||||
@@ -174,7 +176,7 @@ export const additionalWorkList = [
|
||||
|
||||
export const reserveList = [
|
||||
{
|
||||
id:1,
|
||||
id: 1,
|
||||
code: {
|
||||
richText: [
|
||||
{ font: { charset: 134, color: { theme: 1 }, italic: true, name: '宋体', size: 10 }, text: 'Y' },
|
||||
@@ -698,7 +700,7 @@ export async function exportFile(fileName: string, data: any | (() => Promise<an
|
||||
}]
|
||||
});
|
||||
try {
|
||||
onSaveConfirmed?.()
|
||||
onSaveConfirmed?.()
|
||||
const resolvedData = typeof data === 'function' ? await data() : data
|
||||
const workbook = await generateTemplate(resolvedData);
|
||||
const buffer = await workbook.xlsx.writeBuffer();
|
||||
@@ -736,7 +738,7 @@ export async function exportFile(fileName: string, data: any | (() => Promise<an
|
||||
|
||||
// 按模板生成最终工作簿:填充封面、目录、各分表及汇总数据。
|
||||
async function generateTemplate(data) {
|
||||
data.contracts[0].services[0].tasks = ['依据本项目在招标阶段确认的设计图纸工程量,结合工程量清单计量支付规则,对设计工程量进行复核,包括构件工程量、明细表工程量和汇总表工程量,同时与相关方核对工程量', '依据核对后确认的设计图纸数量,细化与合并招标工程量清单或合同工程量清单,建立各维度清单间的数据链接,与相关单位完成核对与确认', '依据确定的招标工程量清单或合同工程量清单,拆解与合并相应的清单费用,与相关单位完成核对与确认', '现场勘查与测量现场实施工程量'];
|
||||
// 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: '下标' }] };
|
||||
console.log(data)
|
||||
// 编制说明 → 工作内容的前后默认项
|
||||
@@ -2096,16 +2098,118 @@ async function generateTemplate(data) {
|
||||
// 合同段划分
|
||||
descSheet.spliceRows(descRowNum, 1);
|
||||
// 咨询服务类型
|
||||
let serviceText = ' (二)咨询服务类型:' + data.contracts[0].services.slice(0, -1).map(si => serviceList[si.id].name).join('、') + (data.contracts[0].services.length > 1 ? '和' : '') + serviceList[data.contracts[0].services.slice(-1)[0].id].name + '。';
|
||||
let serviceTextArr = paragraphLineBreakFor1112(serviceText, ctx);
|
||||
serviceTextArr.forEach(ti => {
|
||||
if (data.contracts[0].services.length) {
|
||||
let serviceText = ' (二)咨询服务类型:' + data.contracts[0].services.slice(0, -1).map(si => serviceList[si.id].name).join('、') + (data.contracts[0].services.length > 1 ? '和' : '') + serviceList[data.contracts[0].services.slice(-1)[0].id].name + '。';
|
||||
let serviceTextArr = paragraphLineBreakFor1112(serviceText, ctx);
|
||||
serviceTextArr.forEach(ti => {
|
||||
cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => {
|
||||
descRowNum++;
|
||||
targetRow.getCell(1).value = ti;
|
||||
});
|
||||
});
|
||||
descSheet.spliceRows(descRowNum, 1);
|
||||
} else {
|
||||
descSheet.getRow(descRowNum).getCell(1).value = ' (二)咨询服务类型:×××××。';
|
||||
descRowNum++;
|
||||
}
|
||||
// 工作内容及要求
|
||||
let ci = data.contracts[0];
|
||||
let ciTastNum = 1;
|
||||
let ciTaskTitle = ` (三)${ci.name}工作内容及要求`;
|
||||
let ciTaskTitleArr = paragraphLineBreakFor1112(ciTaskTitle, ctx);
|
||||
ciTaskTitleArr.forEach(ti => {
|
||||
cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => {
|
||||
descRowNum++;
|
||||
targetRow.getCell(1).value = ti;
|
||||
});
|
||||
});
|
||||
// 工作内容及要求
|
||||
descRowNum++;
|
||||
cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => {
|
||||
descRowNum++;
|
||||
targetRow.getCell(1).value = ' 1.工作内容包括:';
|
||||
});
|
||||
if (ci.hasPreTexts) {
|
||||
prefixTexts.forEach(ti => {
|
||||
let texts = paragraphLineBreakFor1112(` (${ciTastNum})${ti}。`, ctx);
|
||||
texts.forEach(ti => {
|
||||
cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => {
|
||||
descRowNum++;
|
||||
targetRow.getCell(1).value = ti;
|
||||
ciTastNum++;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
ci.services.forEach((si, sindex) => {
|
||||
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++;
|
||||
});
|
||||
});
|
||||
if (si.tasks?.length) {
|
||||
si.tasks.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;
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => {
|
||||
descRowNum++;
|
||||
targetRow.getCell(1).value = ' 1)×××××。';
|
||||
});
|
||||
}
|
||||
});
|
||||
if (ci.addtional && ci.addtional.det.length) {
|
||||
ci.addtional.det.forEach(ai => {
|
||||
cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => {
|
||||
descRowNum++;
|
||||
targetRow.getCell(1).value = ` (${ciTastNum})${ai.id == 1 ? '负责协调工作,具体工作内容包括:' : '其他附加工作,具体工作内容包括:'}`;
|
||||
ciTastNum++;
|
||||
});
|
||||
if (ai.tasks?.length) {
|
||||
ai.tasks.forEach((ati, atindex) => {
|
||||
let atiTextArr = paragraphLineBreakFor1112(` ${atindex + 1})${ati}。`, ctx);
|
||||
atiTextArr.forEach(ti => {
|
||||
cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => {
|
||||
descRowNum++;
|
||||
targetRow.getCell(1).value = ti;
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => {
|
||||
descRowNum++;
|
||||
targetRow.getCell(1).value = ' 1)×××××。';
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if (ci.hasSufTexts) {
|
||||
suffixTexts.forEach(ti => {
|
||||
let texts = paragraphLineBreakFor1112(` (${ciTastNum})${ti}。`, ctx);
|
||||
texts.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 = ` 2.质量标准:${ci.quality || '×××××'}${/。$/.test(ci.quality) ? '' : '。'}`;
|
||||
});
|
||||
cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => {
|
||||
descRowNum++;
|
||||
targetRow.getCell(1).value = ` 3.服务工期:${ci.duration || '×××××'}${/。$/.test(ci.duration) ? '' : '。'}`;
|
||||
});
|
||||
} else {
|
||||
descSheet.getRow(descRowNum).getCell(1).value = descSheet.getRow(descRowNum).getCell(1).value.replace(/×××/g, data.contracts.length);
|
||||
let descRowNum1 = descRowNum + 1;
|
||||
@@ -2143,7 +2247,11 @@ async function generateTemplate(data) {
|
||||
});
|
||||
// 咨询服务类型
|
||||
descRowNum2 = descRowNum1 + descRowNum2 + 1;
|
||||
let ciServiceText = ` ${cindex + 1}.${ci.name}:` + ci.services.slice(0, -1).map(si => serviceList[si.id].name).join('、') + (ci.services.length > 1 ? '和' : '') + serviceList[ci.services.slice(-1)[0].id].name + '。';
|
||||
if (ci.services.length) {
|
||||
var ciServiceText = ` ${cindex + 1}.${ci.name}:` + ci.services.slice(0, -1).map(si => serviceList[si.id].name).join('、') + (ci.services.length > 1 ? '和' : '') + serviceList[ci.services.slice(-1)[0].id].name + '。';
|
||||
} else {
|
||||
var ciServiceText = ` ${cindex + 1}.${ci.name}:×××××。`;
|
||||
}
|
||||
let ciServiceTextArr = paragraphLineBreakFor1112(ciServiceText, ctx);
|
||||
ciServiceTextArr.forEach(ti => {
|
||||
cusInsertRowFunc(descRowNum2, [descSheet.getRow(descRowNum2 - 1)], descSheet, (targetRow) => {
|
||||
@@ -2164,7 +2272,7 @@ async function generateTemplate(data) {
|
||||
});
|
||||
cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {
|
||||
descRowNum3++;
|
||||
targetRow.getCell(1).value = ` 1.工作内容包括:`;
|
||||
targetRow.getCell(1).value = ' 1.工作内容包括:';
|
||||
});
|
||||
if (ci.hasPreTexts) {
|
||||
prefixTexts.forEach(ti => {
|
||||
@@ -2179,7 +2287,7 @@ async function generateTemplate(data) {
|
||||
});
|
||||
}
|
||||
ci.services.forEach((si, sindex) => {
|
||||
let siTextArr = paragraphLineBreakFor1112(` (${ciTastNum})${si.process == 1 ? '审核' : '编制'}${serviceList[si.id].name},具体工作内容包括:`, ctx);
|
||||
let siTextArr = paragraphLineBreakFor1112(` (${ciTastNum})${si.process == null ? '' : (si.process == 1 ? '审核' : '编制')}${serviceList[si.id].name},具体工作内容包括:`, ctx);
|
||||
siTextArr.forEach(ti => {
|
||||
cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {
|
||||
descRowNum3++;
|
||||
@@ -2187,15 +2295,22 @@ async function generateTemplate(data) {
|
||||
ciTastNum++;
|
||||
});
|
||||
});
|
||||
si.tasks?.forEach((sti, stindex) => {
|
||||
let stiTextArr = paragraphLineBreakFor1112(` ${stindex + 1})${sti}。`, ctx);
|
||||
stiTextArr.forEach(ti => {
|
||||
cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {
|
||||
descRowNum3++;
|
||||
targetRow.getCell(1).value = ti;
|
||||
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) => {
|
||||
descRowNum3++;
|
||||
targetRow.getCell(1).value = ti;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {
|
||||
descRowNum3++;
|
||||
targetRow.getCell(1).value = ' 1)×××××。';
|
||||
});
|
||||
}
|
||||
});
|
||||
if (ci.addtional && ci.addtional.det.length) {
|
||||
ci.addtional.det.forEach(ai => {
|
||||
@@ -2204,15 +2319,22 @@ async function generateTemplate(data) {
|
||||
targetRow.getCell(1).value = ` (${ciTastNum})${ai.id == 1 ? '负责协调工作,具体工作内容包括:' : '其他附加工作,具体工作内容包括:'}`;
|
||||
ciTastNum++;
|
||||
});
|
||||
ai.tasks?.forEach((ati, atindex) => {
|
||||
let atiTextArr = paragraphLineBreakFor1112(` ${atindex + 1})${ati}。`, ctx);
|
||||
atiTextArr.forEach(ti => {
|
||||
cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {
|
||||
descRowNum3++;
|
||||
targetRow.getCell(1).value = ti;
|
||||
if (ai.tasks?.length) {
|
||||
ai.tasks.forEach((ati, atindex) => {
|
||||
let atiTextArr = paragraphLineBreakFor1112(` ${atindex + 1})${ati}。`, ctx);
|
||||
atiTextArr.forEach(ti => {
|
||||
cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {
|
||||
descRowNum3++;
|
||||
targetRow.getCell(1).value = ti;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {
|
||||
descRowNum3++;
|
||||
targetRow.getCell(1).value = ' 1)×××××。';
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if (ci.hasSufTexts) {
|
||||
@@ -2229,11 +2351,11 @@ async function generateTemplate(data) {
|
||||
}
|
||||
cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {
|
||||
descRowNum3++;
|
||||
targetRow.getCell(1).value = ` 2.质量标准:${ci.quality || '×××'}${/。$/.test(ci.quality) ? '' : '。'}`;
|
||||
targetRow.getCell(1).value = ` 2.质量标准:${ci.quality || '×××××'}${/。$/.test(ci.quality) ? '' : '。'}`;
|
||||
});
|
||||
cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {
|
||||
descRowNum3++;
|
||||
targetRow.getCell(1).value = ` 3.服务工期:${ci.duration || '×××'}${/。$/.test(ci.duration) ? '' : '。'}`;
|
||||
targetRow.getCell(1).value = ` 3.服务工期:${ci.duration || '×××××'}${/。$/.test(ci.duration) ? '' : '。'}`;
|
||||
});
|
||||
});
|
||||
descRowNum = descRowNum3;
|
||||
|
||||
Reference in new issue
Block a user