templete中
<el-button type="primary" size="mini" @click="addGw('gwruelForm')"
>保存</el-button
>
引入
import { _throttle, Debounce } from "@/utils/util";
methods中
addGw: Debounce(function (formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
var data = {
companyid: sessionStorage.getItem("companyid"),
depid: this.smallDepid,
postname: this.gwForm.postname,
};
this.$api
.addSectionGw(data)
.then((res) => {
if (res.code === 2000) {
this.$message({
type: "success",
message: "新增岗位成功!",
});
this.dialogVisible10 = false;
this.gwForm.postname = "";
this.getGwList();
}
})
.catch((err) => {
console.log(err);
});
}
});
}, 600),