style:证书预览
Showing
2 changed files
with
118 additions
and
43 deletions
1 | <!-- | 1 | <!-- |
2 | * @Description: | 2 | * @Description: |
3 | * @Autor: renchao | 3 | * @Autor: renchao |
4 | * @LastEditTime: 2023-08-28 14:14:09 | 4 | * @LastEditTime: 2023-08-28 17:22:23 |
5 | --> | 5 | --> |
6 | <template> | 6 | <template> |
7 | <div> | 7 | <div> |
... | @@ -30,7 +30,7 @@ | ... | @@ -30,7 +30,7 @@ |
30 | </el-tabs> | 30 | </el-tabs> |
31 | <el-empty description="暂无数据" v-if="headTabBdcqz.length == 0 && noData"></el-empty> | 31 | <el-empty description="暂无数据" v-if="headTabBdcqz.length == 0 && noData"></el-empty> |
32 | 32 | ||
33 | <div class="zs-content" style="width:1180px;"> | 33 | <div class="zs-content"> |
34 | <canvas ref="zs" width="1000" v-show="headTabBdcqz[0]&&headTabBdcqz[0].bdcqzlx==1" height="700"></canvas> | 34 | <canvas ref="zs" width="1000" v-show="headTabBdcqz[0]&&headTabBdcqz[0].bdcqzlx==1" height="700"></canvas> |
35 | <canvas ref="zm" width="1180" v-show="headTabBdcqz[0]&&headTabBdcqz[0].bdcqzlx!=1" height="780"></canvas> | 35 | <canvas ref="zm" width="1180" v-show="headTabBdcqz[0]&&headTabBdcqz[0].bdcqzlx!=1" height="780"></canvas> |
36 | </div> | 36 | </div> |
... | @@ -417,7 +417,49 @@ | ... | @@ -417,7 +417,49 @@ |
417 | context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228); | 417 | context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228); |
418 | // 义务人 | 418 | // 义务人 |
419 | context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275); | 419 | context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275); |
420 | context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 775, 325); | 420 | // context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 775, 325); |
421 | let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : []; | ||
422 | if (getByteLen(this.bdcqz.zl) > 41) { | ||
423 | lines2.forEach((line, index) => { | ||
424 | const y = 315 + (index * 20); // 每行文本的垂直位置 | ||
425 | let currentLine = ''; | ||
426 | let arr = []; | ||
427 | for (let word of line) { | ||
428 | const testLine = currentLine + word; | ||
429 | const lineWidth = context.measureText(testLine).width; | ||
430 | if (lineWidth <= 295) { | ||
431 | currentLine = testLine; | ||
432 | } else { | ||
433 | arr.push(currentLine); | ||
434 | currentLine = word; | ||
435 | } | ||
436 | } | ||
437 | arr.push(currentLine); | ||
438 | arr.forEach((line, index) => { | ||
439 | context.fillText(line, 775, y + (index * 20)); // 调整行高 | ||
440 | }) | ||
441 | }) | ||
442 | } else { | ||
443 | lines2.forEach((line, index) => { | ||
444 | const y = 325 + (index * 20); // 每行文本的垂直位置 | ||
445 | let currentLine = ''; | ||
446 | let arr = []; | ||
447 | for (let word of line) { | ||
448 | const testLine = currentLine + word; | ||
449 | const lineWidth = context.measureText(testLine).width; | ||
450 | if (lineWidth <= 295) { | ||
451 | currentLine = testLine; | ||
452 | } else { | ||
453 | arr.push(currentLine); | ||
454 | currentLine = word; | ||
455 | } | ||
456 | } | ||
457 | arr.push(currentLine); | ||
458 | arr.forEach((line, index) => { | ||
459 | context.fillText(line, 775, y + (index * 20)); // 调整行高 | ||
460 | }) | ||
461 | }) | ||
462 | } | ||
421 | // bdcdyh | 463 | // bdcdyh |
422 | this.bdcdyh = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' + | 464 | this.bdcdyh = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' + |
423 | this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length) | 465 | this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length) |
... | @@ -519,24 +561,18 @@ | ... | @@ -519,24 +561,18 @@ |
519 | if (this.bdcqz.bdcqzlx == 1) { | 561 | if (this.bdcqz.bdcqzlx == 1) { |
520 | getPrintTemplateByCode({ tmpno: 'zsdy' }).then(res => { | 562 | getPrintTemplateByCode({ tmpno: 'zsdy' }).then(res => { |
521 | if (res.code == 200) { | 563 | if (res.code == 200) { |
522 | getSlsqBdcqzList({ bsmSlsq: this.formData.bsmSlsq }).then(infoRes => { | 564 | //打开模板设计 |
523 | if (infoRes.code == 200) { | 565 | let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM')); |
524 | if (infoRes.result && infoRes.result.length > 0) { | 566 | LODOP.ADD_PRINT_DATA("ProgramData", res.result.tmpcontent); //装载模板 |
525 | //打开模板设计 | ||
526 | let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM')); | ||
527 | LODOP.ADD_PRINT_DATA("ProgramData", res.result.tmpcontent); //装载模板 | ||
528 | 567 | ||
529 | infoRes.result[0].bdcdyh1 = infoRes.result[0].bdcdyh.slice(0, 6) + ' ' + infoRes.result[0].bdcdyh.slice(6, 12) + ' ' + | 568 | this.bdcqz.bdcdyh1 = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' + |
530 | infoRes.result[0].bdcdyh.slice(12, 19) + ' ' + infoRes.result[0].bdcdyh.slice(19, infoRes.result[0].bdcdyh.length) | 569 | this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length) |
531 | //todo 调取后端接口获取数据 循环set | 570 | //todo 调取后端接口获取数据 循环set |
532 | for (let key in infoRes.result[0]) { | 571 | for (let key in this.bdcqz) { |
533 | LODOP.SET_PRINT_STYLEA(key, "CONTENT", infoRes.result[0][key]); | 572 | LODOP.SET_PRINT_STYLEA(key, "CONTENT", this.bdcqz[key]); |
534 | } | 573 | } |
535 | LODOP.PREVIEW(); | 574 | LODOP.PREVIEW(); |
536 | that.$popupCacel() | 575 | that.$popupCacel() |
537 | } | ||
538 | } | ||
539 | }) | ||
540 | } else { | 576 | } else { |
541 | this.$message.error(res.message) | 577 | this.$message.error(res.message) |
542 | } | 578 | } |
... | @@ -544,28 +580,22 @@ | ... | @@ -544,28 +580,22 @@ |
544 | } else { | 580 | } else { |
545 | getPrintTemplateByCode({ tmpno: 'zmdy' }).then(res => { | 581 | getPrintTemplateByCode({ tmpno: 'zmdy' }).then(res => { |
546 | if (res.code == 200) { | 582 | if (res.code == 200) { |
547 | getSlsqBdcqzList({ bsmSlsq: this.formData.bsmSlsq }).then(infoRes => { | 583 | //打开模板设计 |
548 | if (infoRes.code == 200) { | 584 | let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM')); |
549 | if (infoRes.result && infoRes.result.length > 0) { | 585 | LODOP.ADD_PRINT_DATA("ProgramData", res.result.tmpcontent); //装载模板 |
550 | //打开模板设计 | ||
551 | let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM')); | ||
552 | LODOP.ADD_PRINT_DATA("ProgramData", res.result.tmpcontent); //装载模板 | ||
553 | 586 | ||
554 | // 年月日 | 587 | // 年月日 |
555 | infoRes.result[0].nian = infoRes.result[0].djsj.split(' ')[0].split('/')[0] | 588 | this.bdcqz.nian = this.bdcqz.djsj.split(' ')[0].split('/')[0] |
556 | infoRes.result[0].yue = infoRes.result[0].djsj.split(' ')[0].split('/')[1] | 589 | this.bdcqz.yue = this.bdcqz.djsj.split(' ')[0].split('/')[1] |
557 | infoRes.result[0].ri = infoRes.result[0].djsj.split(' ')[0].split('/')[1] | 590 | this.bdcqz.ri = this.bdcqz.djsj.split(' ')[0].split('/')[1] |
558 | infoRes.result[0].bdcdyh1 = infoRes.result[0].bdcdyh.slice(0, 6) + ' ' + infoRes.result[0].bdcdyh.slice(6, 12) + ' ' + | 591 | this.bdcqz.bdcdyh1 = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' + |
559 | infoRes.result[0].bdcdyh.slice(12, 19) + ' ' + infoRes.result[0].bdcdyh.slice(19, infoRes.result[0].bdcdyh.length) | 592 | this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length) |
560 | //todo 调取后端接口获取数据 循环set | 593 | //todo 调取后端接口获取数据 循环set |
561 | for (let key in infoRes.result[0]) { | 594 | for (let key in this.bdcqz) { |
562 | LODOP.SET_PRINT_STYLEA(key, "CONTENT", infoRes.result[0][key]); | 595 | LODOP.SET_PRINT_STYLEA(key, "CONTENT", this.bdcqz[key]); |
563 | } | 596 | } |
564 | LODOP.PREVIEW(); | 597 | LODOP.PREVIEW(); |
565 | that.$popupCacel() | 598 | that.$popupCacel() |
566 | } | ||
567 | } | ||
568 | }) | ||
569 | } else { | 599 | } else { |
570 | this.$message.error(res.message) | 600 | this.$message.error(res.message) |
571 | } | 601 | } | ... | ... |
1 | <!-- | 1 | <!-- |
2 | * @Description: | 2 | * @Description: |
3 | * @Autor: renchao | 3 | * @Autor: renchao |
4 | * @LastEditTime: 2023-08-28 13:57:58 | 4 | * @LastEditTime: 2023-08-28 17:18:19 |
5 | --> | 5 | --> |
6 | <template> | 6 | <template> |
7 | <div class="from-clues loadingtext" v-Loading="loading" element-loading-text="拼命加载中..." style="height:720px;text-align: center;"> | 7 | <div class="from-clues loadingtext" v-Loading="loading" element-loading-text="拼命加载中..." style="height:720px;text-align: center;"> |
... | @@ -388,7 +388,52 @@ | ... | @@ -388,7 +388,52 @@ |
388 | context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228); | 388 | context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228); |
389 | // 义务人 | 389 | // 义务人 |
390 | context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275); | 390 | context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275); |
391 | context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 775, 325); | 391 | // context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 775, 325); |
392 | |||
393 | let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : []; | ||
394 | if (getByteLen(this.bdcqz.zl) > 41) { | ||
395 | lines2.forEach((line, index) => { | ||
396 | const y = 315 + (index * 20); // 每行文本的垂直位置 | ||
397 | let currentLine = ''; | ||
398 | let arr = []; | ||
399 | for (let word of line) { | ||
400 | const testLine = currentLine + word; | ||
401 | const lineWidth = context.measureText(testLine).width; | ||
402 | if (lineWidth <= 295) { | ||
403 | currentLine = testLine; | ||
404 | } else { | ||
405 | arr.push(currentLine); | ||
406 | currentLine = word; | ||
407 | } | ||
408 | } | ||
409 | arr.push(currentLine); | ||
410 | arr.forEach((line, index) => { | ||
411 | context.fillText(line, 775, y + (index * 20)); // 调整行高 | ||
412 | }) | ||
413 | }) | ||
414 | } else { | ||
415 | lines2.forEach((line, index) => { | ||
416 | const y = 325 + (index * 20); // 每行文本的垂直位置 | ||
417 | let currentLine = ''; | ||
418 | let arr = []; | ||
419 | for (let word of line) { | ||
420 | const testLine = currentLine + word; | ||
421 | const lineWidth = context.measureText(testLine).width; | ||
422 | if (lineWidth <= 295) { | ||
423 | currentLine = testLine; | ||
424 | } else { | ||
425 | arr.push(currentLine); | ||
426 | currentLine = word; | ||
427 | } | ||
428 | } | ||
429 | arr.push(currentLine); | ||
430 | arr.forEach((line, index) => { | ||
431 | context.fillText(line, 775, y + (index * 20)); // 调整行高 | ||
432 | }) | ||
433 | }) | ||
434 | } | ||
435 | |||
436 | |||
392 | // bdcdyh | 437 | // bdcdyh |
393 | this.bdcdyh = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' + | 438 | this.bdcdyh = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' + |
394 | this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length) | 439 | this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length) | ... | ... |
-
Please register or sign in to post a comment