<template>
  <el-dialog
    title="报表打印"
    :visible.sync="visible"
    width="40%"
    v-dialogDrag
    :close-on-click-modal="false"
    :before-close="cancel"
  >
    <div class="dia-box">
        <el-table  :data="tableData" border max-height="650px">
            <el-table-column label="报表名称" prop="reportName" align="center">
                <template slot-scope="scope">
                    <el-radio :label="scope.row.type" v-model="radioType" @change="handleRadio">{{scope.row.text}}</el-radio>
                </template>
            </el-table-column>
        </el-table>
        <div style="text-align:right;margin:15px 0 20px;">
            <el-button type="primary" size="mini" @click="submit">
                报表打印
            </el-button>
            <el-button size="mini" @click="cancel">关闭</el-button>
      </div>
    </div>
  </el-dialog>
</template>

<script>
import { message } from "@/utils/common";
export default {
  props: {
    visible: {
      type: Boolean,
      default: () => false
    },
  },
  data() {
    return {
      tableData: [
        { type: "封面", text: '归档文件封面' },
        { type: "横", text: '归档文件整理（横）' },
        { type: "竖", text: '归档文件整理（竖）' },
      ],
      radioType: '',
    };
  },
  methods: {
    cancel() {
      this.$emit("cancel");
    },
    submit() {
      if(!this.radioType){
        message("warning", "请选择归档文件类型", 2000);
        return false;
      }
      this.$emit("submit",this.radioType)
    },
    handleRadio(val){
        this.radioType = val;
    }
  }
};
</script>
