<template>
  <NavHeader/>
  <bread-crumb/>
  <div class="w-1200px m-auto">
    <div class="flex items-center">
      <el-date-picker
        v-model="exam_time"
        value-format="YYYY-MM-DD"
        type="date"
        placeholder="考试时间"
        size="large"
      />
      <el-select class="ml-10px" v-model="exam_form" placeholder="考试形式" size="large">
        <el-option label="全部" value="0"
        />
        <el-option
          v-for="item in form_list"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        />
      </el-select>
      <el-select class="ml-20px" v-model="exam_form" placeholder="考试类型" size="large">
        <el-option label="全部" value="0"
        />
        <el-option
          v-for="item in type_list"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        />
      </el-select>
      <el-input
        v-model="keyword"
        class="ml-20px"
        style="width: 200px;"
        size="large"
        clearable
        placeholder="请输入关键字"
      />
      <el-button color="#003eee" class="ml-20px" type="primary" size="large">搜索</el-button>
    </div>
    <div class="flex mt-20px justify-between">
      <button type="button" class="add-btn" @click="linkTo({name:'process-create'})">
        <el-icon class="inline-block align-middle">
          <Plus/>
        </el-icon>
        <span class="ml-5px inline-block align-middle">新建考试计划</span>
      </button>
      <button type="button" class="del-btn">批量删除</button>
    </div>
    <div class="mt-20px process-list-table">
      <div class="head">
        <div class="w-60px">
          <p class="set-check all">
            <input type="checkbox" id="chooseAll" @change="chooseAll" v-model="checked">
            <label for="chooseAll"></label>
          </p>
        </div>
        <div class="w-150px text-left">考试计划名称</div>
        <div class="w-250px">状态</div>
        <div class="w-130px">考试形式</div>
        <div class="w-130px">考试类型</div>
        <div class="w-180px">考试时间</div>
        <div class="w-300px">操作</div>
      </div>
      <div>
        <div class="line">
          <div class="up">
            <div class="w-60px">
              <p class="set-check single">
                <input type="checkbox" id="1" :value="1" v-model="chooseCheck">
                <label :for="1"></label>
              </p>
            </div>
            <div class="w-150px text-left">考试计划名称</div>
            <div class="w-250px">
              <span class="inline-block align-middle">进行中</span>
              <div class="inline-block align-middle ml-10px process-state">
                <h3 class="state-line">
                  <span style="width: 11%;"></span>
                </h3>
              </div>
              <span class="ml-10px inline-block align-middle">11%</span>
            </div>
            <div class="w-130px text-left">线下考试</div>
            <div class="w-130px text-left">联考</div>
            <div class="w-180px text-left">2023.2.4~2023.2.17</div>
            <div class="w-300px">
              <button type="button" class="op-btn">编辑</button>
              <button type="button" class="op-btn ml-10px" @click="linkTo({name:'process-detail-id',params:{id:'1'}})">详情</button>
              <div class="ml-10px relative op-btn cursor-pointer">
                <span class="inline-block align-middle leading-28px">更多</span>
                <div class="more-list">
                  <ul>
                    <li>阅卷任务</li>
                    <li>扫描批阅进度</li>
                    <li>考试分析</li>
                    <li>删除</li>
                  </ul>
                </div>
              </div>
              <button type="button" class="ml-10px inline-block align-middle arrow-btn up"></button>
            </div>
          </div>
          <div class="down pt-15px pl-35px">
            <ul class="subject-list">
              <li>
                <div>
                  <div class="w-140px h-195px m-auto">
                    <img src="/images/yuwen.png" class="w-full" alt="">
                  </div>
                  <div class="mt-5px">
                    <div class="inline-block align-middle process-state">
                      <h3 class="state-line">
                        <span style="width: 11%;"></span>
                      </h3>
                    </div>
                    <span class="ml-10px text-14px inline-block align-middle">11%</span>
                  </div>
                  <div class="mt-5px text-center">
                    <button type="button" class="op-btn">查看</button>
                  </div>
                </div>
              </li>
              <li>
                <div>
                  <div class="w-140px h-195px m-auto">
                    <img src="/images/shuxue.png" class="w-full" alt="">
                  </div>
                  <div class="mt-5px">
                    <div class="inline-block align-middle process-state">
                      <h3 class="state-line">
                        <span style="width: 11%;"></span>
                      </h3>
                    </div>
                    <span class="ml-10px text-14px inline-block align-middle">11%</span>
                  </div>
                  <div class="mt-5px text-center">
                    <button type="button" class="op-btn">查看</button>
                  </div>
                </div>
              </li>
              <li>
                <div>
                  <div class="w-140px h-195px m-auto">
                    <img src="/images/yingyu.png" class="w-full" alt="">
                  </div>
                  <div class="mt-5px">
                    <div class="inline-block align-middle process-state">
                      <h3 class="state-line">
                        <span style="width: 11%;"></span>
                      </h3>
                    </div>
                    <span class="ml-10px text-14px inline-block align-middle">11%</span>
                  </div>
                  <div class="mt-5px text-center">
                    <button type="button" class="op-btn">查看</button>
                  </div>
                </div>
              </li>
              <li>
                <div>
                  <div class="w-140px h-195px m-auto">
                    <img src="/images/wuli.png" class="w-full" alt="">
                  </div>
                  <div class="mt-5px">
                    <div class="inline-block align-middle process-state">
                      <h3 class="state-line">
                        <span style="width: 11%;"></span>
                      </h3>
                    </div>
                    <span class="ml-10px text-14px inline-block align-middle">11%</span>
                  </div>
                  <div class="mt-5px text-center">
                    <button type="button" class="op-btn">查看</button>
                  </div>
                </div>
              </li>
              <li>
                <div>
                  <div class="w-140px h-195px m-auto">
                    <img src="/images/huaxue.png" class="w-full" alt="">
                  </div>
                  <div class="mt-5px">
                    <div class="inline-block align-middle process-state">
                      <h3 class="state-line">
                        <span style="width: 11%;"></span>
                      </h3>
                    </div>
                    <span class="ml-10px text-14px inline-block align-middle">11%</span>
                  </div>
                  <div class="mt-5px text-center">
                    <button type="button" class="op-btn">查看</button>
                  </div>
                </div>
              </li>
              <li>
                <div>
                  <div class="w-140px h-195px m-auto">
                    <img src="/images/shengwu.png" class="w-full" alt="">
                  </div>
                  <div class="mt-5px">
                    <div class="inline-block align-middle process-state">
                      <h3 class="state-line">
                        <span style="width: 11%;"></span>
                      </h3>
                    </div>
                    <span class="ml-10px text-14px inline-block align-middle">11%</span>
                  </div>
                  <div class="mt-5px text-center">
                    <button type="button" class="op-btn">查看</button>
                  </div>
                </div>
              </li>
              <li class="cursor-pointer" @click="dialogVisible = true">
                <div class="subject-add-btn"></div>
              </li>
            </ul>
          </div>
        </div>
        <div class="line">
          <div class="up">
            <div class="w-60px">
              <p class="set-check single">
                <input type="checkbox" id="1" :value="1" v-model="chooseCheck">
                <label :for="1"></label>
              </p>
            </div>
            <div class="w-150px text-left">考试计划名称</div>
            <div class="w-250px">
              <span class="inline-block align-middle">进行中</span>
              <div class="inline-block align-middle ml-10px process-state">
                <h3 class="state-line">
                  <span style="width: 11%;"></span>
                </h3>
              </div>
              <span class="ml-10px inline-block align-middle">11%</span>
            </div>
            <div class="w-130px text-left">线下考试</div>
            <div class="w-130px text-left">联考</div>
            <div class="w-180px text-left">2023.2.4~2023.2.17</div>
            <div class="w-300px">
              <button type="button" class="op-btn">编辑</button>
              <button type="button" class="op-btn ml-10px">详情</button>
              <div class="ml-10px relative op-btn cursor-pointer">
                <span class="inline-block align-middle leading-28px">更多</span>
                <div class="more-list">
                  <ul>
                    <li>阅卷任务</li>
                    <li>扫描批阅进度</li>
                    <li>考试分析</li>
                    <li>删除</li>
                  </ul>
                </div>
              </div>
              <button type="button" class="ml-10px inline-block align-middle arrow-btn down"></button>
            </div>
          </div>
        </div>
      </div>

    </div>
    <div class="mt-20px page-new flex justify-end">
      <el-pagination v-model:current-page="cur_page" v-model:page-size="limit" layout="total,prev, pager, next" :total="total" :background="true" @current-change="handleSelectionChange"></el-pagination>
    </div>
  </div>
  <el-dialog
    v-model="dialogVisible"
    title="增加考试学科"
    width="500px"
    center
    append-to-body
  >
    <div>
      <el-form label-width="120px" size="large">
        <el-form-item label="请选择学科">
          <el-select v-model="add_sub_id" placeholder="请选择学科">
            <el-option v-for="item in subject_list" :label="item.label" :value="item.value" />
          </el-select>
        </el-form-item>
      </el-form>
    </div>
    <template #footer>
      <span class="dialog-footer text-right">
        <el-button @click="dialogVisible = false" size="large">取消</el-button>
        <el-button size="large" color="#003eee" type="primary" @click="dialogVisible = false">
          确定
        </el-button>
      </span>
    </template>

  </el-dialog>
  <commonFooter/>
