<template>
  <el-dialog
      class="ele-dialog-form"
      :visible.sync="codeVisible"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      width="200px"
      append-to-body
      title="二维码"
    >
    <ele-qr-code :value="text" :size="120" />
      <template v-slot:footer>
        <el-button @click="codeVisible=false">返回</el-button>
      </template>
    </el-dialog>
</template>

<script>


import EleQrCode from 'ele-admin/es/ele-qr-code';

export default {

  data() {
    return {
      codeVisible: false,
      text:''


    }
  },
  components: {

    EleQrCode
  },
  watch: {},
  methods: {
    open(row) {
      this.codeVisible=true
      let addr =
              '' + row.addressName ? row.addressName.replaceAll(',', '') : '';
            addr += row.address ? row.address : '';
      const paramsStr = this.obj_to_str({
        name: encodeURIComponent(row.name),
        addr: encodeURIComponent(addr),
        code: encodeURIComponent(row.code),
        unifiedSocialCreditCode: encodeURIComponent(row.unifiedSocialCreditCode),
   
      });
      this.text =
        window.location.origin +
        '/eos/fromQRCode/designDrawing.html' +
        '?' +
        paramsStr;
    },

    obj_to_str(obj) {
      var str = '';
      for (var k in obj) {
        str += `${k}=${obj[k]}&`;
      }
      return str;
    },
    

  }
}
</script>

<style lang="scss" scoped>
</style>
