qosConfigDialog.vue 3.52 KB
<template>
  <div>
    <el-dialog :title="$t('dialog.alertNumberSetting')" :visible.sync="isShow" v-if="isShow" :close-on-click-modal='false' class="manage-dialog dialog_lj" :before-close="closeDialog">
      <el-form :model="addForm" label-width="110px" :rules="rules" ref="addForm">
        <el-form-item :label="$t('dialog.safeNum')" prop="safeNum">
          <el-input-number v-model="addForm.safeNum" :min="1" :controls='false' :precision="0" :placeholder="$t('pholder.input')"></el-input-number>
          <i class="error-tip">*</i>
        </el-form-item>
        <el-form-item :label="$t('dialog.warnNum')" prop="warnNum">
          <el-input-number v-model="addForm.warnNum" :min="1" :controls='false' :precision="0" :placeholder="$t('pholder.input')" ></el-input-number>
          <i class="error-tip">*</i>
        </el-form-item>
        <!-- <el-form-item :label="$t('dialog.dangerNum')" prop="dangerNum">
          <el-input-number v-model="addForm.dangerNum" :min="1" :controls='false' :precision="0" :placeholder="$t('pholder.input')" ></el-input-number>
          <i class="error-tip">*</i>
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="closeDialog" class="dialog-btn">{{$t('dialog.cancel')}}</el-button>
        <el-button type="primary" @click="addSubmit('addForm')" class="dialog-btn dialog-confirm-btn">
          {{$t('dialog.confirm')}}</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        isShow: false,
        addForm: {},
        rules: {
          safeNum: [{
            required: true,
            message: this.$t("pholder.input"),
            trigger: 'blur'
          }],
          warnNum: [{
            required: true,
            message: this.$t("pholder.input"),
            trigger: 'blur'
          }],
          dangerNum: [{
            required: true,
            message: this.$t("pholder.input"),
            trigger: 'blur'
          }],
        },
      }
    },
    methods: {
      dialogInit(row) {
        this.isShow = true;
        this.addForm = {
            ...row
        }
        this.$forceUpdate()
      },
      addSubmit(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            this.$api.queueManagementApi.updateArea(this.addForm).then((res) => {
                let result = res.data;
                if(result.code==200){
                  this.$message({
                    message: result.msg,
                    type: 'success'
                  });
                  this.$parent.getTableData();
                  this.$refs.addForm.resetFields();
                  this.addForm = {}
                  this.isShow = false
                }else{
                  this.$message({
                    message: result.msg,
                    type: 'error'
                  });
                }
              })
          } else {
            return false;
          }
        });
      },
      closeDialog() {
        this.$refs.addForm.resetFields();
        this.addForm = {}
        this.isShow = false;
      }
    }
  }
</script>
<style lang="less" scoped="scoped">
  .dialog_lj{
    /deep/.el-form-item__label{
      width: 100px;
      text-align:left
    }
    /deep/.el-input-number{
      width: 100%;
    }
    /deep/.el-form-item__label+.el-form-item__content{
        float: none !important;
        line-height:40px !important;
    }
    /deep/.el-form-item__error{
        padding-top: 0px !important;
    }
  }
</style>