Blame view

src/views/workflow/components/dialog/zsdy.vue 6.19 KB
1
<!--
yuanbo committed
2
 * @Description:
3
 * @Autor: renchao
4
 * @LastEditTime: 2023-06-25 11:13:07
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 14 15 16 17 18 19 20 21 22 23 24
      <el-form
        :model="ruleForm"
        :rules="rules"
        ref="ruleForm"
        label-width="120px">
        <el-form-item label="印刷序列号:" prop="ysxlh">
          <el-select v-model="ruleForm.ysxlh" placeholder="请选择">
            <el-option
              v-for="item in ysxlh"
              :key="item.ysxlh"
              :label="item.ysxlh"
              :value="item.ysxlh">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
25 26 27
      <div class="zs-content">
        <canvas ref="zs" width="1000" class="zsyl" height="700"></canvas>
      </div>
renchao@pashanhoo.com committed
28
    </div>
renchao@pashanhoo.com committed
29
    <div class="text-center pt-10">
renchao@pashanhoo.com committed
30 31
      <el-button @click="$popupCacel">取消</el-button>
      <el-button type="primary" @click="handleSubmit">确定</el-button>
蔡俊立 committed
32
    </div>
renchao@pashanhoo.com committed
33
  </div>
蔡俊立 committed
34 35 36
</template>

<script>
renchao@pashanhoo.com committed
37 38
  import store from '@/store/index.js'
  import { datas } from "../../javascript/zsyl.js";
39
  import { readYsxlh, certificate, getSlsqBdcqzList } from "@/api/bdcqz.js";
renchao@pashanhoo.com committed
40 41
  export default {
    props: {
renchao@pashanhoo.com committed
42 43 44 45 46 47
      formData: {
        type: Object,
        default: () => {
          return {}
        }
      }
48
    },
renchao@pashanhoo.com committed
49 50
    data () {
      return {
51 52 53 54
        // 不动产证书图片地址
        imgSrc: require('@/image/bdcqz/bdcqzs2.jpg'),
        loading: false,
        bdcqz: [],
renchao@pashanhoo.com committed
55 56 57 58 59 60 61 62 63
        //印刷序列号集合
        ysxlh: [],
        //列名称对象
        columns: [],
        ruleForm: {
          bsmBdcqz: "",
          szmc: "不动产权证书",
          bdcqzlx: "",
          szzh: "",
renchao@pashanhoo.com committed
64
          ysxlh: ""
renchao@pashanhoo.com committed
65 66 67
        },
        rules: {
          ysxlh: [
renchao@pashanhoo.com committed
68 69
            { required: true, message: "请选择印刷序列号", trigger: "change" }
          ]
70
        }
renchao@pashanhoo.com committed
71 72 73
      }
    },
    created () {
renchao@pashanhoo.com committed
74
      store.dispatch('user/refreshPage', false)
renchao@pashanhoo.com committed
75 76
      this.columns = datas.columns()
      this.ysxlhList()
77
      this.getHeadTabBdcqz()
renchao@pashanhoo.com committed
78 79 80
    },
    methods: {
      //获取印刷序列号列表
yuanbo committed
81 82 83 84
      /**
       * @description: 获取印刷序列号列表
       * @author: renchao
       */
renchao@pashanhoo.com committed
85
      ysxlhList () {
renchao@pashanhoo.com committed
86
        readYsxlh({ zslx: this.formData.bdcqz.bdcqzlx }).then((res) => {
renchao@pashanhoo.com committed
87 88 89
          if (res.code === 200) {
            this.ysxlh = res.result;
          }
renchao@pashanhoo.com committed
90
        })
renchao@pashanhoo.com committed
91
      },
92
      //获取受理申请下全部不动产权证
yuanbo committed
93 94 95 96
      /**
       * @description: 获取受理申请下全部不动产权证
       * @author: renchao
       */
97 98 99 100 101 102 103 104 105 106 107
      getHeadTabBdcqz () {
        this.loading = true
        getSlsqBdcqzList({ bsmSlsq: this.formData.bsmSlsq }).then(res => {
          if (res.code == 200) {
            if (res.result && res.result.length > 0) {
              this.bdcqz = res.result[0]
              this.drawTextOnImage()
            }
          }
          this.loading = false
        })
renchao@pashanhoo.com committed
108
      },
109
      // 不动产证书
yuanbo committed
110 111 112 113
      /**
       * @description: 不动产证书
       * @author: renchao
       */
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
      drawTextOnImage () {
        const canvas = this.$refs.zs;
        const context = canvas.getContext('2d');
        const image = new Image();
        image.onload = () => {
          context.drawImage(image, 0, 0);
          context.font = '18px 楷体';
          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);
          context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 138, 97);
          context.fillText(this.bdcqz.gyqk ? this.bdcqz.gyqk : '', 138, 138);
          context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 138, 180);
          context.fillText(this.bdcqz.bdcdyh ? this.bdcqz.bdcdyh : '', 138, 223);
          context.fillText(this.bdcqz.qllx ? this.bdcqz.qllx : '', 138, 263);
          context.fillText(this.bdcqz.qlxz ? this.bdcqz.qlxz : '', 138, 303);
          context.fillText(this.bdcqz.yt ? this.bdcqz.yt : '', 138, 346);
          context.fillText(this.bdcqz.mj ? this.bdcqz.mj : '', 138, 386);
          context.fillText(this.bdcqz.syqx ? this.bdcqz.syqx : '', 138, 429);
          // qlqtzk
          const maxWidth = 280; // 最大宽度限制
          let lines = this.bdcqz.qlqtzk ? this.bdcqz.qlqtzk.split('\n') : [];
          lines.forEach((line, index) => {
            const y = 469 + (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, 138, y + (index * 20)); // 调整行高
            })
          })
          context.fillText(this.bdcqz.fj ? this.bdcqz.fj : '', 580, 100);
        }
        image.src = this.imgSrc
