<template>
  <!-- 是否开启运输预警开关 -->
  
  <div class="addWagonLoad">
    <page-title>请选择需要开启的预警物料</page-title>

      <el-divider content-position="left">请选择报警类型</el-divider>
    <div style="width:100%;text-align:center;">
            <el-radio v-model="radio" label="0">关闭</el-radio>
            <el-radio v-model="radio" label="1">异常线路预警</el-radio>
            <el-radio v-model="radio" label="2">异常线路预警+停车</el-radio>
            <el-radio v-model="radio" label="3">异常线路预警+离线</el-radio>
            <el-radio v-model="radio" label="4">异常线路预警+停车+离线</el-radio>
      </div>
     <div class="form-box" style="margin-right: 10rem">
         
        <!-- <dil-form :formId="244" v-model="form1" ref="from1"></dil-form> -->
      </div>
    <div class="button-box">
      <el-button @click="cancel">取消</el-button>
      <el-button type="primary" @click="makeSure">确定</el-button>
    </div>
    <!-- <div class="primarybtn">
      <el-button class="btn" @click="goback">取消</el-button>
      <el-button type="primary" class="btn" @click="submitclick"
        >确定</el-button
      >
    </div> -->
  </div>
</template>

<script>
import PageTitle from "@/components/Page/Title";
export default {
  components: { PageTitle },
  data() {
    return {
      checkList:[],
      checktype:[],
      form1: {},
      radio:'1',
      value: undefined,
    };
  },
  created(){
     this.switchEcho();
  },
  mounted() {},
  methods: {
    
    // 确定
    makeSure() {

      this.axios
        .post(
          "/api/v1/otms/inTransitWarn?warnSwitch="+'1'+"&radio="+this.radio,
        )
        .then((res) => {

          console.log(res);
        //   console.log(this.form4);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          this.$router.go(-1);
        });
    },
    // 取消
    cancel() {
      this.$router.go(-1);
    },
    switchEcho(){
      let that=this;
       that.axios.post("/api/v1/otms/selectWarnSwitch").then((res) => {
                if(res.data.status=="succeed"){
                  let arry=res.data.data.switch;
                  this.radio=res.data.data.type;
                  console.log(this.radio)
                }
       });
     
    }
  },
};
</script>
<style lang='scss' scoped>
</style>