<template>
  <div class="dashboard-container">
    <!-- 中部 左右 1-1-->
    <!-- <div>
      <el-row>
    <el-col :span="24">-->
    <div style="width: 1200px; margin: 0 auto">
      <el-row style="margin-top: 10px">
        <el-col
          style="
            border: 1px solid #efeded;
            height: 284px;
            margin-right: 10px;
            width: 595px;
          "
        >
          <div class="bumf">
            <span>快捷入口</span>
            <!-- <router-link class="more" :to="{path: '/statisticalReview/statisticalReviewIndex'}">更多 ></router-link> -->
          </div>

          <!-- <div style="border-bottom:2px solid #41afb8;"></div> -->
          <div class="bumfCon">
            <el-row style="margin-top: 30px; margin-left: 65px">
              <el-col :span="2"></el-col>
              <el-col :span="6">
                <a @click="aaaa" target="_blank">
                  <img src="./img/1.png" />
                  <div class="imgName">监督检查</div>
                </a>
              </el-col>

              <el-col :span="6">
                <a
                  href="http://172.16.0.200:88/wui/index.html#/?logintype=1&_key=gefn55"
                  target="_blank"
                >
                  <img src="./img/3.png" />
                  <div class="imgName">政务OA</div>
                </a>
              </el-col>
              <el-col :span="6">
                <a @click="ffff" target="_blank">
                  <img src="./img/4.png" />
                  <div class="imgName">质量管理</div>
                </a>
              </el-col>
              <el-col :span="6">
                <a @click="bbbb" target="_blank">
                  <img src="./img/2.png" />
                  <div class="imgName">储备管理</div>
                </a>
              </el-col>
              <!-- <el-col :span="4">
                <a href="http://218.241.206.66:8097/web/business/#/kjjg/home" target="_blank">
                  <img src="./img/5.png" />
                  <div class="imgName">库级监管</div>
                </a>
              </el-col>-->
              <el-col :span="2"></el-col>
            </el-row>
            <el-row style="margin-top: 10px">
              <el-col :span="2"></el-col>
              <!-- <el-col :span="4">

                <a>
                  <img src="./img/6.png" />
                  <div class="imgName">宏观调控</div>
                </a>
              </el-col>-->

              <el-col :span="5" style="margin-left: 65px">
                <a @click="pppp">
                  <img src="./img/7.png" />
                  <div class="imgName">项目管理</div>
                </a>
              </el-col>
              <el-col :span="5" style="margin-left: 8px">
                <a @click="eeee">
                  <img src="./img/8.png" />
                  <div class="imgName">涉粮企业</div>
                </a>
              </el-col>
              <el-col :span="5" style="margin-left: 8px">
                <a @click="cccc">
                  <img src="./img/9.png" />
                  <div class="imgName">粮油交易</div>
                </a>
              </el-col>
              <!-- <el-col :span="4">
                <a>
                  <img src="./img/10.png" />
                  <div class="imgName">政策法规</div>
                </a>
              </el-col>-->
              <el-col :span="2"></el-col>
            </el-row>
          </div>
        </el-col>
        <el-col style="border: 1px solid #efeded; height: 284px; width: 595px">
          <div class="bumf">
            <span>通知公告</span>
            <!-- <router-link class="more">more ></router-link> -->
            <span
              v-show="tzData && tzData.length > 6"
              @click="tzDialog"
              class="more"
              >更多 ></span
            >
          </div>
          <!-- <div style="border-bottom:2px solid #41afb8;"></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"
                >
                  <!-- <a :href="item.linkUrl" target="_blank"> -->
                  <span
                    @click="detailtz(item)"
                    style="
                      float: left;
                      width: 300px;
                      overflow: hidden;
                      margin-left: 5px;
                      text-overflow: ellipsis;
                      white-space: nowrap;
                    "
                    >{{ item.title }}</span
                  >
                  <span style="float: right; width: 100px">{{
                    item.startTime
                  }}</span>
                  <!-- </a> -->
                </li>
              </ul>
            </el-row>
          </div>
        </el-col>
      </el-row>
      <el-row style="margin-top: 20px">
        <el-col
          style="
            border: 1px solid #efeded;
            height: 334px;
            width: 595px;
            margin-right: 10px;
          "
        >
          <div class="bumf">
            <span>公文待办</span>
            <!-- <router-link class="more">more ></router-link> -->
            <span class="more" v-show="resultList.length > 0" @click="gwDialog"
              >更多 ></span
            >
          </div>
          <!-- <div style="border-bottom:2px solid #41afb8;"></div> -->
          <div class="bumfCon">
            <el-row>
              <template>
                <el-table
                  :data="resultList"
                  v-loading="tableLoading"
                  stripe
                  border
                  @row-click="oaRowClick"
                  highlight-current-row
                  style="width: 100%; z-index: 99"
                >
                  <el-table-column
                    prop="eventInfo"
                    label="标题"
                    width="auto"
                    align="center"
                    :show-overflow-tooltip="true"
                  ></el-table-column>
                  <el-table-column
                    prop="startPersonName"
                    label="发起人"
                    align="center"
                    width="150"
                  ></el-table-column>
                  <el-table-column
                    prop="startTime"
                    label="发起时间"
                    align="center"
                    width="180"
                  ></el-table-column>
                  <!-- <el-table-column label="操作" width="80">
                                <template slot-scope="scope" content="查看">
                                    <el-tooltip class="item" effect="light" content="查看" placement="top">
                                      <el-button type="primary" @click.stop="search(scope.row)" size='small' icon="el-icon-zoom-in" class="button"></el-button>
                                  </el-tooltip>
                                </template>
                  </el-table-column>-->
                </el-table>
              </template>
            </el-row>
          </div>
        </el-col>
        <el-col style="border: 1px solid #efeded; height: 334px; width: 595px">
          <div class="bumf">
            <span>业务待办</span>
            <span class="more">更多 ></span>
          </div>
          <!-- <div style="border-bottom:2px solid #41afb8;"></div> -->
          <div class="bumfCon">
            <el-row>
              <template>
                <el-table
                  :data="resultList1"
                  v-loading="tableLoading1"
                  stripe
                  border
                  highlight-current-row
                  style="width: 100%; z-index: 99"
                >
                  <!-- @row-click="tableRowClick" -->
                  <el-table-column
                    prop="procdefName"
                    label="标题"
                    align="center"
                    width="auto"
                    :show-overflow-tooltip="true"
                  ></el-table-column>
                  <el-table-column
                    prop="taskName"
                    label="发起人"
                    align="center"
                    :show-overflow-tooltip="true"
                    width="150"
                  ></el-table-column>
                  <el-table-column
                    prop="assignTime"
                    label="发起时间"
                    align="center"
                    width="180"
                  ></el-table-column>
                  <!-- <el-table-column label="操作" width="80">
                                <template slot-scope="scope" content="查看">
                                    <el-tooltip class="item" effect="light" content="查看" placement="top">
                                      <el-button type="primary" @click.stop="search(scope.row)" size='small' icon="el-icon-zoom-in" class="button"></el-button>
                                  </el-tooltip>
                                </template>
                  </el-table-column>-->
                </el-table>
              </template>
            </el-row>
          </div>
        </el-col>
      </el-row>
    </div>

    <el-dialog title="通知公告" width="60%" :visible.sync="dialogTableVisible">
      <el-row style="height: 300px; overflow: auto">
        <ul style="background-color: #fff">
          <li class="bumfCon-li" v-for="(item, index) in tzData" :key="index">
            <!-- <a :href="item.linkUrl" target="_blank"> -->
            <span
              style="
                float: left;
                width: 70%;
                overflow: hidden;
                margin-left: 5px;
                text-overflow: ellipsis;
                white-space: nowrap;
              "
              >{{ item.title }}</span
            >
            <!-- <span style="float:right;width:20%;">{{item.startTime}}</span> -->
            <!-- </a> -->
          </li>
        </ul>
      </el-row>
    </el-dialog>
    <el-dialog title="公文代办" :visible.sync="oaDialog">
      <el-row style="height: 300px; overflow: auto" width="60%">
        <el-table
          :data="resultList"
          v-loading="tableLoading"
          stripe
          border
          @row-click="oaRowClick"
          highlight-current-row
          style="width: 100%; z-index: 99"
        >
          <el-table-column
            prop="eventInfo"
            label="标题"
            width="auto"
            align="center"
            :show-overflow-tooltip="true"
          ></el-table-column>
          <el-table-column
            prop="startPersonName"
            label="发起人"
            align="center"
            width="150"
          ></el-table-column>
          <el-table-column
            prop="startTime"
            label="发起时间"
            align="center"
            width="180"
          ></el-table-column>
          <!-- <el-table-column label="操作" width="80">
		                      <template slot-scope="scope" content="查看">
		                      	<el-tooltip class="item" effect="light" content="查看" placement="top">
		                        	<el-button type="primary" @click.stop="search(scope.row)" size='small' icon="el-icon-zoom-in" class="button"></el-button>
		                        </el-tooltip>
		                      </template>
          </el-table-column>-->
        </el-table>
      </el-row>
    </el-dialog>
    <el-dialog title="通知公告" width="60%" :visible.sync="tzDetailDialog">
      <div style="width: 100%">
        <span
          style="
            display: block;
            margin: 0 auto;
            width: 450px;
            text-align: center;
            font-size: 18px;
          "
        >
          {{ detailtzList.title }}
        </span>
        <span
          style="
            display: block;
            margin: 10px auto;
            width: 350px;
            text-align: center;
          "
        >
          {{
            detailtzList.pushPersonName
          }}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{
            detailtzList.pushTime
          }}
        </span>
        <div
          class="ql-container ql-snow"
          style="
            padding: 0px 20px;
            background-color: #f0f0f0;
            min-height: 100px;
            max-height: 150px;
            overflow: auto;
          "
        >
          <el-row>
            <el-col
              :span="24"
              class="ql-editor"
              v-html="detailtzList.content"
              >{{ detailtzList.content }}</el-col
            >
          </el-row>
        </div>
        <div style="margin-top: 10px">
          <span>附件</span>&nbsp;&nbsp;&nbsp;&nbsp;
          <span style="color: blue">{{
            detailtzList.attachInfo ? detailtzList.attachInfo : "未上传附件"
          }}</span>
        </div>
      </div>
    </el-dialog>
    <!-- <iframe id="Loginform" name="Loginform" disabled="true" border="1" frameborder="1" style="display:none;"></iframe> -->

    <!-- <form id="LoginformsOA" ref="LoginformsOA" name="LoginformsOA" action='http://218.241.206.66:8097/irpt/esmain/js/login.do' method=POST>
            <input type='hidden' name='pwdlength' value='9'>
            <input type='hidden' name='action' value='login' />
            <input type='hidden' name='pwdstrength' value='1' />
            <input type='hidden' id="loginid" name='id' />
            <input type='hidden' id="userpassword" name='pw' />
    </form>-->
    <!-- <iframe :src="srcI" style="display:none;"></iframe> -->
    <!-- </el-row> -->
    <!-- </el-col>
      </el-row>
    </div>-->
  </div>
