const herfurl = window.location.href.split('index')[0] //跳转地址
let app = new Vue({
  el: '#app',
  data() {
    return {
      time: '',

      timeout: 15000, // 一分钟发一次心跳

      pageindex: 0,

      planCompletionRate:0,
      productionGoodProductRate:0,
      dataCount:0,

      comprehensive: [],
      dataList: [],
      shortageConfig: [{
        name:'张三',
        code:'SCGD202409060001',
        product:'DM（90*96*12）',
        number:'-',
        date:'-',
        datetime:'2024-09-06 17:06:58'
      },{
        name:'张三',
        code:'SCGD202409060001',
        product:'DM（90*96*12）',
        number:'-',
        date:'-',
        datetime:'2024-09-06 17:06:58'
      },{
        name:'张三',
        code:'SCGD202409060001',
        product:'DM（90*96*12）',
        number:'-',
        date:'-',
        datetime:'2024-09-06 17:06:58'
      },{
        name:'张三',
        code:'SCGD202409060001',
        product:'DM（90*96*12）',
        number:'-',
        date:'-',
        datetime:'2024-09-06 17:06:58'
      },{
        name:'张三',
        code:'SCGD202409060001',
        product:'DM（90*96*12）',
        number:'-',
        date:'-',
        datetime:'2024-09-06 17:06:58'
      },{
        name:'张三',
        code:'SCGD202409060001',
        product:'DM（90*96*12）',
        number:'-',
        date:'-',
        datetime:'2024-09-06 17:06:58'
      },{
        name:'张三',
        code:'SCGD202409060001',
        product:'DM（90*96*12）',
        number:'-',
        date:'-',
        datetime:'2024-09-06 17:06:58'
      },{
        name:'张三',
        code:'SCGD202409060001',
        product:'DM（90*96*12）',
        number:'-',
        date:'-',
        datetime:'2024-09-06 17:06:58'
      },{
        name:'张三',
        code:'SCGD202409060001',
        product:'DM（90*96*12）',
        number:'-',
        date:'-',
        datetime:'2024-09-06 17:06:58'
      },{
        name:'张三',
        code:'SCGD202409060001',
        product:'DM（90*96*12）',
        number:'-',
        date:'-',
        datetime:'2024-09-06 17:06:58'
      }]
          
        
    }
  },
  mounted() {
    setTimeout(() => {
      this.handleTime()


      let token = getQueryVariable('token')

      //顶部统计信息
      get('/mbwb/api/v1/erpscs/productionScreen/getTopStatistics',{},{
        Authorization:token +'='
      }).then(res => {
          this.planCompletionRate = res.info.planCompletionRate
          this.productionGoodProductRate = res.info.productionGoodProductRate
      })

      //领料库存情况
      get('/mbwb/api/v1/erpscs/productionScreen/getNeedMaterialStock',{},{
        Authorization:token +'='
      }).then(res => {
         this.comprehensive =  res.infos
      })

      //生产排产情况
      get('/mbwb/api/v1/erpscs/productionScreen/getProductionScheduleInfo',{},{
        Authorization:token +'='
      }).then(res => {
        this.dataList = res.infos
        this.dataCount = res.totalCount
      })
      
      //获取报工情况
      get('/mbwb/api/v1/erpscs/productionScreen/getWorkReportInfo',{},{
        Authorization:token +'='
      }).then(res => {
        
      })


    }, 0)
  },
  methods: {


    handleTime() {
      setInterval(() => {
        this.time = dayjs().format('YYYY-MM-DD HH:mm:ss')
      }, 1000)
    },

  },
})
