Blame view

src/views/workflow/components/dialog/zsdy.vue 25.7 KB
1
<!--
yuanbo committed
2
 * @Description:
3
 * @Autor: renchao
4
 * @LastEditTime: 2023-11-07 08:47:38
5
-->
蔡俊立 committed
6
<template>
renchao@pashanhoo.com committed
7
  <div>
8
    <div class="zsdy-content" v-Loading="loading">
renchao@pashanhoo.com committed
9 10 11 12 13
      <el-form
        :model="ruleForm"
        ref="ruleForm"
        label-width="120px">
        <el-form-item label="印刷序列号:" prop="ysxlh">
14 15 16 17 18 19 20 21 22 23 24 25
          <el-row>
            <el-col :span="22">
              <el-select v-model="ruleForm.ysxlh" @change="handleSelect" :disabled="disabled" placeholder="请选择">
                <el-option
                  v-for="item in ysxlh"
                  :key="item.ysxlh"
                  :label="item.ysxlh"
                  :value="item.ysxlh">
                </el-option>
              </el-select>
            </el-col>
            <el-col :span="2" v-if="this.formData.ysxlh">
renchao@pashanhoo.com committed
26
              <el-button type="primary" @click="handleZF" v-if="disabled">作废</el-button>
27 28 29
            </el-col>
          </el-row>

renchao@pashanhoo.com committed
30 31
        </el-form-item>
      </el-form>
32
      <div class="zs-content">
33 34
        <canvas ref="zs" width="1000" v-show="this.formData.bdcqzlx==1" height="700"></canvas>
        <canvas ref="zm" width="1180" v-show="this.formData.bdcqzlx==2" height="780"></canvas>
35
      </div>
renchao@pashanhoo.com committed
36
    </div>
renchao@pashanhoo.com committed
37 38 39 40
    <!-- 打印模板需要此模块 -->
    <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>
renchao@pashanhoo.com committed
41
    <div class="text-center pt-10">
renchao@pashanhoo.com committed
42
      <el-button @click="$popupCacel">取消</el-button>
43
      <el-button type="primary" @click="handlePrint" v-if="disabled">打印</el-button>
44
      <el-button type="primary" @click="handleSubmit" v-else>确定</el-button>
蔡俊立 committed
45
    </div>
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60

    <el-dialog title="证书作废" :visible.sync="invalidDiglog" width="40%" :modal-append-to-body="false" top="30vh">
      <div class="invalid-diglog">
        <div class="invalid-title">
          <i class="el-icon-question invalid-icon"></i>
          <div class="invalid-body">您确定作废证书并再次打印?印刷序列号{{bdcqz.ysxlh}}</div>
        </div>
        <div class="invalid-reson">作废原因:</div>
        <el-input v-model="zfyy" placeholder="请输入作废原因" type="textarea" :rows="4"></el-input>
        <div class="text-center pt-10">
          <el-button @click="closeInvalidDiglog">取 消</el-button>
          <el-button type="primary" @click="confirmInvalid">确 定</el-button>
        </div>
      </div>
    </el-dialog>
renchao@pashanhoo.com committed
61
  </div>
蔡俊立 committed
62 63 64
</template>

<script>
renchao@pashanhoo.com committed
65 66
  import store from '@/store/index.js'
  import { datas } from "../../javascript/zsyl.js";
renchao@pashanhoo.com committed
67 68
  import { getPrintTemplateByCode } from "@/api/print";
  import { getLodop } from "@/utils/LodopFuncs"
69
  import { readYsxlh, certificate, getBdcqzDetail, invalidCertificate } from "@/api/bdcqz.js";
70
  import { log } from 'bpmn-js-token-simulation';
