// 插队
<template>
  <div class="addqueueFCancel">
    <div class="top">
      <dil-form :formId="247" v-model="form" @change="onChange"></dil-form>
    </div>
    <div class="tab">
      <dilTable
        v-bind.sync="option"
        @radio-change="currentRadioChange"
      ></dilTable>
    </div>
    <div class="reason">
      <div class="re">
        <span class="text">插队原因：</span>
        <el-input
          type="textarea"
          :rows="4"
          placeholder="请输入内容"
          v-model="textarea"
          maxlength="250"
          minlength="1"
          resize="none"
          show-word-limit
        >
        </el-input>
      </div>
    </div>
    <div class="btn">
      <el-button @click="cancel">取消</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/getAllQueueMes?apiId=184",
        // 控制显示当选列
        selectionType: "radio",
      },
      // 排队实绩id
      resultId:0,
      //插队原因
      textarea: "",
    };
  },
  methods: {
    cancel(){
        this.$router.push({
          path: "/queueFJumpLine",
        });
    },
    onChange(val) {
      this.option.requestUrl =
        "/api/v1/qms/getAllQueueMes?apiId=184&gatepostId=" + val.gatepostId+"&i="+new Date();
    },
    currentRadioChange(row) {
        this.resultId = row.resultId;
    },
    onclick() {
      var mapValue = {
        resultId: this.resultId,
        resultInsertReason: this.textarea,
      };
      console.log(mapValue);
      this.axios.post("/api/v1/qms/queueCutInLine", mapValue).then((res) => {
        if (res.data.code == "200") {
          this.cancel();
          this.$message({
            message: "插队排队成功！",
            type: "success",
          });
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.addqueueFCancel {
  .top {
    width: 100%;
    height: 80px;
    padding-left: 50px;
    padding-top: 20px;
  }
  .tab {
    width: 100%;
    max-height: 300px;
  }
  .reason {
    width: 100%;
    height: 210px;
    display: flex;
    align-items: center;
    justify-content: center;
    .re {
      display: flex;
      width: 30%;
      .text {
        width: 100px;
      }
    }
  }
  .btn {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
</style>