//入库转预留
<template>
  <div class="steel_inbound">
    <div class="sache">
      <span class="text">入库时间：</span>
      <el-date-picker v-model="startTime" type="datetime" placeholder="选择日期">
      </el-date-picker>
      <span class="text">至</span>
      <el-date-picker v-model="endTime" type="datetime" placeholder="选择日期">
      </el-date-picker>
      <el-button type="primary" class="btn" @click="onclick">
        <i class="el-icon-search"></i>查询
      </el-button>
      <el-button type="primary" class="btn" @click="onreserved">
        预留
      </el-button>
    </div>
    <div class="table">
      <dilTable v-bind.sync="options" >
      </dilTable>
    </div>
  </div>
</template>

<script>
import { sjTime } from "@/utils/sharedJsFile";
import { getCookie } from '@/utils/util.js';
export default {
  data(){
    return{
      inputText:"",
      startTime: null,
      endTime: null,
      options:{
        // first请求数据的地址
        requestUrl: "/api/v1/wms/getWmsInboundResult?apiId=371&warehouseId="+3,
        // selectionType: "select",
        // mapList: [],
      },
    }
  },
  
  methods:{
    // inboundDetails(scope){
    //   	this.$router.push("/inboundDetails/" + scope.row.inboundId)
    // },
    onclick(){

      let startTime = null;
      let endTime = null;
      if (this.startTime) {
        startTime = sjTime(this.startTime);
      }
      if (this.endTime) {
        endTime = sjTime(this.endTime);
      }
      if (startTime && endTime) {
        if (startTime < endTime) {
          // if(getCookie("orgCode") == "dagangadmin" || getCookie("orgCode") == "zidonghuabu"){
          this.options.requestUrl = "/api/v1/wms/getWmsInboundResult?apiId=371&warehouseId="+3+"&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date();

          // }else if(getCookie("orgCode") == "wuliuchuyunzhongxin"){
          // this.options.requestUrl = "/api/v1/wms/getWmsInboundResult?apiId=371&orderType=13&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date(); 
          // }else{
          // this.options.requestUrl = '/api/v1/wms/getWmsInboundResult?apiId=371&userId=' + getCookie("orgCode") +"&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date(); 
          // }
        } else {
          this.startTime = null;
          this.endTime = null;
          this.$message.warning("开始时间要比结束时间早");
        }
      } else {
        this.getRequestUrl()
      }
    },
    selectionChange(selection) {
      this.options.mapList = selection;
    },
    onreserved(){
      this.$router.push({
        path: "/addSteelInbound",
      });
    }
  }
}
</script>

<style lang="scss" scode>
.steel_inbound{
  margin-top: 30px;
  margin-left: 20px;
    .sache{
      display: flex;
      margin-bottom: 10px;
      padding-right: 10px;
      .text {
        text-align: left;
        line-height: 40px;
      }
      .el-date-editor {
        margin-right: 5px;
        margin-left: 5px;
      }
      .btn {
        margin-left: 10px;
      }
      .el-select {
      width: 100%;
      .el-input__inner {
        width: 150px;
      }
    }
    }
}
</style>