renchao@pashanhoo.com committed
71 72
  export default {
    props: {
renchao@pashanhoo.com committed
73 74 75 76 77 78
      formData: {
        type: Object,
        default: () => {
          return {}
        }
      }
79
    },
renchao@pashanhoo.com committed
80 81
    data () {
      return {
82 83
        // 详细信息
        bdcqz: {},
84
        key: 0,
85
        disabled: false,
86 87
        // 不动产证书图片地址
        imgSrc: require('@/image/bdcqz/bdcqzs2.jpg'),
88
        bdczmSrc: require('@/image/bdcqz/bdczm.jpg'),
89
        loading: false,
renchao@pashanhoo.com committed
90 91 92 93
        //印刷序列号集合
        ysxlh: [],
        //列名称对象
        columns: [],
94 95
        //tab选择绑定值
        activeName: '',
96 97
        invalidDiglog: false,
        zfyy: "",
renchao@pashanhoo.com committed
98 99 100 101 102
        ruleForm: {
          bsmBdcqz: "",
          szmc: "不动产权证书",
          bdcqzlx: "",
          szzh: "",
renchao@pashanhoo.com committed
103
          ysxlh: ""
104
        }
renchao@pashanhoo.com committed
105 106
      }
    },
107
    mounted () {
renchao@pashanhoo.com committed
108
      store.dispatch('user/refreshPage', false)
renchao@pashanhoo.com committed
109 110
      this.columns = datas.columns()
      this.ysxlhList()
111 112 113 114
      // 获取详细信息
      this.getDetail()
      if (this.formData.ysxlh) {
        this.disabled = true
115
      } else {
116
        this.disabled = false
117
      }
renchao@pashanhoo.com committed
118 119
    },
    methods: {
yuanbo committed
120
      /**
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
       * @description: 获取详细信息
       * @author: renchao
       */
      getDetail () {
        this.loading = true
        getBdcqzDetail(this.formData.bsmBdcqz).then(res => {
          this.bdcqz = res.result
          this.loading = false
          if (this.bdcqz.ysxlh) this.ruleForm.ysxlh = this.bdcqz.ysxlh
          if (this.bdcqz.bdcqzlx == 1) {
            this.drawTextOnImage()
          } else {
            this.drawTextzmImage()
          }
        })
      },
      /**
yuanbo committed
138 139 140
       * @description: 获取印刷序列号列表
       * @author: renchao
       */
renchao@pashanhoo.com committed
141
      ysxlhList () {
142
        readYsxlh({ zslx: this.formData.bdcqzlx }).then((res) => {
renchao@pashanhoo.com committed
143 144 145
          if (res.code === 200) {
            this.ysxlh = res.result;
          }
renchao@pashanhoo.com committed
146
        })
renchao@pashanhoo.com committed
147
      },
yuanbo committed
148 149 150 151 152
      /**
       * @description: handleSelect
       * @param {*} val
       * @author: renchao
       */
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
      handleSelect (val) {
        this.bdcqz.ysxlh = this.ruleForm.ysxlh
        if (this.bdcqz.bdcqzlx == 1) {
          this.drawTextOnImage()
        } else {
          this.drawTextzmImage()
        }
      },
      /**
      * @description: closeInvalidDiglog
      * @author: renchao
      */
      closeInvalidDiglog () {
        this.zfyy = "";
        this.invalidDiglog = false
      },
yuanbo committed
169 170 171 172
      /**
       * @description: handleZF
       * @author: renchao
       */
renchao@pashanhoo.com committed
173 174 175
      handleZF () {
        this.invalidDiglog = true
      },
176 177 178 179 180
      /**
       * @description: 作废缮证信息
       * @author: renchao
       */
      confirmInvalid () {
renchao@pashanhoo.com committed
181
        store.dispatch('user/reWorkFresh', false)
182 183 184 185 186 187 188 189 190 191 192 193 194
        invalidCertificate({ bsmBdcqz: this.bdcqz.bsmBdcqz, zfyy: this.zfyy }).then((res) => {
          if (res.code === 200) {
            this.$message.success("作废成功");
            this.disabled = false
            this.invalidDiglog = false;
            this.zfyy = ''
            this.ruleForm.ysxlh = ''
            this.bdcqz.ysxlh = ''
            if (this.bdcqz.bdcqzlx == 1) {
              this.drawTextOnImage()
            } else {
              this.drawTextzmImage()
            }
renchao@pashanhoo.com committed
195
            store.dispatch('user/reWorkFresh', true)
196 197 198 199 200
          } else {
            this.$message.error(res.message);
          }
        })
      },
yuanbo committed
201 202 203 204
      /**
       * @description: 不动产证书
       * @author: renchao
       */
205
      drawTextOnImage () {
206 207
        function getByteLen (val) {
          var len = 0;
208
          if (!val) return len;
209 210 211 212 213 214 215 216 217 218
          for (var i = 0; i < val.length; i++) {
            var length = val.charCodeAt(i);
            if (length >= 0 && length <= 128) {
              len += 1;
            } else {
              len += 2;
            }
          }
          return len;
        }
219 220 221 222 223
        const canvas = this.$refs.zs;
        const context = canvas.getContext('2d');
        const image = new Image();
        image.onload = () => {
          context.drawImage(image, 0, 0);
renchao@pashanhoo.com committed
224
          context.font = '18px 楷体';
225
          context.fillStyle = '#000000';
226 227 228 229 230 231
          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);
          context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 129, 97);
          context.fillText(this.bdcqz.gyqk ? this.bdcqz.gyqk : '', 129, 136);
232

233 234
          this.bdcdyh = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' +
            this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length)
235
          context.fillText(this.bdcdyh ? this.bdcdyh : '', 129, 223);
236 237


238

239 240 241 242
          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);
          let lines6 = this.bdcqz.mj ? this.bdcqz.mj.split(' ') : [];
