后台删除,查询,重置功能实现

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',

  })

}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值