<template>
  <div class="cjfx_slyf">
    <NavHeader />
    <bread-crumb />

    <div class="w-1200px m-auto flex flex-row justify-between">
      <div class="w-188px">
        <leftSider :ykjId="ykjId" :activeIndex="activeIndex"  @parentClick="parentClick"/>
      </div>

      <div class="w-1012px p-4 overflow-visible blueBg">

        <div class="flex items-center">
          <el-select class="mr-10px" v-model="normal_school" placeholder="请选择学校" size="large">
            <el-option label="全部" value="0" />
            <el-option v-for="item in school_list" :key="item.value" :label="item.label" :value="item.value" />
          </el-select>

          <el-select class="mr-10px" v-model="normal_classroom" placeholder="请选择班级" size="large">
            <el-option label="全部" value="0" />
            <el-option v-for="item in classroom_list" :key="item.value" :label="item.label" :value="item.value" />
          </el-select>

          <el-select class="mr-10px" v-model="normal_subject" placeholder="请选择学科" size="large">
            <el-option label="全部" value="0" />
            <el-option v-for="item in subject_list" :key="item.value" :label="item.label" :value="item.value" />
          </el-select>

          <el-select class="mr-10px" v-model="normal_teacher" placeholder="请选择任课老师" size="large">
            <el-option label="全部" value="0" />
            <el-option v-for="item in school_list" :key="item.value" :label="item.label" :value="item.value" />
          </el-select>

        </div>
        <div class="flex justify-between mt-4 exportBtn">
          <div>
            <el-button color="#003eee" type="primary" size="large" @click="restBtn">重置</el-button>
            <el-button color="#003eee" type="primary" size="large" @click="exportBtn">导出</el-button>
          </div>
          <div>
            <el-button color="#003eee" type="primary" size="large" @click="openDialog">校三率一分</el-button>
          </div>
        </div>

        <div class="h-auto mt-9px listMain">

          <el-table :data="tableData" style="width: 100%">
            <el-table-column prop="xx" label="学校" show-overflow-tooltip width="200" />
            <el-table-column prop="bj" label="班级" width="120" />
            <el-table-column prop="pm" label="排名" />
            <el-table-column prop="pjf" label="平均分" />
            <el-table-column prop="ykrs" label="应考人数" />
            <el-table-column prop="skrs" label="实考人数" />
            <el-table-column prop="zgf" label="最高分" />
            <el-table-column prop="yxrs" label="优秀人数" />
            <el-table-column prop="yxl" label="优秀率" />
            <el-table-column prop="jgrs" label="及格人数" />
            <el-table-column prop="jgl" label="及格率" />
            <el-table-column prop="dfrs" label="低分人数" />
            <el-table-column prop="dfl" label="低分率" />
            <el-table-column prop="nd" label="难度" />
            <el-table-column prop="qfd" label="区分度" />
            <el-table-column prop="bzc" label="标椎差" />
          </el-table>

          <div class="mt-4" >
            <el-pagination background layout="prev, pager, next " :total="1000" style="justify-content: right;" />
            </div>

        </div>

      </div>

      <!-- dialog  -->
      <el-dialog v-model="dialogTableVisible" title="校三率一分" style="width: 90%;">
        <el-table :data="tableData" style="width: 100%;">
            <el-table-column prop="xx" label="学校" show-overflow-tooltip width="200" />
            <el-table-column prop="bj" label="班级" width="120" />
            <el-table-column prop="pm" label="排名" />
            <el-table-column prop="pjf" label="平均分" />
            <el-table-column prop="ykrs" label="应考人数" />
            <el-table-column prop="skrs" label="实考人数" />
            <el-table-column prop="zgf" label="最高分" />
            <el-table-column prop="yxrs" label="优秀人数" />
            <el-table-column prop="yxl" label="优秀率" />
            <el-table-column prop="jgrs" label="及格人数" />
            <el-table-column prop="jgl" label="及格率" />
            <el-table-column prop="dfrs" label="低分人数" />
            <el-table-column prop="dfl" label="低分率" />
            <el-table-column prop="nd" label="难度" />
            <el-table-column prop="qfd" label="区分度" />
            <el-table-column prop="bzc" label="标椎差" />
        </el-table>
        <template #footer>
          <span class="dialog-footer">
            <el-button type="primary" color="#003eee" @click="dialogTableVisible = false">关闭</el-button>
          </span>
        </template>
      </el-dialog>


    </div>

    <commonFooter />
  </div>
</template>
<route lang="json">
{
  "meta": {
    "title": "考试分析",
    "breadcrumb": true
  }
}
</route>
<script lang="ts" setup>
import {cjfx_slyf_list } from '../apiItem';
import { useRouter } from "vue-router";
const router = useRouter();
const route = useRoute();


let normal_subject = $ref("");
let normal_classroom = $ref("");
let normal_school = $ref("");
let normal_teacher = $ref("");


let subject_list = [{
  value: '1',
  label: '语文'
}, {
  value: '2',
  label: '数学'
}]

let classroom_list = [{
  value: '1',
  label: '英语'
}, {
  value: '2',
  label: '体育'
}, {
  value: '3',
  label: '音乐'
}
];

let school_list = [{
  value: '1',
  label: '学校1'
}, {
  value: '2',
  label: '学校2'
}]

// 侧边栏点击
const activeIndex =ref('1-2');
const ykjId = ref();
const parentClick = (val) => {
  activeIndex.value = val;
  ykjId.value = route.params.ykj_id;
}

const tableData = ref([]);
ykjId.value = route.params.ykj_id;

onMounted(() => {
  initData()
})

const initData =() => {
  let transObj = {
    xueke_id: '',
    grade_id: '',
    school_id: ''
  }
  cjfx_slyf_list(transObj)
    .then(res => {
      if (res.code == "1") {
        tableData.value = res.data.tableData;
      }
    })
  .catch(error=>{console.log(error)})
}

//重置
const restBtn = () => {
  normal_subject = "";
  normal_classroom = "";
  normal_school = "";
  normal_teacher = "";

}
//导出
const exportBtn = () => {
  console.log("daochu")
}


//弹出框
const dialogTableVisible = ref(false)
const openDialog = () => {
  dialogTableVisible.value = true;
}

</script>


<style lang="scss" scoped>
::v-deep .el-sub-menu__title {
  background: #003eee;
  color: #fff;
}
::v-deep .el-table__header thead tr th{
  background: #003eee!important;
  color: #fff;
  height: 50px;
  line-height: 50px;
  font-weight: normal;
}
::v-deep .el-table__header thead tr th:first-child{
  border-top-left-radius: 9px;
}
::v-deep .el-table__body tbody .el-table__row td{
  background-color: transparent;
}
::v-deep .el-dialog__footer{
  text-align: center;
}
.blueBg {
  background: #F1F7FF;
}

.whiteBG {
  background: #fff;
}

.singlepart {
  background-color: rgba($color: #ffffff, $alpha: 0.2);
  color: #fff;
}

.listMain {
  min-height: 200px;
  max-height: 600px;
  overflow-y: auto;
}

.listMain_title {
  font-size: 14px;
  color: #fff;
  background: #003eee;
  overflow-y: auto;
}

.singleT {
  flex: 1;
  line-height: 50px;
  width: fit-content;
  text-align: center;
}

.singleD {
  flex: 1;
}

.singleTSec {
  width: fit-content;
  flex: 1;
  line-height: 60px;
  text-align: center;
}

</style>