243
          if (getByteLen(this.bdcqz.mj) > 37) {
244 245
            lines6.forEach((line, index) => {
              const y = 378 + (index * 27); // 每行文本的垂直位置
246 247 248 249 250
              let currentLine = '';
              let arr = [];
              for (let word of line) {
                const testLine = currentLine + word;
                const lineWidth = context.measureText(testLine).width;
251
                if (lineWidth <= 336) {
252 253 254 255 256 257 258 259
                  currentLine = testLine;
                } else {
                  arr.push(currentLine);
                  currentLine = word;
                }
              }
              arr.push(currentLine);
              arr.forEach((line, index) => {
260
                context.fillText(line, 129, y + (index * 20)); // 调整行高
261 262 263
              })
            })
          } else {
264 265 266 267 268 269 270
            lines6.forEach((line, index) => {
              const y = 386 + (index * 27); // 每行文本的垂直位置
              let currentLine = '';
              let arr = [];
              for (let word of line) {
                const testLine = currentLine + word;
                const lineWidth = context.measureText(testLine).width;
271
                if (lineWidth <= 336) {
272 273 274 275 276 277 278 279 280 281 282
                  currentLine = testLine;
                } else {
                  arr.push(currentLine);
                  currentLine = word;
                }
              }
              arr.push(currentLine);
              arr.forEach((line, index) => {
                context.fillText(line, 129, y + (index * 20)); // 调整行高
              })
            })
283
          }
284 285
          // 权利其他状态
          const maxWidth = 332; // 最大宽度限制
286
          let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : [];
287
          for (let i = 0; i < lines.length; i++) {
288 289
            let num = Math.ceil(getByteLen(lines[i]) / 37)
            if (getByteLen(lines[i]) > 37) {
290 291 292 293 294 295 296 297 298 299 300
              let currentLine = '';
              let arr = [];
              for (let word of lines[i]) {
                const testLine = currentLine + word;
                const lineWidth = context.measureText(testLine).width;
                if (lineWidth <= maxWidth) {
                  currentLine = testLine;
                } else {
                  arr.push(currentLine);
                  currentLine = word;
                }
301
              }
302
              arr.push(currentLine);
303 304
              if (i > 0) {
                arr.forEach((line, index) => {
305
                  context.fillText(line, 129, 495 + (29 * (i - 1)) + 4 * num + (index * 14)); // 调整行高
306 307 308
                })
              } else {
                arr.forEach((line, index) => {
309
                  context.fillText(line, 129, 493 + (26 * (i - 1)) + (index * 14)); // 调整行高
310 311
                })
              }
312
            } else {
313
              if (i > 0) {
314
                context.fillText(lines[i] ? lines[i] : '', 129, 500 + 4 * num + (29 * (i - 1)));
315
              } else {
316
                context.fillText(lines[i] ? lines[i] : '', 129, 505 + (27 * (i - 1)));
317
              }
318
            }
319 320
          }

321
          let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split('\n') : [];
322
          lines1.forEach((line, index) => {
323
            const y = 100 + (index * 30); // 每行文本的垂直位置
324 325 326 327 328 329 330 331 332 333 334 335 336 337
            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) => {
338
              context.fillText(line, 580, y + (index * 30)); // 调整行高
339 340
            })
          })
