|
@@ -101,7 +101,7 @@
|
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleResetPwd(scope.row)"
|
|
|
- >重置密码</el-button>
|
|
|
+ >重置密码并且发送邮箱</el-button>
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
@@ -333,7 +333,7 @@ export default {
|
|
|
// 表单重置
|
|
|
reset() {
|
|
|
this.form = {
|
|
|
- userId: undefined,
|
|
|
+ id: undefined,
|
|
|
username: undefined,
|
|
|
nickname: undefined,
|
|
|
phonenumber: undefined,
|
|
@@ -354,46 +354,9 @@ export default {
|
|
|
/** 新增按钮操作 */
|
|
|
handleAdd() {
|
|
|
this.reset();
|
|
|
- // this.postOptions = response.posts;
|
|
|
- // this.roleOptions = response.roles;
|
|
|
this.open = true;
|
|
|
this.title = "添加用户";
|
|
|
this.form.password = this.initPassword;
|
|
|
-
|
|
|
- },
|
|
|
- /** 修改按钮操作 */
|
|
|
- handleUpdate(row) {
|
|
|
- this.reset();
|
|
|
- const userId = row.userId || this.ids;
|
|
|
- getUser(userId).then(response => {
|
|
|
- this.form = response.data;
|
|
|
- this.postOptions = response.posts;
|
|
|
- this.roleOptions = response.roles;
|
|
|
- this.$set(this.form, "postIds", response.postIds);
|
|
|
- this.$set(this.form, "roleIds", response.roleIds);
|
|
|
- this.open = true;
|
|
|
- this.title = "修改用户";
|
|
|
- this.form.password = "";
|
|
|
- });
|
|
|
- },
|
|
|
- /** 重置密码按钮操作 */
|
|
|
- handleResetPwd(row) {
|
|
|
- this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- closeOnClickModal: false,
|
|
|
- inputPattern: /^.{5,20}$/,
|
|
|
- inputErrorMessage: "用户密码长度必须介于 5 和 20 之间"
|
|
|
- }).then(({ value }) => {
|
|
|
- resetUserPwd(row.userId, value).then(response => {
|
|
|
- this.$modal.msgSuccess("修改成功,新密码是:" + value);
|
|
|
- });
|
|
|
- }).catch(() => {});
|
|
|
- },
|
|
|
- /** 分配角色操作 */
|
|
|
- handleAuthRole: function(row) {
|
|
|
- const userId = row.userId;
|
|
|
- this.$router.push("/system/user-auth/role/" + userId);
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
submitForm: function() {
|
|
@@ -407,12 +370,12 @@ export default {
|
|
|
this.getList();
|
|
|
});
|
|
|
} else {
|
|
|
- const param = {
|
|
|
- username: this.form.username,
|
|
|
- nickname: this.form.nickname,
|
|
|
- phonenumber: this.form.phonenumber,
|
|
|
- mailbox: this.form.mailbox
|
|
|
- }
|
|
|
+ // const param = {
|
|
|
+ // username: this.form.username,
|
|
|
+ // nickname: this.form.nickname,
|
|
|
+ // phonenumber: this.form.phonenumber,
|
|
|
+ // mailbox: this.form.mailbox
|
|
|
+ // }
|
|
|
this.$axios.post('/sysUserController', this.form).then((res) => {
|
|
|
this.$message.success('新增成功')
|
|
|
this.open = false;
|
|
@@ -427,6 +390,56 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ /** 重置密码按钮操作 */
|
|
|
+ handleResetPwd(row) {
|
|
|
+ this.$confirm('重置密码并发送到邮箱'+row.mailbox, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ const param = {
|
|
|
+ id: row.id
|
|
|
+ }
|
|
|
+ this.$axios.post('/sysUserController/resetPassword', param).then((res) => {
|
|
|
+ if (res.code==0){
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '重置并发送成功!'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.$message({
|
|
|
+ type: 'error',
|
|
|
+ message: '重置失败!'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).catch((error) => {
|
|
|
+ console.log(error)
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset();
|
|
|
+ const userId = row.userId || this.ids;
|
|
|
+ getUser(userId).then(response => {
|
|
|
+ this.form = response.data;
|
|
|
+ this.postOptions = response.posts;
|
|
|
+ this.roleOptions = response.roles;
|
|
|
+ this.$set(this.form, "postIds", response.postIds);
|
|
|
+ this.$set(this.form, "roleIds", response.roleIds);
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改用户";
|
|
|
+ this.form.password = "";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 分配角色操作 */
|
|
|
+ handleAuthRole: function(row) {
|
|
|
+ const userId = row.userId;
|
|
|
+ this.$router.push("/system/user-auth/role/" + userId);
|
|
|
+ },
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
const userIds = row.userId || this.ids;
|