<template>
  <div class="app-container">

    <div class="header_main">

      <el-dropdown trigger="click" placement="bottom-start">
        <div class="select_address el-dropdown-link">
          <span class="sanjiao-right"></span>
          <p>大足区</p>
        </div>
        <el-dropdown-menu slot="dropdown" style="width: 8vw;text-align: center;">
          <el-dropdown-item v-for="(item,index) in 5">
            <div class="selected">
              <p>张家镇</p>
            </div>
          </el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>

      <el-dropdown trigger="click" placement="bottom-start">
        <div class="select_address el-dropdown-link">
          <span class="sanjiao-right"></span>
          <p>张家镇</p>
        </div>
        <el-dropdown-menu slot="dropdown" style="width: 8vw;text-align: center;">
          <el-dropdown-item v-for="(item,index) in 5">
            <div class="selected">
              <p>张家镇</p>
            </div>
          </el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>

      <p class="todo_num">已处理村庄：<span>19</span>个</p>
      <p class="todo_num2">超时完成村庄：<span>1</span>个</p>

    </div>

    <div class="main">

      <div class="left_main">
        <el-table :data="tableData" style="width: 100%;" :default-sort = "{prop: 'date', order: 'descending'}">

          <el-table-column type="expand">
            <template slot-scope="props">
              <div class="openTable">
                <el-table :data="tableData" style="width: 100%;background-color: transparent;" :default-sort = "{prop: 'date', order: 'descending'}">
                  <el-table-column prop="value1" label="村" show-overflow-tooltip />
                  <el-table-column prop="value1" label="合作社" show-overflow-tooltip />
                  <el-table-column prop="value2" label="记账笔数" show-overflow-tooltip >
                    <template slot-scope="scope">
                      5 <span class="num">7</span>
                    </template>
                  </el-table-column>
                  <el-table-column prop="value3" label="合同数量" show-overflow-tooltip />
                  <el-table-column prop="value4" label="其他" show-overflow-tooltip />
                  <el-table-column prop="value5" label="任务总数" show-overflow-tooltip />
                  <el-table-column prop="value9" label="操作">
                    <template slot-scope="scope">
                      <div class="setting">
                        <el-button type="primary" size="mini" icon="el-icon-edit"></el-button>
                        <img src="../../assets/images/toBeAllocated_icon_delete.png" alt="">
                        <span class="name">王五</span>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column prop="value7" label="截至日期" show-overflow-tooltip />
                </el-table>
              </div>
            </template>
          </el-table-column>

          <el-table-column prop="value1" label="镇/街" show-overflow-tooltip />
          <el-table-column prop="value2" label="村账数量" show-overflow-tooltip />
          <el-table-column prop="value3" label="合作社数量" show-overflow-tooltip />
          <el-table-column prop="value4" label="记账笔数" show-overflow-tooltip >
            <template slot-scope="scope">
              5 <span class="num">7</span>
            </template>
          </el-table-column>
          <el-table-column prop="value5" label="合同数量" show-overflow-tooltip />
          <el-table-column prop="value6" label="其他" show-overflow-tooltip />
          <el-table-column prop="value7" label="任务总数" show-overflow-tooltip />
          <el-table-column prop="value8" label="操作" show-overflow-tooltip >
            <template slot-scope="scope">
              <el-button type="primary" size="mini" icon="el-icon-edit"></el-button>
            </template>
          </el-table-column>

        </el-table>

        <img src="../../assets/images/toBeAllocated_icon_none.png" alt="" class="table_none">

      </div>

      <div class="right_main">

        <div class="right_top_main">

          <div class="title">
            <i></i>
            <p>任务日期</p>
          </div>

          <div class="right_top_block">
            <div class="time_main">
              <span class="sanjiao-top" @click="addDate"></span>
              <p @click = "selectionRange">{{year}}</p>
              <el-date-picker
                v-model="year"
                type="year"
                class="pickerTime"
                ref = "datePicker"
                value-format="yyyy"
                placeholder="选择年">
              </el-date-picker>
              <span class="sanjiao-bottom" @click="reduceDate"></span>
            </div>

            <div class="month_main">
              <p v-for="(item,index) in 12" :class="{'active':index==3}">{{index+1}}月<i v-if="index==3"></i></p>
            </div>
          </div>

        </div>

        <div class="right_bottom_main">

          <div class="title">
            <i></i>
            <p>任务看板</p>
          </div>

          <div class="right_top_block">
            <el-row>
              <el-col span="8">姓名</el-col>
              <el-col span="8" align="center">未完成</el-col>
              <el-col span="8" align="center">任务期限</el-col>
            </el-row>
            <el-row v-for="(item,index) in 10">
              <el-col span="8">张三</el-col>
              <el-col span="8">19 <span class="num">1</span><span class="num2">10</span></el-col>
              <el-col span="8" align="center">
                <span class="no_yes">未选中</span>
                <div class="num_input">
                  <span @click="reduceNum">-</span>
                  <p>{{num}}</p>
                  <span @click="addNum">+</span>
                </div>
              </el-col>
            </el-row>
          </div>

        </div>


      </div>

    </div>


  </div>
