<template>
  <div class="parameter">
    <div class="content">
      <div class="content-title">
        温馨提示：告警门限参数设置，数据如无异常，请勿修改告警门限参数！
      </div>
      <el-form
        ref="form"
        :model="formData"
        :rules="rules"
        label-width="200px"
        class="content-form"
      >
        <el-form-item label="漏缆型号：" prop="code">
          <el-select
            v-model="formData.code"
            style="width: 100%"
            filterable
            placeholder="请选择漏缆型号"
          >
            <el-option
              v-for="item in codeList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="一般告警门限：" prop="one">
          <el-input v-model="formData.one" placeholder="请输入一般告警门限" />
        </el-form-item>
        <el-form-item label="重要告警门限：" prop="two">
          <el-input v-model="formData.two" placeholder="请输入重要告警门限" />
        </el-form-item>
        <el-form-item label="紧急告警门限：" prop="three">
          <el-input v-model="formData.three" placeholder="请输入紧急告警门限" />
        </el-form-item>
      </el-form>
    </div>
    <div class="footer">
      <div class="footer-btn">
        <el-button
          type="primary"
          :loading="loading"
          @click="submit"
        >确认修改</el-button>
      </div>
      <div class="footer-tips">当前未修改漏缆告警门限参数</div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      loading: false,
      formData: {
        code: '',
        one: '',
        two: '',
        three: ''
      },
      rules: {
        code: [
          { required: true, message: '请选择漏缆型号', trigger: 'blur' }
          // { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
        ],
        one: [
          { required: true, message: '请输入一般告警门限', trigger: 'blur' }
        ],
        two: [
          { required: true, message: '请输入重要告警门限', trigger: 'blur' }
        ],
        three: [
          { required: true, message: '请输入紧急告警门限', trigger: 'blur' }
        ]
      },
      codeList: []
    }
  },
  methods: {
    reset() {
      this.$refs.form.resetFields()
    },
    submit() {
      this.$refs.form.validate((valid) => {
        if (valid) {
          console.log(this.formData)
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.parameter {
  padding: 10px;
  .content {
    border: 1px solid #e3e3e3;
    border-radius: 10px;
    .content-title {
      width: 100%;
      height: 60px;
      background: rgba(226, 235, 255, 0.39);
      line-height: 60px;
      font-size: 18px;
      color: #333;
      font-weight: 500;
      text-align: center;
      border-bottom: 1px solid #e3e3e3;
    }
    .content-form {
      margin: 0 auto;
      padding: 20px 0;
      width: 600px;
    }
  }
  .footer {
    text-align: center;
    padding-top: 50px;
    .footer-btn {
      margin-bottom: 50px;
    }
    .footer-tips {
      color: #1E64F6;
      font-weight: 500;
      font-size: 18px;
    }
  }
}

</style>
