<template>
  <div>

    <div>
      <div ref="lxHeader">
        <lx-header icon="md-apps" :text="$route.meta.title" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
          <div slot="content">
            <div class="searchwrap" style="display: flex;align-items: center;">
              <div>
                <el-input v-model="select.name" placeholder="请输入课程名称"></el-input>
              </div>
              <div>
                <el-date-picker v-model="select.daterange" type="daterange" range-separator="至" start-placeholder="开课日期"
                  end-placeholder="结束日期">
                </el-date-picker>
              </div>
              <div>
                <el-select v-model="select.type" placeholder="请选择类别" clearable>
                  <el-option v-for="item in type_options" :key="item.id" :label="item.value" :value="item.id">
                  </el-option>
                </el-select>
              </div>
              <div>
                <el-button type="primary" size="small">查询</el-button>
              </div>
            </div>
          </div>

        </lx-header>
      </div>
    </div>

    <div>
      <xy-table :list="list" :total="total" :table-item="table_item">
      </xy-table>
    </div>

  </div>
</template>

<script>


  export default {
    components: {

    },
    data() {
      return {
        select: {
          name: '',
          daterange: '',
          type: ''
        },
        type_options: [{
          id: 0,
          value: '常规课程'
        }, {
          id: 1,
          value: '短期课程'
        }],
        status_options: [{
          id: 0,
          value: '进行中'
        }, {
          id: 1,
          value: '未开始'
        }],
        list: [{
          name: '第六期高级科创人才研修班',
          daterange: '2024.3.1-2024.9.1',
          type: '常规课程',
          total: 60,
          now_apply:50,
          success_apply:20,
          no_apply:5,
          by_apply:25
        }],
        total: 0,
        table_item: [{
          prop: 'name',
          label: '课程名称',
          align: 'left'
        }, {
          prop: 'daterange',
          label: '开课日期',
          align: 'center',
          width: 180,
        }, {
          prop: 'type',
          label: '类别',
          align: 'center',
          width: 160,
        }, {
          prop: 'total',
          label: '拟开课人数',
          align: 'center',
          width: 120,
        }, {
          prop: 'now_apply',
          label: '目前报名人数',
          align: 'center',
          width: 120,
          customFn: (cell) => {
            return ( < div style = {{cursor: 'pointer',color: "blue",textDecoration: "underline"}}
            on = {
              {
                ['click']: (e) => {
                  if(cell.now_apply<1){
                    return
                  }
                  this.goApply()
                }
              }
            }
            >
            {
              cell.now_apply?cell.now_apply:0
            } </div> )
          }
        }, {
          prop: 'success_apply',
          label: '审核通过人数',
          align: 'center',
          width: 120,
          customFn: (cell) => {
            return ( < div style = {{cursor: 'pointer',color: "blue",textDecoration: "underline"}}
            on = {
              {
                ['click']: (e) => {
                  if(cell.success_apply<1){
                    return
                  }
                  this.goApply()
                }
              }
            }
            >
            {
              cell.success_apply?cell.success_apply:0
            } </div> )
          }
        }, {
          prop: 'no_apply',
          label: '审核不通过人数',
          align: 'center',
          width: 120,
          customFn: (cell) => {
            return ( < div style = {{cursor: 'pointer',color: "blue",textDecoration: "underline"}}
            on = {
              {
                ['click']: (e) => {
                  if(cell.no_apply<1){
                    return
                  }
                  this.goApply()
                }
              }
            }
            >
            {
              cell.no_apply?cell.no_apply:0
            } </div> )
          }
        }, {
          prop: 'by_apply',
          label: '待审核人数',
          align: 'center',
          width: 120,
          customFn: (cell) => {
            return ( < div style = {{cursor: 'pointer',color: "blue",textDecoration: "underline"}}
            on = {
              {
                ['click']: (e) => {
                  if(cell.by_apply<1){
                    return
                  }
                  this.goApply()
                }
              }
            }
            >
            {
              cell.by_apply?cell.by_apply:0
            } </div> )
          }
        }]

      }
    },
    created() {

    },
    methods: {
      goApply(){
        this.$router.push({
          path: '/course/apply_list'
        })
      },
    }
  }
</script>

<style lang="scss" scoped>
  .searchwrap {
    display: flex;
    align-items: center;

    &>div {
      display: flex;
      align-items: center;
      margin-right: 10px;

      span {
        min-width: 70px;
      }
    }
  }
</style>