341
          let lines3 = this.bdcqz.syqx ? this.bdcqz.syqx.split(' ') : [];
342
          if (getByteLen(this.bdcqz.syqx) > 37) {
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383
            lines3.forEach((line, index) => {
              const y = 423 + (index * 27); // 每行文本的垂直位置
              let currentLine = '';
              let arr = [];
              for (let word of line) {
                const testLine = currentLine + word;
                const lineWidth = context.measureText(testLine).width;
                if (lineWidth <= 330) {
                  currentLine = testLine;
                } else {
                  arr.push(currentLine);
                  currentLine = word;
                }
              }
              arr.push(currentLine);
              arr.forEach((line, index) => {
                context.fillText(line, 129, y + (index * 20)); // 调整行高
              })
            })
          } else {
            lines3.forEach((line, index) => {
              const y = 430 + (index * 27); // 每行文本的垂直位置
              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)); // 调整行高
              })
            })
          }

384
          let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : [];
385
          if (getByteLen(this.bdcqz.zl) > 37) {
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425
            lines2.forEach((line, index) => {
              const y = 170 + (index * 20); // 每行文本的垂直位置
              let currentLine = '';
              let arr = [];
              for (let word of line) {
                const testLine = currentLine + word;
                const lineWidth = context.measureText(testLine).width;
                if (lineWidth <= 336) {
                  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) => {
              const y = 180 + (index * 20); // 每行文本的垂直位置
              let currentLine = '';
              let arr = [];
              for (let word of line) {
                const testLine = currentLine + word;
                const lineWidth = context.measureText(testLine).width;
                if (lineWidth <= 336) {
                  currentLine = testLine;
                } else {
                  arr.push(currentLine);
                  currentLine = word;
                }
              }
              arr.push(currentLine);
              arr.forEach((line, index) => {
                context.fillText(line, 129, y + (index * 20)); // 调整行高
              })
            })
          }
426 427
        }
        image.src = this.imgSrc
renchao@pashanhoo.com committed
428
      },
yuanbo committed
429
      /**
430 431 432 433 434 435
       * @description: 不动产证明
       * @author: renchao
       */
      drawTextzmImage () {
        function getByteLen (val) {
          var len = 0;
436
          if (!val) return len;
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452
          for (var i = 0; i < val.length; i++) {
            var length = val.charCodeAt(i);
            if (length >= 0 && length <= 128) {
              len += 1;
            } else {
              len += 2;
            }
          }
          return len;
        }

        const canvas = this.$refs.zm;
        const context = canvas.getContext('2d');
        const image = new Image();
        image.onload = () => {
          context.drawImage(image, 0, 0);
renchao@pashanhoo.com committed
453
          context.font = '18px 楷体';
454 455
          context.fillStyle = '#000000';
          // ysxlh
456
          context.fillText(this.bdcqz.ysxlh ? this.bdcqz.ysxlh : '', 280, 712);
457
          // djsj
458 459
          if (this.bdcqz.djsj) {
            let djsjList = this.bdcqz.djsj.split(' ')[0].split('/')
460 461 462 463
            context.fillText(djsjList[0] ? djsjList[0] : '', 327, 580);
            context.fillText(djsjList[1] ? djsjList[1] : '', 393, 580);
            context.fillText(djsjList[2] ? djsjList[2] : '', 443, 580);
          }
464 465 466 467 468 469
          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);
470
          // 义务人
471 472
          context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275);
          let lines2 = this.bdcqz.zl ? this.bdcqz.zl.split(' ') : [];
473
          if (getByteLen(this.bdcqz.zl) >= 39) {
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513
            lines2.forEach((line, index) => {
              const y = 315 + (index * 20); // 每行文本的垂直位置
              let currentLine = '';
              let arr = [];
              for (let word of line) {
                const testLine = currentLine + word;
                const lineWidth = context.measureText(testLine).width;
                if (lineWidth <= 295) {
                  currentLine = testLine;
                } else {
                  arr.push(currentLine);
                  currentLine = word;
                }
              }
              arr.push(currentLine);
              arr.forEach((line, index) => {
                context.fillText(line, 775, y + (index * 20)); // 调整行高
              })
            })
          } else {
            lines2.forEach((line, index) => {
              const y = 325 + (index * 20); // 每行文本的垂直位置
              let currentLine = '';
              let arr = [];
              for (let word of line) {
                const testLine = currentLine + word;
                const lineWidth = context.measureText(testLine).width;
                if (lineWidth <= 295) {
                  currentLine = testLine;
                } else {
                  arr.push(currentLine);
                  currentLine = word;
                }
              }
              arr.push(currentLine);
              arr.forEach((line, index) => {
                context.fillText(line, 775, y + (index * 20)); // 调整行高
              })
            })
          }
