//转移
<template>
  <div class="addqueueFCancel">
    <div class="top">
      <dil-form :formId="250" v-model="form" @change="onChange"></dil-form>
    </div>
    <div class="tab">
      <dilTable
        v-bind.sync="option"
        @radio-change="currentRadioChange"
      ></dilTable>
    </div>
    <div class="reason">
      <dil-form :formId="251" v-model="form1" @change="onChange1"></dil-form>
    </div>
    <div class="btn">
      <el-button>取消</el-button>
      <el-button type="primary" @click="onclick">确认</el-button>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      form: {},
      form1: {},
      option: {
        // 表格请求数据的地址
        requestUrl: "/api/v1/qms/getAllWarehouseQueueMes?apiId=192",
        // 控制显示当选列
        selectionType: "radio",
      },
      // 转移后的门岗id
      gatepostId: 0,
      // 排队实绩id
      resultId:0,
        //转移原因 
        resultTransferReason:''  
    };
  },
  methods: {
    onChange(val) {
      this.option.requestUrl =
        "/api/v1/qms/getAllWarehouseQueueMes?apiId=192&platformId=" + val.platformId;
    },
    onChange1(val) {
      this.platformId = val.platformId;
      this.resultTransferReason = val.resultTransferReason;
    },
    currentRadioChange(row) {
      if(row.resultId){
        this.resultId = row.resultId
      }
    },
    onclick() {
      var mapValue = {
        resultId:this.resultId,
        platformId:this.platformId,
        resultTransferReason: this.resultTransferReason,
      };
      console.log(mapValue);
      if(mapValue.resultId !== 0 && mapValue.gatepostId !== 0 && mapValue.resultTransferReason !== ""){
        this.axios.post("/api/v1/qms/changeQueue",mapValue).then((res)=>{
          if(res.data.code == "200"){
            this.$router.push({
                path: "/qmsWarehouse/queueWTransfer",
            });
            this.$message({
                message: '转移成功！',
                type: 'success'
            });
          }
        })
      }else{
        console.log(mapValue.platformId)
        if(mapValue.resultId == 0){
          this.$message({
            message: '请选择需要转移的车辆！',
            type: 'warning'
          });
        }else{
          if(mapValue.platformId == undefined){
            this.$message({
                message: '请选择需要转移到的月台！',
                type: 'warning'
              });
          }else{
            if(mapValue.resultTransferReason == ""){
              this.$message({
                message: '请填写转移的原因！',
                type: 'warning'
              });
            }
          }
        }
      }
    },
  },
};
</script>
<style lang="scss" scoped>
.addqueueFCancel {
  .top {
    width: 100%;
    height: 5rem;
    padding-left: 3.125rem;
    padding-top: 1.25rem;
  }
  .tab {
    width: 100%;
    max-height: 18.75rem;
  }
  .reason {
    width: 100%;
    height: 13.125rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .btn {
    width: 100%;
    height: 5rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
</style>