<template>
  <div class="main-data data-current-area">
    <!-- <div class="title-area flex-row align-items-center">
      <span>当前区域数据</span>
    </div> -->
    <div class="content-area">
<!--      <img src="@/assets/images/main/data_bg6.png" class="bg" />-->

      <!-- 摄像头列表 -->
      <div class="content">
        <div class="content-title long">
          <span class="title">问题台账统计</span>
        </div>
        <div class="sddha">
          <div class="data-asgeh">
            <div class="asdakda">
              <div>
                <img src="@/assets/images/service_new/img_1.png"/>
              </div>
              <div>本周检查项目数</div>
            </div>
            <div >
              <div class="num">{{ issues }} <span class="unit">个</span></div>
            </div>
          </div>
          <div class="data-asgeh">
            <div class="asdakda">
              <div>
                <img src="@/assets/images/service_new/img_1.png"/>
              </div>
              <div>问题数</div>
            </div>
            <div class="num">{{ lastweek }} <span class="unit">个</span></div>
          </div>
          <div class="data-asgeh">
            <div class="asdakda">
              <div>
                <img src="@/assets/images/service_new/img_1.png"/>
              </div>
              <div>已整改数</div>
            </div>
            <div class="num">{{getprojectnum}} <span class="unit">个</span></div>
          </div>
        </div>
      </div>
    </div>
<!--    近一周问题列表/-->
    <div class="content-ear">
      <div class="content">
        <div class="content-title long">
          <span class="title">近一周问题列表</span>
        </div>
        <div class="table-cont">
          <div class="table-top">
            <div class="fir" style="width: 43%">时间</div>
            <div class="snd" style="width: 31%">标题</div>
            <div class="thd" style="width: 29%">问题状态</div>
          </div>
          <div class="table-roll" @click="choose" ref="scrollContainer" style="padding-bottom: 140px">
            <div class="table-bot">
              <div class="table-list"  v-for="(item, index) in getProList" :key="index">
                <div class="said"></div>
                <div class="fir">{{ item.name }}</div>
                <div class="snd">{{ item.num }}</div>
                <div class="thd">
                  <div v-if="item.status === '1'"><span style="color: #67C23A">●</span> 已完结</div>
                  <div v-if="item.status === '0'"><span style="color: #FAAD14">●</span> 处理中</div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
<!--    本周检查计划-->
    <div class="content-ear">
      <div class="content">
        <div class="content-title long">
          <span class="title">本周检查计划</span>
        </div>
        <div class="table-cont">
          <div class="table-top">
            <div class="fir">检查日期</div>
            <div class="snd">所属项目</div>
            <div class="thd">检查内容</div>
            <div class="fir">负责人员</div>
          </div>
          <div class="table-roll">
            <div class="table-bot">
             <div class="table-roll">
               <div class="table-list" v-for="(item, index) in getProjecList" :key="index" @click="co">
                 <div class="said"></div>
                 <div class="fir">{{item.head}}</div>
                 <div class="snd">{{item.startTime}}</div>
                 <div class="thd">{{item.content}}</div>
                 <div class="fir">{{item.projectName}}</div>
               </div>
             </div>
            </div>
          </div>

        </div>
      </div>
    </div>
<!--    本周施工计划-->
    <div class="content-ear">
      <div class="content">
        <div class="content-title long">
          <span class="title">本周施工计划</span>
        </div>
        <div style="display: flex;flex-wrap: nowrap;overflow: auto">
          <div class="table-five">
            <div class="table-top">
              <div class="fir">所属项目</div>
              <div class="snd">施工内容</div>
              <div class="thd">开始日期</div>
              <div class="fir">结束日期</div>
              <div class="fiv">负责人</div>
            </div>
            <div class="table-bot">
              <div class="table-roll">
                <div class="table-list" v-for="(item, index) in thisweek" :key="index">
                  <div class="fir">{{ item.projectName }}</div>
                  <div class="snd">{{ item.content }}</div>
                  <div class="thd">{{ item.startTime }}</div>
                  <div class="fir">{{ item.endTime }}</div>
                  <div class="fiv">{{ item.head  }}</div>
                </div>
              </div>
            </div>
          </div>
        </div>

      </div>
    </div>
  </div>

</template>

<script>
import LineChart from "@/components/Echarts/LineChart.vue";
import echarts from "echarts";
import {
  getCanteenData,
  getCanteenNameList,
  getIssueListLastWeek, getIssueNum, getOverIssueNum,
  getProjectNumThisWeek, planCheckList, planDoneList,
  videoList
} from '@/api/screen/service'
import BarChart from "@/components/Echarts/BarChart.vue";


