<template>
  <div class="mc-wrap">
    <div class="container-box">
      <div class="mc-top">
        <div class="mc-top-left">
             <div class="car-line">
                <div style="height:20px;"></div>
                 <div class="task_list">           
                    <el-tabs v-model="activeTab" @tab-click="handleClick"  style="width: 100%">
                        <el-tab-pane label="待办任务" name="first">
                        <div class="task_list">  
                            <mySearch :searchList="searchList" @searchInfo="searchInfo"></mySearch>
                        </div>
                          <el-table   
                              class="com-table" 
                              ref="multipleTable" 
                              :data="toDoList"  
                              tooltip-effect="dark"   
                              size="small"  
                              border 
                              style="width: 100%" 
                              height="350px" 
                              v-loading="toDoLoading"  
                              :cell-style="{ background: '#fff' }"
                            >
                              <el-table-column type="index" width="50" align="center" label="序号"></el-table-column>
                              <el-table-column label="任务编号" prop="taskId"   align="center"></el-table-column>
                              <!--<el-table-column label="任务名称" prop="woTitle" align="center"></el-table-column>-->
                              <el-table-column label="任务名称" prop="taskName" align="center"></el-table-column>
                              <el-table-column label="工单编码" prop="woNo"     align="center"></el-table-column>
                              <el-table-column label="流程名称" prop="procName" align="center"></el-table-column>
                              <el-table-column label="流程编码" prop="procId"  align="center"></el-table-column>
                              <el-table-column label="版本" prop="procVersion" width="60px" align="center"></el-table-column>
                              <el-table-column label="状态" prop="stsDesc" width="60px" align="center"></el-table-column>
                              <el-table-column label="操作" align="center">
                                <template slot-scope="scope">
                                  <el-button size="small" @click="dealItem(scope.row)">处理</el-button>
                                </template>
                              </el-table-column>
                          </el-table>
                        <el-pagination
                        class="pageBox"
                        @current-change="currchange1"
                        layout="prev, pager, next"
                        background
                        :total="total1"
                      >
                      </el-pagination>
                        </el-tab-pane>

                        <el-tab-pane label="已办任务" name="second">
                          <div class="task_list">  
                              <mySearch :searchList="searchList" @searchInfo="searchInfox"></mySearch>
                          </div>
                        
                        
                        <el-table height="450px"
                              v-loading="loading"
                              class="com-table"
                              ref="multipleTable"
                              :data="downData"
                              tooltip-effect="dark"
                              size="small"
                              border
                              style="width: 100%;"
                            >
                          <el-table-column align="center" prop="taskId" show-overflow-tooltip label="任务编码"></el-table-column>
                          <el-table-column prop="taskName" label="任务名称" align="left" show-overflow-tooltip ></el-table-column>
                          <el-table-column align="center" prop="woNo" show-overflow-tooltip label="工单编号"></el-table-column>
                          <el-table-column align="center" prop="stsDesc" label="工单状态"> </el-table-column>
                           <el-table-column align="center" prop="procId" show-overflow-tooltip label="流程编号"> </el-table-column>
                          <el-table-column align="center"  prop="procName" label="流程名称" show-overflow-tooltip >  </el-table-column>
                                    <el-table-column align="center" prop="opName" label="处理人">
                                    </el-table-column>
                                    <el-table-column
                                      align="center"
                                      prop="opTime"
                                      show-overflow-tooltip
                                      label="处理时间"
                                    >
                                    </el-table-column>

                                    <el-table-column align="center" prop="dealType" label="操作">
                                      <template slot-scope="scope">
                                        <el-button
                                          size="mini"
                                          plain
                                          type="primary"
                                          @click="detailes(scope.row)"
                                          >轨迹</el-button
                                        >
                                      </template>
                                    </el-table-column>
                        </el-table>

                      <el-pagination
                        class="pageBox"
                        @current-change="currchange"
                        layout="prev, pager, next"
                        background
                        :total="total"
                      >
                      </el-pagination>
                          </el-tab-pane>
                    </el-tabs>
                </div>
             </div>
              </div>
            </div>
    </div>


    <el-dialog
      :modal-append-to-body="false"
      :close-on-click-modal="true"
      title="流程轨迹"
      :visible.sync="dateVisible"
      width="80%"
    >
      <div style="height: 500px; width: 100%">
        <iframe
          width="100%"
          height="100%"
          :src="`/static/views/flow/flowDesignPrew.html?prevFlag=true&woNo=${rowData.woNo}&taskName=${rowData.actionName}&fqFlag=Y&procId=${rowData.procId}#&woTitle=${rowData.procName}&procName=${rowData.procName}&procVersion=${rowData.procVersion}`"
          frameborder="0"
        ></iframe>
      </div>
    </el-dialog>

  </div>