</template>
<route lang="json">
{
"meta":{
"title":"阅卷流程",
"breadcrumb": true
}
}
</route>
<script setup>
import {process_list} from "~/pages/process/api";
import { useRouter } from "vue-router";
const router = useRouter();
console.log(router,87)
const linkTo = (obj) => {
  router.push(obj);
};
let exam_time = $ref('')
let exam_form = $ref('')
let exam_type = $ref('')
let keyword = $ref('')
let form_list = [{
  value: '1',
  label: '线上考试'
}, {
  value: '2',
  label: '线下考试'
}]
let type_list = [{
  value: '1',
  label: '周考'
}, {
  value: '2',
  label: '月考'
}, {
  value: '3',
  label: '期中'
},{
  value: '4',
  label: '期末'
}, {
  value: '5',
  label: '作业'
}, {
  value: '6',
  label: '测试'
}]
let subject_list = [{
  value: '1',
  label: '语文'
}, {
  value: '2',
  label: '数学'
}, {
  value: '3',
  label: '英语'
},{
  value: '4',
  label: '物理'
}, {
  value: '5',
  label: '生物'
}, {
  value: '6',
  label: '化学'
}]
let chooseCheck = $ref([]);
let checked = $ref(false);
let checkedIds = $ref([]);
let noData = $ref(null);
let limit = $ref(10);
let total = $ref(0);
let cur_page = $ref(1);
let listData = $ref([]);
let dialogVisible = $ref(false)
let add_sub_id = $ref('')
function chooseAll() {

}
function getListData() {
  let data = {
    page:cur_page,
    limit:limit,
  };
  process_list(data).then(res=>{
    if(res.code === '1') {
      listData = res.data.page_data;
      total = Number(res.data.total_rows);
      cur_page = Number(res.data.page_now);
    }
  })
}
getListData();
</script>
<style lang="scss" scoped>
$color: #003eee;
::v-deep .el-pagination.is-background .btn-next.is-active,
::v-deep .el-pagination.is-background .btn-prev.is-active,
::v-deep .el-pagination.is-background .el-pager li.is-active{
  background-color: $color;
}
.add-btn {
  width: 129px;
  height: 36px;
  background: #ffffff;
  border: 1px solid $color;
  border-radius: 4px;
  font-size: 14px;
  color: $color;
  text-align: center;
}