</template>

<script>
  export default {
    name: "processed",
    data() {
      return {
        tableData: [{
          value1: '当当村',
          value2: '5',
          value3: '8',
          value4: '5',
          value5: '5',
          value6: '18',
          value7: '63',
          value8: '2023.03.06',
          value9: '111'
        }, {
          value1: '当当村',
          value2: '5',
          value3: '8',
          value4: '5',
          value5: '5',
          value6: '18',
          value7: '63',
          value8: '2023.03.06',
          value9: '111'
        }, {
          value1: '当当村',
          value2: '5',
          value3: '8',
          value4: '5',
          value5: '5',
          value6: '18',
          value7: '63',
          value8: '2023.03.06',
          value9: '111'
        }, {
          value1: '当当村',
          value2: '5',
          value3: '8',
          value4: '5',
          value5: '5',
          value6: '18',
          value7: '63',
          value8: '2023.03.06',
          value9: '111'
        }],
        year:'2023',
        num:0
      }
    },
    created() {

    },
    methods:{
      addDate(){
        this.year = Number(this.year) + 1 ;
      },
      reduceDate(){
        this.year = Number(this.year) - 1 ;
      },
      addNum(){
        this.num = Number(this.num) + 1 ;
      },
      reduceNum(){
        if(this.num==0){return;}
        this.num = Number(this.num) - 1 ;
      },
      selectionRange(){
        this.$refs.datePicker.focus();
      },
    },
    mounted(){

    }
  }
</script>

