1、查询
@click="handleQuery"
/** 搜索按钮操作 */
handleQuery() {
this.getList(); //获取详情列表接口调用即可
},
2、重置
@click="resetQuery"
/** 重置按钮操作 */
涉及html部分
<el-form
:inline="true" // label文字和input在一行设置
ref="queryForm"
>
resetQuery() {
this.resetForm("queryForm");
//表单置空 element置空方法 this.resetForm(" ")
第二种写法 this.$refs["this.$refs["form" ].resetFields()" ].resetFields()
this.handleQuery(); //调取搜索方法,恢复全局详情
},
3、删除()
插槽中<template slot-scope="scope">
@click="handleDelete(scope.row)" //scope.row 指删除当前一行
/** 删除按钮操作 */
handleDelete(row) {
if (confirm("是否确认删除数据项?")) { 弹窗提示
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "info"
}.then{() => {
getDelete(this.hearId, row.id) //删除接口
.then((response) => {
this.getDataList(); //刷新列表
this.loading = false; //关闭弹窗
}).catch((error) => {
console.log(error, "错误");
});
},
}
//删除接口,涉及两个参数参数 两个参数拼接
export function getDelete(hearId, id) {
return request({
url: '/code/gen/deleteField/' + hearId + '/' + id,
method: 'Delete',
})
}