<template>
  <div>
    <el-form ref="form" :rules="rules"  :model="form" label-width="120px">
      <el-form-item
          label="等级名称："
          prop="name"
      >
        <el-input v-model="form.name"  placeholder="请输入等级名称"></el-input>
      </el-form-item>

      <el-form-item label="sort：" prop="sort">
        <el-input v-model="form.sort"  placeholder="请输入排序" ></el-input>
      </el-form-item>
      <el-form-item label="备注信息：" prop="remark">
        <el-input v-model="form.remark"  placeholder="请输入站备注信息" ></el-input>
      </el-form-item>
      <el-form-item>
        <div style="text-align: center">
          <el-button type="primary" @click="onSubmit" :disabled="Isdisabled" :loading="isloading">保存</el-button>
          <el-button style="color: #5075FC " @click="closeDlg">取消</el-button>
        </div>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
export default {
  props: {
    userLevelDataForm: {
      type: Object,
      default: () => {}
    },
    isloading:{
      type:Boolean,
      default: true
    },
    closeDlg:{
      type:Function
    }
  },
  data() {
    let self = this
    return {
      userLevelList:[],
      form: {
        id:'',
        name: '',
        sort:"",
        remark:"",
      },
      menulist: [],
      Isdisabled: false,
      rules: {
        name: [
          { required: true, message: '等级名称必填' },
        ]
      }
    }
  },
  mounted() {
    if(this.userLevelDataForm) {
      this.form = Object.assign({} , this.userLevelDataForm)
    }
  },
  methods: {
    closeDlg() {
      this.$emit('closeDlg',1)
    },
    onSubmit() {
      let that = this
      that.$refs['form'].validate((valid) => {
        if (valid) {
          this.$emit('userLevelSubmitClick', this.form)
        }
      })
    },
  }
}
</script>
<style>
.el-cascader-node>.el-radio{
  margin-top:25px;
}
</style>