export default {
  name: "Canteen",
  components: {
    BarChart
  },
  props: {
    appOrg: {
      type: String,
      default: "10001",
    },
  },
  watch:{
  },
  data() {
    return{
      getProList:[],
      getProjecList:[],
      thisweek:[],
      issues:0,
      issueCount: 0,
      lastweek:0,
      getprojectnum:0
    }
  },
  created() {
    this.getProjectNumThisWeek()
    this.getIssueNum()
    this.getOverIssueNum()
    this.getIssueListLastWeek()
    this.planCheckList()
    this.planDoneList()
  },
  destroyed() {},
  beforeDestroy() {
    clearTimeout(this.scrollTimeout);
  },
  mounted() {},
  methods: {
    startAutoScroll() {
      const scrollContainer = this.$refs.scrollContainer;
      const scroll = () => {
        scrollContainer.scrollTop += 1;
        if (scrollContainer.scrollTop >= scrollContainer.scrollHeight - scrollContainer.clientHeight) {
          scrollContainer.scrollTop = 0;
        }
        this.scrollTimeout = setTimeout(scroll, 600);
      };
      this.scrollTimeout = setTimeout(scroll, 600);
    },
    co(){
      console.log(this.getProjecList)
    },
    getIssueListLastWeek(){
      getIssueListLastWeek(this.$props.appOrg).then((res) => {
        if (Number(res.code) === 200) {
          this.getProList = res.data;
          this.getProList.forEach((item, index) => {
            item.name = item.createTime;
            item.num = item.title;
            if (this.getProList.length > 6){
              this.startAutoScroll()
            }
          });
        }
      });
    },
    planCheckList(){
      planCheckList(this.$props.appOrg).then((res) => {
        if (Number(res.code) === 200) {
          this.thisweek = res.data;
        }
      });
    },
    planDoneList(){
      planDoneList(this.$props.appOrg).then((res) => {
        if (Number(res.code) === 200) {
          this.getProjecList = res.data;
        }
      });
    },
    getProjectNumThisWeek(){
      getProjectNumThisWeek(this.$props.appOrg).then((res) => {
        if (Number(res.code) === 200) {
          this.issues=res.data;
          this.issueCount = res.data.length;

        }
      });
    },
    getIssueNum(){
      getIssueNum(this.$props.appOrg).then((res) => {
        if (Number(res.code) === 200) {
          this.lastweek = res.data;
        }
      });
    },
    getOverIssueNum(){
      getOverIssueNum(this.$props.appOrg).then((res) => {
        if (Number(res.code) === 200) {
          this.getprojectnum = res.data;
        }
      });
    },
    choose(){
      this.$emit('choose')
    }
  }
}

</script>

