da83bbf3 by renchao@pashanhoo.com

style:打印

1 parent cadfcb73
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-08-25 10:34:46
* @LastEditTime: 2023-08-25 14:43:39
-->
<template>
<div>
......@@ -26,6 +26,10 @@
<canvas ref="zs" width="1000" class="zsyl" height="700"></canvas>
</div>
</div>
<!-- 打印模板需要此模块 -->
<object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" v-show="false">
<embed id="LODOP_EM" type="application/x-print-lodop" width="1180" height="720" pluginspage="install_lodop32.exe" />
</object>
<div class="text-center pt-10">
<el-button @click="$popupCacel">取消</el-button>
<el-button type="primary" @click="handleSubmit">确定</el-button>
......@@ -36,6 +40,8 @@
<script>
import store from '@/store/index.js'
import { datas } from "../../javascript/zsyl.js";
import { getPrintTemplateByCode } from "@/api/print";
import { getLodop } from "@/utils/LodopFuncs"
import { readYsxlh, certificate, getSlsqBdcqzList } from "@/api/bdcqz.js";
export default {
props: {
......@@ -89,7 +95,6 @@
}
})
},
//获取受理申请下全部不动产权证
/**
* @description: 获取受理申请下全部不动产权证
* @author: renchao
......@@ -189,29 +194,9 @@
})
})
}
// context.fillText(this.bdcqz.syqx ? this.bdcqz.syqx : '', 129, 429);
// 权利其他状态
const maxWidth = 332; // 最大宽度限制
let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : [];
// lines.forEach((line, index) => {
// const y = 463 + (index * 33); // 每行文本的垂直位置
// 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, 129, y + (index * 17)); // 调整行高
// })
// })
for (let i = 0; i < lines.length; i++) {
if (getByteLen(lines[i]) > 41) {
let currentLine = '';
......@@ -350,19 +335,44 @@
handleSubmit () {
this.savePrintRecord()
},
//保存打印记录
/**
* @description: 保存打印记录
* @author: renchao
*/
savePrintRecord () {
let that = this
this.ruleForm.bsmBdcqz = this.formData.bdcqz.bsmBdcqz;
this.ruleForm.bdcqzlx = this.formData.bdcqz.bdcqzlx;
this.ruleForm.szzh = this.formData.bdcqz.bdcqzh;
certificate(this.ruleForm).then((res) => {
if (res.code === 200) {
this.$popupCacel()
this.$message.success("提交成功")
that.$popupCacel()
// this.$message.success("提交成功")
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)
//todo 调取后端接口获取数据 循环set
for (let key in infoRes.result[0]) {
LODOP.SET_PRINT_STYLEA(key, "CONTENT", infoRes.result[0][key]);
}
LODOP.PREVIEW();
that.$popupCacel()
}
}
})
} else {
this.$message.error(res.message)
}
})
//刷新列表
store.dispatch('user/reWorkFresh', true)
} else {
......
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-08-25 13:19:14
* @LastEditTime: 2023-08-25 14:10:54
-->
<template>
<div class="from-clues loadingtext" v-Loading="loading" element-loading-text="拼命加载中..." style="height:720px;text-align: center;">
......@@ -406,7 +406,7 @@
let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : [];
if (lines[0]) {
lines[0].split(' ').forEach((line, index) => {
const y = 415 + (index * 60); // 每行文本的垂直位置
const y = 415 + (index * 30); // 每行文本的垂直位置
let currentLine = '';
let arr = [];
for (let word of line) {
......@@ -421,13 +421,13 @@
}
arr.push(currentLine);
arr.forEach((line, index) => {
context.fillText(line, 775, y + (index * 23)); // 调整行高
context.fillText(line, 775, y + (index * 14)); // 调整行高
});
});
}
lines.slice(1).forEach((line, index) => {
const y = ((parseInt(lines[0].length) / 19) * 22) + 415 + (index * 30); // 每行文本的垂直位置
const y = ((parseInt(lines[0].length) / 19) * 22) + 415 + (index * 20); // 每行文本的垂直位置
let currentLine = '';
let arr = [];
for (let word of line) {
......
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-08-24 15:38:52
* @LastEditTime: 2023-08-25 14:03:00
-->
<template>
<div class="szxx">
......@@ -75,6 +75,7 @@
<script>
import { mapGetters } from 'vuex'
import store from '@/store/index.js'
import { getPrintTemplateByCode } from "@/api/print";
import { getSlsqBdcqzList, invalidCertificate } from "@/api/bdcqz.js";
export default {
props: {},
......