Merge branch 'dev' of http://yun.pashanhoo.com:9090/bdc/bdcdj-web into dev
Showing
2 changed files
with
120 additions
and
26 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2024-01-24 17:31:21 | 4 | * @LastEditTime: 2024-02-06 13:23:36 |
| 5 | --> | 5 | --> |
| 6 | <template> | 6 | <template> |
| 7 | <div> | 7 | <div> |
| ... | @@ -526,7 +526,7 @@ | ... | @@ -526,7 +526,7 @@ |
| 526 | // context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228); | 526 | // context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228); |
| 527 | // 权利人 | 527 | // 权利人 |
| 528 | let qlrlines = this.bdcqz.qlr | 528 | let qlrlines = this.bdcqz.qlr |
| 529 | if (getByteLen(this.bdcqz.qlr) > 36) { | 529 | if (getByteLen(this.bdcqz.qlr) > 32) { |
| 530 | let currentLine = ''; | 530 | let currentLine = ''; |
| 531 | let arr = []; | 531 | let arr = []; |
| 532 | for (let word of qlrlines) { | 532 | for (let word of qlrlines) { |
| ... | @@ -551,7 +551,7 @@ | ... | @@ -551,7 +551,7 @@ |
| 551 | // context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275); | 551 | // context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275); |
| 552 | 552 | ||
| 553 | let ywrlines = this.bdcqz.ywr | 553 | let ywrlines = this.bdcqz.ywr |
| 554 | if (getByteLen(this.bdcqz.ywr) > 36) { | 554 | if (getByteLen(this.bdcqz.ywr) > 32) { |
| 555 | let currentLine = ''; | 555 | let currentLine = ''; |
| 556 | let arr = []; | 556 | let arr = []; |
| 557 | for (let word of ywrlines) { | 557 | for (let word of ywrlines) { |
| ... | @@ -575,7 +575,7 @@ | ... | @@ -575,7 +575,7 @@ |
| 575 | 575 | ||
| 576 | 576 | ||
| 577 | let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : []; | 577 | let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : []; |
| 578 | if (getByteLen(this.bdcqz.zl) > 37) { | 578 | if (getByteLen(this.bdcqz.zl) > 32) { |
| 579 | lines2.forEach((line, index) => { | 579 | lines2.forEach((line, index) => { |
| 580 | const y = 315 + (index * 20); // 每行文本的垂直位置 | 580 | const y = 315 + (index * 20); // 每行文本的垂直位置 |
| 581 | let currentLine = ''; | 581 | let currentLine = ''; |
| ... | @@ -628,12 +628,60 @@ | ... | @@ -628,12 +628,60 @@ |
| 628 | // 恢复原始字体设置 | 628 | // 恢复原始字体设置 |
| 629 | context.font = originalFont; | 629 | context.font = originalFont; |
| 630 | // qlqtzk | 630 | // qlqtzk |
| 631 | function getByteLenBdcdy (val) { | ||
| 632 | var encoder = new TextEncoder('utf-8'); | ||
| 633 | return encoder.encode(val).length; | ||
| 634 | } | ||
| 631 | const maxWidth = 290; // 最大宽度限制 | 635 | const maxWidth = 290; // 最大宽度限制 |
| 632 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n').filter(i => i && i.trim()) : []; | 636 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n').filter(i => i && i.trim()) : []; |
| 633 | for (let i = 0; i < lines.length; i++) { | 637 | let bdcdyNum = Math.ceil(getByteLenBdcdy(lines[0]) / 43) |
| 634 | console.log(getByteLen(lines[i])); | 638 | // 单独处理不动产单元号 |
| 635 | let num = Math.ceil(getByteLen(lines[i]) / 37) | 639 | let linesBdcdy = lines[0] ? lines[0].split(' ') : []; |
| 636 | if (getByteLen(lines[i]) > 37) { | 640 | if (getByteLenBdcdy(lines[0]) > 43) { |
| 641 | linesBdcdy.forEach((line, index) => { | ||
| 642 | const y = 412 + (index * 17); // 每行文本的垂直位置 | ||
| 643 | let currentLine = ''; | ||
| 644 | let arr = []; | ||
| 645 | for (let word of line) { | ||
| 646 | const testLine = currentLine + word; | ||
| 647 | const lineWidth = context.measureText(testLine).width; | ||
| 648 | if (lineWidth <= maxWidth) { | ||
| 649 | currentLine = testLine; | ||
| 650 | } else { | ||
| 651 | arr.push(currentLine); | ||
| 652 | currentLine = word; | ||
| 653 | } | ||
| 654 | } | ||
| 655 | arr.push(currentLine); | ||
| 656 | arr.forEach((line, index) => { | ||
| 657 | context.fillText(line, 770, y + (index * 17)); // 调整行高 | ||
| 658 | }) | ||
| 659 | }) | ||
| 660 | } else { | ||
| 661 | linesBdcdy.forEach((line, index) => { | ||
| 662 | const y = 418 + (index * 17); // 每行文本的垂直位置 | ||
| 663 | let currentLine = ''; | ||
| 664 | let arr = []; | ||
| 665 | for (let word of line) { | ||
| 666 | const testLine = currentLine + word; | ||
| 667 | const lineWidth = context.measureText(testLine).width; | ||
| 668 | if (lineWidth <= maxWidth) { | ||
| 669 | currentLine = testLine; | ||
| 670 | } else { | ||
| 671 | arr.push(currentLine); | ||
| 672 | currentLine = word; | ||
| 673 | } | ||
| 674 | } | ||
| 675 | arr.push(currentLine); | ||
| 676 | arr.forEach((line, index) => { | ||
| 677 | context.fillText(line, 770, y + (index * 17)); // 调整行高 | ||
| 678 | }) | ||
| 679 | }) | ||
| 680 | } | ||
| 681 | |||
| 682 | for (let i = 1; i < lines.length; i++) { | ||
| 683 | let num = Math.ceil(getByteLen(lines[i]) / 32) | ||
| 684 | if (getByteLen(lines[i]) > 32) { | ||
| 637 | let currentLine = ''; | 685 | let currentLine = ''; |
| 638 | let arr = []; | 686 | let arr = []; |
| 639 | for (let word of lines[i]) { | 687 | for (let word of lines[i]) { |
| ... | @@ -649,18 +697,18 @@ | ... | @@ -649,18 +697,18 @@ |
| 649 | arr.push(currentLine); | 697 | arr.push(currentLine); |
| 650 | if (i > 0) { | 698 | if (i > 0) { |
| 651 | arr.forEach((line, index) => { | 699 | arr.forEach((line, index) => { |
| 652 | context.fillText(line, 770, 438 + (24 * (i - 1)) + 5 * num + (index * 17)); // 调整行高 | 700 | context.fillText(line, 770, 408 + (bdcdyNum * 15) + (24 * (i - 1)) + 5 * num + (index * 17)); // 调整行高 |
| 653 | }) | 701 | }) |
| 654 | } else { | 702 | } else { |
| 655 | arr.forEach((line, index) => { | 703 | arr.forEach((line, index) => { |
| 656 | context.fillText(line, 770, 438 + (24 * (i - 1)) + (index * 17)); // 调整行高 | 704 | context.fillText(line, 770, 408 + (bdcdyNum * 15) + (24 * (i - 1)) + (index * 17)); // 调整行高 |
| 657 | }) | 705 | }) |
| 658 | } | 706 | } |
| 659 | } else { | 707 | } else { |
| 660 | if (i > 0) { | 708 | if (i > 0) { |
| 661 | context.fillText(lines[i] ? lines[i] : '', 770, 447 + 6 * num + (25 * (i - 1))); | 709 | context.fillText(lines[i] ? lines[i] : '', 770, 417 + (bdcdyNum * 15) + 6 * num + (25 * (i - 1))); |
| 662 | } else { | 710 | } else { |
| 663 | context.fillText(lines[i] ? lines[i] : '', 770, 447 + (25 * (i - 1))); | 711 | context.fillText(lines[i] ? lines[i] : '', 770, 417 + (bdcdyNum * 15) + (25 * (i - 1))); |
| 664 | } | 712 | } |
| 665 | } | 713 | } |
| 666 | } | 714 | } | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2024-01-30 16:29:37 | 4 | * @LastEditTime: 2024-02-06 13:23:44 |
| 5 | --> | 5 | --> |
| 6 | <template> | 6 | <template> |
| 7 | <div class="from-clues loadingtext" v-Loading="loading" element-loading-text="拼命加载中..." style="text-align: center;"> | 7 | <div class="from-clues loadingtext" v-Loading="loading" element-loading-text="拼命加载中..." style="text-align: center;"> |
| ... | @@ -415,7 +415,6 @@ | ... | @@ -415,7 +415,6 @@ |
| 415 | } | 415 | } |
| 416 | return len; | 416 | return len; |
| 417 | } | 417 | } |
| 418 | |||
| 419 | const canvas = this.$refs.zm; | 418 | const canvas = this.$refs.zm; |
| 420 | const context = canvas.getContext('2d'); | 419 | const context = canvas.getContext('2d'); |
| 421 | const image = new Image(); | 420 | const image = new Image(); |
| ... | @@ -434,7 +433,6 @@ | ... | @@ -434,7 +433,6 @@ |
| 434 | } | 433 | } |
| 435 | context.fillText(this.bdcqz.sjjc ? this.bdcqz.sjjc : '', 620, 125); | 434 | context.fillText(this.bdcqz.sjjc ? this.bdcqz.sjjc : '', 620, 125); |
| 436 | context.fillText(this.bdcqz.djnd ? this.bdcqz.djnd : '', 665, 125); | 435 | context.fillText(this.bdcqz.djnd ? this.bdcqz.djnd : '', 665, 125); |
| 437 | console.log(getByteLen(this.bdcqz.sxqc)); | ||
| 438 | if (getByteLen(this.bdcqz.sxqc) > 14) { | 436 | if (getByteLen(this.bdcqz.sxqc) > 14) { |
| 439 | const originalFont = context.font; | 437 | const originalFont = context.font; |
| 440 | // 设置新的字体大小 | 438 | // 设置新的字体大小 |
| ... | @@ -452,7 +450,7 @@ | ... | @@ -452,7 +450,7 @@ |
| 452 | // context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228); | 450 | // context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228); |
| 453 | // 权利人 | 451 | // 权利人 |
| 454 | let qlrlines = this.bdcqz.qlr | 452 | let qlrlines = this.bdcqz.qlr |
| 455 | if (getByteLen(this.bdcqz.qlr) > 36) { | 453 | if (getByteLen(this.bdcqz.qlr) > 32) { |
| 456 | let currentLine = ''; | 454 | let currentLine = ''; |
| 457 | let arr = []; | 455 | let arr = []; |
| 458 | for (let word of qlrlines) { | 456 | for (let word of qlrlines) { |
| ... | @@ -477,7 +475,7 @@ | ... | @@ -477,7 +475,7 @@ |
| 477 | // 义务人 | 475 | // 义务人 |
| 478 | // context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275); | 476 | // context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275); |
| 479 | let ywrlines = this.bdcqz.ywr | 477 | let ywrlines = this.bdcqz.ywr |
| 480 | if (getByteLen(this.bdcqz.ywr) > 36) { | 478 | if (getByteLen(this.bdcqz.ywr) > 32) { |
| 481 | let currentLine = ''; | 479 | let currentLine = ''; |
| 482 | let arr = []; | 480 | let arr = []; |
| 483 | for (let word of ywrlines) { | 481 | for (let word of ywrlines) { |
| ... | @@ -500,9 +498,8 @@ | ... | @@ -500,9 +498,8 @@ |
| 500 | } | 498 | } |
| 501 | 499 | ||
| 502 | // context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 775, 325); | 500 | // context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 775, 325); |
| 503 | |||
| 504 | let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : []; | 501 | let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : []; |
| 505 | if (getByteLen(this.bdcqz.zl) > 37) { | 502 | if (getByteLen(this.bdcqz.zl) > 32) { |
| 506 | lines2.forEach((line, index) => { | 503 | lines2.forEach((line, index) => { |
| 507 | const y = 315 + (index * 20); // 每行文本的垂直位置 | 504 | const y = 315 + (index * 20); // 每行文本的垂直位置 |
| 508 | let currentLine = ''; | 505 | let currentLine = ''; |
| ... | @@ -557,11 +554,60 @@ | ... | @@ -557,11 +554,60 @@ |
| 557 | // 恢复原始字体设置 | 554 | // 恢复原始字体设置 |
| 558 | context.font = originalFont; | 555 | context.font = originalFont; |
| 559 | // qlqtzk | 556 | // qlqtzk |
| 557 | function getByteLenBdcdy (val) { | ||
| 558 | var encoder = new TextEncoder('utf-8'); | ||
| 559 | return encoder.encode(val).length; | ||
| 560 | } | ||
| 560 | const maxWidth = 295; // 最大宽度限制 | 561 | const maxWidth = 295; // 最大宽度限制 |
| 561 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n').filter(i => i && i.trim()) : []; | 562 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n').filter(i => i && i.trim()) : []; |
| 562 | for (let i = 0; i < lines.length; i++) { | 563 | let bdcdyNum = Math.ceil(getByteLenBdcdy(lines[0]) / 43) |
| 563 | let num = Math.ceil(getByteLen(lines[i]) / 37) | 564 | // 单独处理不动产单元号 |
| 564 | if (getByteLen(lines[i]) > 37) { | 565 | let linesBdcdy = lines[0] ? lines[0].split(' ') : []; |
| 566 | if (getByteLenBdcdy(lines[0]) > 43) { | ||
| 567 | linesBdcdy.forEach((line, index) => { | ||
| 568 | const y = 412 + (index * 17); // 每行文本的垂直位置 | ||
| 569 | let currentLine = ''; | ||
| 570 | let arr = []; | ||
| 571 | for (let word of line) { | ||
| 572 | const testLine = currentLine + word; | ||
| 573 | const lineWidth = context.measureText(testLine).width; | ||
| 574 | if (lineWidth <= maxWidth) { | ||
| 575 | currentLine = testLine; | ||
| 576 | } else { | ||
| 577 | arr.push(currentLine); | ||
| 578 | currentLine = word; | ||
| 579 | } | ||
| 580 | } | ||
| 581 | arr.push(currentLine); | ||
| 582 | arr.forEach((line, index) => { | ||
| 583 | context.fillText(line, 770, y + (index * 17)); // 调整行高 | ||
| 584 | }) | ||
| 585 | }) | ||
| 586 | } else { | ||
| 587 | linesBdcdy.forEach((line, index) => { | ||
| 588 | const y = 418 + (index * 17); // 每行文本的垂直位置 | ||
| 589 | let currentLine = ''; | ||
| 590 | let arr = []; | ||
| 591 | for (let word of line) { | ||
| 592 | const testLine = currentLine + word; | ||
| 593 | const lineWidth = context.measureText(testLine).width; | ||
| 594 | if (lineWidth <= maxWidth) { | ||
| 595 | currentLine = testLine; | ||
| 596 | } else { | ||
| 597 | arr.push(currentLine); | ||
| 598 | currentLine = word; | ||
| 599 | } | ||
| 600 | } | ||
| 601 | arr.push(currentLine); | ||
| 602 | arr.forEach((line, index) => { | ||
| 603 | context.fillText(line, 770, y + (index * 17)); // 调整行高 | ||
| 604 | }) | ||
| 605 | }) | ||
| 606 | } | ||
| 607 | |||
| 608 | for (let i = 1; i < lines.length; i++) { | ||
| 609 | let num = Math.ceil(getByteLen(lines[i]) / 32) | ||
| 610 | if (getByteLen(lines[i]) > 32) { | ||
| 565 | let currentLine = ''; | 611 | let currentLine = ''; |
| 566 | let arr = []; | 612 | let arr = []; |
| 567 | for (let word of lines[i]) { | 613 | for (let word of lines[i]) { |
| ... | @@ -577,18 +623,18 @@ | ... | @@ -577,18 +623,18 @@ |
| 577 | arr.push(currentLine); | 623 | arr.push(currentLine); |
| 578 | if (i > 0) { | 624 | if (i > 0) { |
| 579 | arr.forEach((line, index) => { | 625 | arr.forEach((line, index) => { |
| 580 | context.fillText(line, 770, 438 + (24 * (i - 1)) + 5 * num + (index * 17)); // 调整行高 | 626 | context.fillText(line, 770, 408 + (bdcdyNum * 15) + (24 * (i - 1)) + 5 * num + (index * 17)); // 调整行高 |
| 581 | }) | 627 | }) |
| 582 | } else { | 628 | } else { |
| 583 | arr.forEach((line, index) => { | 629 | arr.forEach((line, index) => { |
| 584 | context.fillText(line, 770, 438 + (24 * (i - 1)) + (index * 17)); // 调整行高 | 630 | context.fillText(line, 770, 408 + (bdcdyNum * 15) + (24 * (i - 1)) + (index * 17)); // 调整行高 |
| 585 | }) | 631 | }) |
| 586 | } | 632 | } |
| 587 | } else { | 633 | } else { |
| 588 | if (i > 0) { | 634 | if (i > 0) { |
| 589 | context.fillText(lines[i] ? lines[i] : '', 770, 447 + 6 * num + (25 * (i - 1))); | 635 | context.fillText(lines[i] ? lines[i] : '', 770, 417 + (bdcdyNum * 15) + 6 * num + (25 * (i - 1))); |
| 590 | } else { | 636 | } else { |
| 591 | context.fillText(lines[i] ? lines[i] : '', 770, 447 + (25 * (i - 1))); | 637 | context.fillText(lines[i] ? lines[i] : '', 770, 417 + (bdcdyNum * 15) + (25 * (i - 1))); |
| 592 | } | 638 | } |
| 593 | } | 639 | } |
| 594 | } | 640 | } | ... | ... |
-
Please register or sign in to post a comment