//结转
<template>
  <div class="steel_inbound">
    <div class="sache">     
    <span class="demonstration">月</span>
    <el-date-picker
      v-model="value"
      type="month"
      placeholder="选择月">
    </el-date-picker>
    <el-button type="primary" class="btn" @click="onclick">
        <i class="el-icon-search"></i>查询
      </el-button>
    <el-button type="primary" @click="exportData()"><i class="el-icon-download"></i>导出(Excel)</el-button>        
      <span style="margin-left: 1rem;">合计本月总库存：</span>
      <el-input v-model="totalNumber" :disabled="true" style="width: 150px;"></el-input>
    </div>
    <div class="table">
      <dilTable ref="excelDom" v-bind.sync="option" @func="func">
      </dilTable>
    </div>
  </div>
</template>

<script>
import { sjTime } from '@/utils/sharedJsFile'
export default {
  data(){
    return{
      value : null,
      totalNumber: 0,
      option:{
        // first请求数据的地址
        requestUrl: "/api/v1/wms/getInventoryClose?apiId=95&warehouseId=2&value="+ (sjTime(new Date() + "")),
      },
    }
  },
  methods:{
       func(res){
      console.log(res)
      var total = 0
      res.list.forEach(e => {
        total = total+e.close_thismonth_inventory
      });
      this.totalNumber = total
    
    },
    onclick(){
      console.log("value",this.value)
      var value = null;
      if(this.value){
        value = sjTime(this.value)
      }
      this.option.requestUrl = "/api/v1/wms/getInventoryClose?apiId=95&warehouseId=2&value="+value;
    }
  }
}
</script>

<style lang="scss" scode>
.steel_inbound {
  .sache {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    padding-left: 50px;
    .el-date-editor{
      margin: 20px;
    }
  }
}
</style>