514
          // bdcdyh
515 516
          this.bdcdyh = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' +
            this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length)
517 518
          context.fillText(this.bdcdyh ? this.bdcdyh : '', 775, 373);
          // qlqtzk
519 520
          const maxWidth = 290; // 最大宽度限制
          let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : [];
521
          for (let i = 0; i < lines.length; i++) {
522
            console.log(getByteLen(lines[i]));
523 524
            let num = Math.ceil(getByteLen(lines[i]) / 37)
            if (getByteLen(lines[i]) > 37) {
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548
              let currentLine = '';
              let arr = [];
              for (let word of lines[i]) {
                const testLine = currentLine + word;
                const lineWidth = context.measureText(testLine).width;
                if (lineWidth <= maxWidth) {
                  currentLine = testLine;
                } else {
                  arr.push(currentLine);
                  currentLine = word;
                }
              }
              arr.push(currentLine);
              if (i > 0) {
                arr.forEach((line, index) => {
                  context.fillText(line, 770, 438 + (23 * (i - 1)) + 5 * num + (index * 16)); // 调整行高
                })
              } else {
                arr.forEach((line, index) => {
                  context.fillText(line, 770, 438 + (23 * (i - 1)) + (index * 16)); // 调整行高
                })
              }
            } else {
              if (i > 0) {
549
                context.fillText(lines[i] ? lines[i] : '', 770, 447 + 6 * num + (23 * (i - 1)));
550
              } else {
551
                context.fillText(lines[i] ? lines[i] : '', 770, 447 + (23 * (i - 1)));
552 553 554 555
              }
            }
          }
          // fj
556
          let lines1 = this.bdcqz.fj ? this.bdcqz.fj.split('\n') : [];
557
          for (let i = 0; i < lines1.length; i++) {
558 559
            let num = Math.ceil(getByteLen(lines1[i]) / 37)
            if (getByteLen(lines1[i]) > 37) {
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592
              let currentLine = '';
              let arr = [];
              for (let word of lines1[i]) {
                const testLine = currentLine + word;
                const lineWidth = context.measureText(testLine).width;
                if (lineWidth <= maxWidth) {
                  currentLine = testLine;
                } else {
                  arr.push(currentLine);
                  currentLine = word;
                }
              }
              arr.push(currentLine);
              if (i > 0) {
                arr.forEach((line, index) => {
                  context.fillText(line, 770, 610 + (25 * (i - 1)) + 5 * num + (index * 15)); // 调整行高
                })
              } else {
                arr.forEach((line, index) => {
                  context.fillText(line, 770, 610 + (25 * (i - 1)) + (index * 15)); // 调整行高
                })
              }
            } else {
              if (i > 0) {
                context.fillText(lines1[i] ? lines1[i] : '', 770, 610 + 5 * num + (23 * (i - 1)));
              } else {
                context.fillText(lines1[i] ? lines1[i] : '', 770, 610 + (23 * (i - 1)));
              }
            }
          }
        }
        image.src = this.bdczmSrc;
      },
yuanbo committed
593 594 595 596
      /**
       * @description: 打印
       * @author: renchao
       */
