This commit is contained in:
wintsa 2026-03-18 11:19:30 +08:00
commit ad363041c3
6 changed files with 546 additions and 56 deletions

367
public/data.js Normal file
View File

@ -0,0 +1,367 @@
let data1 = {
name: 'test001',
writer: '张三',// 编制人
reviewer: '李四',// 复核人
company: '测试公司',// 公司名称
date: '2021-09-24',// 编制日期
industry: 0,// 0为公路工程1为铁路工程2为水运工程
fee: 10000,
scaleCost: 100000,// scale的cost的合计数
overview: '项目概况××××',
desc: ' 在履行造价咨询服务时宜根据咨询服务质量情况分级确定相应的处罚金额。其中考评得分在大于及等于85和小于90分时处罚金额为预算费用的10%其中考评得分在大于及等于80和小于85分时处罚金额为预算费用的20%其中考评得分在大于及等于75和小于80分时处罚金额为预算费用的30%其中考评得分在大于及等于70和小于75分时处罚金额为预算费用的40%其中考评得分小于70分时处罚金额为预算费用的50%以上。',
scale: [// 规模信息
{
major: 0,
cost: 100000,
area: 200,
},
{
major: 1,
cost: 100000,
area: 200,
},
],
serviceCoes: [// 项目咨询分类系数
{
serviceid: 0,
coe: 1.1,
remark: '',// 用户输入的说明
},
{
serviceid: 1,
coe: 1.2,
remark: '',// 用户输入的说明
},
],
majorCoes: [// 项目工程专业系数
{
majorid: 0,
coe: 1.1,
remark: '',// 用户输入的说明
},
{
majorid: 1,
coe: 1.2,
remark: '',// 用户输入的说明
},
],
contracts: [// 合同段信息
{
name: 'A合同段',
serviceFee: 100000,
addtionalFee: 0,
reserveFee: 0,
fee: 10000,
quality: '造价咨询服务的综合评价应达到“较好”或综合评分90分',
duration: '自xxxx年xx月开始至xxxx年xx月结束服务周期xx个月。',
scale: [
{
major: 0,
cost: 100000,
area: 200,
},
{
major: 1,
cost: 100000,
area: 200,
},
],
serviceCoes: [// 合同段咨询分类系数
{
serviceid: 0,
coe: 1.1,
remark: '',// 用户输入的说明
},
{
serviceid: 1,
coe: 1.2,
remark: '',// 用户输入的说明
},
],
majorCoes: [// 合同段工程专业系数
{
majorid: 0,
coe: 1.1,
remark: '',// 用户输入的说明
},
{
majorid: 1,
coe: 1.2,
remark: '',// 用户输入的说明
},
],
services: [
{
id: 0,
fee: 100000,
finalFee: 100000,
process: 0,// 工作环节0为编制1为审核
method1: { // 投资规模法
cost: 100000,
basicFee: 200,
basicFee_basic: 200,
basicFee_optional: 0,
fee: 250000,
proAmount: 3,
det: [
{
proNum: 1,
major: 0,
cost: 100000,
basicFee: 200,
basicFormula: '856,000+(1,000,000,000-500,000,000)×1‰',
basicFee_basic: 200,
optionalFormula: '171,200+(1,000,000,000-500,000,000)×0.2‰',
basicFee_optional: 0,
serviceCoe: 1.1,
majorCoe: 1.2,
processCoe: 1,// 工作环节系数(编审系数)
proportion: 0.5,// 工作占比
fee: 100000,
remark: '',// 用户输入的说明
},
],
},
method2: { // 用地规模法
area: 1200,
basicFee: 200,
basicFee_basic: 200,
basicFee_optional: 0,
fee: 250000,
proAmount: 3,
det: [
{
proNum: 1,
major: 0,
area: 1200,
basicFee: 200,
basicFormula: '106,000+(1,200-1,000)×60',
basicFee_basic: 200,
optionalFormula: '21,200+(1,200-1,000)×12',
basicFee_optional: 0,
serviceCoe: 1.1,
majorCoe: 1.2,
processCoe: 1,// 工作环节系数(编审系数)
proportion: 0.5,// 工作占比
fee: 100000,
remark: '',// 用户输入的说明
},
],
},
method3: { // 工作量法
basicFee: 200,
fee: 250000,
det: [
{
task: 0,
price: 100000,
amount: 10,
basicFee: 200,
serviceCoe: 1.1,
fee: 100000,
remark: '',// 用户输入的说明
},
{
task: 1,
price: 100000,
amount: 10,
basicFee: 200,
serviceCoe: 1.1,
fee: 100000,
remark: '',// 用户输入的说明
},
],
},
method4: { // 工时法
person_num: 10,
work_day: 10,
fee: 250000,
det: [
{
expert: 0,
price: 100000,
person_num: 10,
work_day: 3,
fee: 100000,
remark: '',// 用户输入的说明
},
{
expert: 1,
price: 100000,
person_num: 10,
work_day: 3,
fee: 100000,
remark: '',// 用户输入的说明
},
],
},
tasks: [{ serviceid: 0, process: 0, text: ['abc', 'efg'] }, { serviceid: 1, process: 0, text: ['abc', 'efg'] }],// 工作内容
},
],
addtional: {// 附加工作费
ref: { richText: [{ font: { charset: 134, color: { theme: 1 }, italic: true, name: '宋体', size: 10 }, text: 'C' }, { font: { charset: 134, color: { theme: 1 }, italic: true, name: 'Calibri', size: 10, vertAlign: 'subscript' }, text: 'C' }] },
name: '附加工作',
fee: 10000,
det: [
{
id: 0,
ref: { richText: [{ font: { charset: 134, color: { theme: 1 }, italic: true, name: '宋体', size: 10 }, text: 'C' }, { font: { charset: 134, color: { theme: 1 }, italic: true, name: 'Calibri', size: 10, vertAlign: 'subscript' }, text: 'F' }] },
name: '人员驻场服务及其他附加工作',
fee: 10000,
m4: {
person_num: 10,
work_day: 3,
fee: 10000,
det: [
{
expert: 0,
price: 100000,
person_num: 10,
work_day: 3,
fee: 100000,
remark: '',// 用户输入的说明
},
{
expert: 1,
price: 100000,
person_num: 10,
work_day: 3,
fee: 100000,
remark: '',// 用户输入的说明
},
],
},
m5: {
fee: 10000,
det: [
{
name: '×××项',
unit: '项',
amount: 10,
price: 100000,
fee: 100000,
remark: '',// 用户输入的说明
},
{
name: '×××项',
unit: '项',
amount: 10,
price: 100000,
fee: 100000,
remark: '',// 用户输入的说明
},
],
},
},
{
id: 1,
ref: { richText: [{ font: { charset: 134, color: { theme: 1 }, italic: true, name: '宋体', size: 10 }, text: 'C' }, { font: { charset: 134, color: { theme: 1 }, italic: true, name: 'Calibri', size: 10, vertAlign: 'subscript' }, text: 'X' }] },
name: '咨询服务协调工作',
fee: 10000,
m0: {
coe: 0.03,
fee: 10000,
},
m4: {
person_num: 10,
work_day: 3,
fee: 10000,
det: [
{
expert: 0,
price: 100000,
person_num: 10,
work_day: 3,
fee: 100000,
remark: '',// 用户输入的说明
},
{
expert: 1,
price: 100000,
person_num: 10,
work_day: 3,
fee: 100000,
remark: '',// 用户输入的说明
},
],
},
m5: {
fee: 10000,
det: [
{
name: '×××项',
unit: '项',
amount: 10,
price: 100000,
fee: 100000,
remark: '',// 用户输入的说明
},
{
name: '×××项',
unit: '项',
amount: 10,
price: 100000,
fee: 100000,
remark: '',// 用户输入的说明
},
],
},
},
]
},
reserve: {// 预备费
ref: { richText: [{ font: { charset: 134, color: { theme: 1 }, italic: true, name: '宋体', size: 10 }, text: 'Y' }, { font: { charset: 134, color: { theme: 1 }, italic: true, name: 'Calibri', size: 10, vertAlign: 'subscript' }, text: 'B' }] },
name: '预备费',
fee: 10000,
m0: {
coe: 0.03,
fee: 10000,
},
m4: {
person_num: 10,
work_day: 3,
fee: 10000,
det: [
{
expert: 0,
price: 100000,
person_num: 10,
work_day: 3,
fee: 100000,
remark: '',// 用户输入的说明
},
{
expert: 1,
price: 100000,
person_num: 10,
work_day: 3,
fee: 100000,
remark: '',// 用户输入的说明
},
],
},
m5: {
fee: 10000,
det: [
{
name: '×××项',
unit: '项',
amount: 10,
price: 100000,
fee: 100000,
remark: '',// 用户输入的说明
},
{
name: '×××项',
unit: '项',
amount: 10,
price: 100000,
fee: 100000,
remark: '',// 用户输入的说明
},
],
}
},
},
],
};

