//添加因为传值到后台只需要部门的id,所以这儿只需要id就行了。
addSubmit: function () {
//新增保存操作 --新增表单验证 vue自带验证
this.KaTeX parse error: Expected '}', got 'EOF' at end of input: …提示框 this.confirm(‘确认提交吗?’, ‘提示’, {}).then(() => {
//新增 加载中
this.addLoading = true;
//传递参数 把表单里面的addForm 复制一份给para {name:‘xxx’}
let para = Object.assign({}, this.addForm);
let department ={ //封装部门的id到dept变量
id:para.id,
}; //封装部门的id信息
para.department =department; //部门的dept变量
//发送请求到后台
this.$http.put("/employee/add",para).then(res=>{
//新增加载结束
this.addLoading = false;
/*解构对象*/
let{isSuccess,msg} = res.data;
if (isSuccess){
//关闭表单(弹出的)对话框
this.addFormVisible = false;
//给用户提示保存成功的消息
this.$message({
message:'保存成功