<template>
  <div class="mc-wrap">
    <div class="container-box">
      <div class="mc-top">
        <div class="mc-top-left">
          <el-row>
            <el-col :span="24">
                <div class="car-line">
                    <h2 style="margin-left: 20px;padding-top: 10px;">魔百和大屏广告自有业务承载审批流程</h2>
                    <div class="adv-box">
                        <div class="adv-tit" @click="jumpadv('0')">
                            <i class="el-icon-time"></i>
                            <span>待办 <em>{{totalToDo||0}}</em></span>
                        </div>
                        <div class="adv-tit" @click="jumpadv('1')">
                            <i class="el-icon-finished"></i>
                            <span>已办 <em>{{totalDone||0}}</em></span>
                        </div>
                        <div class="adv-tit" @click="jumpadv('2')">
                            <i class="el-icon-notebook-1"></i>
                            <span>已归档 <em>{{totalFinish||0}}</em></span>
                        </div>
                        <div class="adv-tit adv-add" @click="advadd">
                            <i class="el-icon-plus"></i>
                            <span>创建</span>
                        </div>
                    </div>
                </div>
            </el-col>

            <el-col :span="24">
              <hometask></hometask>
            </el-col>
          </el-row>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import hometask from "./homeTask.vue";

export default {
  components: {
    hometask,
  },
  data() {
    return {
      totalToDo: 0,
      totalDone: 0,
      totalFinish: 0,
    };
  },
  methods: {
    advadd(){
        this.$router.push({
            path: "/mbAuditAdd",
        });
        this.setabList("发起需求", "/mbAuditAdd");
    },

    jumpadv(v){
        if(v!=='2'){
          this.$router.push({ path: "/mbAuditList", query:{ type:v}});
          this.setabList("魔百和审批流程列表", "/mbAuditList?type="+v);
        }else if(v==='2'){
          this.$router.push({ path: "/magicBoxItem"});
        }
    },
    setabList(n, p) {
        let params = {
            children: "",
            name: n,
            rountPath: p,
            target: "_self",
        };
        for (let i = 0; i < this.$store.state.tabList.length; i++) {
            if (this.$store.state.tabList[i].name === params.name) {
                this.$store.state.tabList[i] = params;
            }
        }
        let set = new Set([...this.$store.state.tabList, params]);
        set.add(params);
        this.$store.commit("setDefaultActive", params.rountPath);
        this.$store.commit("setTabList", Array.from(set));
    },
    //待办工单列表查询
    getToDoList(v, n) {
        this.pageSizeToDo = n;
        v.procName = "魔百和大屏广告自有业务承载审批流程";
        //v.procName = "广告申请";
        this.$http({
            url: "/bpm/api/queryToDoTaskList",
            method: "post",
            headers: {
                "Content-Type": "application/json",
                "page": '{"pageNo":"' + n + '","pageSize":"10"}'
            },
            data: v,
        }).then((res) => {
            this.totalToDo = res.data.totalRecord;
        });
    },
    //已办工单列表查询
    getDoneList(v, n) {
        this.pageSizeDone = n;
        v.procName = "魔百和大屏广告自有业务承载审批流程";
        //v.procName = "广告申请";
        this.$http({
            url: "/bpm/api/queryDoneTaskList",
            method: "post",
            headers: {
                "Content-Type": "application/json",
                "page": '{"pageNo":"' + n + '","pageSize":"10"}'
            },
            data: v,
        }).then((res) => {
            this.totalDone = res.data.totalRecord;
        });
    },
    //已归档工单列表查询
    getFinishList(v, n) {
        this.pageSizeDone = n;
        v.procName = "魔百和大屏广告自有业务承载审批流程";
        //v.procName = "广告申请";
        this.$http({
            url: "/market/mbh/list",
            method: "post",
            headers: {
                "Content-Type": "application/json"
            },
            data: {"status":"1"},
        }).then((res) => {
            this.totalFinish = res.data.body.length
        });
    },
  },
  mounted() {
    this.getToDoList({}, 1);
    this.getDoneList({}, 1);
    this.getFinishList({}, 1);
  },
  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);
  }
}
</style>
