<template>
  <div class="max-big-box">
    <div class="big-max-box" v-if="pageType==1">
      <!--返回按钮-->
      <div class="out-page-button cursor_pointer" @click="outButton">
        <img src="~@/assets/images/icon_25.png">
        <p>返回</p>
      </div>
      <!--操作按钮-->
      <div class="top-box">
        <div class="input-box">
          <input class="search-input" type="text" placeholder="请输入任务名称/任务执行地点关键字进行查询">
          <div class="dropdown-box" v-for="(item,index) in downList" :key="index">
            <p class="dropdown-left-title">{{item.name}}：</p>
            <div class="dropdown-right-box cursor_pointer"
                 @mouseenter="dropdownClickOpen(index,'1')" @mouseleave="dropdownClickOpen(index,'2')">
              <p class="dropdown-text">{{downList[index].downText}}</p>
              <div class="dropdown-for-max" v-if="downList[index].downType">
                <p v-for="(item,indexTwo) in downList[index].list" :key="indexTwo"
                   :class="{'color-A':downList[index].mouseColor == item}"
                   @mouseenter="colorTypeEnter(index,item)" @mouseleave="colorTypeLeave(index)"
                   @click="dropdownClick(index,item)">{{item}}</p>
              </div>
            </div>
          </div>
          <div class="button-box cursor_pointer">
            <img src="~@/assets/images/icon_27.png">
            <p class="cursor_pointer">查询</p>
          </div>
        </div>
      </div>
      <!--表格-->
      <div class="table-box">
        <el-table
          ref="multipleTable"
          :row-key="getRowKey"
          :data="tableData"
          tooltip-effect="dark"
          style="width: 100%">
          <el-table-column
            type="index"
            :index="indexMethod"
            label="序号"
            width="90">
          </el-table-column>
          <el-table-column
            prop="name"
            label="任务名称"
            width="177">
          </el-table-column>
          <el-table-column
            prop="warehouse"
            label="任务类型"
            width="140">
          </el-table-column>
          <el-table-column
            prop="supplies"
            label="单位名称"
            width="156">
          </el-table-column>
          <el-table-column
            prop="unit"
            label="医疗队名称"
            width="140">
          </el-table-column>
          <el-table-column
            prop="typeBig"
            label="任务执行时间"
            width="218">
          </el-table-column>
          <el-table-column
            prop="typeMin"
            label="任务执行地点"
            width="175">
          </el-table-column>
          <el-table-column
            prop="intoBound"
            label="任务内容"
            width="249">
          </el-table-column>
          <el-table-column
            prop="outBound"
            label="任务状态"
            width="140">
            <template slot-scope="scope">
              <p :class="{'colorA':scope.row.outBound==1,'colorB':scope.row.outBound==2,'colorC':scope.row.outBound==3}">{{ scope.row.outBound==1?"出发拉动":(scope.row.outBound==2?"到达地点":(scope.row.outBound==3?"执行完毕返回":"")) }}</p>
            </template>
          </el-table-column>
          <el-table-column
            label="历史行驶轨迹"
            width="224">
            <template slot-scope="scope">
              <p class="button-p cursor_pointer" @click="pageTypeClick">查看</p>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <el-pagination
        background
        @current-change="handleCurrentChange"
        layout="prev, pager, next"
        :current-page="currentPage"
        :page-size="pagesize"
        :total="total">
      </el-pagination>
    </div>
    <view-historical-driving-trails
      v-if="pageType==2">
    </view-historical-driving-trails>
  </div>
</template>

