<template>
  <d2-container class="page">
    <el-tabs value="first">
      <el-tab-pane label="校考成绩查询" name="first">
        
        
        选择批次：
        <el-select size="medium" v-model="year_code" filterable clearable placeholder="请选择批次" @change="query()">
            <el-option v-for="item in exam_times" :key="item.id" :label="item.exam_year_month" :value="item.year_code"></el-option>
        </el-select>
        <font style="color:red;font-size:16px;font-weight:530">&nbsp;&nbsp;注意: 本查询接口仅供参考</font>
        <div style="margin-top:10px;margin-buttom:10px">准考证号:{{stdReg.ticket_no}}&nbsp;&nbsp;&nbsp;&nbsp;姓名:{{stdReg.std_name}}&nbsp;&nbsp;&nbsp;&nbsp;身份证号:{{stdReg.cert_no? stdReg.cert_no.replace(/^(.{6})(?:\w+)(.{4})$/, "\$1********\$2"):""}}</div>
        <el-table
          v-loading="loading"
          :data="scoreList"
          style="width: 100%">
          <el-table-column
            type="index"
            label="序号"
            width="50">
          </el-table-column>

          
          <el-table-column
            prop="year_code"
            label="考试年月"
            width="80">
          </el-table-column>
          <el-table-column
            prop="ticket_no"
            label="准考证号"
            width="120">
          </el-table-column>
          <el-table-column
            prop="course_code"
            label="课程代码"
            width="80">
          </el-table-column>
          <el-table-column
            prop="course_name"
            label="课程名称"
            width="300">
          </el-table-column>
          <el-table-column
            prop="score"
            label="成绩"
            width="80">
          </el-table-column>

          <el-table-column
            prop="score_type_name"
            label="成绩性质"
            width="120">
          </el-table-column>
          <el-table-column
            prop="org_name"
            label="主考学校"
            width="150">
          </el-table-column>
        </el-table>
      </el-tab-pane>
    </el-tabs>
  </d2-container>
</template>

<script>
import { mapState, mapActions } from "vuex";
import { json } from "body-parser";
import { debug } from 'util';

export default {
  computed: {
    ...mapState({
      stdReg: state => state.enrol.StdReg,
      StdImageArray: state => state.enrol.StdImageArray,
      FrameParam: state => state.enrol.FrameParam
    })
  },

  data() {
    return {
      loading: false,
      majorList: null,
      exam_times:[],
      exam_time_id:"",
      year_code:"",
      scoreList: [], 
    };
  },

  async mounted() {
    this.loading = true;
    this.init();
    this.loading = false;
  },
  methods: {
    //初始化
    async init() {

      let res = await this.$http.post(
        "/pl/plExamTime/listtime.htm",
        {},
        this.$http.headers.FORM
      );
      this.exam_times = res.data.array;
     

      this.$nextTick(() => {
          this.query();
      });
    },
    async query() {
    
      this.loading = true;
      
      let res = await this.$http.post(
        "/kj/kjUnifiedScoreDetail/queryCollegeScoreByStd.htm",
        this.Qs.stringify({
          std_id: this.stdReg.id,
          year_code: this.year_code        
        }),
        
        this.$http.headers.FORM
      );
      
      this.scoreList = res.data.array;
      this.loading = false;
    }
  }
};
</script>

<style lang="scss" scoped>
@import "~@/assets/style/public.scss";
</style>