.del-btn {
  width: 92px;
  height: 36px;
  background: #ff0000;
  border-radius: 4px;
  font-size: 14px;
  color: #fff;
  text-align: center;
}

.process-list-table {
  width: 100%;
  min-height: 600px;

  .head {
    height: 50px;
    display: flex;
    background: $color;
    border-radius: 6px 6px 0 0;
    font-size: 16px;
    line-height: 50px;
    color: #fff;
  }

  .line {
    width: 100%;

    &:nth-child(odd) {
      >.up {
        border-radius: 4px;
        background: rgba(112, 175, 253, 0.1);
      }
    }

    >.up {
      display: flex;
      align-items: center;
      padding: 15px 0;
      font-size: 15px;
      color: #404040;
    }
  }
}

.set-check {
  position: relative;
  z-index: 40;
  width: 20px;
  height: 20px;
  margin: 15px auto 0;

  label {
    position: absolute;
    left: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
    border-radius: 3px;
  }

  input[type=checkbox] {
    width: 20px;
    height: 20px;
    opacity: 0;

    &:checked + label:after {

    }
  }

  &.all {
    label {
      border: 1px solid #fff;
    }

    input[type=checkbox] {
      &:checked + label {
        border-color: #fff;
      }

      &:checked + label:after {
        content: '';
        width: 14px;
        height: 8px;
        position: absolute;
        top: 3px;
        left: 2px;
        border: 2px solid #fff;
        border-top: none;
        border-right: none;
        -moz-transform: rotate(-45deg);
        -ms-transform: rotate(-45deg);
        -webkit-transform: rotate(-45deg);
        transform: rotate(-45deg);

      }
    }
  }

  &.single {
    margin: 0 auto;

    label {
      border: 1px solid #aaa;
    }

    input[type=checkbox] {
      &:checked + label {
        border-color: #003eee;
      }

      &:checked + label:after {
        content: '';
        width: 14px;
        height: 8px;
        position: absolute;
        top: 3px;
        left: 2px;
        border: 2px solid #003eee;
        border-top: none;
        border-right: none;
        -moz-transform: rotate(-45deg);
        -ms-transform: rotate(-45deg);
        -webkit-transform: rotate(-45deg);
        transform: rotate(-45deg);
      }
    }
  }
}

