<template>
  <div
    ref="dashboardWrap"
    id="dashboardWrap"
    style="
      height: 85vh;
      margin: -12px 0 0 0;
      padding-top: 1px;
      overflow-y: auto;
    "
  >
    <div style="width: 1470px; margin: 0 auto">
      <el-row
        style="margin-top: 10px; width: 100%; height: 45%; margin-left: 10px"
      >
        <el-col
          :span="16"
          style="
            border: 1px solid #e7e7e7 !important;
            background: #f7f9fb !important;
            width: 65%;
          "
        >
          <div class="bumf entrance">
            <span class="iconfont iconkuaijierukou">快捷入口</span>
          </div>
          <div class="bumfCon" style="margin: 10px 0 20px 50px">
            <el-col
              :span="4"
              v-for="(item, index) in quickEntryList"
              :key="index"
            >
              <a
                class="imgWrap"
                @click="jumpView(item.name)"
                target="_blank"
                @mouseout="changeImg(item.imgPreName, item.imgName)"
              >
                <img
                  :src="item.imgSrc"
                  :ref="item.imgPreName"
                  @mouseover="changeImg(item.imgPreName, item.imgPreName)"
                />
                <div class="imgName">{{ item.name }}</div>
              </a>
            </el-col>
          </div>
        </el-col>
        <el-col :span="1" style="width: 2%">
          <div style="width: 100%; height: 197px"></div>
        </el-col>
        <el-col :span="7" style="width: 33%">
          <el-col :span="12" style="border: 1px solid #e7e7e7 !important">
            <div class="scroll-title">
              <div class="icon zql-icon"></div>
              转圈粮预警
            </div>
            <div
              class="scroll-wrapper"
              @mouseenter="stop1()"
              @mouseleave="autoMove1()"
            >
              <div
                :style="'margin-top:-' + marginTop1 + 'px;transition:all 0.5s;'"
              >
                <div
                  v-for="(item, index) in circleGrainWarning"
                  :key="index"
                  class="circleWarn-item"
                >
                  <div class="circleWarn-item-icon"></div>
                  <a
                    href="javascript:void(0);"
                    @click="readWarnItem(item.content, item.id, 1, item.cch)"
                    >{{ item.content }}</a
                  >
                </div>
              </div>
              <div v-if="!circleGrainWarning.length" class="noData">暂无</div>
            </div>
          </el-col>
          <el-col
            :span="12"
            style="border: 1px solid #e7e7e7; border-left: none"
          >
            <div class="scroll-title">
              <div class="icon jkq-icon"></div>
              架空期预警
            </div>
            <div
              class="scroll-wrapper"
              @mouseenter="stop2()"
              @mouseleave="autoMove2()"
            >
              <div
                :style="'margin-top:-' + marginTop2 + 'px;transition:all 0.5s;'"
              >
                <div
                  v-for="(item, index) in jkqWarning"
                  :key="index"
                  class="jkqWarn-item"
                >
                  <div class="circleWarn-item-icon"></div>
                  <span>{{ item.xybh }}将于{{ item.scjssj }}到期</span>
                </div>
              </div>
              <div v-if="!jkqWarning.length" class="noData">暂无</div>
            </div>
          </el-col>
        </el-col>
      </el-row>
      <el-row
        style="margin-top: 20px; width: 100%; height: 45%; margin-left: 10px"
      >
        <el-col
          class="home-card-box"
          style="width: 49%; height: 100%; float: left"
        >
          <div class="bumf">
            <span class="iconfont iconyewudaiban">业务待办</span>
            <span @click="jumpView('通用功能')" class="more">更多 ></span>
          </div>
          <div class="bumfCon">
            <!--            <el-row>-->
            <!--              <ul style="background-color:#fff;" v-loading="tzLoading">-->
            <!--                <li class="bumfCon-li" v-for="(item, index) in tzData" :key="index">-->
            <!--                  <span-->
            <!--                    @click="detailtz(item)"-->
            <!--                    style="float:left;width:300px;overflow:hidden;margin-left:5px;-->
            <!--    text-overflow:ellipsis;-->
            <!--    white-space:nowrap"-->
            <!--                  >{{ item.businessName }}</span>-->
            <!--                  <span style="float:right;width:120px;">{{ item.assignTime }}</span>-->
            <!--                </li>-->
            <!--              </ul>-->
            <!--            </el-row>-->
            <el-table
              :data="tzData"
              stripe
              border
              @row-click="jumpDetails"
              style="width: 100%"
            >
              <el-table-column
                prop="itemName"
                label="标题"
                align="center"
              ></el-table-column>
              <!-- <el-table-column
                prop="submitter"
                label="发起人"
                align="center"
                width="100"
              ></el-table-column> -->
              <el-table-column
                prop="reportDate"
                align="center"
                label="发起时间"
                width="140"
              ></el-table-column>
            </el-table>
          </div>
        </el-col>
        <el-col
          class="home-card-box"
          style="width: 49%; height: 100%; float: right"
        >
          <div class="bumf">
            <span class="iconfont iconyewudaiban">帮助中心</span>
            <span class="more" @click="helpMoreList('通用功能')">更多 ></span>
          </div>
          <div class="bumfCon">
            <el-table
              :data="helpData"
              stripe
              border
              @row-click="goHelpDetail"
              style="width: 100%"
            >
              <el-table-column
                prop="gnmk"
                label="系统模块"
                align="center"
              ></el-table-column>
              <el-table-column
                prop="wdbt"
                label="文档标题"
                align="center"
              ></el-table-column>
              <el-table-column
                prop="tjdz"
                label="推荐读者"
                align="center"
              ></el-table-column>
            </el-table>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import "@/style/theme/_page.scss";
