<template>
  <div class="main">
    <van-row>
      <div style="margin-left: 50px;display: flex;align-items: center;">
        <van-icon name="friends-o" size="50" color="#1989fa" />
        <span style="font-size: 30px">{{userInfo.姓名}}</span>
      </div>

    </van-row>
    <van-row>
      <van-col span="12">
        <van-button class="big-btn" type="info" @click="routeJump('ChangeMaterial')">
          <van-icon name="notes-o" size="60" color="#ffffff" />
          <br>
          <i>更换物料</i>
        </van-button>
      </van-col>
      <van-col span="12">

        <van-button class="big-btn" type="primary" @click="routeJump('ProductScrapping')">
          <van-icon name="records-o" size="60" color="#ffffff" />
          <br>
          <i>报废解体</i>
        </van-button>
      </van-col>
    </van-row>
    <van-row>
    <van-col span="12">
      <van-button class="big-btn" type="warning" @click="routeJump('RepairSearch')">
        <van-icon name="todo-list-o" size="60" color="#ffffff" />
        <br>
        <i>返修记录</i>
      </van-button>
    </van-col>
      <van-col span="12">
        <van-button class="big-btn" type="danger" @click="routeJump('')">
          <van-icon name="notes-o" size="60" color="#ffffff" />
          <br>
          <i>退出登录</i>
        </van-button>
      </van-col>
    </van-row>
    <!--    <van-row v-if="planCount !== 0">-->
    <!--      <div style="margin-left: 50px;display: flex;align-items: center;">-->
    <!--        <van-icon name="info-o" size="30" color="#1989fa" />-->
    <!--        <span style="font-size: 20px">消息提醒：</span>-->
    <!--        <span style="font-size: 20px">共有{{planCount}}待执行的计划，<a style="font-size: 25px;padding: 0 10px;color: #3a8ee6" @click="routeJump('CheckPlanExec')">前去执行</a></span>-->
    <!--      </div>-->
    <!--    </van-row>-->

  </div>
</template>
<script>
import {getBeforeOrAfterTime, getNowTime2} from '../utils/tool'

export default {
  computed: {},
  components: {},
  watch: {},
  props: {},
  data() {
    return {
      planCount: 0,
      pageCurrent: 1,
      pageSize: 10000,
      dateTime: [],
      userInfo: {
        姓名: ''
      }
    }
  },
  created() {
    this.dateTime = [getBeforeOrAfterTime(-30), getNowTime2()]
    this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
    // this.fetchData()
  },
  mounted() {
    document.getElementById('topPageName').innerText = '首页'
  },
  methods: {
    routeJump(val){
      if (val.indexOf('/') !== -1) {
        val = val.substring(1)
      }
      this.$router.push({
        path: '/' + val
      })
    },
    fetchData() {
      var param = []
      param[0] = ['开始日期', this.dateTime[0]]
      param[1] = ['结束日期', this.dateTime[1]]
      param[2] = ['检验员id', this.userInfo['人员编号']]
      param[3] = ['PageCurrent', this.pageCurrent]
      param[4] = ['PageSize', this.pageSize]
      param[5] = ['PageCount', 1000, 'int', '1']
      param[6] = ['ItemCount', 1000, 'int', '1']
      var Data = this.CreateData('11', '质检_工单_未完成_查询', param)
      this.ExecDatabase(Data).then(response => {
        this.planCount = parseInt(response.data.output[0].ItemCount)
      })
    },
  },

}
</script>
<style lang="less" scoped>
.main {
  margin-top: 60px;
}
.big-btn {
  margin: 20px 30px;
  height: 250px;
  width: 85%;
  font-size: 3rem;
}
</style>