</template>
<script>
import mySearch from "@/components/search";
export default {
  components: {mySearch},
  data() {
    return {
      activeTab: "first",
      info:{},
      bannerData: [
        {src: require("../../../../static/img/bannar-1.png"),id: "1",},
        {src: require("../../../../static/img/bannar-1.png"), id: "2",},
        {src: require("../../../../static/img/bannar-1.png"), id: "3",},
      ],
      toDoList:[],
      downData:[],
      itemList:[],
      rowData:[],
      toDoLoading:false,
      loading:false,
      dateVisible:false,
      params:[],
      searchParams:[],
      searchParamsx:[],
      searchList: [
        {type: "input",	tit: "任务名称",	value: "",	width: "30%"},
        {type: "input",	tit: "任务编号",	value: "",	width: "30%"},
        {type: "input",	tit: "工单编号",	value: "",	width: "30%"},

      ],
      total:0,
      total1:0,
      pageSize:10,
      type:1
    };
  },
  methods: {
    handleClick(){

    },
    searchInfo(v){
      this.searchParams = {};
      //v[0] ? (this.searchParams.woTitle = v[0]) : "";
      v[0] ? (this.searchParams.taskName = v[0]) : "";
      v[1] ? (this.searchParams.taskId = v[1]) : "";
      v[2] ? (this.searchParams.woNo = v[2]) : "";
      this.searchParams.procName="互联网电视引入流程"
      this.loadToDoData(this.searchParams,1)
    },
    searchInfox(v){
      this.searchParamsx = {};
      v[0] ? (this.searchParamsx.taskName = v[0]) : "";
      v[1] ? (this.searchParamsx.taskId = v[1]) : "";
      v[2] ? (this.searchParamsx.woNo = v[2]) : "";
      this.searchParamsx.procName="互联网电视引入流程"
      this.searchParamsx.sts="1";
      this.loadToDoDatax(this.searchParamsx,1)
    },
    detailes(row){
      this.rowData = row;
      this.dateVisible = true;
    },
    
    dealItem(row){
      let woNo = row.woNo
      let taskId = row.taskId
      let stepId = row.stepId
      let procId = row.procId
      let procVersion = row.procVersion
      let params = "&woNo="+woNo+"&taskId="+taskId+"&stepId="+stepId+"&procId="+procId+"&procVersion="+procVersion;
      let taskName = row.taskName;
      let path = ""
      if(taskName==="资质审核"){
          path="/auditQualification"
      }else if(taskName==="指定评估专家"){
          path = "/assignExpert"
      }else if(taskName==="专家登录评审"){
          path = "/peerReview"
      }else if(taskName==="评审汇总"){
          path = "/reviewSummary"
      }else if(taskName==="室主任初审(内部)"){
          path = "/innerOfficerAudit"
      }else if(taskName==="中心主任复审(内部)"){
          path = "/innerCentralAudit"
      }else if(taskName==="会议结果录入"){
          path = "/inputMeetingReport"
      }else if(taskName==="室主任初审"){
          path = "/extendOfficerAudit"
      }else if(taskName==="中心主任终审"){
          path = "/extendCentralAudit"
      }else if(taskName==="市场决策委员会审核"){
          path = "/marketDecision"
      }else if(taskName==="专业公司发函"){
          path = "/sendLetter"
      }else if(taskName==="省内引入"){
          path = "/importProvince"
      }else if(taskName==="产品上线"){
          path = "/publish"
      }else if(taskName==="上线"){
          path = "/publish2"
      }
      //
      path = path + "?"+params;
      this.$router.push({"path":path})
    },
    
    dealItemx(row){
      let woNo = row.woNo
      let taskId = row.taskId
      let stepId = row.stepId
      let procId = row.procId
      let procVersion = row.procVersion
      let params = "&woNo="+woNo+"&taskId="+taskId+"&stepId="+stepId+"&procId="+procId+"&procVersion="+procVersion;
      let taskName = row.taskName;
      let path = ""
      if(taskName==="资质审核"){
          path="/auditQualification"
      }else if(taskName==="指定评估专家"){
          path = "/assignExpert"
      }else if(taskName==="专家登录评审"){
          path = "/peerReview"
      }else if(taskName==="评审汇总"){
          path = "/reviewSummary"
      }else if(taskName==="室主任初审(内部)"){
          path = "/innerOfficerAudit"
      }else if(taskName==="中心主任复审(内部)"){
          path = "/innerCentralAudit"
      }else if(taskName==="会议结果录入"){
          path = "/inputMeetingReport"
      }else if(taskName==="室主任初审"){
          path = "/extendOfficerAudit"
      }else if(taskName==="中心主任终审"){
          path = "/extendCentralAudit"
      }else if(taskName==="市场决策委员会审核"){
          path = "/marketDecision"
      }else if(taskName==="专业公司发函"){
          path = "/sendLetter"
      }else if(taskName==="省内引入"){
          path = "/importProvince"
      }else if(taskName==="产品上线"){
          path = "/publish"
      }else if(taskName==="上线"){
          path = "/publish2"
      }
      
      
      path = path + "?"+params;
      this.$router.push({"path":path})
    },
    loadToDoDatax(params,n){
      params.sts="1"
      this.loading = true;
      this.$http({
        url: "/bpm/api/queryDoneTaskList",
        method: "post",
        headers: {
          "Content-Type": "application/json",
          page: '{"pageNo":"' + n + '","pageSize":"10"}',
        },
        data: params,
      }).then((res) => {
        this.loading = false;
        this.downData = res.data.data;
        this.total = res.data.totalRecord;
      });
    },
    loadToDoData(params,n){
      this.toDoLoading = true
      this.$http({
        url: "/bpm/api/queryToDoTaskList",
        method: "post",
        headers: {
          "Content-Type": "application/json",
          page: '{"pageNo":"' + n + '","pageSize":"10"}',
        },
        data:params
      }).then((res) => {
        this.toDoLoading = false;
        this.toDoList = res.data.data
      });
    },
    currchange(v) {
      this.pageSize = v;
      this.searchParamsx={}
      this.loadToDoDatax(this.searchParamsx, this.pageSize);
    },
    currchange1(v) {
      this.pageSize = v;
      this.searchParams={}
      this.loadToDoData(this.searchParams, this.pageSize);
    },
    showTab(){
      this.type = this.type ===undefined ? 1 : this.type;
      if(this.type==="2"){
          this.activeTab="second";
      }else{
          this.activeTab="first";
          this.type === "1"
      }
    }
  },
  mounted() {
    let params= {}
    params.procName="互联网电视引入流程"
    this.loadToDoData(params,1)
    params.sts="1"
    this.loadToDoDatax(params,1)
    this.type = this.$route.query.type;
    this.showTab()
   
  },
  created() {

  },
};
</script>

