3be41f24 by renchao@pashanhoo.com

style:证书预览

1 parent 38c90d66
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-08-28 14:14:09
* @LastEditTime: 2023-08-28 17:22:23
-->
<template>
<div>
......@@ -30,7 +30,7 @@
</el-tabs>
<el-empty description="暂无数据" v-if="headTabBdcqz.length == 0 && noData"></el-empty>
<div class="zs-content" style="width:1180px;">
<div class="zs-content">
<canvas ref="zs" width="1000" v-show="headTabBdcqz[0]&&headTabBdcqz[0].bdcqzlx==1" height="700"></canvas>
<canvas ref="zm" width="1180" v-show="headTabBdcqz[0]&&headTabBdcqz[0].bdcqzlx!=1" height="780"></canvas>
</div>
......@@ -417,7 +417,49 @@
context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228);
// 义务人
context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275);
context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 775, 325);
// context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 775, 325);
let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : [];
if (getByteLen(this.bdcqz.zl) > 41) {
lines2.forEach((line, index) => {
const y = 315 + (index * 20); // 每行文本的垂直位置
let currentLine = '';
let arr = [];
for (let word of line) {
const testLine = currentLine + word;
const lineWidth = context.measureText(testLine).width;
if (lineWidth <= 295) {
currentLine = testLine;
} else {
arr.push(currentLine);
currentLine = word;
}
}
arr.push(currentLine);
arr.forEach((line, index) => {
context.fillText(line, 775, y + (index * 20)); // 调整行高
})
})
} else {
lines2.forEach((line, index) => {
const y = 325 + (index * 20); // 每行文本的垂直位置
let currentLine = '';
let arr = [];
for (let word of line) {
const testLine = currentLine + word;
const lineWidth = context.measureText(testLine).width;
if (lineWidth <= 295) {
currentLine = testLine;
} else {
arr.push(currentLine);
currentLine = word;
}
}
arr.push(currentLine);
arr.forEach((line, index) => {
context.fillText(line, 775, y + (index * 20)); // 调整行高
})
})
}
// bdcdyh
this.bdcdyh = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' +
this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length)
......@@ -519,24 +561,18 @@
if (this.bdcqz.bdcqzlx == 1) {
getPrintTemplateByCode({ tmpno: 'zsdy' }).then(res => {
if (res.code == 200) {
getSlsqBdcqzList({ bsmSlsq: this.formData.bsmSlsq }).then(infoRes => {
if (infoRes.code == 200) {
if (infoRes.result && infoRes.result.length > 0) {
//打开模板设计
let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
LODOP.ADD_PRINT_DATA("ProgramData", res.result.tmpcontent); //装载模板
infoRes.result[0].bdcdyh1 = infoRes.result[0].bdcdyh.slice(0, 6) + ' ' + infoRes.result[0].bdcdyh.slice(6, 12) + ' ' +
infoRes.result[0].bdcdyh.slice(12, 19) + ' ' + infoRes.result[0].bdcdyh.slice(19, infoRes.result[0].bdcdyh.length)
this.bdcqz.bdcdyh1 = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' +
this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length)
//todo 调取后端接口获取数据 循环set
for (let key in infoRes.result[0]) {
LODOP.SET_PRINT_STYLEA(key, "CONTENT", infoRes.result[0][key]);
for (let key in this.bdcqz) {
LODOP.SET_PRINT_STYLEA(key, "CONTENT", this.bdcqz[key]);
}
LODOP.PREVIEW();
that.$popupCacel()
}
}
})
} else {
this.$message.error(res.message)
}
......@@ -544,28 +580,22 @@
} else {
getPrintTemplateByCode({ tmpno: 'zmdy' }).then(res => {
if (res.code == 200) {
getSlsqBdcqzList({ bsmSlsq: this.formData.bsmSlsq }).then(infoRes => {
if (infoRes.code == 200) {
if (infoRes.result && infoRes.result.length > 0) {
//打开模板设计
let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
LODOP.ADD_PRINT_DATA("ProgramData", res.result.tmpcontent); //装载模板
// 年月日
infoRes.result[0].nian = infoRes.result[0].djsj.split(' ')[0].split('/')[0]
infoRes.result[0].yue = infoRes.result[0].djsj.split(' ')[0].split('/')[1]
infoRes.result[0].ri = infoRes.result[0].djsj.split(' ')[0].split('/')[1]
infoRes.result[0].bdcdyh1 = infoRes.result[0].bdcdyh.slice(0, 6) + ' ' + infoRes.result[0].bdcdyh.slice(6, 12) + ' ' +
infoRes.result[0].bdcdyh.slice(12, 19) + ' ' + infoRes.result[0].bdcdyh.slice(19, infoRes.result[0].bdcdyh.length)
this.bdcqz.nian = this.bdcqz.djsj.split(' ')[0].split('/')[0]
this.bdcqz.yue = this.bdcqz.djsj.split(' ')[0].split('/')[1]
this.bdcqz.ri = this.bdcqz.djsj.split(' ')[0].split('/')[1]
this.bdcqz.bdcdyh1 = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' +
this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length)
//todo 调取后端接口获取数据 循环set
for (let key in infoRes.result[0]) {
LODOP.SET_PRINT_STYLEA(key, "CONTENT", infoRes.result[0][key]);
for (let key in this.bdcqz) {
LODOP.SET_PRINT_STYLEA(key, "CONTENT", this.bdcqz[key]);
}
LODOP.PREVIEW();
that.$popupCacel()
}
}
})
} else {
this.$message.error(res.message)
}
......
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-08-28 13:57:58
* @LastEditTime: 2023-08-28 17:18:19
-->
<template>
<div class="from-clues loadingtext" v-Loading="loading" element-loading-text="拼命加载中..." style="height:720px;text-align: center;">
......@@ -388,7 +388,52 @@
context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228);
// 义务人
context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275);
context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 775, 325);
// context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 775, 325);
let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : [];
if (getByteLen(this.bdcqz.zl) > 41) {
lines2.forEach((line, index) => {
const y = 315 + (index * 20); // 每行文本的垂直位置
let currentLine = '';
let arr = [];
for (let word of line) {
const testLine = currentLine + word;
const lineWidth = context.measureText(testLine).width;
if (lineWidth <= 295) {
currentLine = testLine;
} else {
arr.push(currentLine);
currentLine = word;
}
}
arr.push(currentLine);
arr.forEach((line, index) => {
context.fillText(line, 775, y + (index * 20)); // 调整行高
})
})
} else {
lines2.forEach((line, index) => {
const y = 325 + (index * 20); // 每行文本的垂直位置
let currentLine = '';
let arr = [];
for (let word of line) {
const testLine = currentLine + word;
const lineWidth = context.measureText(testLine).width;
if (lineWidth <= 295) {
currentLine = testLine;
} else {
arr.push(currentLine);
currentLine = word;
}
}
arr.push(currentLine);
arr.forEach((line, index) => {
context.fillText(line, 775, y + (index * 20)); // 调整行高
})
})
}
// bdcdyh
this.bdcdyh = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' +
this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length)
......