3d7db342 by renchao@pashanhoo.com

style:证书打印

1 parent f9f7c736

240 KB | W: | H:

328 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
1 <!-- 1 <!--
2 * @Description: 2 * @Description:
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-11-08 13:27:03 4 * @LastEditTime: 2023-12-18 16:00:55
5 --> 5 -->
6 <template> 6 <template>
7 <div> 7 <div>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
12 label-width="120px"> 12 label-width="120px">
13 <el-form-item label="印刷序列号:" prop="ysxlh"> 13 <el-form-item label="印刷序列号:" prop="ysxlh">
14 <el-row> 14 <el-row>
15 <el-col :span="22"> 15 <el-col :span="18">
16 <el-select v-model="ruleForm.ysxlh" @change="handleSelect" :disabled="disabled" placeholder="请选择"> 16 <el-select v-model="ruleForm.ysxlh" @change="handleSelect" :disabled="disabled" placeholder="请选择">
17 <el-option 17 <el-option
18 v-for="item in ysxlh" 18 v-for="item in ysxlh"
...@@ -22,6 +22,12 @@ ...@@ -22,6 +22,12 @@
22 </el-option> 22 </el-option>
23 </el-select> 23 </el-select>
24 </el-col> 24 </el-col>
25 <el-col :span="4" v-if="this.formData.bdcqzlx==1">
26 <el-tabs v-model="activeTitle">
27 <el-tab-pane label="第一页" name="title1"></el-tab-pane>
28 <el-tab-pane label="第二页" name="title2"></el-tab-pane>
29 </el-tabs>
30 </el-col>
25 <el-col :span="2" v-if="this.formData.ysxlh"> 31 <el-col :span="2" v-if="this.formData.ysxlh">
26 <el-button type="primary" @click="handleZF" v-if="disabled">作废</el-button> 32 <el-button type="primary" @click="handleZF" v-if="disabled">作废</el-button>
27 </el-col> 33 </el-col>
...@@ -30,7 +36,8 @@ ...@@ -30,7 +36,8 @@
30 </el-form-item> 36 </el-form-item>
31 </el-form> 37 </el-form>
32 <div class="zs-content"> 38 <div class="zs-content">
33 <canvas ref="zs" width="1000" v-show="this.formData.bdcqzlx==1" height="700"></canvas> 39 <canvas ref="zs1" width="1000" v-show="this.formData.bdcqzlx==1 && activeTitle=='title1'" height="700"></canvas>
40 <canvas ref="zs" width="1000" v-show="this.formData.bdcqzlx==1 && activeTitle=='title2'" height="700"></canvas>
34 <canvas ref="zm" width="1180" v-show="this.formData.bdcqzlx==2" height="780"></canvas> 41 <canvas ref="zm" width="1180" v-show="this.formData.bdcqzlx==2" height="780"></canvas>
35 </div> 42 </div>
36 </div> 43 </div>
...@@ -62,12 +69,12 @@ ...@@ -62,12 +69,12 @@
62 </template> 69 </template>
63 70
64 <script> 71 <script>
72 import QRCode from 'qrcode'
65 import store from '@/store/index.js' 73 import store from '@/store/index.js'
66 import { datas } from "../../javascript/zsyl.js"; 74 import { datas } from "../../javascript/zsyl.js";
67 import { getPrintTemplateByCode } from "@/api/print"; 75 import { getPrintTemplateByCode } from "@/api/print";
68 import { getLodop } from "@/utils/LodopFuncs" 76 import { getLodop } from "@/utils/LodopFuncs"
69 import { readYsxlh, certificate, getBdcqzDetail, invalidCertificate } from "@/api/bdcqz.js"; 77 import { readYsxlh, certificate, getBdcqzDetail, invalidCertificate } from "@/api/bdcqz.js";
70 import { log } from 'bpmn-js-token-simulation';
71 export default { 78 export default {
72 props: { 79 props: {
73 formData: { 80 formData: {
...@@ -79,11 +86,13 @@ ...@@ -79,11 +86,13 @@
79 }, 86 },
80 data () { 87 data () {
81 return { 88 return {
89 activeTitle: 'title1',
82 // 详细信息 90 // 详细信息
83 bdcqz: {}, 91 bdcqz: {},
84 key: 0, 92 key: 0,
85 disabled: false, 93 disabled: false,
86 // 不动产证书图片地址 94 // 不动产证书图片地址
95 imgSrc1: require('@/image/bdcqz/bdcqzs1.jpg'),
87 imgSrc: require('@/image/bdcqz/bdcqzs2.jpg'), 96 imgSrc: require('@/image/bdcqz/bdcqzs2.jpg'),
88 bdczmSrc: require('@/image/bdcqz/bdczm.jpg'), 97 bdczmSrc: require('@/image/bdcqz/bdczm.jpg'),
89 loading: false, 98 loading: false,
...@@ -202,7 +211,42 @@ ...@@ -202,7 +211,42 @@
202 * @description: 不动产证书 211 * @description: 不动产证书
203 * @author: renchao 212 * @author: renchao
204 */ 213 */
214 drawTextOnImage1 () {
215 const canvas = this.$refs.zs1;
216 const context = canvas.getContext('2d');
217 const image = new Image();
218 image.onload = () => {
219 context.drawImage(image, 0, 0);
220 context.font = '18px 楷体';
221 context.fillStyle = '#000000';
222 let date = this.bdcqz.djsj.split(' ')[0].split('/');
223 let nian = date[0]
224 let yue = date[1]
225 let ri = date[2]
226 this.bdcqz.nian = nian
227 this.bdcqz.yue = yue
228 this.bdcqz.ri = ri
229 context.fillText(nian ? nian : '', 780, 499);
230 context.fillText(yue ? yue : '', 840, 499);
231 context.fillText(ri ? ri : '', 885, 499);
232 QRCode.toDataURL(this.bdcqz.bdcqzh, { margin: 0 })
233 .then(url => {
234 const qrImage = new Image();
235 this.bdcqz.qrImage = url; // 将二维码图片的 URL 存储到 bdcqz 对象的 qrImage 属性中
236 qrImage.onload = () => {
237 context.drawImage(qrImage, 670, 400, 100, 100);
238 };
239 qrImage.src = url;
240 })
241 .catch(error => {
242 console.error(error);
243 });
244 context.fillText(this.bdcqz.bdcqzbm ? this.bdcqz.bdcqzbm : '', 745, 633);
245 };
246 image.src = this.imgSrc1;
247 },
205 drawTextOnImage () { 248 drawTextOnImage () {
249 this.drawTextOnImage1()
206 function getByteLen (val) { 250 function getByteLen (val) {
207 var len = 0; 251 var len = 0;
208 if (!val) return len; 252 if (!val) return len;
...@@ -595,33 +639,53 @@ ...@@ -595,33 +639,53 @@
595 * @author: renchao 639 * @author: renchao
596 */ 640 */
597 handlePrint () { 641 handlePrint () {
642 let that = this
598 if (this.ruleForm.ysxlh == '') { 643 if (this.ruleForm.ysxlh == '') {
599 this.$message.error('请选择印刷序列号'); 644 this.$message.error('请选择印刷序列号');
600 return; 645 return;
601 } 646 }
602 store.dispatch('user/reWorkFresh', false) 647 store.dispatch('user/reWorkFresh', false)
603 let that = this
604 if (this.bdcqz.bdcqzlx == 1) { 648 if (this.bdcqz.bdcqzlx == 1) {
605 getPrintTemplateByCode({ tmpno: 'zsdy' }).then(resInfo => { 649 if (this.activeTitle == 'title1') {
606 if (resInfo.code == 200) { 650 getPrintTemplateByCode({ tmpno: 'zsdy1' }).then(resInfo => {
607 //打开模板设计 651 if (resInfo.code == 200) {
608 let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM')); 652 //打开模板设计
609 LODOP.ADD_PRINT_DATA("ProgramData", resInfo.result.tmpcontent); //装载模板 653 let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
654 LODOP.ADD_PRINT_DATA("ProgramData", resInfo.result.tmpcontent); //装载模板
655 console.log(that.bdcqz);
656 for (let key in that.bdcqz) {
657 LODOP.SET_PRINT_STYLEA(key, "CONTENT", that.bdcqz[key]);
658 }
659 LODOP.PREVIEW();
660 } else {
661 that.$message.error(resInfo.message)
662 }
663 that.$popupCacel()
664 //刷新列表
665 store.dispatch('user/reWorkFresh', true)
666 })
667 } else {
668 getPrintTemplateByCode({ tmpno: 'zsdy' }).then(resInfo => {
669 if (resInfo.code == 200) {
670 //打开模板设计
671 let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
672 LODOP.ADD_PRINT_DATA("ProgramData", resInfo.result.tmpcontent); //装载模板
610 673
611 this.bdcqz.bdcdyh1 = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' + 674 that.bdcqz.bdcdyh1 = that.bdcqz.bdcdyh.slice(0, 6) + ' ' + that.bdcqz.bdcdyh.slice(6, 12) + ' ' +
612 this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length) 675 that.bdcqz.bdcdyh.slice(12, 19) + ' ' + that.bdcqz.bdcdyh.slice(19, that.bdcqz.bdcdyh.length)
613 //todo 调取后端接口获取数据 循环set 676 //todo 调取后端接口获取数据 循环set
614 for (let key in this.bdcqz) { 677 for (let key in that.bdcqz) {
615 LODOP.SET_PRINT_STYLEA(key, "CONTENT", this.bdcqz[key]); 678 LODOP.SET_PRINT_STYLEA(key, "CONTENT", that.bdcqz[key]);
679 }
680 LODOP.PREVIEW();
681 } else {
682 that.$message.error(resInfo.message)
616 } 683 }
617 LODOP.PREVIEW(); 684 that.$popupCacel()
618 } else { 685 //刷新列表
619 this.$message.error(resInfo.message) 686 store.dispatch('user/reWorkFresh', true)
620 } 687 })
621 that.$popupCacel() 688 }
622 //刷新列表
623 store.dispatch('user/reWorkFresh', true)
624 })
625 } else { 689 } else {
626 getPrintTemplateByCode({ tmpno: 'zmdy' }).then(resInfo => { 690 getPrintTemplateByCode({ tmpno: 'zmdy' }).then(resInfo => {
627 if (resInfo.code == 200) { 691 if (resInfo.code == 200) {
...@@ -679,6 +743,15 @@ ...@@ -679,6 +743,15 @@
679 </script> 743 </script>
680 <style scoped lang="scss"> 744 <style scoped lang="scss">
681 @import "~@/styles/mixin.scss"; 745 @import "~@/styles/mixin.scss";
746 /deep/.el-tabs__nav-wrap::after {
747 display: none;
748 }
749 /deep/.el-tabs__header {
750 margin: 0;
751 }
752 /deep/.el-form-item--small.el-form-item {
753 margin-bottom: 0;
754 }
682 .zsdy-content { 755 .zsdy-content {
683 height: 80vh; 756 height: 80vh;
684 overflow-y: scroll; 757 overflow-y: scroll;
......