<style lang="scss" scoped>
.mc-wrap {
  box-sizing: border-box !important;
  margin: 0;
  height: calc(100vh - 120px);
  overflow: hidden;
  width: 100%;
  padding-right: 15px;

  .container-box {
    width: 100%;
    height: calc(100% - 40px);
    margin-top: 20px;
    overflow-y: scroll;
    padding: 0 0 0 15px;
  }

  .tit {
    height: 30px;
    background: #fff;
    line-height: 35px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
  }
}

.mc-top {
  display: flex;
  width: 100%;
}

.mc-wrap .mc-top-left {
  width: 100%;
  margin-right: 15px;
}

.car-line-knowledge {
  min-height: 250px;
  max-height: 250px;
  background: #fff;
  //   margin: 10px 0 0 0;
  margin-left: 10px;
  overflow-y: auto;

  .car-box {
    padding: 0 20px;
    line-height: 44px;
    height: 44px;
    color: #333;
    border-bottom: 1px solid #c1abfc;

    span {
      cursor: pointer;
      margin-right: 20px;
    }

    span:first-child {
      cursor: auto;
    }

    span:last-child {
      float: right;
      margin-right: 0;
    }
  }
}

.car-line {
  height: 140px;
  background: #fff;
  //   margin: 10px 0 0 0;

  .car-box {
    padding: 0 20px;
    line-height: 40px;
    color: #333;

    span {
      cursor: pointer;
      margin-right: 20px;
    }

    span:first-child {
      cursor: auto;
    }

    span:last-child {
      float: right;
      margin-right: 0;
    }
  }

  .adv-box {
      margin-top: 20px;
      margin-left: 20px;
      margin-right: 20px;
      display: flex;
      flex-wrap: nowrap;
      justify-content: space-between;

      div {
          display: inline-block;
          cursor: pointer;
          .el-card {
              width: 100%;
          }
          i{
              margin-right: 10px;
          }
      }

      .adv-tit {
          width: 28%;
          border: 1px solid transparent;
          border-radius: 5px;
          height: 60px;
          line-height: 60px;
          padding-left: 20px;
          box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
          overflow: hidden;
          em{
              float: right;
              margin-right: 20px;
              font-style: normal;
              color: #0074D9;
          }
      }
      .adv-tit:hover{
          border: 1px solid #CFE8FC;
          background: #CFE8FC;
      }

      .adv-add {
          width: 100px;
      }

  }
}