<script>
  export default {
    name: "history",//历史轨迹
    components:{
      viewHistoricalDrivingTrails: resolve => {require(['@/components/directorateDecisionSupport/positioningMonitoringView/viewHistoricalDrivingTrails'], resolve)},//任务详细信息查看
    },
    data () {
      return {
        pageType:1,
        //表格限制
        pagesize: 8,
        currentPage:1,
        //列表总数
        total:0,
        /*数据*/
        tableData:[
          {
            id:"1",
            name:"第1318紧急拉动",
            warehouse:"战备拉动",
            supplies:"服务保障中心",
            unit:"野战医院",
            typeBig:"2021-1-1 10:10",
            typeMin:"重庆市************",
            intoBound:"本次任务内容主要为了本次任务出动主要是...",
            outBound:"1",
          },
          {
            id:"2",
            name:"第1318紧急拉动",
            warehouse:"战备拉动",
            supplies:"服务保障中心",
            unit:"野战医院",
            typeBig:"2021-1-1 10:10",
            typeMin:"重庆市************",
            intoBound:"本次任务内容主要为了本次任务出动主要是...",
            outBound:"1",
          },
          {
            id:"3",
            name:"第1318紧急拉动",
            warehouse:"战备拉动",
            supplies:"服务保障中心",
            unit:"野战医院",
            typeBig:"2021-1-1 10:10",
            typeMin:"重庆市************",
            intoBound:"本次任务内容主要为了本次任务出动主要是...",
            outBound:"1",
          },
          {
            id:"4",
            name:"第1318紧急拉动",
            warehouse:"战备拉动",
            supplies:"服务保障中心",
            unit:"野战医院",
            typeBig:"2021-1-1 10:10",
            typeMin:"重庆市************",
            intoBound:"本次任务内容主要为了本次任务出动主要是...",
            outBound:"1",
          },
        ],
        //下拉框
        downList:[
          {
            name:"单位名称",
            downType:false,
            downText:"全部",
            mouseColor:"",
            list:["全部","西南医院","新桥医院",]
          },
          {
            name:"医疗队名称",
            downType:false,
            downText:"全部",
            mouseColor:"",
            list:["全部","第一医疗队","第二医疗队",]
          },
        ],
      }
    },

    created(){

    },
    mounted() {

    },
    methods: {
      pageTypeClick(){
        this.pageType = 2;
      },
      //下拉菜单进入悬浮状态
      colorTypeEnter(type,item){
        this.downList[type].mouseColor=item;
      },
      //下拉菜单离开悬浮状态
      colorTypeLeave(type){
        this.downList[type].mouseColor = "";
      },
      // 下拉菜单选项悬浮事件
      dropdownClickOpen(type,state){
        if(state==1){
          this.downList[type].downType = true
        }else if(state==2){
          this.downList[type].downType = false
        }
      },
      // 下拉菜单点击事件
      dropdownClick(type,item){
        this.downList[type].downText = item;
        this.downList[type].downType = false;
      },
      //表格绑定ID
      getRowKey (row) {
        return row.id
      },
      indexMethod(index) {
        return (this.currentPage-1)*this.pagesize+index+1;
      },
      //翻页
      handleCurrentChange(val) {
        console.log(`当前页: `,val);
        this.currentPage = val;
      },
      //供子组件调用方法
      outPage(){
        this.pageType = 1;
      },
      // 调用父组件方法退出当前页面
      outButton(){
        this.$parent.outPage();
      },
    }
  }
</script>

