elementUi使用dialog的进行信息的添加、删除表格数据时进行信息提示。删除或者添加成功的信息提示(SpringBoot+Vue+MybatisPlus)
文章目录
1、添加新用户,通过dialog的弹窗形式
1.1 添加的按钮
<el-button
type="primary"
size="small"
round
@click="addNewUser()"
>添加用户</el-button
>
1.2 调用方法设置窗口可见
注意:adddialogVisible: false,
默认是false,默认窗口不可见
//添加用户窗口
addNewUser() {
this.adddialogVisible = true;
},
1.3 窗口代码
<el-dialog
title="添加新用户"
:visible.sync="adddialogVisible"
width="30%"
:close-on-click-modal="false"
>
<el-form
style="width: 80%"
:model="UserForm"
:rules="rules"
label-width="100px"
ref="UserForm"
class="demo-ruleForm"
>
<el-form-item label="姓名" prop="userName">
<el-input
prefix-icon="el-icon-user"
class="letLine"
v-model="UserForm.userName"
></el-input>
</el-form-item>
<el-form-item label="昵称" prop="nickName">
<el-input v-model="UserForm.nickName"></el-input>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input v-model="UserForm.password"></el-input>
</el-form-item>
<el-form-item label="性别" prop="gender">
<el-input v-model="UserForm.gender"></el-input>
</el-form-item>
<el-form-item label="邮箱" prop="email">
<el-input v-model="UserForm.email"></el-input>
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input v-model="UserForm.phone"></el-input>
</el-form-item>
<el-form-item label="身份证" prop="idCard">
<el-input v-model="UserForm.idCard"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="resetForm('UserForm')">重置</el-button>
<el-button @click="adddialogVisible = false">取 消</el-button>
<el-button
type="primary"
round
@click="submitForm('UserForm')"
>确 定</el-button
>
</span>
</el-dialog>
1.4 提交注册信息方法
提示:这里完成的效果:用户注册成功、会以弹窗的形式提示用户信息添加成功
// //添加用户
submitForm(UserForm) {
const _this = this;
this.$refs[UserForm].validate((valid) => {
if (valid) {
axios.post("/user/register", this.UserForm).then(function (resp) {
if (resp.data.code == 200) {
_this.adddialogVisible = false; //dialog对话窗口关闭
// alert("添加成功") 跳转的路由
_this.$alert(
"《" + _this.UserForm.userName + "》添加成功",
"消息",
{
confirmButtonText: "确定",
callback: (action) => {
_this.showAllUserInfo();
},
}
);
_this.showAllUserInfo();
} else {
_this.$message.error(resp.data.data.errMessage);
}
});
} else {
console.log("error submit!!");
return false;
}
});
},
1.5 使用mybatisPlus方法进行添加信息到数据库
2、删除用户信息之前进行信息提示
2.1 代码块
<el-table-column fixed="right" label="操作" width="200">
<template slot-scope="scope">
<el-button
@click="handleClick(scope.row)"
type="text"
size="small"
>查看</el-button
>
<el-button type="text" size="small">编辑</el-button>
<el-popconfirm
confirm-button-text="好的"
cancel-button-text="不用了"
icon="el-icon-info"
icon-color="red"
title="确定删除该用户吗?"
@confirm="handleDelete(scope.$index, scope.row)"
>
<el-button
type="danger"
icon="el-icon-delete"
slot="reference"
></el-button>
</el-popconfirm>
</template>
</el-table-column>
2.2 删除方法
//删除用户
handleDelete(index, row) {
const _this = this;
axios.delete("/user/deleteUser/"+row.idCard).then((resp) => {
if (resp.data.code == 200) {
_this.$alert("删除用户成功", "消息", {
confirmButtonText: "确定",
callback: (action) => {
_this.showAllUserInfo();
},
});
} else {
_this.$message.error(resp.data.data.errMessage);
}
});
},
3、效果展示
elementUi使用dialog的进行信息的添加、删除表格数据时进行信息提示。删除或者添加成功的信息提示(SpringBoot+Vue+MybatisPlus)的更多相关文章
- HTTP 请求方式: GET和POST的比较当发送数据时,GET 方法向 URL 添加数据;URL 的长度是受限制的(URL 的最大长度是 2048 个字符)。
什么是HTTP? 超文本传输协议(HyperText Transfer Protocol -- HTTP)是一个设计来使客户端和服务器顺利进行通讯的协议. HTTP在客户端和服务器之间以request ...
- boke练习: spring boot: security post数据时,要么关闭crst,要么添加隐藏域
spring boot: security post数据时,要么关闭crst,要么添加隐藏域 http.csrf().disable(); 或者: <input name="${_cs ...
- 当使用listIterator进行迭代时候 list的迭代器可以在创建迭代器对象后 添加数据 但打印的时候不显示添加后的数据。 collection 的iterator迭代器不能添加数据 。list的对象与collection的实例对象都不能在创建迭代器后添加数据 list的迭代器保存的是循环前的数据长度
- SpringBoot + Vue + ElementUI 实现后台管理系统模板 -- 后端篇(一): 搭建基本环境、整合 Swagger、MyBatisPlus、JSR303 以及国际化操作
相关 (1) 相关博文地址: SpringBoot + Vue + ElementUI 实现后台管理系统模板 -- 前端篇(一):搭建基本环境:https://www.cnblogs.com/l-y- ...
- 利用jquery动态添加和删除表格的一行,并且保存单行数据
开发时遇到一个需求:要求要在页面的表格可以添加和删除一行,并能填写对应的数据后保存这一行数据. HTML代码 界面使用了freemarker框架,teams是后台传过来的list类型数据 <fo ...
- elementui移动dialog
1.在创建Vue对象时添加全局属性 Vue.directive('dialogDrag', { bind(el, binding, vnode, oldVnode) { const dialogHea ...
- element-ui组件dialog遇到form
Vue.js似乎成了一种潮流. UI框架element-ui也跟着成了一种潮流,不过得承认,至少我个人还是非常认可的,element-ui做的是真不错. 用到element-ui,那么在dialog中 ...
- easyui tree datagrid动态添加表头和表格数据,动态弹出框,修改和删除按钮
1.要有获取表头的URL和表格的URL 背景:点击树的一个节点,就加载一个表格,这个表格是动态的,表头和表格数据都是动态的 解决方案:需要两个URL,一个是获取表头的URL,一个是获取表格数据的URL ...
- SpringBoot + Vue + ElementUI 实现后台管理系统模板 -- 后端篇(五): 数据表设计、使用 jwt、redis、sms 工具类完善注册登录逻辑
(1) 相关博文地址: SpringBoot + Vue + ElementUI 实现后台管理系统模板 -- 前端篇(一):搭建基本环境:https://www.cnblogs.com/l-y-h/p ...
随机推荐
- Eplan创建符号详细解说
如何创建新的符号库以及在项目里面导入这个新的符号库 这个就不详细的赘述了 网上很多教程 和我一样的萌新可以参考 https://wenku.baidu.com/view/18c16641e45c3b3 ...
- React报错之Encountered two children with the same key
正文从这开始~ 总览 当我们从map()方法返回的两个或两个以上的元素具有相同的key属性时,会产生"Encountered two children with the same key&q ...
- java的stream让我灵光一现
说实话,我是一个到了退役也没有搞明白C++的istream和ostream的. 刚开始的时候我把<iostream>直接拆解成ios和tream 真,果粉暴露 退役之后划水,倒是从java ...
- Luogu3855 [TJOI2008]Binary Land (BFS)
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> ...
- monodepth2学习1-原理介绍
monodepth2介绍 monodepth2是在2019年CVPR会议上提出的一种三维重建算法,monodepth2是基于monodepth进行了改进,采用的是基于自监督的神经网络,提出了一下三点优 ...
- B/S结构通信系统原理
本文介绍JavaWeb的B/S结构通信原理 概念: Javaweb中B/S架构是一种系统架构形式,这里的B是Browser(浏览器),S是Server(服务器),是一种系统的架构形式,有 ...
- P4767 [IOI2000]邮局 - 平行四边形不等式优化DP
There is a straight highway with villages alongside the highway. The highway is represented as an in ...
- 必应每日壁纸API
必应官网每天会更新不同的高质量背景图 我们可以通过 F12 开发者工具手动下载当天的壁纸,网上也有很多网站提供必应壁纸下载.如果我们想每天应用最新的壁纸到我们的网站上就需要手动下载再设置壁纸,比较麻烦 ...
- 【JDBC】学习路径9-dbcp数据源的使用
第一章:下载 要下载三个东西:commons pool.commons log.dbcp dbcp中有些东西是依赖于commons pool 和 commons log 的. 缺一不可,否则无法正确运 ...
- 一款类似B站的开源弹幕播放器,太酷了
今天小编推荐一款开源的弹幕视频播放器,由Typescript加Sass编写,无任何第三方运行时依赖,Gzip大小只有21KB,兼容IE11,支持SSR,支持直播.该播放器高度可定制,所有图标.按钮.色 ...