<template>
  <div>
    <el-dialog title="导出站点类型" :visible.sync="isShow" @open="dialogOpen" class="export-site-dialog">
      <el-form :inline="true" :model="exportSite" class="demo-form-inline" label-width="150px">
        <el-form-item label="导出站点类型：">
          <el-checkbox-group v-model="exportSite.type">
            <span v-for="item in exportSiteTypes" :key="item.value" style="margin-left:5px;">
            <el-checkbox :label="item.label" >{{item.value}}</el-checkbox>
            </span>
          </el-checkbox-group>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="isShow = false">取 消</el-button>
        <el-button type="primary" @click="confirm">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
export default {
  data() {
    return {
      confirmLoading: false,
      exportSite: {type: []},
      exportSiteTypes: []
    }
  },
  computed: {
    isShow: {
      get() {
        return this.show
      },
      set(val) {
        this.$emit('update:show', val)
      }
    }
  },
  methods: {
    async dialogOpen() {
      this.confirmLoading = false
      this.exportSite.type = []
      let res = await axios.get('/ui/platform/codes/ExportSiteType')
      this.exportSiteTypes = res.data.data
      res.data.data.forEach(o => {
        this.exportSite.type.push(o.codeValue)
      })
    },
    confirm() {
      this.$emit('callback', this.exportSite)
    }
  },
  props: {
    show: {
      type: Boolean
    }
  }
}
</script>
