<template>
  <div class="import_result">
    <el-dialog :visible.sync="dialogVisible"
               :title="dialogTitle"
               width="600px"
               @close="dialogVisible = false">
      <p class="line_item">
        <span>本次导入：</span>{{total}}笔
      </p>
      <p class="line_item">
        <span>失败数：</span>{{form.loseNum}}
      </p>
      <p class="line_item">
        <span>成功数：</span>{{form.successNum}}
      </p>
      <btn-export btnSize="small"
                  :xhr="$xhr"
                  class="btn_center"
                  :store="$store"
                  type="primary"
                  :openPerms="false"
                  :icon="'iconfont icondownload'"
                  templateCode="jinbiao001"
                  :queryParas="queryParams"
                  :btnName="$t('chargeback.download_detail')"></btn-export>
    </el-dialog>
  </div>
</template>

<script>
import BaseEdit from '@/pages/baseEditPage'
import { btnExport } from 'newepoch-components'
export default {
  components: { btnExport },
  props: {
    dialogTitle: {
      type: String,
      default: ''
    }
  },
  extends: new BaseEdit(),
  data () {
    return {
      queryParams: {},
      xhr: null
    }
  },
  mounted () {
    this.xhr = this.$xhr
  },
  methods: {},
  computed: {
    total () {
      const { loseNum, successNum } = this.form
      return loseNum + successNum
    }
  },
  watch: {
    visible (old) {
      if (old) {
        const { importBatchNo } = this.form
        this.queryParams = {
          batchNo: importBatchNo
        }
      } else {
      }
    }
  }
}
</script>
