<template>
  <div class="steel_inbound_real">
    <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>
    </div>
    <div class="table">
      <dilTable
        v-bind.sync="options"
        ref="table"
        :showSummaryList="showSummaryList"
        :isshowSummary="true"
      >
        <el-table-column label="操作" width="120px">
          <template slot-scope="scope">
            <el-button type="text" @click="crtlZ(scope.row)">撤销</el-button>
          </template>
        </el-table-column>
      </dilTable>
    </div>
  </div>
</template>
<script>
import { sjTime } from "@/utils/sharedJsFile";
export default {
  data() {
    return {
      inputText: "",
      startTime: null,
      endTime: null,
      region: "0",
      options: {
        // first请求数据的地址
        requestUrl: "/api/v1/wms/getInboundEasInfo?apiId=510&warehouseId=" + 2
        // selectionType: "select",
        // mapList: [],
      },
      showSummaryList: ["theroticalWeight", "materialNum", "actuallyWeight"]
    };
  },
  methods: {
    // inboundDetails(scope){
    //   	this.$router.push("/inboundDetails/" + scope.row.inboundId)
    // }
    onclick() {
      let startTime = null;
      let endTime = null;
      if (this.startTime && this.endTime) {
        startTime = sjTime(this.startTime);
        endTime = sjTime(this.endTime);
      }
      this.options.requestUrl =
        "/api/v1/wms/getInboundEasInfo?apiId=510&warehouseId=2&startTime=" +
        startTime +
        "&endTime=" +
        endTime +
        "&i=" +
        new Date();
    },
    crtlZ(row) {
      console.log(row.inboundEasId);
      this.axios
        .post("/api/v1/wms/reduceInboundEas?inboundEasId=" + row.inboundEasId)
        .then(res => {
          if (res.data.code == "200") {
            this.$message.success("撤销成功");
          } else {
            this.$message.error("撤销失败");
          }
          this.options.requestUrl =
            "/api/v1/wms/getInboundEasInfo?apiId=510&warehouseId=2" +
            "&i=" +
            new Date();
        });
    }
  }
};
</script>

<style lang="scss" scoped>
.steel_inbound_real {
  .sache {
    margin-left: 20px;
    margin-top: 20px;
  }
  .table {
    margin-left: 20px;
    margin-top: 20px;
  }
}
</style>
