Blame view

src/views/workflow/components/dialog/zsyl.vue 12.5 KB
1
<!--
yuanbo committed
2
 * @Description:
3
 * @Autor: renchao
4
 * @LastEditTime: 2023-08-16 17:02:36
5
-->
liangyifan committed
6
<template>
7
  <div class="from-clues loadingtext" v-Loading="loading" element-loading-text="拼命加载中..." style="height:720px;text-align: center;">
任超 committed
8
    <!-- 表单部分 -->
9
    <el-tabs v-model="activeName" @tab-click="handleClick" v-if="headTabBdcqz.length >1">
10 11 12
      <el-tab-pane :label="item.qlr + (item.bdcqzh !== null ? '(' + item.bdcqzh + ')' : '')" :name="item.bsmBdcqz"
        v-for="(item, index) in headTabBdcqz" :key="index">
      </el-tab-pane>
任超 committed
13
    </el-tabs>
14
    <el-empty description="暂无数据" v-if="headTabBdcqz.length == 0 && noData"></el-empty>
15 16
    <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>
任超 committed
17
  </div>
liangyifan committed
18 19 20
</template>

<script>
21
  import { datas } from "../../javascript/zsyl.js";
22
  import { getSlsqBdcqzList } from "@/api/bdcqz.js"
23 24 25 26 27 28 29
  export default {
    name: "zsyl",
    props: {
      formData: {
        type: Object,
        default: {}
      }
蔡俊立 committed
30
    },
31 32
    data () {
      return {
33
        key: 0,
34
        noData: false,
35
        imgSrc: require('@/image/bdcqz/bdcqzs2.jpg'),
36
        bdczmSrc: require('@/image/bdcqz/bdczm.jpg'),
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
        loading: false,
        //印刷序列号集合
        ysxlh: [],
        //列名称对象
        columns: [],
        //选择的不动产权证文件
        bdcqz: '',
        //证书打开类型 是否需要展示打印按钮
        isToPrint: false,
        //tab切换栏数组
        headTabBdcqz: [],
        //tab选择绑定值
        activeName: '',
        //证书图片预览
        previewImage: '',
        ruleForm: {
          bsmBdcqz: '',
          szmc: '不动产权证书',
55
          bsmBdcqz: '',
56 57 58 59
          szzh: '',
          ysxlh: '',
        },
      }
60
    },
61 62 63 64 65 66 67 68 69
    mounted () {
      this.columns = datas.columns();
      if (this.formData.bdcqz) {
        //从缮证进入
        this.bdcqz = this.formData.bdcqz
      } else {
        //从按钮进入
        this.getHeadTabBdcqz();
      }
70
    },
71
    methods: {
yuanbo committed
72 73 74 75 76
      /**
       * @description: 获取证书内容
       * @param {*} code
       * @author: renchao
       */
77 78 79 80
      getRowValue (code) {
        var value = this.bdcqz[code];
        return value;
      },
yuanbo committed
81 82 83 84
      /**
       * @description: 获取受理申请下全部不动产权证
       * @author: renchao
       */
85 86 87 88
      getHeadTabBdcqz () {
        this.loading = true
        getSlsqBdcqzList({ bsmSlsq: this.formData.bsmSlsq }).then(res => {
          if (res.code == 200) {
89
            this.noData = true
90
            if (res.result && res.result.length > 0) {
91
              this.activeName = res.result[0].bsmBdcqz
92 93
              this.bdcqz = res.result[0]
              this.headTabBdcqz = res.result
94
              if (res.result[0].bdcqzlx == 1) {
95 96 97 98
                this.drawTextOnImage()
              } else {
                this.drawTextzmImage()
              }
99 100
            }
          }
101
          this.loading = false
102 103
        })
      },
yuanbo committed
104 105 106 107 108
      /**
       * @description: tab表头切换方法
       * @param {*} e
       * @author: renchao
       */
109 110
      handleClick (e) {
        this.bdcqz = this.headTabBdcqz[e.index - 0]
111
        this.activeName = this.headTabBdcqz.bsmBdcqz
112
        if (this.bdcqz.bdcqzlx == 1) {
113 114 115 116
          this.drawTextOnImage()
        } else {
          this.drawTextzmImage()
        }
117
      },
yuanbo committed
118 119 120 121
      /**
       * @description: 不动产证书
       * @author: renchao
       */
122
      drawTextOnImage () {
123
        const canvas = this.$refs.zs;
124 125 126 127
        const context = canvas.getContext('2d');
        const image = new Image();
        image.onload = () => {
          context.drawImage(image, 0, 0);
128
          context.font = '16px 楷体';
129 130 131 132 133
          context.fillStyle = '#000000';
          context.fillText(this.bdcqz.sjjc ? this.bdcqz.sjjc : '', 60, 56);
          context.fillText(this.bdcqz.djnd ? this.bdcqz.djnd : '', 113, 56);
          context.fillText(this.bdcqz.sxqc ? this.bdcqz.sxqc : '', 180, 56);
          context.fillText(this.bdcqz.sxh ? this.bdcqz.sxh : '', 370, 56);
134 135 136
          context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 129, 97);
          context.fillText(this.bdcqz.gyqk ? this.bdcqz.gyqk : '', 129, 136);

137
          this.bdcdyh = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' +
138
            this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length)
139
          context.fillText(this.bdcdyh ? this.bdcdyh : '', 129, 223);
140 141 142 143 144 145 146



          context.fillText(this.bdcqz.qllx ? this.bdcqz.qllx : '', 129, 263);
          context.fillText(this.bdcqz.qlxz ? this.bdcqz.qlxz : '', 129, 303);
          context.fillText(this.bdcqz.yt ? this.bdcqz.yt : '', 129, 346);
          context.fillText(this.bdcqz.mj ? this.bdcqz.mj : '', 129, 386);
147
          // context.fillText(this.bdcqz.syqx ? this.bdcqz.syqx : '', 129, 429);
148
          // qlqtzk
149
          const maxWidth = 330; // 最大宽度限制
150 151
          let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : [];
          lines.forEach((line, index) => {
152
            const y = 473 + (index * 27); // 每行文本的垂直位置
153 154 155 156 157 158 159 160 161 162 163 164 165 166
            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) => {
167
              context.fillText(line, 129, y + (index * 20)); // 调整行高
168 169
            })
          })
