<template>
  <el-dialog
    title="单组合匹配"
    :visible.sync="singleShow"
    width="30%"
  >
    <div>
      <mx-table :propDefines="propDefines" :rows="formatList">
      </mx-table>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" @click="singleShow = false">确 定</el-button>
    </span>
  </el-dialog>
</template>
<script>

export default {
  data() {
    return {
      singleShow: false,
      major: [],
      reports: [],
    }
  },
  computed: {
    formatList() {
      if (!this.reports.length) return []
      return this.reports.map(item => {
        return {
          groupName: item.groupName,
          status: this.major.matchedGroupIds.findIndex(gi => gi == item.groupId) != -1 ? '符合' : '不符合',
        }
      })
    },
    propDefines() {
      if (!this.major) return {}
      return {
        groupName: {
          label: `${this.major.majorCategoryName}${this.major.collegeName ? `(${this.major.collegeName})`: '' }`
        },
        status: {
          label: '符合'
        },
      }
    },
  },
  methods: {
    open(major,reports) {
      this.singleShow = true
      this.major = major
      this.reports = reports
    },
  }
}
</script>
<style scoped>
.cell .el-tag{
  margin-right: 5px;
}
</style>