<style scoped lang="stylus">
  .max-big-box
    display flex
    flex-direction column
    flex:1;
    .big-max-box
      display flex
      flex-direction column
      flex:1;
      //返回按钮
      .out-page-button
        height:30px;
        width:93px;
        margin:0 0 0 106px;
        background:url("~@/assets/images/button_02.png");
        background-size 100% 100%
        display flex
        img
          display block
          height:12px;
          width:7px;
          margin:9px 10px 0 22px;
        p
          line-height:30px;
          font-size:$font_12;
          color:$color_ff;
          text-align left
      //搜索与操作按钮
      .top-box
        height:30px;
        margin-top:20px;
        .input-box
          width:1700px;
          height:30px;
          display flex
          margin-left:105px;
          .search-input
            height:28px;
            width:290px;
            border:1px solid $theme;
            padding-left:10px;
          .dropdown-box
            display flex
            color:$color_ff;
            z-index:1;
            margin-left:30px;
            .dropdown-left-title
              line-height:30px;
              font-size:$font_14;
            .dropdown-right-box
              font-size:$font_12;
              .dropdown-text
                width:160px;
                height:30px;
                line-height:30px;
                background:url("~@/assets/images/button_15.png");
                background-size:100% 100%;
              .dropdown-for-max
                background:$backColor1;
                border-bottom-right-radius 4px
                border-bottom-left-radius 4px
                p
                  width:160px;
                  height:30px;
                  line-height:30px;
                .color-A
                  /*
                  background:$backColor2 !important;
                  color:$color_ff !important;
                  */
                  color:$theme !important;
                  border-bottom-right-radius 4px
                  border-bottom-left-radius 4px
          .button-box
            margin-left:32px;
            display flex
            height:30px;
            width:80px;
            background:url("~@/assets/images/button_03.png");
            background-size:100% 100%;
            img
              display block
              height:20px;
              width:20px;
              margin:5px 6px 0 13px;
            p
              line-height:30px;
              font-size:$font_12;
              color:$color_ff;
      //表格
      .table-box
        width:1710px !important;
        margin:20px 105px;
        text-align center !important
        .button-p
          width:80px;
          line-height:30px;
          color:$color_ff;
          border-radius:4px;
          background:url("~@/assets/images/button_03.png");
          background-size:100% 100%;
          margin:0 auto;
        .colorA
          color:$theme2;
        .colorB
          color:$theme3;
        .colorC
          color:$theme1;
      //时间日历
      .time-max-big-box
        z-index 6
        height:100%;
        width:100%;
        position: absolute
        top:0;
        left:0;
        background:rgba(0,0,0,0.3);
        .time-big-box
          z-index 6
          height:750px;
          width:660px;
          position: absolute
          top:50%;
          left:50%;
          transform :translate3d(-50%,-50%,0)
          margin:auto;
          background $color_ff
          border-radius:8px;
          border:4px solid $theme;
          .button-box
            display flex
            color:$color_ff;
            width:260px;
            margin:20px auto;
            p:nth-child(1)
              height:30px;
              line-height:30px;
              width:120px;
              background:url("~@/assets/images/button_10.png");
              background-size 100% 100%
            p:nth-child(2)
              margin-left:20px;
              height:30px;
              line-height:30px;
              width:120px;
              background:url("~@/assets/images/button_05.png");
              background-size 100% 100%
            p:nth-child(3)
              margin-left:20px;
              height:30px;
              line-height:30px;
              width:120px;
              background:url("~@/assets/images/button_02.png");
              background-size 100% 100%
    //修改日期选择样式
    /*
    .el-calendar
      background $color_ff
    */
    //修改table表格样式
    .el-table
      background rgba(6,177,240,0.2)
    .el-table /deep/ .el-table__empty-text
      width: 100%;
      text-align left
      margin-left:825px;
    .el-table /deep/ .el-table__body-wrapper::-webkit-scrollbar
      width: 4px;     /*高宽分别对应横竖滚动条的尺寸*/
      height: 4px;
    .el-table /deep/ .el-table__body-wrapper::-webkit-scrollbar-thumb
      border-radius: 5px;
      -webkit-box-shadow: inset 0 0 5px $theme;
      background: $theme;
    .el-table /deep/ .el-table__body-wrapper::-webkit-scrollbar-track
      -webkit-box-shadow: inset 0 0 5px rgba(255,255,255,0);
      border-radius: 0;
      background: rgba(255,255,255,0);
    .el-table /deep/ tr
    .el-table /deep/ th
      background rgba(6,177,240,0)
    .el-table::before
      height:0;
    .el-table /deep/ .cell
      max-height:46px;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      overflow: hidden;
    .el-table /deep/ td
    .el-table /deep/ th.is-leaf
      border-bottom:0!important;
    .el-table /deep/ .el-checkbox__inner
      //background rgba(6,177,240,0.2)
      border 1px solid #216f93 !important
    .el-table /deep/ thead
      color:$color_ff;
    .el-table
      color:$color_a1
    .el-table /deep/ th
      text-align-last: center;
    .el-table /deep/ td
      text-align-last: center;
    .el-table /deep/ tbody tr:hover > td
      background rgba(6,177,240,0.2)
      color:$theme;
    .el-table /deep/ .el-checkbox
      width:14px;
      margin:0 auto;
      display block
    //修改动作条样式
    .el-pagination.is-background /deep/ .btn-next
    .el-pagination.is-background /deep/ .btn-prev
    .el-pagination.is-background /deep/ .el-pager li
      background:url("~@/assets/images/button_13.png");
      color:$color_ff;
    .el-pagination.is-background /deep/ .el-pager li:not(.disabled).active
      background:url("~@/assets/images/button_14.png");
      color:$color_ff;
    .colorA
      color :$theme;
    ::-webkit-input-placeholder
      color: $border_1;
    ::-moz-placeholder
      color: $border_1;
    ::-ms-input-placeholder
      color: $border_1;

</style>
