<template>
  <div
    class="pb_content"
    style="
      background: unset;
      overflow: auto;
      padding: 20px;
      margin: 0;
      box-sizing: border-box;
    "
  >
    <div
      style="
        position: absolute;
        width: 100%;
        top: 0;
        height: 100%;
        overflow: auto;
        left: 50%;
        transform: translateX(-50%);
      "
    >
      <div
        class="pb_content_body"
        style="
          background: #fff;
          padding: 0px 21px;
          box-sizing: border-box;
          border-radius: 5px;
        "
      >
        <div class="pb_head">
          <!-- <span>备注：教师可以根据课程、班级条件筛选学生并查看该学生信息</span> -->
          <span
            @click="
              goTo('/works?userid=' + userid + '&oid=' + oid + '&org=' + org)
            "
            >评价管理</span
          >
          <span class="sub_head">数据报告</span>
        </div>
        <div class="pb_child_head">
          <div @click="wrType = 0" :class="{ iswrClick: wrType == 0 }">
            学生报告
          </div>
          <div @click="wrType = 1" :class="{ iswrClick: wrType == 1 }">
            班级报告
          </div>
          <div @click="wrType = 2" :class="{ iswrClick: wrType == 2 }">
            课程报告
          </div>
          <div @click="wrType = 3" :class="{ iswrClick: wrType == 3 }">
            目标评价
          </div>
        </div>
        <div>
          <StReport
            v-if="wrType == 0"
            :uuid="userid"
            :ooid="oid"
            :ccid="cid"
            :checkid="checkid"
            @getStReport="getOneReport"
          ></StReport>
          <ClassReport
            v-if="wrType == 1"
            :ooid="oid"
            :checkid="checkid"
            @getCStReport="getSecondReport"
          ></ClassReport>
          <CourseReport
            v-if="wrType == 2"
            :ooid="oid"
            :checkid="checkid"
            @getCourseReport="getThirdReport"
          ></CourseReport>
          <EvaReport v-if="wrType == 3" :ooid="oid" @getEvaReport="getFourReport" 
          :checkid="checkid"
          ></EvaReport>
        </div>
      </div>
    </div>
    <div class="report_box" v-if="reportVisible">
      <myReportLook
        :checkCourse="checkCourse"
        :checkStudent="checkStudent"
        :oid="oid"
      ></myReportLook>
    </div>
    <div class="cancelbox" v-if="reportVisible">
      <el-button @click="cancelR" type="primary" size="small">返回</el-button>
    </div>
    <div class="report_box" v-if="reportVisible1">
      <classStudentReport
        :checkCourse="checkCourse1"
        :checkStudent="checkStudent1"
        :oid="oid"
      ></classStudentReport>
    </div>
    <div class="cancelbox" v-if="reportVisible1">
      <el-button @click="cancelR1" type="primary" size="small">返回</el-button>
    </div>
  </div>
</template>

<script>
import StReport from "./components/stReport";
import ClassReport from "./components/classReport";
import CourseReport from "./components/courseReport";
import EvaReport from "./components/evaReport";
import myReportLook from "./myReport/components/MyLookComponent/myReportLook";
import classStudentReport from "./components/classStudentReport";
export default {
  components: {
    StReport,
    ClassReport,
    CourseReport,
    EvaReport,
    myReportLook,
    classStudentReport,
  },
  data() {
    return {
      userid: this.$route.query.userid,
      org: this.$route.query.org,
      oid: this.$route.query.oid,
      cid: this.$route.query.classid,
      checkid: this.$route.query.checkid,
      wrType: 0,
      reportVisible: false,
      reportVisible1: false,
      checkCourse: [],
      checkStudent: "",
      checkCourse1: [],
      checkStudent1: "",
    };
  },
  methods: {
    goTo(path) {
      this.$router.push(path);
    },
    getOneReport(item, uid) {
      var a = [];
      for (var i = 0; i < item.length; i++) {
        a.push(item);
      }
      this.checkCourse = a.join(",");
      this.checkStudent = uid;
      this.reportVisible = true;
    },
    getSecondReport(item, cid) {
      this.checkCourse1 = cid;
      this.checkStudent1 = item.join(",");
      this.reportVisible1 = true;
    },
    getThirdReport(item, cid) {
      this.checkCourse1 = cid;
      this.checkStudent1 = item.join(",");
      this.reportVisible1 = true;
    },
    getFourReport(item, cid) {
      this.checkCourse1 = cid;
      this.checkStudent1 = item.join(",");
      this.reportVisible1 = true;
    },
    cancelR1() {
      this.checkCourse1 = "";
      this.checkStudent1 = "";
      this.reportVisible1 = false;
    },
    cancelR() {
      this.checkCourse = "";
      this.checkStudent = "";
      this.reportVisible = false;
    },
  },
};
</script>

<style scoped>
.sub_head {
  position: relative;
  margin-left: 10px;
}
.sub_head::after {
  content: "";
  width: 100%;
  background: #5a9cea;
  height: 2px;
  position: absolute;
  left: 0;
  bottom: -12px;
}

.pb_head > span:nth-child(1) {
  font-size: 26px;
  cursor: pointer;
  color: #999;
}
.pb_head > span:nth-child(1):hover {
  color: #000;
}
.pb_head {
  margin: 0 !important;
  width: 100% !important;
}
.pb_child_head {
  padding: 10px 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
}
.pb_child_head > div {
  margin-right: 20px;
  padding-bottom: 10px;
  cursor: pointer;
}
.iswrClick {
  border-bottom: 2px solid #238bfc;
  color: #1684fc;
}
.cancelbox {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 20px;
  width: 95%;
  transform: translateX(-50%);
  display: flex;
  justify-content: flex-end;
  padding: 0 90px 0px 0px;
  box-sizing: border-box;
}

.report_box {
  height: 100%;
  position: absolute;
  top: 0;
  /* background: #fff; */
  background: rgb(231, 242, 252);
  overflow: auto;
  z-index: 1;
  width: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 20px;
  box-sizing: border-box;
}
</style>