170 171
          let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split(' ') : [];
          lines1.forEach((line, index) => {
172
            const y = 100 + (index * 27); // 每行文本的垂直位置
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
            let currentLine = '';
            let arr = [];
            for (let word of line) {
              const testLine = currentLine + word;
              const lineWidth = context.measureText(testLine).width;
              if (lineWidth <= 395) {
                currentLine = testLine;
              } else {
                arr.push(currentLine);
                currentLine = word;
              }
            }
            arr.push(currentLine);
            arr.forEach((line, index) => {
              context.fillText(line, 580, y + (index * 20)); // 调整行高
            })
          })
190 191
          let lines3 = this.bdcqz.syqx ? this.bdcqz.syqx.split(' ') : [];
          lines3.forEach((line, index) => {
192
            const y = 423 + (index * 27); // 每行文本的垂直位置
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
            let currentLine = '';
            let arr = [];
            for (let word of line) {
              const testLine = currentLine + word;
              const lineWidth = context.measureText(testLine).width;
              if (lineWidth <= 315) {
                currentLine = testLine;
              } else {
                arr.push(currentLine);
                currentLine = word;
              }
            }
            arr.push(currentLine);
            arr.forEach((line, index) => {
              context.fillText(line, 129, y + (index * 20)); // 调整行高
            })
          })
210

211 212 213 214 215


          let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : [];
          if (lines2.length > 22) {
            lines2.forEach((line, index) => {
216
              const y = 170 + (index * 20); // 每行文本的垂直位置
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
              let currentLine = '';
              let arr = [];
              for (let word of line) {
                const testLine = currentLine + word;
                const lineWidth = context.measureText(testLine).width;
                if (lineWidth <= 360) {
                  currentLine = testLine;
                } else {
                  arr.push(currentLine);
                  currentLine = word;
                }
              }
              arr.push(currentLine);
              arr.forEach((line, index) => {
                context.fillText(line, 129, y + (index * 20)); // 调整行高
              })
            })
          } else {
            lines2.forEach((line, index) => {
236
              const y = 180 + (index * 20); // 每行文本的垂直位置
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
              let currentLine = '';
              let arr = [];
              for (let word of line) {
                const testLine = currentLine + word;
                const lineWidth = context.measureText(testLine).width;
                if (lineWidth <= 360) {
                  currentLine = testLine;
                } else {
                  arr.push(currentLine);
                  currentLine = word;
                }
              }
              arr.push(currentLine);
              arr.forEach((line, index) => {
                context.fillText(line, 129, y + (index * 20)); // 调整行高
              })
            })
          }