<style lang="scss">
.data-current-area {
  height: 100%;
  overflow: hidden;
  position: relative;
  .content-area {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 15px 20px 0 15px;
    overflow: auto;

    .bg{
      display: block;
      width:calc(100% - 40px);
      height:auto;
      position: absolute;
      left:20px;
      bottom:40px;
      z-index:-5;
    }
  }
  .content-ear {
    width: 100%;
    height: 28%;
    display: flex;

    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 15px 20px 0 15px;
    overflow: auto;

    .bg{
      display: block;
      width:calc(100% - 40px);
      height:auto;
      position: absolute;
      left:20px;
      bottom:40px;
      z-index:-5;
    }
  }
  .content {
    margin-top: 10px;
    width: 100%;
    flex-direction: row;
    .title-format {
    display: flex;
    flex-direction: row;
    align-items: center;
    img {
      width: 6px !important;
      height: 24px !important;
      margin-right: 6px;
    }
    .title-info {
      display: flex;
      flex-direction: column;
      font-size: 14px;
      color: #ffffff;
      .title-en {
        font-size: 8px;
        color: #ffffff;
        opacity: 0.4;
      }
    }
  }
    .sddha{
      display: flex;
      margin-left: 20px;
      align-items: flex-start;
      justify-content: flex-start;

      .data-asgeh{
        display: flex;
        flex-direction: column;
        padding-top: 12px;
        padding-left: 10px;
        padding-right: 50px;
        justify-content: flex-end;
      }
      .asdakda{
        display: flex;
        font-size:14px;
        color:#FFFFFF;
        justify-content: space-around;
      }
    }
    .num{
      font-size: 34px;
      color: #00FFFF;
      font-weight: bold;
      font-family: "electronicFont";
    }
    .unit{
      font-size: 12px;
      color: #00FFFF;
      font-weight: 500;
      position: relative;
      right:0px
    }


    .data-list {
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: flex-start;
      width: 30%;
      .data-item {
        display: flex;
        flex-direction: row;
        justify-content: center;
        flex: 1;
        width: 30%;
        border-right: 1px solid rgba(25, 252, 222, 0.2);
        margin-right: 20px;
        .data-detail {
          display: flex;
          flex-direction: row;
          align-items: baseline;
          color: #00ffff;
          margin-top: 11px;
          font-size: 12px;
          .data {
            font-size: 30px;
            font-family: "electronicFont";
          }
        }
      }
      .data-item:last-child {
        border-right: none;
        margin-right: 0px;
      }
    }
    .chart-area {
      .chart-item {
        margin-top: 40px;
      }
    }
  }

  .table-cont{
    width: 100%;

    .table-roll{
      width: 100%;
      height: 140px;
      overflow: auto;
    }
    .table-top{
      height: 38px;
      background-size: 100% 100%;
      padding:0 25px 0 10px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size:14px;
      color:#00FFFF;
      width: 515px;
      background: #44f1ff1a;


    }
    .table-bot{
      width:100%;
      padding: 5px 0px;

      .table-list{
        width:100%;
        height:35px;
        padding:5px 25px 0 10px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size:14px;
        color:#FFFFFF;
        font-weight: 500;
      }
    }

    .fir{
      width:40%;
      text-align: left;
      margin-left: 5px;
    }
    .snd{
      width:30%;
      text-align: left;
    }
    .thd{
      width:30%;
      left: 3px;
      text-align: left;
    }
  }
  .table-five{
    width: 600px;

    .table-roll{
      width: 100%;
      height: 120px;
      overflow: auto;
    }
    .table-top{

      height: 38px;
      background-size: 100% 100%;
      padding:0 25px 0 10px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size:14px;
      color:#00FFFF;
      width: 515px;
      background: #44f1ff1a;

    }
    .table-bot{
      width:100%;
      padding: 5px 0px;

      .table-list{
        width:100%;
        height:30px;
        padding:5px 25px 0 10px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size:14px;
        color:#FFFFFF;
        font-weight: 500;
      }
    }

    .fir{

      text-align: left;
      margin-left: 5px;
    }
    .snd{

      text-align: left;
    }
    .thd{

      left: 3px;
      text-align: left;
    }
  }

  .said{
    width: 1px;
    height: 13px;
    background-color: #00FFFF;
  }
  .smail{
    width: 8px;
    height: 8px;
    background: #FAAD14;
    border-radius: 50%;
    border: 1px solid #FFDE9E;
  }
  .content-title {
    width: 230px;
    height: 26px;
    background: url("../../../assets/images/main/title_pro.png") no-repeat !important;
    background-size: 100% 100%;
    font-family: "PingFangSC";
    font-size: 16px;
    font-weight: bold;
    color: #00ffff;
    padding-left: 20px !important;
    .title {
      display: block;
      position: relative;
      top:-5px !important;
    }
  }

  .content-title.long {
    width: 100%;
    margin-top: -8px;
    background: url("../../../assets/images/main/title_pro_long.png") no-repeat !important;
  }

  .monitor-cont{
    width:100%;
    display: flex;
    flex-wrap: wrap;
    padding:15px 15px 20px;



    .monitor-list{
      width:151px;
      position: relative;
      margin:0 10px 10px 0;
      cursor: pointer;
      .img{
        display: block;
        width:151px;
        height:104px;
      }
      .monitor-info{
        position: absolute;
        left:0;
        bottom: 0;
        width: 100%;
        height: 25px;
        opacity: 0.55;
        background: #000000;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 8px;

        .name{
          font-size: 13px;
          color: #FFFFFF;
          font-weight: 500;
        }
        .online{
          font-size: 12px;
          color: #00F6EC;
          font-weight: 500;
        }
        .offline{
          font-size: 12px;
          color: #F60000;
          font-weight: 500;
        }
      }
    }
    .monitor-list:nth-child(3n){
      margin-right: 0;
    }
  }


  ::-webkit-scrollbar {
    display: none;
    width: 3px;
    height: 3px;
  }

  ::-webkit-scrollbar-thumb {
    //滑块部分
    // border-radius: 5px;
    background-color: #58cbbb;
  }

  ::-webkit-scrollbar-track {
    //轨道部分
    // box-shadow: inset 0 0 5px #ddd;
    background: #ddd;
    // border-radius: 5px;
  }
}
</style>