.mc-wrap .mc-top-right {
  width: calc(20% - 15px);
  background-color: white;
  overflow: hidden;

  .inner-box {
    width: calc(100% + 20px);
    background-color: white;
    overflow-y: scroll;
  }
}

.swiper-pagination {
  position: absolute;
  bottom: 0;
}

.main-box .item {
  float: left;
  width: 50%;
}

.main-box {
  overflow: hidden;
}

#test-n2 #layui-laydate1 {
  width: 100% !important;
}

.mc-wrap .laydate-theme-grid .layui-laydate-content td {
  border: none !important;
  border-radius: 50%;
}

.mc-wrap .layui-laydate-main {
  width: 100% !important;
}

.mc-wrap .layui-laydate-content table {
  width: 100%;
}

.mc-wrap .layui-laydate-static {
  width: 100% !important;
  border: none !important;
  box-shadow: none !important;
}

.mc-wrap .laydate-day-mark::after {
  bottom: 0 !important;
  left: 45% !important;
  top: 50px !important;
}

.mc-wrap .laydate-day-mark {
  overflow: inherit !important;
  overflow: none !important;
}

.mc-wrap .layui-laydate .layui-this {
  background-color: #a3c1e5 !important;
}

#test-n2 {
  width: initial !important;
}

.tasksituation {
  border-bottom: 1px solid #f7f7f7;
}

.mc-wrap .tasksituation > .title {
  font-size: 16px;
  font-weight: 500;
  padding-top: 20px;
  padding-left: 20px;
  color: #333;
}

.mc-wrap .main-box .point {
  color: #ff6060;
  font-size: 30px;
  font-weight: 500;
}

.mc-wrap .main-box .item img {
  width: 100%;
}

.mc-wrap .describe {
  text-align: center;
}

.mc-wrap .describe .title {
  color: #999;
  font-size: 12px;
  padding: 5px 0;
}

.mc-wrap .describe .day {
  color: #0081cc;
  font-size: 16px;
}

.mc-wrap .swiper-pagination-bullet {
  width: 10% !important;
  border-radius: 0;
  height: 5px !important;
}

.mc-wrap .laydate-icon {
  display: none;
}

.mc-wrap .laydate-set-ym {
  text-align: left;
}

.mc-wrap .layui-laydate-header {
  padding: 0;
}

.mc-wrap .layui-laydate-header i {
  display: none !important;
}

.mc-wrap .data-box {
  position: relative;
}

.datetimeBox {
  .el-timeline {
    padding-left: 20px;
  }
}

.mc-wrap .operation {
  padding-right: 20px;
  cursor: pointer;
  margin-top: 10px;
  text-align: right;
}

.mc-wrap .layui-laydate-footer {
  display: none;
}

.mc-wrap .layui-timeline-axis {
  width: 50px !important;
  height: 18px;
  border-radius: 20px;
  top: 3px;
  color: white;
  line-height: 18px;
}

.mc-wrap .layui-timeline-content {
  margin-left: 35px;
}

.mc-wrap .layui-timeline {
  width: 80%;
  margin: 0 auto;
}

.mc-wrap .layui-timeline-item:before {
  left: 9% !important;
  width: 3px;
  background-color: #daeaf2;
  top: 3px;
}

.mc-wrap .layui-timeline-axis:hover {
  color: white !important;
}

.mc-wrap .ztree li a.curSelectedNode {
  border: none !important;
  background-color: white !important;
}

.point-baifen {
  font-size: 14px;
  margin-left: -5%;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(1turn);
  }
}

.info-line {
  width: 100%;
  display: block;
  padding-left: 20px;

  div {
    width: 50%;
    display: inline-block;
    overflow: hidden;
  }

  .mytxt {
    height: 40px;
    padding-left: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: calc(100% - 100px);
    float: left;
  }

  .mytxtinfo {
    line-height: 40px;
    height: auto;
    padding-left: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: calc(100% - 100px);
  }

  span {
    width: 80px;
    display: inline-block;
    text-align: left;
    float: left;

    i {
      color: red;
      display: inline-block;
      padding-right: 5px;
    }
  }

  .el-select,
  .el-input {
    width: calc(100% - 100px);
  }
}

.online {
  width: 100%;

  .el-select {
    width: calc(100% - 100px);
  }

  span {
    vertical-align: top;
  }

  .el-textarea {
    width: calc(100% - 100px);
  }
}

.task_list{
  background-color: white;
  padding:0px 20px 20px 20px;
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
}
</style>
