diff --git a/eladmin-web/src/api/system/user.js b/eladmin-web/src/api/system/user.js index 6cd91a5..fee2d84 100644 --- a/eladmin-web/src/api/system/user.js +++ b/eladmin-web/src/api/system/user.js @@ -17,6 +17,14 @@ export function del(ids) { }) } +export function resetPwd(ids) { + return request({ + url: 'api/users/resetPwd', + method: 'put', + data: ids + }) +} + export function edit(data) { return request({ url: 'api/users', @@ -57,5 +65,5 @@ export function updateEmail(form) { }) } -export default { add, edit, del } +export default { add, edit, del, resetPwd } diff --git a/eladmin-web/src/views/system/user/index.vue b/eladmin-web/src/views/system/user/index.vue index 9017069..f64ba19 100644 --- a/eladmin-web/src/views/system/user/index.vue +++ b/eladmin-web/src/views/system/user/index.vue @@ -57,7 +57,19 @@ - + + 重置密码 + + @@ -471,6 +483,23 @@ export default { }, checkboxT(row, rowIndex) { return row.id !== this.user.id + }, + resetPwd(datas) { + this.$confirm(`你选中了 ${datas.length} 位用户,确认重置用户的密码吗?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + const ids = [] + datas.forEach(val => { + ids.push(val.id) + }) + console.log(ids) + crudUser.resetPwd(ids).then(() => { + this.crud.notify('重置成功, 用户新密码:123456', CRUD.NOTIFICATION_TYPE.SUCCESS) + }).catch(() => {}) + }).catch(() => { + }) } } }