<script setup lang="ts">
import _request from '../utils/request';

import radars1 from './student/radars1.vue'
import radars2 from './student/radars2.vue'
import bar from './student/bar.vue'
import lines from './student/lines.vue'


const AllResponse = ref('');

const left_middle_table = ref('');
const left_bottom_table = ref('');

const left_top_left_echartsData = ref('');
const left_top_right_echartsData = ref('');

const right_top_echartsData = ref('');
const right_bottom_echartsData = ref('');

const initData = () => {
  _request({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    baseURL:window.GLOBAL_CONFIG.api,
    url: "/openapi/chart/student_data.php",
    data:{},
  })
    .then(res => {
      if (res.code == '1') {
        AllResponse.value = res.data;
        console.log(res, "alvis")
        left_middle_table.value =res.data.left_middle_table;
        left_bottom_table.value =res.data.left_bottom_table;

        left_top_left_echartsData.value = res.data.left_top_left_echartsData;
        left_top_right_echartsData.value = res.data.left_top_right_echartsData;
        right_top_echartsData.value = res.data.right_top_echartsData;
        console.log(right_top_echartsData.value,"090909");

        right_bottom_echartsData.value = res.data.right_bottom_echartsData;

      }
    })
  .catch(error=>{console.log(error)})
}
initData();

</script>

<template>
  <div class="flex justify-between">
    <div class="flex flex-col justify-between" style="width:50%;">
      <div class="flex justify-between">
        <div class="px-3 py-2 w-410px h-332px border border-hex-0A337E bg-block" style="margin-right: 1%;">
          <radars1 v-if="left_top_left_echartsData"  :ecahrtsData="left_top_left_echartsData"/>
        </div>
        <div class="px-3 py-2 w-410px h-332px border border-hex-0A337E bg-block">
          <radars2 v-if="left_top_right_echartsData" :ecahrtsData="left_top_right_echartsData" />
        </div>
      </div>
      <div class="mt-4" >
        <div class="text-lg mb-4">{{ left_middle_table.bigtitle }}</div>
        <div class="normalTable">
          <div class="flex justify-between normalTable_title" v-if="left_middle_table.mainTable">
            <div class="wslice8" v-for="(item,index)  in left_middle_table.mainTable.secScholltableTitle " :key="index" >{{item }}</div>
          </div>
          <div class="flex justify-between normalTable_content" v-if="left_middle_table.mainTable" v-for="(item,index) in left_middle_table.mainTable.secSchollTableContent" :key="index">
            <div class="normalTable_contentDetile">
             <div class="wslice8">{{ item.a1}}</div>
             <div class="wslice8">{{ item.a2 }}</div>
             <div class="wslice8">{{ item.a3 }}</div>
             <div class="wslice8">{{ item.a4 }}</div>
             <div class="wslice8">{{ item.a5 }}</div>
             <div class="wslice8">{{ item.a6 }}</div>
             <div class="wslice8">{{ item.a7 }}</div>
             <div class="wslice8">{{ item.a8 }}</div>
            </div>
          </div>
        </div>
      </div>
      <div class="mt-4">
        <div class="text-lg mb-4 ">{{ left_bottom_table.bigtitle }}</div>
        <div class="normalTable">
          <div class="flex justify-between normalTable_title" v-if="left_bottom_table.mainTable">
            <div class="wslice8" v-for="(item,index)  in left_bottom_table.mainTable.secScholltableTitle" :key="index" >{{item }}</div>
          </div>
          <div class="flex justify-between normalTable_content" v-if="left_bottom_table.mainTable" v-for="(item,index) in left_bottom_table.mainTable.secSchollTableContent" :key="index">
            <div class="normalTable_contentDetile">
             <div class="wslice8">{{ item.a1}}</div>
             <div class="wslice8">{{ item.a2 }}</div>
             <div class="wslice8">{{ item.a3 }}</div>
             <div class="wslice8">{{ item.a4 }}</div>
             <div class="wslice8">{{ item.a5 }}</div>
             <div class="wslice8">{{ item.a6 }}</div>
             <div class="wslice8">{{ item.a7 }}</div>
             <div class="wslice8">{{ item.a8 }}</div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="flex flex-col justify-between " style="width:49%;">
      <div class="w-full h-450px px-5 py-4 border border-hex-0A337E bg-block">
        <bar v-if="right_top_echartsData" :ecahrtsData="right_top_echartsData" />
      </div>
      <div class="w-full h-450px px-5 py-4 border border-hex-0A337E bg-block" style="margin-top: 2%;">
        <lines v-if="right_bottom_echartsData" :ecahrtsData="right_bottom_echartsData" />
      </div>
    </div>

  </div>
</template>

<style scoped>
.wslice8{
  width: 12%;
}
.wslice7{
  width: 14%;
}
.wslice6{
  width: 16%;
}
.wslice5{
  width: 20%;
}
.wslice4{
  width: 25%;
}

.normalTable_title{
  height:50px;
  line-height: 50px;
  box-sizing: border-box;
  padding:0 2%;
  background: linear-gradient(90deg,rgba(11,38,147,1) 0%, rgba(27,66,131,0) 100%);
  font-size: 14px;
  font-weight: normal;
  
}
.normalTable_title div{
  text-align: center;
}

.normalTable_content{
  display: flex;
  justify-content: space-between;
  height:40px;
  line-height:40px;
  box-sizing: border-box;
  padding:0 2%;
  background-color: rgba(0,22,68, 0.5);
}
.normalTable_contentDetile{
  width:100%;
  display: flex;
  flex-direction: row;
  justify-content:space-between;

}
.normalTable_contentDetile div{
  text-align: center;
}
</style>