//查询预留
<template>
  <div class="steel_inbound">
    <div class="sache">
      <el-input
        placeholder="请输入内容"
        v-model="inputText"
        clearable>
      </el-input>
      <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" @selection-change="selectionChange" ref="table">
        <el-table-column fixed="right" label="操作" width="150">
								<template slot-scope="scope">
									<el-button type="text" size="mini" @click="inboundDetails(scope)">
										详情
									</el-button>
								</template>
							</el-table-column>
      </dilTable>
    </div>
  </div>
</template>

<script>
export default {
  data(){
    return{
      inputText:"",
      options:{
        // first请求数据的地址
        requestUrl: "/api/v1/wms/getWmsReservedResult?apiId=371",
        selectionType: "select",
        mapList: [],
      },
    }
  },
  methods:{
    inboundDetails(scope){
      	this.$router.push("/inboundDetails/" + scope.row.inboundId)
      	
    },
    onclick(){
      console.log("点击事件");
    },
    selectionChange(selection) {
      this.options.mapList = selection;
    },
    onreserved(){
      console.log("fahaahahahaha")
      if (this.options.mapList.length == 0) {
        this.$message({
          type: "warning",
          message: "请先选择入库单!",
        });
      } else {
        this.$confirm("是否预留", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
          center: true,
        })
          .then(() => {
            //初始化maplist
            var mapList = [];
            this.options.mapList.forEach((item, i) => {
              //初始化mapItem
              var mapItem = {
                //入库实绩表id
                inboundId: 0,
                // 给一个标记定义其为预留变为入库
                status: 1,
              };
              mapItem.inboundId = item.inboundId;
              mapList.push(mapItem);
            });
            this.$message({
              type: "success",
              message: "预留成功!",
            });
            console.log(mapList)
            this.axios.post("/api/v1/wms/changeReserved", mapList).then((res) => {
              console.log("res.data"+res.data)
              if (res.data >= 1) {
                //改变查询条件
                this.$refs.table.setDataRequestQuery({
                  
                });  
                this.$router.go(0);
              }
            });
            console.log("fdagfaahh")
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "取消上传!",
            });
          });
      }
    }
  }
}
</script>

<style lang="scss" scode>
.steel_inbound{
  .sache{
    height: 5rem;
    display: flex;
    align-items: center;
    padding-left: 1.875rem;
  }
}
</style>