</template>

<script>
// import { mapGetters } from 'vuex'
// import {auth} from '@/api/index'
// import {
//   getInfo
// } from '@/api/login'
// import axios from 'axios'
// import { AdminIindxStAu, AdminIindxDaSt,userInfo } from '@/api/acheck/index'
import qs from "qs";
import axios from "axios";
import {
  getDaiBanPagesNew,
  findNoticeList,
  findNoticeId,
  findOAList,
  signTask,
  todoList,
} from "@/api/taskReport/index";
// import {
//     queryStatisicalRptInfo
// } from '@/api/statisticalReview'
// import { getInfoById } from '@/api/login'
// import Cookies from 'js-cookie'
export default {
  name: "dashboard",
  data() {
    return {
      needArray: [],
      tzData: [],
      dialogTableVisible: false,
      tzDetailDialog: false,
      oaDialog: false,
      form: {
        procName: "",
        starter: "",
        userId: "",
      },
      limit: {
        page: 1,
        size: 6,
        total: 0,
      },
      userId: "",
      resultList: [],
      resultList1: [],
      toInven: [],
      toInvens: [],
      numOfPeoEmp: [],
      numOfPeoEmps: [],
      numOfUni: [],
      numOfUnis: [],
      warUni: [],
      warUnis: [],
      laEnCa: [],
      laEnCas: [],
      newFoodEnt: [],
      newFoodEnts: [],
      tableLoading: false,
      tableLoading1: false,
      tzLoading: false,
      detailtzList: {},
    };
  },
  methods: {
    aaaa() {
      getLeftMenuList("监督检查");
      this.$router.push({ path: "/inspection/checkTalentPoolList" });
    },
    bbbb() {
      getLeftMenuList("储备管理");
      this.$router.push({ path: "/grainReserves/yearReceive/index" });
    },
    cccc() {
      getLeftMenuList("粮油交易");
      this.$router.push({
        path: "/transaction/tradeEntrust/outInDepotEntrust/index",
      });
    },
    eeee() {
      getLeftMenuList("企业备案管理系统");
      this.$router.push({ path: "/grainCoManage/userManage/index" });
    },
    ffff() {
      getLeftMenuList("质量管理");
      this.$router.push({ path: "/quality/zhiliangguanli/basicInfo/zhijjgTj" });
    },
    pppp() {
      getLeftMenuList("项目管理");
      this.$router.push({ path: "/projectmanage/projectApply" });
    },
    getList() {
      this.listLoading = true;
      todoList({}).then((res) => {
        console.log(res, "ssssssssss");
        if (res.infoCode == 200) {
          this.resultList1 = res.data;
        }
      });
      if (window.sessionStorage.getItem("TOKENL")) {
      } else {
        this.resultList1 = [{}];
      }
      // cl(this.form, this.limit)
      //   .then(res => {
      //     if (res.infoCode == 200) {
      //       console.log(res)
      //       this.tableLoading1 = false
      //       this.resultList1 = res.data.list
      //       this.limit.total = res.data.total
      //     } else {
      //       this.$message({
      //         message: res.msg,
      //         type: 'error'
      //       })
      //     }
      //     this.listLoading = false
      //   })
      //   .catch(err => {
      //     console.log(err)
      //     this.listLoading = false
      //   })
    },
    DBList() {
      findNoticeList(this.limit).then((res) => {
        // for (let item of res.data.list) {
        //   console.log(item)
        //   item.linkUrl += '&token=' + sessionStorage.getItem('TOKENL');
        //   // console.log(item)
        // }
        console.log(res, "1111");
        if (res.infoCode == 200) {
          if (res.data != null) {
            this.tzData = res.data;
          }
        }
        this.tzLoading = false;
      });
    },
    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;
        }
      });
    },
    oaRowClick(row) {
      // console.log()
      window.open(row.linkUrl);
    },
    gwDialog() {
      this.oaDialog = true;
    },
    tzDialog() {
      this.dialogTableVisible = true;
    },
    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)
    //     }
    //   }
    // }
  },
  mounted() {
    setTimeout(() => {
      this.getList();
      this.DBList();
      // this.OAList()
    }, 200);

    // this.OAList()
    let num = 1;
    let _this = this;
    setInterval(function () {
      if (num === 1) {
        // let getMenusData = JSON.parse(sessionStorage.getItem('menusData'))[0].children;
        // this.getResourceUrl()
        console.log("333");
        num += 1;
      }
    }, 500);
  },
};
</script>