import { getTheme } from "@/api/publicfunction/theme";
import qs from "qs";
import axios from "axios";
import {
  getDaiBanPagesNew,
  findNoticeList,
  findNoticeId,
  findOAList,
  signTask,
  todoList,
  modificationFn,
  warnList,
  readList,
} from "@/api/taskReport/index";
import { helpList } from "@/api/publicfunction/helpDocument";
export default {
  name: "dashboard",
  data() {
    return {
      needArray: [],
      tzData: [],
      helpData: [],
      dialogTableVisible: false,
      tzDetailDialog: false,
      oaDialog: false,
      form: {
        procName: "",
        starter: "",
        userId: "",
      },
      userId: "",
      resultList: [],
      resultList1: [],
      toInven: [],
      toInvens: [],
      numOfPeoEmp: [],
      numOfPeoEmps: [],
      numOfUni: [],
      numOfUnis: [],
      warUni: [],
      warUnis: [],
      laEnCa: [],
      laEnCas: [],
      newFoodEnt: [],
      newFoodEnts: [],
      tableLoading: false,
      tableLoading1: false,
      tzLoading: false,
      detailtzList: {},
      menuUrl: "",
      entranceList: [
        {
          name: "业务检查",
          imgName: "ywjc",
          imgPreName: "ywjc-pre",
          imgSrc: require("./img/ywjc.png"),
        },
        {
          name: "质量管理",
          imgName: "zlgls",
          imgPreName: "zlgls-pre",
          imgSrc: require("./img/zlgls.png"),
        },
        {
          name: "储备粮管理",
          imgName: "cblgl",
          imgPreName: "cblgl-pre",
          imgSrc: require("./img/cblgl.png"),
        },
        {
          name: "粮油交易",
          imgName: "lyjy",
          imgPreName: "lyjy-pre",
          imgSrc: require("./img/lyjy.png"),
        },
        {
          name: "粮食安全区长责任制考核",
          imgName: "qzzrz",
          imgPreName: "qzzrz-pre",
          imgSrc: require("./img/qzzrz.png"),
        },
        {
          name: "信息审核备案",
          imgName: "xxshba",
          imgPreName: "xxshba-pre",
          imgSrc: require("./img/xxshba.png"),
        },
        {
          name: "涉粮企业管理",
          imgName: "slqygl",
          imgPreName: "slqygl-pre",
          imgSrc: require("./img/slqygl.png"),
        },
        {
          name: "项目管理",
          imgName: "xmgl",
          imgPreName: "xmgl-pre",
          imgSrc: require("./img/xmgl.png"),
        },
        {
          name: "财务管理",
          imgName: "cwgl",
          imgPreName: "cwgl-pre",
          imgSrc: require("./img/cwgl.png"),
        },
        {
          name: "业务报表",
          imgName: "ywbb",
          imgPreName: "ywbb-pre",
          imgSrc: require("./img/ywbb.png"),
        },
        {
          name: "粮食流通专家",
          imgName: "lsltzj",
          imgPreName: "lsltzj-pre",
          imgSrc: require("./img/lsltzj.png"),
        },
        {
          name: "自定义分析查询",
          imgName: "zdyfxcx",
          imgPreName: "zdyfxcx-pre",
          imgSrc: require("./img/zdyfxcx.png"),
        },
        {
          name: "领导驾驶舱",
          imgName: "ldjsc",
          imgPreName: "ldjsc-pre",
          imgSrc: require("./img/ldjsc.png"),
        },
        {
          name: "安全生产",
          imgName: "aqsc",
          imgPreName: "aqsc-pre",
          imgSrc: require("./img/aqsc.png"),
        },
      ],
      systeamList: [
        {
          value: "cbl",
          name: "储备粮管理",
        },
        {
          value: "ywjc",
          name: "业务检查",
        },
        {
          value: "zj",
          name: "质量管理",
        },
        {
          value: "qzzrz",
          name: "粮食安全区长责任制考核",
        },
        {
          value: "jy",
          name: "粮油交易",
        },
        {
          value: "pm",
          name: "项目管理",
        },
        {
          value: "xxsh",
          name: "信息审核备案",
        },
        {
          value: "safe",
          name: "安全生产",
        },
      ],
      quickEntryList: [],
      timer: null,
      circleGrainWarning: [],
      jkqWarning: [],
      marginTop1: 0,
      marginTop2: 0,
      timer: null,
      timer1: null,
      timer2: null,
      flag1: 1,
      flag2: 2,
    };
  },
  created() {
    console.log("888----------=========");
    // console.log("theme---"+sessionStorage.getItem("theme"))
    // if(sessionStorage.getItem("theme")){
    //   window.document.documentElement.setAttribute( "data-theme", sessionStorage.getItem("theme"));
    // }else{
    //   getTheme(sessionStorage.getItem("userLoginName")).then((res) => {
    //     sessionStorage.setItem("theme", themeName)
    //     window.document.documentElement.setAttribute( "data-theme", res.theme );
    //   })
    // }
  },
  methods: {
    helpMoreList(firstMenuName) {
      getLeftMenuList(firstMenuName); //获取当前对应的左侧菜单
      this.$router.push({
        path: "/publicfunction/helpDocument",
      });
    },
    goHelpDetail(row) {
      getLeftMenuList("通用功能"); //获取当前对应的左侧菜单
      this.$router.push({
        path: "/publicfunction/helpDocumentDetail",
        query: { wdId: row.wdid },
      });
    },
    jumpView(name) {
      getLeftMenuList(name);
      this.getFirstMenu(JSON.parse(sessionStorage.getItem("leftMenuList")));
      window.location.href =
        location.host == "localhost:9000"
          ? "/#" + this.menuUrl
          : "/web/portal/#" + this.menuUrl;
    },
    getFirstMenu(arr) {
      if (arr[0].children.length) {
        this.getFirstMenu(arr[0].children);
      } else {
        this.menuUrl = arr[0].resourceUrl;
      }
    },
    getSysteamName(code) {
      let name = "";
      this.systeamList.forEach((item) => {
        if (item.value == code) {
          name = item.name;
        }
      });
      return name;
    },
    getResCode(MenuList, row) {
      MenuList.map((item) => {
        if (row.itemUrl.indexOf("detail") > -1) {
          let detailUrl = row.itemUrl;
          detailUrl = detailUrl.split("/").slice(0, -1).join("/");
          detailUrl = detailUrl + "/index";
          if (detailUrl === item.resourceUrl) {
            if (item.children.length > 0) {
              this.getResCode(item.children, row);
            } else {
              sessionStorage.setItem("resourceCode", item.resourceCode);
              return item.resourceCode;
            }
          } else {
            if (item.children && item.children.length > 0) {
              this.getResCode(item.children, row);
            } else {
              return;
            }
          }
        } else {
          if (row.itemUrl === item.resourceUrl) {
            sessionStorage.setItem("resourceCode", item.resourceCode);
            return item.resourceCode;
          } else {
            if (item.children && item.children.length > 0) {
              this.getResCode(item.children, row);
            } else {
              return;
            }
          }
        }
      });
    },
    jumpDetails(row) {
      if (row.sysCode == "ywjc") {
        if (row.itemStatusName == "待分配" || row.itemStatusName == "待检查") {
          let nameStrArray = row.itemId.split("-");
          let rwId = nameStrArray[0];
          let jgId = nameStrArray[0];
          let jhId = nameStrArray[1];
          let idKeyName = row.itemQuery.idKey;
          row.itemQuery = JSON.parse(
            JSON.stringify(row.itemQuery).replace(/idKey/g, row.itemQuery.idKey)
          );

          switch (idKeyName) {
            case "rwId":
              row.itemQuery[idKeyName] = rwId;
              if (row.itemQuery.jhId) {
                row.itemQuery.jhId = jhId;
              }
              break;
            case "jhId":
              row.itemQuery[idKeyName] = jhId;
              if (row.itemQuery.rwId) {
                row.itemQuery.rwId = rwId;
              }
              break;
            case "jgId":
              row.itemQuery[idKeyName] = jgId;
              if (row.itemQuery.rwId) {
                row.itemQuery.rwId = rwId;
              }
              break;
          }
        } else {
          if (row.itemStatusName == "待企业上传") {
            let nameStrArray = row.itemId.split("-");
            let jgId = nameStrArray[0];
            let rwId = nameStrArray[0];
            row.itemQuery = JSON.parse(
              JSON.stringify(row.itemQuery.management).replace(
                /idKey/g,
                row.itemQuery.management.idKey
              )
            );
            row.itemQuery.object = JSON.stringify({ jgId: jgId });
            if (row.itemQuery.rwId) {
              row.itemQuery.rwId = rwId;
            }
            row.itemUrl = row.itemUrl.split(",")[1];
          } else {
            let nameStrArray = row.itemId.split("-");
            row.itemId = nameStrArray[0];
            if (row.itemQuery) {
              let idKeyName = row.itemQuery.idKey;
              row.itemQuery = JSON.parse(
                JSON.stringify(row.itemQuery).replace(
                  /idKey/g,
                  row.itemQuery.idKey
                )
              );
              row.itemQuery[idKeyName] = row.itemId;
            }
          }
        }
      } else if (row.sysCode == "qzzrz") {
        row.handlingTime = this.dateFormat(new Date());
        row.handler = JSON.parse(sessionStorage.getItem("userInfo")).userName;
        row.handlerId = JSON.parse(sessionStorage.getItem("userInfo")).userId;
        // modificationFn(row).then((res) => {});
      } else {
        if (row.sysCode == "jy" && row.itemId.indexOf("-") != -1) {
          row.itemId = row.itemId.substring(0, row.itemId.indexOf("-"));
        }
        if (
          row.sysCode == "cbl" &&
          row.itemId.indexOf("-") != -1 &&
          row.itemId.indexOf(",") == -1
        ) {
          row.itemId = row.itemId.substring(0, row.itemId.indexOf("-"));
        }
        if (
          row.sysCode == "xxsh" &&
          row.itemId.indexOf("-") != -1 &&
          row.itemId.indexOf(",") == -1
        ) {
          row.itemId = row.itemId.substring(0, row.itemId.indexOf("-"));
        }
        if (row.sysCode == "safe" && row.itemId.indexOf("-") != -1) {
          row.itemId = row.itemId.substring(0, row.itemId.indexOf("-"));
        }
        if (row.itemQuery) {
          if (row.itemId.indexOf(",") != -1) {
            row.itemId = row.itemId.split(",");
            row.itemQuery.idKey = row.itemQuery.idKey.split(",");
            row.itemId.forEach((item, index) => {
              if (item.indexOf("-") != -1) {
                row.itemId[index] = item.substring(0, item.indexOf("-"));
              }
            });
            row.itemQuery.idKey.map((item, index) => {
              row.itemQuery[row.itemQuery.idKey[index]] = row.itemId[index];
            });
          } else {
            row.itemQuery[row.itemQuery.idKey] = row.itemId;
          }
        }
      }
      getLeftMenuList(this.getSysteamName(row.sysCode));
      let MenuList = [];
      MenuList = JSON.parse(sessionStorage.getItem("topMenuList"));
      this.getResCode(MenuList, row);
      console.log(
        sessionStorage.getItem("resourceCode"),
        "lllllllllllllllllk-----"
      );
      sessionStorage.setItem("searchData", null);
      let query = "";
      if (row.itemUrl) {
        if (row.itemQuery) {
          for (let key in row.itemQuery) {
            query += key + "=" + row.itemQuery[key] + "&";
          }
          window.location.href =
            location.host == "localhost:9000"
              ? "/#" + row.itemUrl + "?" + query
              : "/web/portal/#" + row.itemUrl + "?" + query;
        } else {
          window.location.href =
            location.host == "localhost:9000"
              ? "/#" + row.itemUrl
              : "/web/portal/#" + row.itemUrl;
        }
      }
    },
    getList() {
      console.log("888----------=========");
      this.listLoading = true;
      let data = {
        pageSize: "10",
        pageNum: "1",
        itemName: "",
        submitter: "",
        receiver: sessionStorage.getItem("userCode"),
        orgCode: sessionStorage.getItem("orgCode"),
      };
      todoList(data).then((res) => {
        let wrapHeight = parseInt(this.$refs.dashboardWrap.style.height);
        let windowHeight = window.innerHeight;
        let height = (wrapHeight / 100) * windowHeight;
        if (height > 600) {
          this.tzData = res.items;
        } else {
          this.tzData = res.items.slice(0, 4);
        }
      });
      if (window.sessionStorage.getItem("TOKENL")) {
      } else {
        this.resultList1 = [{}];
      }
    },
    DBList() {
      findNoticeList().then((res) => {
        this.tzLoading = false;
        this.tzData = res.data.splice(10);
      });
    },
    detailtz(item) {
      this.tzDetailDialog = true;
      findNoticeId(item.id).then((res) => {
        this.detailtzList = res.data;
      });
    },
    OAList() {
      // alert(111)
      findOAList().then((res) => {
        // console.log(res)
        if (res.infoCode == "200") {
          this.tableLoading = false;
          this.resultList = res.data.list;
        }
      });
    },
    changeImg(refName, imgName) {
      this.$refs[refName][0].src = require("./img/" + imgName + ".png");
    },
    oaRowClick(row) {
      // console.log()
      window.open(row.linkUrl);
    },
    dateFormat(timedate) {
      if (timedate === null || timedate === undefined) {
        return "";
      } else {
        let date = new Date(timedate);
        let year = date.getFullYear();
        /* 在日期格式中，月份是从0开始的，因此要加0
         * 使用三元表达式在小于10的前面加0，以达到格式统一  如 09:11:05
         * */
        let month =
          date.getMonth() + 1 < 10
            ? "0" + (date.getMonth() + 1)
            : date.getMonth() + 1;
        let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
        let hours =
          date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
        let minutes =
          date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
        let seconds =
          date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
        // 拼接
        return (
          year +
          "-" +
          month +
          "-" +
          day +
          " " +
          hours +
          ":" +
          minutes +
          ":" +
          seconds
        );
        // return (year + '/' + month + '/' + day)
      }
    },
    tableRowClick(row) {
      console.log(row);
      if (row.businessType == 20) {
        window.open(
          `http://218.241.206.66:8097/web/business/#/task/companySh?iframeUrl=${row.procInstId}&from=reportForm2`
        );
      } else if (row.businessType == 30) {
        window.open(
          `http://218.241.206.66:8097/web/business/#/task/companyBg?iframeUrl=${row.procInstId}&from=reportForm2`
        );
      } else {
        let data = {
          code: "20",
          procInstIid: row.procInstId,
          actId: row.actId,
          taskId: row.taskId,
        };
        // signTask(data).then(res => {
        //   if (res.infoCode === 200) {
        //     const iframeUrl = res.data
        //     console.log(iframeUrl)
        //     window.open(
        //       `http://218.241.206.66:8097/web/business/#/task/biDetail?iframeUrl=${iframeUrl}&from=reportForm2`
        //     )
        //   }
        // })
      }
    },
    ywMore() {
      window.open("http://218.241.206.66:8097/web/business/#/task/reportForm2");
    },
    oAPass() {
      axios
        .post(
          "http://218.241.206.66:8097/irpt/esmain/js/login.do?action=login&id=xiaolb&pw={25f9e794323b453885f5181f1b624d0b}&pwdstrength=1&pwdlength=9"
        )
        .then(function (res) {
          res = res.data;
          if (res.code == "000") {
          } else {
          }
        });
      // const timerOA = setInterval(function () {
      //   const LoginCode = JSON.parse(sessionStorage.getItem('LoginCode'))
      //   if (LoginCode.loginCode === '1') {
      //     clearInterval(timerOA)
      //     console.log('我是定时器')
      //     document.getElementById('loginid').value = LoginCode.username
      //     document.getElementById('userpassword').value = "123456789"
      //     console.log( document.getElementById('loginid').value,document.getElementById('userpassword').value)
      //     document.LoginformsOA.submit()
      //   }
      // }, 10)
    },
    //递归函数【遍历权限下的行政管理和综合业务】
    // getResourceUrl() {
    //   // for (let i = 0; i < childrenArray.length; i++) {
    //   //   if (childrenArray[i].children.length === 0 && childrenArray[i].resourceUrl.indexOf('/ssoa/') > -1 && this.numOa === 0) {
    //   this.oAPass() //OA免登
    //   // this.numOa += 1;
    //   //     } else if (childrenArray[i].children.length === 0 && childrenArray[i].resourceUrl.indexOf('/sso/') > -1 && this.numI === 0) {
    //   //       console.log('I免登', childrenArray[i].resourceUrl.split('url=')[1] + '?token=' + sessionStorage.getItem('TOKENL'))
    //   //       this.srcI = childrenArray[i].resourceUrl.split('url=')[1] + '?token=' + sessionStorage.getItem('TOKENL')
    //   //       this.numI += 1;
    //   //     } else {
    //   //       this.getResourceUrl(childrenArray[i].children)
    //   //     }
    //   //   }
    // },
    helpDocumentList() {
      //帮助文档列表
      const options = {
        gnmk: "",
        status: [1],
        tjdz: "",
        wdbt: "",
        yhcj: ["1", "1,2"],
      };
      const limit = {
        page: 1,
        size: 10,
      };
      helpList(options, limit).then((res) => {
        if (res && res.items) {
          this.helpData = res.items;
        } else {
          this.$message({
            message: res.msg,
            type: "error",
            duration: 2000,
          });
        }
      });
    },
    //快捷入口
    quickEntry() {
      console.log("888----------=========");
      this.timer = setInterval(() => {
        console.log(1);
        if (sessionStorage.getItem("topMenuList")) {
          clearInterval(this.timer);
          this.quickEntryList = [];
          let topMenuList = JSON.parse(sessionStorage.getItem("topMenuList"));
          let quickEntryList = [];
          topMenuList.map((item) => {
            if (item.children.length != 0 && item.children[0].resourceImgUrl) {
              item.children.map((item1) => {
                quickEntryList.push(item1.resourceName);
              });
            }
          });
          this.entranceList.map((item) => {
            quickEntryList.map((item1) => {
              if (item.name == item1 && this.quickEntryList.length < 6) {
                this.quickEntryList.push(item);
              }
            });
          });
        }
      }, 300);
    },
    //首页转圈粮列表
    getWarnList() {
      warnList()
        .then((response) => {
          if (response && response.infoCode === 200) {
            this.circleGrainWarning = response.data.circleGrainWarning;
            this.jkqWarning = response.data.jkqWarning;
            if (this.circleGrainWarning && this.circleGrainWarning.length > 5) {
              this.stop1();
              this.autoMove1();
            }
            if (this.jkqWarning && this.jkqWarning.length > 5) {
              this.stop2();
              this.automove2();
            }
          }
        })
        .catch();
    },
    autoMove1() {
      this.stop1();
      if (this.circleGrainWarning && this.circleGrainWarning.length > 5) {
        let that = this;
        this.timer1 = setInterval(() => {
          if (that.flag1 <= that.circleGrainWarning.length - 5) {
            that.marginTop1 = 31 * that.flag1;
            that.flag1 = that.flag1 + 1;
          } else {
            that.marginTop1 = 0;
            that.flag1 = 1;
          }
        }, 3000);
      }
    },
    automove2() {
      this.stop2();
      if (this.jkqWarning && this.jkqWarning.length > 5) {
        let that = this;
        this.timer2 = setInterval(() => {
          if (that.flag2 <= that.jkqWarning.length - 5) {
            that.marginTop2 = 31 * that.flag2;
            that.flag2 = that.flag2 + 1;
          } else {
            that.marginTop2 = 0;
            that.flag2 = 1;
          }
        }, 3000);
      }
    },
    stop1() {
      clearInterval(this.timer1);
    },
    stop2() {
      clearInterval(this.timer2);
    },
    readWarnItem(content, id, type, cch, xybh) {
      if (type === 1) {
        let userid = sessionStorage.getItem("userCode");
        let data = {
          content: content,
          creatorCode: userid,
          messageType: type,
          sourceID: id,
        };
        readList(JSON.stringify(data))
          .then((response) => {
            if (response && response.infoCode === 200) {
              this.$router.push({
                path: "/inspection/circularGrainWarn",
                query: {
                  cch: cch,
                },
              });
            }
          })
          .catch();
      } else {
        this.$router.push({
          path: "/grainReserves/overheadRoundout/index",
          query: {
            xybh: xybh,
          },
        });
      }
    },
  },
  mounted() {
    console.log("888----------=========");
    let that = this;
    this.timer = setInterval(() => {
      that.getWarnList();
    }, 60000);
    this.helpDocumentList();
    window.onresize = () => {
      return (() => {
        this.windowHeight = window.innerHeight;
      })();
    };
    this.quickEntry();
    setTimeout(() => {
      this.getList();
      this.getWarnList();
    }, 500);
    let num = 1;
    let _this = this;
    setInterval(function () {
      if (num === 1) {
        num += 1;
      }
    }, 500);
  },
  destroyed() {
    clearInterval(this.timer);
    clearInterval(this.timer1);
    clearInterval(this.timer2);
  },
};
</script>

