69b87965 by renchao@pashanhoo.com

style:打印申请书

1 parent eb8495eb
1 <!--
2 * @Description:
3 * @Autor: renchao
4 * @LastEditTime: 2023-11-22 17:09:14
5 -->
6 <template>
7 <div>
8 <el-button type="primary" @click="handlePrint(1)">打印第1页</el-button>
9 <el-button type="primary" @click="handlePrint(2)">打印第2页</el-button>
10 <!-- 打印模板需要此模块 -->
11 <object
12 id="LODOP_OB"
13 classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA"
14 v-show="false">
15 <embed
16 id="LODOP_EM"
17 type="application/x-print-lodop"
18 width="820"
19 height="450"
20 pluginspage="install_lodop32.exe" />
21 </object>
22 </div>
23 </template>
24 <script>
25 import Vue from 'vue'
26 import { getLodop } from "@/utils/LodopFuncs";
27 import { getPrintTemplateByCode } from "@/api/print";
28 import { getPrintApplicationForm } from "@/api/workFlow.js";
29 export default {
30 props: {
31 formData: {
32 type: Object,
33 default: () => {
34 return {}
35 }
36 }
37 },
38 data () {
39 return {
40 }
41 },
42 methods: {
43 handlePrint (val) {
44 if (val == 1) {
45 getPrintTemplateByCode({ tmpno: Vue.prototype.BASE_API.adapter }).then(res => {
46 if (res.code === 200) {
47 getPrintApplicationForm(this.formData.bsmSldy).then(infoRes => {
48 if (infoRes.code === 200) {
49 let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
50
51 // 装载第一个模板并设置数据
52 LODOP.ADD_PRINT_DATA("ProgramData", res.result.tmpcontent);
53 for (let key in infoRes.result) {
54 LODOP.SET_PRINT_STYLEA(key, "CONTENT", infoRes.result[key]);
55 }
56
57 // 进行预览
58 LODOP.PREVIEW();
59 } else {
60 this.$message.error(infoRes.message);
61 }
62 });
63 } else {
64 this.$message.error(res.message);
65 }
66 })
67 } else {
68 getPrintTemplateByCode({ tmpno: Vue.prototype.BASE_API.adapter + '-2' }).then(res => {
69 if (res.code === 200) {
70 getPrintApplicationForm(this.formData.bsmSldy).then(infoRes => {
71 if (infoRes.code === 200) {
72 let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
73
74 // 装载第一个模板并设置数据
75 LODOP.ADD_PRINT_DATA("ProgramData", res.result.tmpcontent);
76 for (let key in infoRes.result) {
77 LODOP.SET_PRINT_STYLEA(key, "CONTENT", infoRes.result[key]);
78 }
79
80 // 进行预览
81 LODOP.PREVIEW();
82 } else {
83 this.$message.error(infoRes.message);
84 }
85 });
86 } else {
87 this.$message.error(res.message);
88 }
89 })
90 }
91
92 }
93 }
94 }
95 </script>
...\ No newline at end of file ...\ No newline at end of file
1 /* 1 /*
2 * @Description: 2 * @Description:
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-11-22 13:18:47 4 * @LastEditTime: 2023-11-22 17:05:55
5 */ 5 */
6 import Vue from 'vue' 6 import Vue from 'vue'
7 import { getPrintTemplateByCode } from "@/api/print"; 7 import { getPrintTemplateByCode } from "@/api/print";
...@@ -134,29 +134,32 @@ export default { ...@@ -134,29 +134,32 @@ export default {
134 this.$popupDialog("证书修改", "workflow/components/dialog/zsxg", { bsmSlsq: this.bsmSlsq, }, '55%', true) 134 this.$popupDialog("证书修改", "workflow/components/dialog/zsxg", { bsmSlsq: this.bsmSlsq, }, '55%', true)
135 break; 135 break;
136 case "B6": 136 case "B6":
137 this.$popupDialog("打印申请书", "workflow/components/dialog/sqs",
138 { bsmSldy: this.currentSelectProps.bsmSldy }, '30%', true
139 )
137 //根据编号获取对应信息 140 //根据编号获取对应信息
138 getPrintTemplateByCode({ tmpno: Vue.prototype.BASE_API.adapter }).then(res => { 141 // getPrintTemplateByCode({ tmpno: Vue.prototype.BASE_API.adapter }).then(res => {
139 if (res.code === 200) { 142 // if (res.code === 200) {
140 getPrintApplicationForm(this.currentSelectProps.bsmSldy).then(infoRes => { 143 // getPrintApplicationForm(this.currentSelectProps.bsmSldy).then(infoRes => {
141 if (infoRes.code === 200) { 144 // if (infoRes.code === 200) {
142 let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM')); 145 // let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
143 146
144 // 装载第一个模板并设置数据 147 // // 装载第一个模板并设置数据
145 LODOP.ADD_PRINT_DATA("ProgramData", res.result.tmpcontent); 148 // LODOP.ADD_PRINT_DATA("ProgramData", res.result.tmpcontent);
146 for (let key in infoRes.result) { 149 // for (let key in infoRes.result) {
147 LODOP.SET_PRINT_STYLEA(key, "CONTENT", infoRes.result[key]); 150 // LODOP.SET_PRINT_STYLEA(key, "CONTENT", infoRes.result[key]);
148 } 151 // }
149 152
150 // 进行预览 153 // // 进行预览
151 LODOP.PREVIEW(); 154 // LODOP.PREVIEW();
152 } else { 155 // } else {
153 this.$message.error(infoRes.message); 156 // this.$message.error(infoRes.message);
154 } 157 // }
155 }); 158 // });
156 } else { 159 // } else {
157 this.$message.error(res.message); 160 // this.$message.error(res.message);
158 } 161 // }
159 }) 162 // })
160 break; 163 break;
161 case "B7": 164 case "B7":
162 this.$popupDialog("证书领取", "workflow/components/dialog/zslq", 165 this.$popupDialog("证书领取", "workflow/components/dialog/zslq",
......