<style lang="scss" scoped>
.dashboard-container .crumb {
  color: #41afb8;
  font-size: 16px;
  line-height: 45px;
  font-weight: 600;
}
// ------局内公文 数据统计 ----/-----
.dashboard-container .bumf {
  height: 45px;
  line-height: 45px;
  color: #fff;
  font-size: 14px;
  padding-left: 15px;
  background-repeat: no-repeat;
  background-color: #eff7ff;
  background-image: url("./img/tjtitle.png");
  overflow: hidden;
  position: relative;
}
.dashboard-container .bumf .more {
  float: right;
  color: #999999;
  font-weight: normal;
  padding-right: 15px;
  position: absolute;
  cursor: pointer;
  right: 15px;
}
.dashboard-container .bumf .bumfCon {
  height: 280px;
  overflow: hidden;
}
.bumfCon {
  height: 280px;
  overflow: hidden;
}
.dashboard-container .bumfCon ul li {
  width: 100%;
  // margin:0 5px;
  border-bottom: 1px #ccc dashed;
  // text-align: center;
  line-height: 30px;
  margin: 15px 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.dashboard-container .bumfCon ul li > span {
  margin-left: 10px;
  float: left;
  width: 75%;
  // border-bottom: 1px #ccc dashed;
  // text-align: center;
  // line-height: 30px;
  margin-right: 5px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.dashboard-container .dataSt {
  width: 206px;
  margin: 0 auto;
}
.dashboard-container .dataSt .dataStDiv1 {
  display: inline-block;
  text-align: center;
}
.dashboard-container .dataStDiv1 div {
  padding: 10px;
}
.dashboard-container .dataSt ul {
  width: 206px;
  height: 42px;
  // background-color: #449dd6;
  overflow: hidden;
  margin-top: 15px;
}
.dashboard-container .dataSt li {
  width: 31px;
  height: 44px;
  float: left;
  text-align: center;
  font-size: 30px;
  line-height: 40px;
  color: #ffffff;
  margin-right: 3px;
  // border: 1px solid #449dd6;
  background: url("./img/center-nav-bg.png") center top;
}
// ------局内公文 数据统计----\-----
// ------ 快捷区域----/-----
.dashboard-container .quick div {
  background-repeat: no-repeat;
  text-align: center;
  height: 170px;
  line-height: 250px;
  padding-top: 10px;
}
// ------ 快捷区域----\-----
// ---------中部左右-------\------
.dashboard-container .footer {
  width: 100%;
  height: 40px;
  line-height: 40px;
  font-size: 16px;
  color: #dfdfdf;
  text-align: center;
  background-color: #505050;
}
.dashboard-container ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.dashboard-container .bumfConUlL li {
  text-align: left !important;
}
.button {
  background-color: #006bd5;
}
.imgName {
  color: #000000;
  width: 72px;
  text-align: center;
}
a {
  color: #000000;
}
.bumfCon-li {
  width: 100%;
  // margin-left: 5px;
  height: 32px;
  cursor: pointer;
}
</style>
