<template>
  <div>
    <el-dialog title="添加基础薪资配置" :visible.sync="open" width="600px">
      <el-form ref="form" :model="form" label-width="90px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="配置名称:" prop="name">
              <el-input v-model="form.name" placeholder="请输入配置名称" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="金额(元):" prop="salary">
              <el-input v-model="form.salary" placeholder="请输入配置名称" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {saveOrEditSalaryBase} from "@/api/school/salary";

export default {
  name: 'ChangeSalaryBase',
  data() {
    return {
      open: false,
      // 表单参数
      form: {
        name: '',
        salary:null,
      },
      loadingSelect: false,
    }
  },
  created() {
  },
  methods: {
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    reset() {
      this.form = {
        name:'',
        salary: null,
      }
      this.resetForm('form')
    },
    handleAdd() {
      this.reset()
      this.open = true
      this.title = '添加会员基本信息'
    },
    handleUpdate(row) {
      this.reset()
      const data=JSON.parse(JSON.stringify(row))
      this.form=data
      this.open = true
      this.title = '修改会员基本信息'
    },
    /** 提交按钮 */
    submitForm: function() {
      saveOrEditSalaryBase(this.form).then(res=>{
        this.msgSuccess(res.msg)
        this.open = false
        this.$emit('success')
      })
    },
  }
}
</script>
