<template>
  <div>
    <basic-container>
      <div class="notification-container">
        <div class="notification-heading">通知</div>
        <p class="notification-title"><i class="el-icon-chat-line-round el-icon-home"></i>  今日消息</p>
        <div class="headOverflowList">
          <el-skeleton :rows="3" animated v-show="skeleton"/>
          <div class="el-collapse">
            <div class="el-collapse-item">
              <div class="el-collapse-item__header"><span class="el-collapse-span">一致性 Consistency</span></div>
            </div>
            <div class="el-collapse-item">
              <div class="el-collapse-item__header"><span class="el-collapse-span">一致性 Consistency</span></div>
            </div>
            <div class="el-collapse-item">
              <div class="el-collapse-item__header"><span class="el-collapse-span">一致性 Consistency</span></div>
            </div>
            <div class="el-collapse-item">
              <div class="el-collapse-item__header"><span class="el-collapse-span">一致性 Consistency</span></div>
            </div>
            <div class="el-collapse-item">
              <div class="el-collapse-item__header"><span class="el-collapse-span">一致性 Consistency</span></div>
            </div>
          </div>
        </div>
      </div>
      <el-row>
        <el-col :span="12">
          <div class="notification-container-task">
            <div class="notification-heading">任务信息</div>
            <p class="notification-title"><i class="el-icon-document el-icon-home"></i>  今日任务</p>
            <div class="overflowList">
              <el-skeleton :rows="3" animated v-show="skeleton"/>
              <div class="el-collapse-item" v-for="(item, index) in homePageData.inspectionTasksAudit" :key="index">
                <div class="el-collapse-item__header" @click="skip('/inspection/inspectiontasksDetail', item.id)"><span class="el-collapse-span">☆巡检任务：{{item.taskName}}</span></div>
              </div>
            </div>
          </div>
        </el-col>
        <el-col :span="12">
          <div class="notification-container-audit">
            <div class="notification-heading">审核信息</div>
            <p class="notification-title"><i class="el-icon-s-check el-icon-home"></i>  今日待审核</p>
            <el-skeleton :rows="8" animated v-show="auditSkeleton"/>
            <div class="overflowList" v-show="!auditSkeleton">
              <el-empty v-if="!homePageData.workOrderAudit
                            && !homePageData.supplierInfoAudit
                            && !homePageData.manufacturerInfoAudit
                            && !homePageData.warehouseAudit
                            && !homePageData.workPermitAudit
                            && !homePageData.workOperationTicketAudit
                            && !homePageData.toolInventoryRecordsAudit
                            && !homePageData.equipmentLedgerAudit">
              </el-empty>
              <div class="el-collapse">
                <div v-show="homePageData.equipmentLedgerAudit || homePageData.toolInventoryRecordsAudit">
                  <div class="el-collapse-item">
                    <div class="el-audit-head"><span class="el-collapse-span">待审核设备台账</span></div>
                  </div>
                  <div class="el-collapse-item" v-for="(item, index) in homePageData.equipmentLedgerAudit" :key="index">
                    <div class="el-collapse-item__header" @click="skip('/leger/equipmentledgerDetail', item.id)"><span class="el-collapse-span">{{item.eqLedgerCode}}号设备台账待审核</span></div>
                  </div>
                  <div class="el-collapse-item" v-for="(item, index) in homePageData.toolInventoryRecordsAudit" :key="index">
                    <div class="el-collapse-item__header" @click="skip('/leger/toolinventoryrecordDetail', item.id)"><span class="el-collapse-span">{{item.toolsCodeId}}号工器具编码待审核</span></div>
                  </div>
                </div>
                <div v-show="homePageData.workOperationTicketAudit || homePageData.workPermitAudit">
                  <div class="el-collapse-item">
                    <div class="el-audit-head"><span class="el-collapse-span">待审核智能两票</span></div>
                  </div>
                  <div class="el-collapse-item" v-for="(item, index) in homePageData.workOperationTicketAudit" :key="index">
                    <div class="el-collapse-item__header" @click="skip('/smart/operationticketDetail', item.id)"><span class="el-collapse-span">{{item.operationTicketNo}}号操作票待审核</span></div>
                  </div>
                  <div class="el-collapse-item" v-for="(item, index) in homePageData.workPermitAudit" :key="index">
                    <div class="el-collapse-item__header" @click="skip('/smart/workpermitDetail', item.id)"><span class="el-collapse-span">{{item.workTicketNo}}号工作票待审核</span></div>
                  </div>
                </div>
                <div v-show="homePageData.warehouseAudit || homePageData.manufacturerInfoAudit || homePageData.supplierInfoAudit || homePageData.materialAudit">
                  <div class="el-collapse-item">
                    <div class="el-audit-head"><span class="el-collapse-span">待审核备件管理</span></div>
                  </div>
                  <div class="el-collapse-item" v-for="(item, index) in homePageData.workOrderAudit" :key="index">
                    <div class="el-collapse-item__header" @click="skip('/spares/warehouse', item.id)"><span class="el-collapse-span">{{item.code}}号仓库待审核</span></div>
                  </div>
                  <div class="el-collapse-item" v-for="(item, index) in homePageData.materialAudit" :key="index">
                    <div class="el-collapse-item__header" @click="skip('/spares/material', item.id)"><span class="el-collapse-span">{{item.materialNo}}号物资待审核</span></div>
                  </div>
                  <div class="el-collapse-item" v-for="(item, index) in homePageData.manufacturerInfoAudit" :key="index">
                    <div class="el-collapse-item__header" @click="skip('/spares/manufacturerinfo', item.id)"><span class="el-collapse-span">{{item.creditCode}}号制造商待审核</span></div>
                  </div>
                  <div class="el-collapse-item" v-for="(item, index) in homePageData.supplierInfoAudit" :key="index">
                    <div class="el-collapse-item__header" @click="skip('/spares/supplierinfo', item.id)"><span class="el-collapse-span">{{item.creditCode}}号供应商待审核</span></div>
                  </div>
                </div>
                <div v-show="homePageData.workOrderAudit">
                  <div class="el-collapse-item">
                    <div class="el-audit-head"><span class="el-collapse-span">待审核工单</span></div>
                  </div>
                  <div class="el-collapse-item" v-for="(item, index) in homePageData.workOrderAudit" :key="index">
                    <div class="el-collapse-item__header" @click="skip('/workorder/detail', item.id)"><span class="el-collapse-span">{{item.workOrderNo}}号工单待审核</span></div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </el-col>
      </el-row>


    </basic-container>



  </div>