View File

@ -594,9 +594,11 @@ const columnDefs: ColDef<DetailRow>[] = [
{ {
headerName: '名称', headerName: '名称',
field: 'name', field: 'name',
minWidth: 250, minWidth: 180,
flex: 3, flex: 3,
tooltipField: 'name', wrapText: true,
autoHeight: true,
cellStyle: { lineHeight: '1.4', paddingTop: '4px', paddingBottom: '4px' },
valueGetter: params => { valueGetter: params => {
if (!params.data) return '' if (!params.data) return ''
if (isFixedRow(params.data)) return '' if (isFixedRow(params.data)) return ''
@ -607,9 +609,9 @@ const columnDefs: ColDef<DetailRow>[] = [
headerName: '工作环节', headerName: '工作环节',
field: 'process', field: 'process',
headerClass: 'ag-center-header zxfw-process-header', headerClass: 'ag-center-header zxfw-process-header',
minWidth: 170, minWidth: 80,
maxWidth: 220, maxWidth: 100,
flex: 1.2, flex: 1,
editable: false, editable: false,
sortable: false, sortable: false,
filter: false, filter: false,
@ -629,8 +631,8 @@ const columnDefs: ColDef<DetailRow>[] = [
headerName: '投资规模法', headerName: '投资规模法',
field: 'investScale', field: 'investScale',
headerClass: 'ag-right-aligned-header', headerClass: 'ag-right-aligned-header',
minWidth: 140, minWidth: 100,
flex: 2, flex: 1.5,
cellClass: 'ag-right-aligned-cell', cellClass: 'ag-right-aligned-cell',
editable: false, editable: false,
@ -646,8 +648,8 @@ const columnDefs: ColDef<DetailRow>[] = [
headerName: '用地规模法', headerName: '用地规模法',
field: 'landScale', field: 'landScale',
headerClass: 'ag-right-aligned-header', headerClass: 'ag-right-aligned-header',
minWidth: 140, minWidth: 100,
flex: 2, flex: 1.5,
cellClass: 'ag-right-aligned-cell', cellClass: 'ag-right-aligned-cell',
editable: false, editable: false,
@ -663,8 +665,8 @@ const columnDefs: ColDef<DetailRow>[] = [
headerName: '工作量法', headerName: '工作量法',
field: 'workload', field: 'workload',
headerClass: 'ag-right-aligned-header', headerClass: 'ag-right-aligned-header',
minWidth: 120, minWidth: 90,
flex: 2, flex: 1.5,
cellClass: 'ag-right-aligned-cell', cellClass: 'ag-right-aligned-cell',
editable: false, editable: false,
@ -681,8 +683,8 @@ const columnDefs: ColDef<DetailRow>[] = [
headerName: '工时法', headerName: '工时法',
field: 'hourly', field: 'hourly',
headerClass: 'ag-right-aligned-header', headerClass: 'ag-right-aligned-header',
minWidth: 120, minWidth: 90,
flex: 2, flex: 1.5,
cellClass: 'ag-right-aligned-cell', cellClass: 'ag-right-aligned-cell',
editable: false, editable: false,
@ -699,9 +701,8 @@ const columnDefs: ColDef<DetailRow>[] = [
headerName: '小计', headerName: '小计',
field: 'subtotal', field: 'subtotal',
headerClass: 'ag-right-aligned-header', headerClass: 'ag-right-aligned-header',
flex: 3, flex: 2,
minWidth: 100,
minWidth: 120,
cellClass: 'ag-right-aligned-cell', cellClass: 'ag-right-aligned-cell',
editable: false, editable: false,
valueGetter: params => { valueGetter: params => {
@ -720,8 +721,8 @@ const columnDefs: ColDef<DetailRow>[] = [
headerName: '确认金额', headerName: '确认金额',
field: 'finalFee', field: 'finalFee',
headerClass: 'ag-right-aligned-header', headerClass: 'ag-right-aligned-header',
flex: 3, flex: 2,
minWidth: 140, minWidth: 110,
cellClass: 'ag-right-aligned-cell', cellClass: 'ag-right-aligned-cell',
editable: params => !isFixedRow(params.data), editable: params => !isFixedRow(params.data),
valueGetter: params => { valueGetter: params => {
@ -748,9 +749,9 @@ const columnDefs: ColDef<DetailRow>[] = [
{ {
headerName: '操作', headerName: '操作',
field: 'actions', field: 'actions',
minWidth: 220, minWidth: 180,
flex: 2, flex: 1.5,
maxWidth: 260, maxWidth: 220,
editable: false, editable: false,
sortable: false, sortable: false,
filter: false, filter: false,

View File

@ -1092,15 +1092,15 @@ export const useZxFwPricingStore = defineStore('zxFwPricing', () => {
if (!state?.detailRows?.length) return null if (!state?.detailRows?.length) return null
const fixedRow = state.detailRows.find(row => String(row.id || '') === FIXED_ROW_ID) const fixedRow = state.detailRows.find(row => String(row.id || '') === FIXED_ROW_ID)
const fixedSubtotal = toFiniteNumberOrNull(fixedRow?.subtotal) const fixedFinalFee = toFiniteNumberOrNull(fixedRow?.finalFee)
if (fixedSubtotal != null) return round3(fixedSubtotal) if (fixedFinalFee != null) return round3(fixedFinalFee)
let hasValid = false let hasValid = false
const sum = state.detailRows.reduce((acc, row) => { const sum = state.detailRows.reduce((acc, row) => {
if (String(row.id || '') === FIXED_ROW_ID) return acc if (String(row.id || '') === FIXED_ROW_ID) return acc
const subtotal = toFiniteNumberOrNull(row.subtotal) const fee = toFiniteNumberOrNull(row.finalFee) ?? toFiniteNumberOrNull(row.subtotal)
if (subtotal != null) hasValid = true if (fee != null) hasValid = true
return subtotal == null ? acc : acc + subtotal return fee == null ? acc : acc + fee
}, 0) }, 0)
return hasValid ? round3(sum) : null return hasValid ? round3(sum) : null
} }

View File

@ -152,7 +152,8 @@ export const expertList = {
}; };
export const additionalWorkList = [ export const additionalWorkList = [
{ id:'1', {
id: '1',
code: { code: {
richText: [ richText: [
{ font: { charset: 134, color: { theme: 1 }, italic: true, name: '宋体', size: 10 }, text: 'C' }, { font: { charset: 134, color: { theme: 1 }, italic: true, name: '宋体', size: 10 }, text: 'C' },
@ -161,7 +162,8 @@ export const additionalWorkList = [
}, },
name: '人员驻场服务及其他附加工作' name: '人员驻场服务及其他附加工作'
}, },
{id:'2', {
id: '2',
code: { code: {
richText: [ richText: [
{ font: { charset: 134, color: { theme: 1 }, italic: true, name: '宋体', size: 10 }, text: 'C' }, { font: { charset: 134, color: { theme: 1 }, italic: true, name: '宋体', size: 10 }, text: 'C' },
@ -174,7 +176,7 @@ export const additionalWorkList = [
export const reserveList = [ export const reserveList = [
{ {
id:1, id: 1,
code: { code: {
richText: [ richText: [
{ font: { charset: 134, color: { theme: 1 }, italic: true, name: '宋体', size: 10 }, text: 'Y' }, { 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 { try {
onSaveConfirmed?.() onSaveConfirmed?.()
const resolvedData = typeof data === 'function' ? await data() : data const resolvedData = typeof data === 'function' ? await data() : data
const workbook = await generateTemplate(resolvedData); const workbook = await generateTemplate(resolvedData);
const buffer = await workbook.xlsx.writeBuffer(); const buffer = await workbook.xlsx.writeBuffer();
@ -736,7 +738,7 @@ export async function exportFile(fileName: string, data: any | (() => Promise<an
// 按模板生成最终工作簿:填充封面、目录、各分表及汇总数据。 // 按模板生成最终工作簿:填充封面、目录、各分表及汇总数据。
async function generateTemplate(data) { 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: '下标' }] }; // 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) console.log(data)
// 编制说明 → 工作内容的前后默认项 // 编制说明 → 工作内容的前后默认项
@ -2096,16 +2098,118 @@ async function generateTemplate(data) {
// 合同段划分 // 合同段划分
descSheet.spliceRows(descRowNum, 1); 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 + '。'; if (data.contracts[0].services.length) {
let serviceTextArr = paragraphLineBreakFor1112(serviceText, ctx); 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 + '。';
serviceTextArr.forEach(ti => { 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) => { cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => {
descRowNum++; descRowNum++;
targetRow.getCell(1).value = ti; targetRow.getCell(1).value = ti;
}); });
}); });
// 工作内容及要求 cusInsertRowFunc(descRowNum, [descSheet.getRow(descRowNum - 1)], descSheet, (targetRow) => {
descRowNum++; 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 { } else {
descSheet.getRow(descRowNum).getCell(1).value = descSheet.getRow(descRowNum).getCell(1).value.replace(/×××/g, data.contracts.length); descSheet.getRow(descRowNum).getCell(1).value = descSheet.getRow(descRowNum).getCell(1).value.replace(/×××/g, data.contracts.length);
let descRowNum1 = descRowNum + 1; let descRowNum1 = descRowNum + 1;
@ -2144,8 +2248,12 @@ async function generateTemplate(data) {
}); });
// 咨询服务类型 // 咨询服务类型
descRowNum2 = descRowNum1 + descRowNum2 + 1; descRowNum2 = descRowNum1 + descRowNum2 + 1;
console.log(ci.services)
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); let ciServiceTextArr = paragraphLineBreakFor1112(ciServiceText, ctx);
ciServiceTextArr.forEach(ti => { ciServiceTextArr.forEach(ti => {
cusInsertRowFunc(descRowNum2, [descSheet.getRow(descRowNum2 - 1)], descSheet, (targetRow) => { cusInsertRowFunc(descRowNum2, [descSheet.getRow(descRowNum2 - 1)], descSheet, (targetRow) => {
@ -2166,7 +2274,7 @@ async function generateTemplate(data) {
}); });
cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => { cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {
descRowNum3++; descRowNum3++;
targetRow.getCell(1).value = ` 1.工作内容包括:`; targetRow.getCell(1).value = ' 1.工作内容包括:';
}); });
if (ci.hasPreTexts) { if (ci.hasPreTexts) {
prefixTexts.forEach(ti => { prefixTexts.forEach(ti => {
@ -2181,7 +2289,7 @@ async function generateTemplate(data) {
}); });
} }
ci.services.forEach((si, sindex) => { 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 => { siTextArr.forEach(ti => {
cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => { cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {
descRowNum3++; descRowNum3++;
@ -2189,15 +2297,22 @@ async function generateTemplate(data) {
ciTastNum++; ciTastNum++;
}); });
}); });
si.tasks?.forEach((sti, stindex) => { if (si.tasks?.length) {
let stiTextArr = paragraphLineBreakFor1112(` ${stindex + 1}${sti}`, ctx); si.tasks.forEach((sti, stindex) => {
stiTextArr.forEach(ti => { let stiTextArr = paragraphLineBreakFor1112(` ${stindex + 1}${sti}`, ctx);
cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => { stiTextArr.forEach(ti => {
descRowNum3++; cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {
targetRow.getCell(1).value = ti; 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) { if (ci.addtional && ci.addtional.det.length) {
ci.addtional.det.forEach(ai => { ci.addtional.det.forEach(ai => {
@ -2206,15 +2321,22 @@ async function generateTemplate(data) {
targetRow.getCell(1).value = ` ${ciTastNum}${ai.id == 1 ? '负责协调工作,具体工作内容包括:' : '其他附加工作,具体工作内容包括:'}`; targetRow.getCell(1).value = ` ${ciTastNum}${ai.id == 1 ? '负责协调工作,具体工作内容包括:' : '其他附加工作,具体工作内容包括:'}`;
ciTastNum++; ciTastNum++;
}); });
ai.tasks?.forEach((ati, atindex) => { if (ai.tasks?.length) {
let atiTextArr = paragraphLineBreakFor1112(` ${atindex + 1}${ati}`, ctx); ai.tasks.forEach((ati, atindex) => {
atiTextArr.forEach(ti => { let atiTextArr = paragraphLineBreakFor1112(` ${atindex + 1}${ati}`, ctx);
cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => { atiTextArr.forEach(ti => {
descRowNum3++; cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {
targetRow.getCell(1).value = ti; descRowNum3++;
targetRow.getCell(1).value = ti;
});
}); });
}); });
}); } else {
cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {
descRowNum3++;
targetRow.getCell(1).value = ' 1×××××。';
});
}
}); });
} }
if (ci.hasSufTexts) { if (ci.hasSufTexts) {
@ -2231,11 +2353,11 @@ async function generateTemplate(data) {
} }
cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => { cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {
descRowNum3++; 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) => { cusInsertRowFunc(descRowNum3, [descSheet.getRow(descRowNum3 - 1)], descSheet, (targetRow) => {
descRowNum3++; descRowNum3++;
targetRow.getCell(1).value = ` 3.服务工期:${ci.duration || '×××'}${/$/.test(ci.duration) ? '' : '。'}`; targetRow.getCell(1).value = ` 3.服务工期:${ci.duration || '×××××'}${/$/.test(ci.duration) ? '' : '。'}`;
}); });
}); });
descRowNum = descRowNum3; descRowNum = descRowNum3;