// 排队取消
<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"
        @selection-change="selectionChange"
      ></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: "select",
      },
      // 转移后的门岗id
      gatepostId: 0,
      // 排队实绩id
      resultIdList: [],
      //转移原因
      textarea: "",
    };
  },
  methods: {
    cancel(){
        this.$router.push({
          path: "/queueFCancel",
        });
    },
    onChange(val) {
      this.option.requestUrl =
        "/api/v1/qms/getAllQueueMes?apiId=184&gatepostId=" + val.gatepostId+"&i="+new Date();
    },
    selectionChange(row) {
      this.resultIdList = [];
      row.forEach((e) => {
        this.resultIdList.push(e.resultId);
      });
    },
    onclick() {
      var mapValue = {
        resultIdList: this.resultIdList,
        resultCancelReason: this.textarea,
      };
      console.log(mapValue);
      this.axios.post("/api/v1/qms/queueCancel", mapValue).then((res) => {
        if (res.data.code == "200") {
          this.cancel();
          this.$message({
            message: "取消排队成功!",
            type: "success",
          });
        }
      });
    },
  },
};
</script>
<style lang="scss">
.addqueueFCancel {
  .top {
    width: 100%;
    height: 80px;
    padding-left: 50px;
    padding-top: 20px;
  }
  .tab {
    width: 100%;
    max-height: 300px;
  }
  .reason {
    width: 100%;
    margin-top: 30px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    .re {
      display: flex;
      width: 30%;
      .text {
        width: 100px;
        text-align: right;
        margin-right: 10px;
      }
    }
  }
  .btn {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
</style>