255
        }
256 257 258
        image.src = this.imgSrc
      },
      // 不动产证明
yuanbo committed
259 260 261 262
      /**
       * @description: 不动产证明
       * @author: renchao
       */
263 264 265 266 267 268 269 270
      drawTextzmImage () {
        const canvas = this.$refs.zm;
        const context = canvas.getContext('2d');
        const image = new Image();
        image.onload = () => {
          context.drawImage(image, 0, 0);
          context.font = '18px 楷体';
          context.fillStyle = '#000000';
271 272 273
          // ysxlh
          context.fillText(this.bdcqz.ysxlh ? this.bdcqz.ysxlh : '', 280, 712);
          // djsj
274 275 276 277 278 279
          if (this.bdcqz.djsj) {
            let djsjList = this.bdcqz.djsj.split(' ')[0].split('/')
            context.fillText(djsjList[0] ? djsjList[0] : '', 327, 580);
            context.fillText(djsjList[1] ? djsjList[1] : '', 393, 580);
            context.fillText(djsjList[2] ? djsjList[2] : '', 443, 580);
          }
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
          context.fillText(this.bdcqz.sjjc ? this.bdcqz.sjjc : '', 620, 125);
          context.fillText(this.bdcqz.djnd ? this.bdcqz.djnd : '', 665, 125);
          context.fillText(this.bdcqz.sxqc ? this.bdcqz.sxqc : '', 750, 125);
          context.fillText(this.bdcqz.sxh ? this.bdcqz.sxh : '', 960, 123);
          context.fillText(this.bdcqz.zmqlhsx ? this.bdcqz.zmqlhsx : '', 775, 180);
          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);
          // bdcdyh
          context.fillText(this.bdcqz.bdcdyh ? this.bdcqz.bdcdyh : '', 775, 373);
          // qlqtzk
          const maxWidth = 280; // 最大宽度限制
          let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : [];
          lines.forEach((line, index) => {
            const y = 415 + (index * 37); // 每行文本的垂直位置
            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, 775, y + (index * 20)); // 调整行高
            });
          });
renchao@pashanhoo.com committed
313
          // fj
314
          context.fillText(this.bdcqz.fj ? this.bdcqz.fj : '', 775, 600);
315
        };
renchao@pashanhoo.com committed
316

317
        image.src = this.bdczmSrc;
318
      }
319
    }
liangyifan committed
320 321 322
  }
</script>
<style scoped lang="scss">
323
  @import "~@/styles/mixin.scss";
任超 committed
324

325 326 327 328 329
  .imgClass {
    display: inline-block;
    height: auto;
    max-width: 100%;
  }
任超 committed
330

331 332 333
  .middle_padding {
    padding-bottom: 10px;
  }
任超 committed
334

335 336 337
  .zsyl-button {
    text-align: center;
    margin-top: 20px;
任超 committed
338

339 340 341 342
    .operation_button {
      width: 100px;
      border: 1px solid rgb(0, 121, 254);
    }
任超 committed
343

344 345 346 347
    .dy-button {
      color: white;
      background-color: rgb(0, 121, 254);
    }
蔡俊立 committed
348
  }
任超 committed
349

350 351 352
  .table-column {
    border-spacing: 1px;
    width: 100%;
任超 committed
353

354 355 356 357 358 359 360 361
    tr td {
      border: 1px solid #ccc;
      text-align: center;
      height: 40px;
      padding: 4px;
      font-size: 13px;
      background: rgb(251, 249, 229);
    }
任超 committed
362 363
  }

364 365 366 367 368 369
  .zsyl-title {
    background: #fafbe5;
    text-align: center;
    padding: 5px 0px;
    font-size: 20px;
  }
蔡俊立 committed
370

371 372 373 374 375 376
  .no-data {
    font-size: 18px;
    display: flex;
    text-align: center;
    justify-content: center;
  }
liangyifan committed
377
</style>