.process-state {
  width: 140px;

  .state-line {
    width: 100%;
    height: 5px;
    background: #e2e2e2;
    border-radius: 3px;

    span {
      display: block;
      height: 5px;
      background: #003eee;
      border-radius: 3px;
    }
  }

  .state-info {
    position: absolute;
    top: 8px;
    left: 0;
    width: 100%;
    font-size: 13px;
    color: #003eee;
    text-align: center;
  }
}

.op-btn {
  display: inline-block;
  vertical-align: middle;
  padding: 0 15px;
  height: 30px;
  background: #fff;
  border: 1px solid #003eee;
  border-radius: 4px;
  font-size: 14px;
  color: #003eee;
  text-align: center;

  &:disabled {
    background: #ccc;
    border-color: #ccc;
    color: #fff;
    cursor: default;
  }

  .more-list {
    display: none;
    position: absolute;
    left: 50%;
    top: 30px;
    margin-left: -50px;
    z-index: 50;
    width: 100px;
    padding-top: 5px;

    ul {
      width: 100%;
      background: #fff;
      box-shadow: 0 0 5px rgba(0, 0, 0, .3);

      li {
        width: 100%;
        height: 30px;
        font-size: 14px;
        color: #003eee;
        text-align: center;
        line-height: 30px;
        cursor: pointer;

        &.disabled {
          background: #fff !important;
          color: #ccc !important;
          cursor: default !important;
          pointer-events: none;
        }

        &:hover {
          background: #F0F7FF;
        }
      }
    }
  }

  &:hover {
    .more-list {
      display: block;
    }
  }
}
.arrow-btn{
  width: 21px;
  height: 13px;
  &.up{
    background: url("/images/arrow-up.png") center no-repeat;
  }
  &.down{
    background: url("/images/arrow-down.png") center no-repeat;
  }
}
.subject-list{
  display: flex;
  flex-wrap: wrap;
  li{
    width: 205px;
    height: 280px;
    margin: 0 28px 23px 0;
    border: 2px solid $color;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
}
.subject-add-btn{
  width: 57px;
  height: 57px;
  background: url("/images/icon-add.png") center no-repeat;
}
</style>
