Form表单中的增删改查
如果是按钮形式的 那就新建一个vue文件Form显示表单,
增“add”:
this.$refs.Form.init("add","");
删除"del":
先确定id然后在进行操作
let ids =
id ||
this.$refs.studentKshTable
.getCheckboxRecords()
.map((item) => {
return item.id;
})
.join(",");
this.$confirm("确定删除所选项吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
(this.loading = true),
this.studentKshService.delete(ids).then(({ data }) => {
this.$message.success(data),
(this.loading = false),
this.refreshList();
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
},
修改:“edit”:
先确定id然后在进行操作
id=
id||
this.$refs.studentKshTable.getCheckboxRecords().map((item)=>{
return item.id
})[0],
this.$refs.studentKshForm.init("edit",id)
},
查看:“view”:
this.$refs.studentKshForm.init("view", id);