<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="button-box">
      <el-button @click="cancel">取消</el-button>
      <el-button type="primary" @click="makeSure">确定</el-button>
    </div>
  </div>
</template>

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

      this.axios.post(
          "/api/v1/otms/inTransitWarn?warnSwitch="+1+"&radio="+this.radio,
        )
        .then((res) => {
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          this.switchEcho();
        });
    },
    // 取消
    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;
                }
       });
     
    }
  },
};
</script>
<style lang='scss' scoped>
</style>