<style lang="scss" scoped>
* {
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
}

/*.dashboard-container {*/
/*    !*width: 1200px;*!*/
/*    margin: 0 auto;*/
/*    border: none;*/
/*    background: #ffffff;*/
/*    padding: 0;*/
/*}*/

// ------局内公文 数据统计 ----/-----
.bumf {
  height: 42px;
  line-height: 42px;
  color: #fff;
  font-size: 14px;
  padding-left: 15px;
  overflow: hidden;
  position: relative;
}
.bumf span {
  font-size: 16px !important;
}

.bumf .more {
  float: right;
  font-weight: normal;
  padding-right: 15px;
  position: absolute;
  cursor: pointer;
  right: 15px;
}

.bumf .bumfCon {
  // height: 280px;
  overflow: hidden;
}

.bumfCon {
  overflow: hidden;
}

.button {
  background-color: #006bd5;
}

.imgWrap {
  width: 100px;
  height: 105px;
  display: inline-block;
  text-align: center;
  position: relative;
  margin-top: 20px;
  /*background: url("./img/ywjc.png") no-repeat;*/
}

.imgName {
  // position: absolute;
  // bottom: 0;
  width: 100%;
  // line-height: 20px;
  // height: 20px;
}

.el-table .el-table__body-wrapper .el-table__row {
  cursor: pointer;
}
.bumfConkj {
  padding-bottom: 120px;
}
.scrollWarn {
  float: right;
  width: 25%;
  height: 125px;
  // background-color: skyblue;
}
.scroll-left,
.scroll-right {
  width: 49%;
  height: 100%;
}
.scroll-left {
  float: left;
}
.scroll-right {
  float: right;
}
.scroll-title {
  font-size: 15px;
  font-weight: 600;
  height: 42px;
  line-height: 42px;
  text-align: center;
  background-color: #eff7ff;
}
// .icon {
//   display: inline-block;
//   width: 21px;
//   height: 21px;
//   margin-right: 5px;
//   vertical-align: middle;
// }
.zql-icon {
  background: url("./img/zql-icon.png") no-repeat;
  background-size: 100% 100%;
}
.jkq-icon {
  background: url("./img/jkq-icon.png") no-repeat;
  background-size: 100% 100%;
}
.scroll-wrapper {
  overflow: hidden;
  height: 155px;
}
.circleWarn-item,
.jkqWarn-item {
  height: 31px;
  line-height: 31px;
  font-size: 12px;
  text-align: center;
}
.circleWarn-item-icon {
  display: inline-block;
  width: 13px;
  margin-left: 5px;
  height: 13px;
  background: url("./img/zql-warn-icon.png") no-repeat;
  background-size: 100% 100%;
}
.circleWarn-item:nth-child(2n + 1),
.jkqWarn-item:nth-child(2n + 1) {
  background-color: #fff;
}
.circleWarn-item:nth-child(2n),
.jkqWarn-item:nth-child(2n) {
  background-color: #f7f9fb;
}
.circleWarn-item-icon {
  display: inline-block;
  width: 13px;
  margin-left: 5px;
  height: 13px;
  background: url("./img/jkq-warn-item.png") no-repeat;
  background-size: 100% 100%;
}
.noData {
  height: 155px;
  line-height: 155px;
  font-size: 12px;
  text-align: center;
  background-color: #fff;
}
</style>
