style:图形定位
Showing
2 changed files
with
130 additions
and
1 deletions
1 | <template> | 1 | <template> |
2 | <iframe :src="window._config.services.management +'/#/' + formData.bsmZd" frameborder="0" style="width: 100%; height:710px;"></iframe> | 2 | <iframe :src="ip +'/txdw/#/' + formData.bsmZd" frameborder="0" style="width: 100%; height:710px;"></iframe> |
3 | </template> | 3 | </template> |
4 | <script> | 4 | <script> |
5 | export default { | 5 | export default { |
... | @@ -10,6 +10,11 @@ | ... | @@ -10,6 +10,11 @@ |
10 | return {} | 10 | return {} |
11 | } | 11 | } |
12 | } | 12 | } |
13 | }, | ||
14 | data () { | ||
15 | return { | ||
16 | ip: window._config.services.management | ||
17 | } | ||
13 | } | 18 | } |
14 | } | 19 | } |
15 | </script> | 20 | </script> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
src/views/zhcx/zslqcx/components/zslr.vue
0 → 100644
1 | <!-- | ||
2 | * @Description: | ||
3 | * @Autor: renchao | ||
4 | * @LastEditTime: 2023-08-10 14:01:09 | ||
5 | --> | ||
6 | <template> | ||
7 | <div class="from-clues loadingtext" v-Loading="loading" element-loading-text="拼命加载中..." style="height:720px;text-align: center;"> | ||
8 | <el-empty description="暂无数据" v-if="headTabBdcqz.length == 0 && noData"></el-empty> | ||
9 | <canvas ref="zs" width="1000" height="700"></canvas> | ||
10 | </div> | ||
11 | </template> | ||
12 | |||
13 | <script> | ||
14 | import { getSlsqBdcqzList } from "@/api/bdcqz.js" | ||
15 | export default { | ||
16 | name: "zsyl", | ||
17 | props: { | ||
18 | formData: { | ||
19 | type: Object, | ||
20 | default: {} | ||
21 | } | ||
22 | }, | ||
23 | data () { | ||
24 | return { | ||
25 | noData: false, | ||
26 | imgSrc: require('@/image/bdcqz/bdcqzs2.jpg'), | ||
27 | loading: false, | ||
28 | } | ||
29 | }, | ||
30 | mounted () { | ||
31 | this.getHeadTabBdcqz(); | ||
32 | }, | ||
33 | methods: { | ||
34 | /** | ||
35 | * @description: 获取受理申请下全部不动产权证 | ||
36 | * @author: renchao | ||
37 | */ | ||
38 | getHeadTabBdcqz () { | ||
39 | this.loading = true | ||
40 | getSlsqBdcqzList({ bsmSlsq: this.formData.bsmSlsq }).then(res => { | ||
41 | if (res.code == 200) { | ||
42 | this.noData = true | ||
43 | if (res.result && res.result.length > 0) { | ||
44 | this.bdcqz = res.result[0] | ||
45 | this.drawTextOnImage() | ||
46 | } | ||
47 | } | ||
48 | this.loading = false | ||
49 | }) | ||
50 | }, | ||
51 | /** | ||
52 | * @description: 不动产证书 | ||
53 | * @author: renchao | ||
54 | */ | ||
55 | drawTextOnImage () { | ||
56 | const canvas = this.$refs.zs; | ||
57 | const context = canvas.getContext('2d'); | ||
58 | const image = new Image(); | ||
59 | image.onload = () => { | ||
60 | context.drawImage(image, 0, 0); | ||
61 | context.font = '18px 楷体'; | ||
62 | context.fillStyle = '#000000'; | ||
63 | context.fillText(this.bdcqz.sjjc ? this.bdcqz.sjjc : '', 60, 56); | ||
64 | context.fillText(this.bdcqz.djnd ? this.bdcqz.djnd : '', 113, 56); | ||
65 | context.fillText(this.bdcqz.sxqc ? this.bdcqz.sxqc : '', 180, 56); | ||
66 | context.fillText(this.bdcqz.sxh ? this.bdcqz.sxh : '', 370, 56); | ||
67 | context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 138, 97); | ||
68 | context.fillText(this.bdcqz.gyqk ? this.bdcqz.gyqk : '', 138, 138); | ||
69 | context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 138, 180); | ||
70 | context.fillText(this.bdcqz.bdcdyh ? this.bdcqz.bdcdyh : '', 138, 223); | ||
71 | context.fillText(this.bdcqz.qllx ? this.bdcqz.qllx : '', 138, 263); | ||
72 | context.fillText(this.bdcqz.qlxz ? this.bdcqz.qlxz : '', 138, 303); | ||
73 | context.fillText(this.bdcqz.yt ? this.bdcqz.yt : '', 138, 346); | ||
74 | context.fillText(this.bdcqz.mj ? this.bdcqz.mj : '', 138, 386); | ||
75 | context.fillText(this.bdcqz.syqx ? this.bdcqz.syqx : '', 138, 429); | ||
76 | // qlqtzk | ||
77 | const maxWidth = 280; // 最大宽度限制 | ||
78 | let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : []; | ||
79 | lines.forEach((line, index) => { | ||
80 | const y = 469 + (index * 37); // 每行文本的垂直位置 | ||
81 | let currentLine = ''; | ||
82 | let arr = []; | ||
83 | for (let word of line) { | ||
84 | const testLine = currentLine + word; | ||
85 | const lineWidth = context.measureText(testLine).width; | ||
86 | if (lineWidth <= maxWidth) { | ||
87 | currentLine = testLine; | ||
88 | } else { | ||
89 | arr.push(currentLine); | ||
90 | currentLine = word; | ||
91 | } | ||
92 | } | ||
93 | arr.push(currentLine); | ||
94 | arr.forEach((line, index) => { | ||
95 | context.fillText(line, 138, y + (index * 20)); // 调整行高 | ||
96 | }) | ||
97 | }) | ||
98 | let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split(' ') : []; | ||
99 | lines1.forEach((line, index) => { | ||
100 | const y = 100 + (index * 37); // 每行文本的垂直位置 | ||
101 | let currentLine = ''; | ||
102 | let arr = []; | ||
103 | for (let word of line) { | ||
104 | const testLine = currentLine + word; | ||
105 | const lineWidth = context.measureText(testLine).width; | ||
106 | if (lineWidth <= 395) { | ||
107 | currentLine = testLine; | ||
108 | } else { | ||
109 | arr.push(currentLine); | ||
110 | currentLine = word; | ||
111 | } | ||
112 | } | ||
113 | arr.push(currentLine); | ||
114 | arr.forEach((line, index) => { | ||
115 | context.fillText(line, 580, y + (index * 20)); // 调整行高 | ||
116 | }) | ||
117 | }) | ||
118 | |||
119 | } | ||
120 | image.src = this.imgSrc | ||
121 | }, | ||
122 | } | ||
123 | } | ||
124 | </script> |
-
Please register or sign in to post a comment