用户管理
This commit is contained in:
parent
53d676e179
commit
9f0ebf2f3d
|
|
@ -30,17 +30,18 @@ export function addUser(data) {
|
|||
// 修改用户
|
||||
export function updateUser(data) {
|
||||
return request({
|
||||
url: '/smartArchives/system/user',
|
||||
url: '/smartArchives/system/user/editUser',
|
||||
method: 'POST',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除用户
|
||||
export function delUser(userId) {
|
||||
export function delUser(data) {
|
||||
return request({
|
||||
url: '/smartArchives/system/user/' + userId,
|
||||
method: 'delete'
|
||||
url: '/smartArchives/system/user/delUser',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ export const formLabel = [
|
|||
isShow: false, // 是否展示label
|
||||
f_type: 'ipt',
|
||||
f_label: '用户名',
|
||||
f_model: 'nickName',
|
||||
f_model: 'userName',
|
||||
f_max: 32,
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@
|
|||
修改
|
||||
</el-button>
|
||||
<el-button plain size="mini" type="danger" icon="el-icon-delete" v-hasPermi="['system:user:remove']"
|
||||
@click="handleDelete(data)">
|
||||
@click="handleDelete(data)" v-if="!data.admin">
|
||||
删除
|
||||
</el-button>
|
||||
<el-button plain size="mini" style="color: #039088"
|
||||
@click="handleResetPwd(scope.row)" v-hasPermi="['system:user:remove']">
|
||||
@click="handleResetPwd(data)" v-hasPermi="['system:user:remove']">
|
||||
重置密码
|
||||
</el-button>
|
||||
</template>
|
||||
|
|
@ -50,6 +50,7 @@ import Treeselect from "@riophae/vue-treeselect";
|
|||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
import {
|
||||
listUser,
|
||||
delUser
|
||||
} from '@/api/system/user'
|
||||
import { getDeptSelectApi,getRoleSelectApi } from '@/api/select'
|
||||
import UserForm from './profile/userForm'
|
||||
|
|
@ -122,10 +123,10 @@ export default {
|
|||
},
|
||||
/** 删除操作 */
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm(`是否确认删除参数名称为"${row.configName}"的数据项?`).then(() => {
|
||||
this.$modal.confirm(`是否确认删除此数据项?`).then(() => {
|
||||
// 显示加载遮罩
|
||||
this.$modal.loading("正在删除,请稍候...");
|
||||
deleteAPI({ id: row.id }).then(res => {
|
||||
delUser({ id: row.id }).then(res => {
|
||||
this.$modal.closeLoading();
|
||||
if (res.code === 200) {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
|
|
@ -163,6 +164,29 @@ export default {
|
|||
return node
|
||||
})
|
||||
},
|
||||
/** 重置密码按钮操作 */
|
||||
handleResetPwd(row) {
|
||||
this.$prompt('请输入"' + row.userName + '"的新密码', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
closeOnClickModal: false,
|
||||
inputPattern:
|
||||
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\w\d\s]).{8,20}$/,
|
||||
inputErrorMessage:
|
||||
'用户密码长度必须介于 8 和 20 之间,且包含大小写字母、数字和特殊字符',
|
||||
inputValidator: (value) => {
|
||||
if (/<|>|"|'|\||\\/.test(value)) {
|
||||
return '不能包含非法字符:< > " \' \\\ |'
|
||||
}
|
||||
},
|
||||
})
|
||||
.then(({ value }) => {
|
||||
resetUserPwd(row.userId, value).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功,新密码是:' + value)
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue