<template>
  
  <div style="width:100%;text-align: right;line-height:40px;">
    <a style="padding-right: 0.5rem;" @click="init()">刷新</a>
    <!-- <RouterLink to="/site/xspjjgore">查看更多</RouterLink> -->
  </div>
  <a-list item-layout="horizontal" :data-source="list" :grid="{ gutter: 16, xs: 2, sm: 4, md: 4, lg: 4, xl: 4, xxl: 4, xxxl: 4 }">
    <template #renderItem="{ item }">
      <a-list-item>
          <div style="border: 2px #eef1f2 solid;">
          <div>
            <div style="width: 100%;height: 20px;background-color: #1c84c6;"></div>
            <div style="width:100%;white-space:normal; word-break:break-all;overflow:hidden;padding: 10px;height: 70px;font-weight: 600;font-size: 16px;">
              {{ item.kcmc }} 
            </div>
          </div>
          <a-divider style="margin: 0px;color: #eef1f2;" />
          <div style="padding: 20px;font-weight: 600;">
            <a-row>
              <a-col :span="15">
                <div style="height: 38px;font-size: 16px;font-weight: 700;">{{ item.skjs }}</div>
                <div style="font-size: 14px;font-weight: 700;height: 50px;">{{ item.kkyx }}</div>
              </a-col>
              <a-col :span="9" style="text-align: center;height: 70px;background-color: #e2e2e2;border-radius: 5px;">
                <div style="color: #1c84c6;font-size: 20px;font-weight: 600;margin-top: 10px;">{{ item.cpl }}</div>
                <div style="font-size: 14px;font-weight: 700;">参评率</div>
              </a-col>

              <a-col :span="24" style="margin-top:0px;font-weight: 700;">
                <div>平均分汇总：{{ item.pjfhz }}</div>
                <div>参 评 率 ：{{ item.cpl }}</div>
                <!-- <div>有 效 数 ：{{ item.yxs }}</div> -->
                <div>学期学年 ：{{ item.xqxn }}</div>
              </a-col>

              <a-col :span="24">
                <a-row style="text-align: center;">
                  <a-col :span="24">
                    <a-button type="primary" class="bcClass" @click="openJspjPage(item)" >详情</a-button>
                  </a-col>
                </a-row>
              </a-col>
            </a-row>
          </div>
        </div>

      </a-list-item>
    </template>
  </a-list>
  <a-pagination v-model="current" :total="total" show-less-items @change="handlePageChange" v-if="props.flagPage" style="text-align: right;" :hideOnSinglePage="true"/>

  <KcXsktjxmydcpDetailModal ref="KcXsktjxmydcpDetailModalPage"/>


</template>
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue';
import { TeamOutlined, FormOutlined } from '@ant-design/icons-vue';
import { Pagination } from 'ant-design-vue';
import { getUserId, getSysConfig } from '/@/views/site/utils/index';

import KcXsktjxmydcpDetailModal from '/@/views/kc/kcXsktjxmydcp/components/KcXsktjxmydcpDetail2Modal.vue';

import { defHttp } from '/@/utils/http/axios';
enum Api {
  list = '/pjxxJszbpjf/pjxxJszbpjf/listIndex'
}

const KcXsktjxmydcpDetailModalPage = ref();

const current = ref<number>(0);
const total = ref<number>(2);
const loadingList = ref<boolean>(false);

const APagination = Pagination;
const emit = defineEmits(['changeParam']);

const props = defineProps({
  queryParam: { type: Object, default: () => ({}) },
  flagPage: { type:Boolean,default:false}
});

/**
 * 列表接口
 * @param params
 */
const listApi = (params) => defHttp.get({ url: Api.list, params });

const list = ref<any>([]);
onMounted(() => {
  init();
});

watch(
  () => props.queryParam,
  (v) => init(),
  {
    deep:true,
    immediate:true,
  }
);


function init() {
  console.log('init');
  loadingList.value = true
  listApi({ jsbh: getUserId(), ...props.queryParam }).then(res => {
    list.value = res?.records ?? [];

    total.value = res.total;
    current.value = res.current;
    list.value = res.records
    loadingList.value = false
  });
}

function handlePageChange(record){
  emit('changeParam',record);
  // loadData();
}
/**
 * 转换时间由【0012】转成【00:12】
 * @param time 四个字符，时分，无分隔
 */
 function formatTime(time: string) {
  if(!time) return '';
  let t_i_m_e = time.split('');
  return [t_i_m_e[0],t_i_m_e[1],':',t_i_m_e[2],t_i_m_e[3]].join('');
}
function onSearch() {
  init();
}

//教师评价
function openJspjPage(item) {
  KcXsktjxmydcpDetailModalPage.value.disableSubmit = true;
  KcXsktjxmydcpDetailModalPage.value.edit(item)
}

defineExpose({
  onSearch
});

</script>
<style lang="less" scoped>
.wenZiJuZhong {
  text-align: center;
}
.wenZiJiaCu {
  font-weight: 700;
}
.fs1d1r {
  font-size: 16px;
  min-height: 55.281px;
}
.hand {
 cursor:pointer;
}
.dateAndTime {
  padding-top: 10px;
}

.yyyClass{
  background: #6cafda;font-weight: 600;color:#fff;border-radius: 5px;line-height: 23px;
}
.yyClass{
  background-color: #1c84c6;font-weight: 600;color:#fff;border-radius: 5px;line-height: 23px;
}
.bcClass{
  background-color: #1c84c6;font-weight: 600;border-radius: 5px;line-height: 23px;
}

.itemDate {
  border-radius: 25px;
  background: #cccccc8c;
  width: 90%;
  margin-bottom: 0.5rem;
  text-align: center;
  margin: 0 auto .5rem;
  padding: 0.5rem;
  font-weight: 700;
  font-size: 16px;
}
</style>