diff --git a/klp-ui/src/views/crm/contract/components/ContractList.vue b/klp-ui/src/views/crm/contract/components/ContractList.vue index 53e501fa..540ae889 100644 --- a/klp-ui/src/views/crm/contract/components/ContractList.vue +++ b/klp-ui/src/views/crm/contract/components/ContractList.vue @@ -4,8 +4,8 @@
]*>([\s\S]*?)<\/p>/g; let match; const pContents = []; - + while ((match = pTagRegex.exec(htmlContent)) !== null) { let content = match[1]; - + // 移除其他HTML标签 content = content.replace(/<[^>]*>/g, ''); - + // 处理HTML实体 content = content.replace(/ /g, ' '); content = content.replace(/</g, '<'); @@ -537,10 +541,10 @@ export default { content = content.replace(/&/g, '&'); content = content.replace(/"/g, '"'); content = content.replace(/'/g, "'"); - + // 清理空格和换行 content = content.trim(); - + // 如果不是以大写汉字数字开头,添加一个中文字符的缩进 if (content) { // 检查是否以大写汉字数字开头(一、二、三、四、五、六、七、八、九、十) @@ -551,12 +555,12 @@ export default { pContents.push(content); } } - + // 如果没有提取到p标签内容,尝试提取所有文本内容 if (pContents.length === 0) { let textContent = htmlContent.replace(/<[^>]*>/g, ''); textContent = textContent.replace(/ /g, ' ').trim(); - + // 如果不是以大写汉字数字开头,添加一个中文字符的缩进 if (textContent) { // 检查是否以大写汉字数字开头(一、二、三、四、五、六、七、八、九、十) @@ -567,28 +571,28 @@ export default { pContents.push(textContent); } } - + // 直接合并单元格并设置内容,避免合并已合并的单元格 if (pContents.length > 0) { // 计算需要的行数 const contentLines = pContents.reduce((total, content) => { return total + (content.match(/\n/g) || []).length + 1; }, 0); - + // 合并单元格 const endRow = currentRow + Math.ceil(contentLines / 2); // 估算需要的行数 worksheet.mergeCells(`A${currentRow}:H${endRow}`); - + // 设置合并后单元格的内容和样式 const mergedContent = pContents.join('\n'); worksheet.getCell(`A${currentRow}`).value = mergedContent; worksheet.getCell(`A${currentRow}`).alignment = { horizontal: 'left', vertical: 'top', wrapText: true }; - + // 调整合并后单元格的行高 const lineCount = (mergedContent.match(/\n/g) || []).length + 1; const height = Math.max(60, lineCount * 15); worksheet.getRow(currentRow).height = height; - + // 调整currentRow currentRow = endRow + 1; } @@ -602,62 +606,62 @@ export default { if (currentRow > 0) { // 空行 currentRow++; - + // 供方(甲方)信息 worksheet.mergeCells(`A${currentRow}:D${currentRow}`); worksheet.getCell(`A${currentRow}`).value = `供方(甲方):${row.supplier || '嘉祥科伦普重工有限公司'}`; worksheet.getCell(`A${currentRow}`).alignment = { horizontal: 'left', vertical: 'middle' }; - + worksheet.mergeCells(`E${currentRow}:H${currentRow}`); worksheet.getCell(`E${currentRow}`).value = `需方(乙方):${row.customer || ''}`; worksheet.getCell(`E${currentRow}`).alignment = { horizontal: 'left', vertical: 'middle' }; currentRow++; - + // 地址信息 worksheet.mergeCells(`A${currentRow}:D${currentRow}`); worksheet.getCell(`A${currentRow}`).value = `地址:${row.supplierAddress || ''}`; worksheet.getCell(`A${currentRow}`).alignment = { horizontal: 'left', vertical: 'middle' }; - + worksheet.mergeCells(`E${currentRow}:H${currentRow}`); worksheet.getCell(`E${currentRow}`).value = `地址:${row.customerAddress || ''}`; worksheet.getCell(`E${currentRow}`).alignment = { horizontal: 'left', vertical: 'middle' }; currentRow++; - + // 电话信息 worksheet.mergeCells(`A${currentRow}:D${currentRow}`); worksheet.getCell(`A${currentRow}`).value = `电话:${row.supplierPhone || ''}`; worksheet.getCell(`A${currentRow}`).alignment = { horizontal: 'left', vertical: 'middle' }; - + worksheet.mergeCells(`E${currentRow}:H${currentRow}`); worksheet.getCell(`E${currentRow}`).value = `电话:${row.customerPhone || ''}`; worksheet.getCell(`E${currentRow}`).alignment = { horizontal: 'left', vertical: 'middle' }; currentRow++; - + // 开户行信息 worksheet.mergeCells(`A${currentRow}:D${currentRow}`); worksheet.getCell(`A${currentRow}`).value = `开户行:${row.supplierBank || ''}`; worksheet.getCell(`A${currentRow}`).alignment = { horizontal: 'left', vertical: 'middle' }; - + worksheet.mergeCells(`E${currentRow}:H${currentRow}`); worksheet.getCell(`E${currentRow}`).value = `开户行:${row.customerBank || ''}`; worksheet.getCell(`E${currentRow}`).alignment = { horizontal: 'left', vertical: 'middle' }; currentRow++; - + // 账号信息 worksheet.mergeCells(`A${currentRow}:D${currentRow}`); worksheet.getCell(`A${currentRow}`).value = `账号:${row.supplierAccount || ''}`; worksheet.getCell(`A${currentRow}`).alignment = { horizontal: 'left', vertical: 'middle' }; - + worksheet.mergeCells(`E${currentRow}:H${currentRow}`); worksheet.getCell(`E${currentRow}`).value = `账号:${row.customerAccount || ''}`; worksheet.getCell(`E${currentRow}`).alignment = { horizontal: 'left', vertical: 'middle' }; currentRow++; - + // 税号信息 worksheet.mergeCells(`A${currentRow}:D${currentRow}`); worksheet.getCell(`A${currentRow}`).value = `税号:${row.supplierTaxNo || ''}`; worksheet.getCell(`A${currentRow}`).alignment = { horizontal: 'left', vertical: 'middle' }; - + worksheet.mergeCells(`E${currentRow}:H${currentRow}`); worksheet.getCell(`E${currentRow}`).value = `税号:${row.customerTaxNo || ''}`; worksheet.getCell(`E${currentRow}`).alignment = { horizontal: 'left', vertical: 'middle' }; diff --git a/klp-ui/src/views/crm/customer/index.vue b/klp-ui/src/views/crm/customer/index.vue index b51de219..bd6c5368 100644 --- a/klp-ui/src/views/crm/customer/index.vue +++ b/klp-ui/src/views/crm/customer/index.vue @@ -6,14 +6,17 @@