<style lang="scss" scoped>
  p{margin: 0;line-height: 1;}
  .app-container{
    background-color: #f5f6f8;
    width: 100vw;
    height: 100vh;
  }

  .selected{
    display: flex;
    height: 4vh;
    p{
      width: 8vw;
      line-height: 4vh;
      text-align: center;
    }
  }
  .pickerTime{
    opacity: 0;
    position: absolute;
    left: 0px;
    top: 30px;
    width: 5px;
    height: 5px;
    z-index: -1;
  }
  .el-dropdown-link {
    cursor: pointer;
  }

  .setting{
    display: flex;
    align-items: center;
  }
  .title{
    display: flex;
    align-items: center;
    i{
      display: inline-block;
      width: 5px;
      height: 20px;
      background: #4d7cfe;
      border-radius: 5px;
      margin-right: 10px;
    }
    p{
      font-size: 18px;
    }
  }

  ::v-deep .el-table .cell{
    text-align: center;
  }

  ::v-deep .el-table .el-table__cell{
    border: none!important;
  }
  ::v-deep .el-table::before{
    display: none;
  }
  ::v-deep .el-table .el-table__header-wrapper th{
    background-color: transparent;
  }
  ::v-deep .el-table tr{
    background-color: transparent;
  }

  .num{
    color: #3976ff;
    display: inline-block;
    background-color: #e2ebff;
    width: 1.8vw;
    border-radius: 5px;
    margin-left: 5px;
    text-align: center;
  }

  .num2{
    color: #ffffff;
    display: inline-block;
    background-color: #3976ff;
    width: 1.8vw;
    border-radius: 5px;
    margin-left: 5px;
    text-align: center;
  }

  .no_yes{
    color: #9a9a9a;
    display: none;
  }

  .num_input{
    display: flex;
    align-items: center;
    justify-content: center;
    span{
      background-color: #3976ff;
      color: #ffffff;
      width: 25px;
      height: 25px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 8px;
      cursor: pointer;
    }
    p{
      width: 3vw;
      border: 1px solid #3976ff;
      margin: 0 .3vw;
      color: #3976ff;
      height: 25px;
      line-height: 25px;
      border-radius: 8px;
    }
  }

  .table_none{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
  }

  .name{
    color: #666666;
    display: inline-block;
    background-color: #e2ebff;
    width: 3.5vw;
    border-radius: 5px;
    margin-left: 5px;
  }
  .openTable{
    background-color: #eef3fd;
    padding: 0 2.5vw 2vh;
    ::v-deep .el-table__body{
      background-color: #ffffff;
      border-radius: 15px;
      overflow: hidden;
    }
  }

  .header_main{
    display: flex;
    align-items: center;
    position: relative;
    .selected{
      width: 16vw;
      background-color: #ffffff;
      position: absolute;
      top: 4vh;
      left: 10vw;
      z-index: 9;
      border-radius: 8px;
      box-shadow: 0 10px 10px #dedfe1;
      padding: 1vh 0;
      div{
        display: flex;
        height: 4vh;
        p{
          width: 8vw;
          line-height: 4vh;
          text-align: center;
        }
      }
    }
    .select_address{
      display: flex;
      align-items: center;
      justify-content: center;
      margin-right: 2vw;
      background-color: #ffffff;
      padding: 0px 0px;
      border-radius: 8px;
      box-shadow: 0 0 10px #dedfe1;
      width: 8vw;
      height: 4vh;
      overflow: hidden;
      &:nth-child(2){
        margin-right: 0vw;
      }
      &:nth-child(3){
        margin-right: 0vw;
        border-top-left-radius: initial;
        border-bottom-left-radius: initial;
      }
      .sanjiao-right {
        display: inline-block;
        border-left: 8px solid #000;
        border-left-color: initial;
        border-top: 5px solid transparent;
        border-bottom: 5px solid transparent;
        margin-right: 5px;
      }
      .select_time{
        text-align: center;
        width: 100%;
        height: 4vh;
        line-height: 4vh;
        background-color: #3976ff;
        color: #ffffff;
      }
    }
    .todo_num{
      margin-left: auto;
      span{
        font-size: 24px;
        color: #3976ff;
      }
    }
    .todo_num2{
      margin-left: 2vw;
      span{
        font-size: 24px;
        color: #ef0027;
      }
    }
  }

  .main{
    display: flex;
    .left_main{
      width: 72%;
      margin-right: 0.57%;
      margin-top: 15px;
      border-radius: 8px;
      box-shadow: 4px 0px 10px rgba(0, 0, 0, 0.13);
      background: #fff;
      padding: 15px 20px;
      height: calc(100vh - 91px);
      position: relative;
    }

    .right_main{
      width: 27.43%;
      .right_top_main{
        margin-top: 15px;
        border-radius: 8px;
        box-shadow: 4px 0px 10px rgba(0, 0, 0, 0.13);
        background: #fff;
        padding: 15px 20px;
        .right_top_block{
          display: flex;
          align-items: center;
        }
      }
      .right_bottom_main{
        margin-top: 15px;
        border-radius: 8px;
        box-shadow: 4px 0px 10px rgba(0, 0, 0, 0.13);
        background: #fff;
        padding: 15px 20px;
        .right_top_block{
          ::v-deep .el-col-8{
            padding-top: 15px ;
          }
        }
      }
    }

  }

  .sanjiao-top {
    display: inline-block;
    border-bottom: 8px solid #414141;
    border-bottom-color: initial;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
  }

  .sanjiao-bottom {
    display: inline-block;
    border-top: 8px solid #414141;
    border-top-color: initial;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
  }

  .time_main{
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f5f6f8;
    color: #414141;
    width: 15%;
    margin-top: 15px;
    padding: 15px 0;
    border-radius: 8px;
    height: 82px;
    position: relative;
    cursor: pointer;
    p{
      margin: 10px 0;
    }
  }

  .month_main{
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 15px;
    color: #414141;
    background-color: #f5f6f8;
    height: 82px;
    flex: 1;
    margin-left: 1vw;
    border-radius: 8px;
    p{
      /*margin-top: 3vh;*/
      width: 16%;
      position: relative;
      text-align: center;
      &.active{
        color: #3976ff;
      }
      &:hover{
        color: #3976ff;
        cursor: pointer;
      }
      i{
        display: block;
        width: 5px;
        height: 5px;
        background-color: #fc5659;
        position: absolute;
        top: -5px;
        right: 12px;
        border-radius: 100%;
      }
    }

  }

</style>