</template>

<script>
  import {mapGetters} from "vuex";
  // import * as echarts from 'echarts';
  // import {dayLineStatistics , activities} from '@/api/desk/dashboard'
  import {honePageData} from "@/api/system/role";
  export default {
    name: "wel",
    data() {
      return {
        homePageData: {},
        skeleton: false,
        auditSkeleton: false,
      };
    },
    computed: {
      ...mapGetters(["userInfo"]),
    },
    mounted() {
      this.auditLoad();
    },
    methods: {
      auditLoad(){
        this.auditSkeleton = true;
        honePageData().then(res => {
          this.homePageData = res.data.data;
          this.auditSkeleton = false;
          this.selectionClear();
        });
      },
      skip(path, id){
        this.$router.push({
          path: path,
          query: {
            frameMode:"search",
            id: id
          },
        });
      }
    }
  };
</script>

<style>
  .notification-container {
    padding: 14px;
    background-color: #f7f7f7;
    height: 260px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
  }

  .notification-container-task {
    margin-top: 15px;
    max-width: 94%;
    padding: 14px;
    height: 475px;
    background-color: #f7f7f7;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
  }

  .notification-container-audit {
    margin-top: 15px;
    max-width: 97%;
    padding: 14px;
    height: 475px;
    background-color: #f7f7f7;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
  }

  .notification-heading {
    font-size: 24px;
    margin-bottom: 10px;
  }
  .notification-title {
    font-size: 20px;
  }
  .el-icon-home {
    color: #0087ff;
    font-weight: bold;
  }
  .el-collapse-span {
    margin-left: 20px;
  }
  .el-audit-head {
    background-color: #0283f1;
    color: white;
    height: 40px;
    line-height: 40px;
  }
  .headOverflowList {
    height: 170px;
    overflow: auto;
  }
  .overflowList {
    height: 380px;
    overflow: auto;
  }
</style>