renchao@pashanhoo.com committed
160
      },
yuanbo committed
161 162 163 164
      /**
       * @description: handleSubmit
       * @author: renchao
       */
165 166
      handleSubmit () {
        this.savePrintRecord()
renchao@pashanhoo.com committed
167 168
      },
      //保存打印记录
yuanbo committed
169 170 171 172
      /**
       * @description: 保存打印记录
       * @author: renchao
       */
renchao@pashanhoo.com committed
173
      savePrintRecord () {
renchao@pashanhoo.com committed
174 175 176
        this.ruleForm.bsmBdcqz = this.formData.bdcqz.bsmBdcqz;
        this.ruleForm.bdcqzlx = this.formData.bdcqz.bdcqzlx;
        this.ruleForm.szzh = this.formData.bdcqz.bdcqzh;
renchao@pashanhoo.com committed
177 178
        certificate(this.ruleForm).then((res) => {
          if (res.code === 200) {
renchao@pashanhoo.com committed
179 180
            this.$popupCacel()
            this.$message.success("提交成功")
renchao@pashanhoo.com committed
181
            //刷新列表
182
            store.dispatch('user/refreshPage', true)
renchao@pashanhoo.com committed
183
          } else {
renchao@pashanhoo.com committed
184
            this.$message.error(res.message)
renchao@pashanhoo.com committed
185
          }
186 187 188 189
        })
      }
    }
  }
蔡俊立 committed
190 191
</script>
<style scoped lang="scss">
renchao@pashanhoo.com committed
192
  @import "~@/styles/mixin.scss";
renchao@pashanhoo.com committed
193 194 195 196
  .zsdy-content {
    height: 80vh;
    overflow-y: scroll;
  }
197
  .zs-content {
renchao@pashanhoo.com committed
198
    text-align: center;
蔡俊立 committed
199 200
  }
</style>