474a36d0 by tianhaohao@pashanhoo.com

Merge branch 'dev' of http://yun.pashanhoo.com:9090/bdc/bdcdj-web into dev

2 parents 48d26dad 7a4e9519
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2024-01-24 17:31:21
* @LastEditTime: 2024-02-06 13:23:36
-->
<template>
<div>
......@@ -526,7 +526,7 @@
// context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228);
// 权利人
let qlrlines = this.bdcqz.qlr
if (getByteLen(this.bdcqz.qlr) > 36) {
if (getByteLen(this.bdcqz.qlr) > 32) {
let currentLine = '';
let arr = [];
for (let word of qlrlines) {
......@@ -551,7 +551,7 @@
// context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275);
let ywrlines = this.bdcqz.ywr
if (getByteLen(this.bdcqz.ywr) > 36) {
if (getByteLen(this.bdcqz.ywr) > 32) {
let currentLine = '';
let arr = [];
for (let word of ywrlines) {
......@@ -575,7 +575,7 @@
let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : [];
if (getByteLen(this.bdcqz.zl) > 37) {
if (getByteLen(this.bdcqz.zl) > 32) {
lines2.forEach((line, index) => {
const y = 315 + (index * 20); // 每行文本的垂直位置
let currentLine = '';
......@@ -628,12 +628,60 @@
// 恢复原始字体设置
context.font = originalFont;
// qlqtzk
function getByteLenBdcdy (val) {
var encoder = new TextEncoder('utf-8');
return encoder.encode(val).length;
}
const maxWidth = 290; // 最大宽度限制
let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n').filter(i => i && i.trim()) : [];
for (let i = 0; i < lines.length; i++) {
console.log(getByteLen(lines[i]));
let num = Math.ceil(getByteLen(lines[i]) / 37)
if (getByteLen(lines[i]) > 37) {
let bdcdyNum = Math.ceil(getByteLenBdcdy(lines[0]) / 43)
// 单独处理不动产单元号
let linesBdcdy = lines[0] ? lines[0].split(' ') : [];
if (getByteLenBdcdy(lines[0]) > 43) {
linesBdcdy.forEach((line, index) => {
const y = 412 + (index * 17); // 每行文本的垂直位置
let currentLine = '';
let arr = [];
for (let word of line) {
const testLine = currentLine + word;
const lineWidth = context.measureText(testLine).width;
if (lineWidth <= maxWidth) {
currentLine = testLine;
} else {
arr.push(currentLine);
currentLine = word;
}
}
arr.push(currentLine);
arr.forEach((line, index) => {
context.fillText(line, 770, y + (index * 17)); // 调整行高
})
})
} else {
linesBdcdy.forEach((line, index) => {
const y = 418 + (index * 17); // 每行文本的垂直位置
let currentLine = '';
let arr = [];
for (let word of line) {
const testLine = currentLine + word;
const lineWidth = context.measureText(testLine).width;
if (lineWidth <= maxWidth) {
currentLine = testLine;
} else {
arr.push(currentLine);
currentLine = word;
}
}
arr.push(currentLine);
arr.forEach((line, index) => {
context.fillText(line, 770, y + (index * 17)); // 调整行高
})
})
}
for (let i = 1; i < lines.length; i++) {
let num = Math.ceil(getByteLen(lines[i]) / 32)
if (getByteLen(lines[i]) > 32) {
let currentLine = '';
let arr = [];
for (let word of lines[i]) {
......@@ -649,18 +697,18 @@
arr.push(currentLine);
if (i > 0) {
arr.forEach((line, index) => {
context.fillText(line, 770, 438 + (24 * (i - 1)) + 5 * num + (index * 17)); // 调整行高
context.fillText(line, 770, 408 + (bdcdyNum * 15) + (24 * (i - 1)) + 5 * num + (index * 17)); // 调整行高
})
} else {
arr.forEach((line, index) => {
context.fillText(line, 770, 438 + (24 * (i - 1)) + (index * 17)); // 调整行高
context.fillText(line, 770, 408 + (bdcdyNum * 15) + (24 * (i - 1)) + (index * 17)); // 调整行高
})
}
} else {
if (i > 0) {
context.fillText(lines[i] ? lines[i] : '', 770, 447 + 6 * num + (25 * (i - 1)));
context.fillText(lines[i] ? lines[i] : '', 770, 417 + (bdcdyNum * 15) + 6 * num + (25 * (i - 1)));
} else {
context.fillText(lines[i] ? lines[i] : '', 770, 447 + (25 * (i - 1)));
context.fillText(lines[i] ? lines[i] : '', 770, 417 + (bdcdyNum * 15) + (25 * (i - 1)));
}
}
}
......
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2024-01-30 16:29:37
* @LastEditTime: 2024-02-06 13:23:44
-->
<template>
<div class="from-clues loadingtext" v-Loading="loading" element-loading-text="拼命加载中..." style="text-align: center;">
......@@ -415,7 +415,6 @@
}
return len;
}
const canvas = this.$refs.zm;
const context = canvas.getContext('2d');
const image = new Image();
......@@ -434,7 +433,6 @@
}
context.fillText(this.bdcqz.sjjc ? this.bdcqz.sjjc : '', 620, 125);
context.fillText(this.bdcqz.djnd ? this.bdcqz.djnd : '', 665, 125);
console.log(getByteLen(this.bdcqz.sxqc));
if (getByteLen(this.bdcqz.sxqc) > 14) {
const originalFont = context.font;
// 设置新的字体大小
......@@ -452,7 +450,7 @@
// context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228);
// 权利人
let qlrlines = this.bdcqz.qlr
if (getByteLen(this.bdcqz.qlr) > 36) {
if (getByteLen(this.bdcqz.qlr) > 32) {
let currentLine = '';
let arr = [];
for (let word of qlrlines) {
......@@ -477,7 +475,7 @@
// 义务人
// context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275);
let ywrlines = this.bdcqz.ywr
if (getByteLen(this.bdcqz.ywr) > 36) {
if (getByteLen(this.bdcqz.ywr) > 32) {
let currentLine = '';
let arr = [];
for (let word of ywrlines) {
......@@ -500,9 +498,8 @@
}
// context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 775, 325);
let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : [];
if (getByteLen(this.bdcqz.zl) > 37) {
if (getByteLen(this.bdcqz.zl) > 32) {
lines2.forEach((line, index) => {
const y = 315 + (index * 20); // 每行文本的垂直位置
let currentLine = '';
......@@ -557,11 +554,60 @@
// 恢复原始字体设置
context.font = originalFont;
// qlqtzk
function getByteLenBdcdy (val) {
var encoder = new TextEncoder('utf-8');
return encoder.encode(val).length;
}
const maxWidth = 295; // 最大宽度限制
let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n').filter(i => i && i.trim()) : [];
for (let i = 0; i < lines.length; i++) {
let num = Math.ceil(getByteLen(lines[i]) / 37)
if (getByteLen(lines[i]) > 37) {
let bdcdyNum = Math.ceil(getByteLenBdcdy(lines[0]) / 43)
// 单独处理不动产单元号
let linesBdcdy = lines[0] ? lines[0].split(' ') : [];
if (getByteLenBdcdy(lines[0]) > 43) {
linesBdcdy.forEach((line, index) => {
const y = 412 + (index * 17); // 每行文本的垂直位置
let currentLine = '';
let arr = [];
for (let word of line) {
const testLine = currentLine + word;
const lineWidth = context.measureText(testLine).width;
if (lineWidth <= maxWidth) {
currentLine = testLine;
} else {
arr.push(currentLine);
currentLine = word;
}
}
arr.push(currentLine);
arr.forEach((line, index) => {
context.fillText(line, 770, y + (index * 17)); // 调整行高
})
})
} else {
linesBdcdy.forEach((line, index) => {
const y = 418 + (index * 17); // 每行文本的垂直位置
let currentLine = '';
let arr = [];
for (let word of line) {
const testLine = currentLine + word;
const lineWidth = context.measureText(testLine).width;
if (lineWidth <= maxWidth) {
currentLine = testLine;
} else {
arr.push(currentLine);
currentLine = word;
}
}
arr.push(currentLine);
arr.forEach((line, index) => {
context.fillText(line, 770, y + (index * 17)); // 调整行高
})
})
}
for (let i = 1; i < lines.length; i++) {
let num = Math.ceil(getByteLen(lines[i]) / 32)
if (getByteLen(lines[i]) > 32) {
let currentLine = '';
let arr = [];
for (let word of lines[i]) {
......@@ -577,18 +623,18 @@
arr.push(currentLine);
if (i > 0) {
arr.forEach((line, index) => {
context.fillText(line, 770, 438 + (24 * (i - 1)) + 5 * num + (index * 17)); // 调整行高
context.fillText(line, 770, 408 + (bdcdyNum * 15) + (24 * (i - 1)) + 5 * num + (index * 17)); // 调整行高
})
} else {
arr.forEach((line, index) => {
context.fillText(line, 770, 438 + (24 * (i - 1)) + (index * 17)); // 调整行高
context.fillText(line, 770, 408 + (bdcdyNum * 15) + (24 * (i - 1)) + (index * 17)); // 调整行高
})
}
} else {
if (i > 0) {
context.fillText(lines[i] ? lines[i] : '', 770, 447 + 6 * num + (25 * (i - 1)));
context.fillText(lines[i] ? lines[i] : '', 770, 417 + (bdcdyNum * 15) + 6 * num + (25 * (i - 1)));
} else {
context.fillText(lines[i] ? lines[i] : '', 770, 447 + (25 * (i - 1)));
context.fillText(lines[i] ? lines[i] : '', 770, 417 + (bdcdyNum * 15) + (25 * (i - 1)));
}
}
}
......