597
      handlePrint () {
598 599 600 601
        if (this.ruleForm.ysxlh == '') {
          this.$message.error('请选择印刷序列号');
          return;
        }
renchao@pashanhoo.com committed
602
        store.dispatch('user/reWorkFresh', false)
603
        let that = this
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620
        if (this.bdcqz.bdcqzlx == 1) {
          getPrintTemplateByCode({ tmpno: 'zsdy' }).then(resInfo => {
            if (resInfo.code == 200) {
              //打开模板设计
              let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
              LODOP.ADD_PRINT_DATA("ProgramData", resInfo.result.tmpcontent); //装载模板

              this.bdcqz.bdcdyh1 = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' +
                this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length)
              //todo 调取后端接口获取数据 循环set
              for (let key in this.bdcqz) {
                LODOP.SET_PRINT_STYLEA(key, "CONTENT", this.bdcqz[key]);
              }
              LODOP.PREVIEW();
            } else {
              this.$message.error(resInfo.message)
            }
621 622 623
            that.$popupCacel()
            //刷新列表
            store.dispatch('user/reWorkFresh', true)
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645
          })
        } else {
          getPrintTemplateByCode({ tmpno: 'zmdy' }).then(resInfo => {
            if (resInfo.code == 200) {
              //打开模板设计
              let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
              LODOP.ADD_PRINT_DATA("ProgramData", resInfo.result.tmpcontent); //装载模板

              // 年月日
              this.bdcqz.nian = this.bdcqz.djsj.split(' ')[0].split('/')[0]
              this.bdcqz.yue = this.bdcqz.djsj.split(' ')[0].split('/')[1]
              this.bdcqz.ri = this.bdcqz.djsj.split(' ')[0].split('/')[1]
              this.bdcqz.bdcdyh1 = this.bdcqz.bdcdyh.slice(0, 6) + ' ' + this.bdcqz.bdcdyh.slice(6, 12) + ' ' +
                this.bdcqz.bdcdyh.slice(12, 19) + ' ' + this.bdcqz.bdcdyh.slice(19, this.bdcqz.bdcdyh.length)
              //todo 调取后端接口获取数据 循环set
              for (let key in this.bdcqz) {
                LODOP.SET_PRINT_STYLEA(key, "CONTENT", this.bdcqz[key]);
              }
              LODOP.PREVIEW();
            } else {
              this.$message.error(resInfo.message)
            }
646 647 648
            that.$popupCacel()
            //刷新列表
            store.dispatch('user/reWorkFresh', true)
649 650
          })
        }
renchao@pashanhoo.com committed
651
      },
yuanbo committed
652 653 654 655
      /**
       * @description: 保存打印记录
       * @author: renchao
       */
656
      handleSubmit () {
renchao@pashanhoo.com committed
657
        let that = this
658 659 660 661
        if (this.ruleForm.ysxlh == '') {
          this.$message.error('请选择印刷序列号');
          return;
        }
renchao@pashanhoo.com committed
662
        store.dispatch('user/reWorkFresh', false)
663 664 665 666
        this.ruleForm.bsmBdcqz = this.bdcqz.bsmBdcqz;
        this.ruleForm.bdcqzlx = this.bdcqz.bdcqzlx;
        this.ruleForm.szzh = this.bdcqz.bdcqzh;
        this.bdcqz.ysxlh = this.ruleForm.ysxlh
renchao@pashanhoo.com committed
667 668
        certificate(this.ruleForm).then((res) => {
          if (res.code === 200) {
renchao@pashanhoo.com committed
669
            that.$popupCacel()
670
            this.handlePrint()
renchao@pashanhoo.com committed
671
          } else {
renchao@pashanhoo.com committed
672
            this.$message.error(res.message)
renchao@pashanhoo.com committed
673
          }
674
          store.dispatch('user/reWorkFresh', true)
675 676 677 678
        })
      }
    }
  }
蔡俊立 committed
679 680
</script>
<style scoped lang="scss">
renchao@pashanhoo.com committed
681
  @import "~@/styles/mixin.scss";
renchao@pashanhoo.com committed
682 683 684 685
  .zsdy-content {
    height: 80vh;
    overflow-y: scroll;
  }
686
  .zs-content {
renchao@pashanhoo.com committed
687
    text-align: center;
蔡俊立 committed
688
  }
689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720
  .invalid-diglog {
    padding-bottom: 20px;
    font-size: 16px;
    font-weight: bold;
    color: rgb(99, 99, 99);

    .invalid-title {
      display: flex;
      align-content: center;

      .invalid-icon {
        color: rgb(254, 148, 0);
        font-size: 34px;
        margin-right: 10px;
      }

      .invalid-body {
        line-height: 40px;
        margin-bottom: 10px;
      }
    }

    .invalid-reson {
      margin-bottom: 10px;
    }

    .dialog-footer {
      margin-top: 10px;
      display: flex;
      justify-content: flex-end;
    }
  }
蔡俊立 committed
721
</style>