完善重置密码的功能,增加页面
This commit is contained in:
@@ -233,8 +233,7 @@ public class UserController extends BaseController {
|
||||
HttpServletRequest request) throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
Long id = jsonObject.getLong("id");
|
||||
String password = "123456";
|
||||
String md5Pwd = Tools.md5Encryp(password);
|
||||
String md5Pwd = jsonObject.getString("password");
|
||||
int update = userService.resetPwd(md5Pwd, id, request);
|
||||
if(update > 0) {
|
||||
return returnJson(objectMap, SUCCESS, ErpInfo.OK.code);
|
||||
|
||||
@@ -20,6 +20,7 @@ const editUser = (params)=>putAction("/user/updateUser",params);
|
||||
const getUserList = (params)=>getAction("/user/getUserList",params);
|
||||
const getUserBtnByCurrentUser = (params)=>getAction("/user/getUserBtnByCurrentUser",params);
|
||||
const queryPermissionsByUser = (params)=>postAction("/function/findMenuByPNumber",params);
|
||||
const resetPwd = (params)=>postAction("/user/resetPwd",params);
|
||||
//机构管理
|
||||
const queryOrganizationTreeList = (params)=>getAction("/organization/getOrganizationTree",params);
|
||||
const getAllOrganizationTreeByUser = (params)=>getAction("/organization/getAllOrganizationTreeByUser",params);
|
||||
@@ -131,6 +132,7 @@ export {
|
||||
getUserList,
|
||||
getUserBtnByCurrentUser,
|
||||
queryPermissionsByUser,
|
||||
resetPwd,
|
||||
queryOrganizationTreeList,
|
||||
getAllOrganizationTreeByUser,
|
||||
queryOrganizationById,
|
||||
|
||||
@@ -57,9 +57,7 @@
|
||||
<a>删除</a>
|
||||
</a-popconfirm>
|
||||
<a-divider type="vertical"/>
|
||||
<a-popconfirm title="确定重置密码为123456吗?" @confirm="() => handleReset(record.id)">
|
||||
<a>重置密码</a>
|
||||
</a-popconfirm>
|
||||
<a @click="handleResetModal(record)">重置密码</a>
|
||||
</span>
|
||||
<!-- 状态渲染模板 -->
|
||||
<template slot="customRenderFlag" slot-scope="status">
|
||||
@@ -72,6 +70,7 @@
|
||||
<user-modal ref="modalForm" @ok="modalFormOk"></user-modal>
|
||||
<user-depot-modal ref="userDepotModal" @ok="modalFormOk"></user-depot-modal>
|
||||
<user-customer-modal ref="userCustomerModal" @ok="modalFormOk"></user-customer-modal>
|
||||
<user-reset-modal ref="userResetModal" @ok="modalFormOk"></user-reset-modal>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@@ -81,6 +80,7 @@
|
||||
import UserModal from './modules/UserModal'
|
||||
import UserDepotModal from './modules/UserDepotModal'
|
||||
import UserCustomerModal from './modules/UserCustomerModal'
|
||||
import UserResetModal from './modules/UserResetModal'
|
||||
import {postAction} from '@/api/manage';
|
||||
import {getCurrentSystemConfig} from '@/api/api'
|
||||
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
|
||||
@@ -92,6 +92,7 @@
|
||||
UserModal,
|
||||
UserDepotModal,
|
||||
UserCustomerModal,
|
||||
UserResetModal,
|
||||
JInput
|
||||
},
|
||||
data() {
|
||||
@@ -175,6 +176,10 @@
|
||||
this.$refs.modalForm.isReadOnly = true
|
||||
}
|
||||
},
|
||||
handleResetModal(record) {
|
||||
this.$refs.userResetModal.edit(record);
|
||||
this.$refs.userResetModal.title = "请输入" + record.loginName + "的新密码";
|
||||
},
|
||||
handleReset(id) {
|
||||
let that = this;
|
||||
postAction(that.url.resetPwd, {id: id}).then((res) => {
|
||||
|
||||
109
jshERP-web/src/views/system/modules/UserResetModal.vue
Normal file
109
jshERP-web/src/views/system/modules/UserResetModal.vue
Normal file
@@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<div ref="container">
|
||||
<a-modal
|
||||
:title="title"
|
||||
:width="600"
|
||||
:visible="visible"
|
||||
:confirmLoading="confirmLoading"
|
||||
:getContainer="() => $refs.container"
|
||||
:maskStyle="{'top':'93px','left':'154px'}"
|
||||
:wrapClassName="wrapClassNameInfo()"
|
||||
:mask="isDesktop()"
|
||||
:maskClosable="false"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
cancelText="取消"
|
||||
okText="保存"
|
||||
style="top:30%;height: 35%;">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="新密码">
|
||||
<a-input-password placeholder="请输入新密码" v-decorator.trim="[ 'password', validatorRules.password]" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import md5 from 'md5'
|
||||
import pick from 'lodash.pick'
|
||||
import { resetPwd } from '@/api/api'
|
||||
import {mixinDevice} from '@/utils/mixin'
|
||||
export default {
|
||||
name: "UserResetModal",
|
||||
mixins: [mixinDevice],
|
||||
data () {
|
||||
return {
|
||||
title:"操作",
|
||||
visible: false,
|
||||
model: {},
|
||||
maskStyle: '',
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 5 },
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 },
|
||||
},
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
validatorRules:{
|
||||
password:{
|
||||
rules: [
|
||||
{ required: true, message: '请输入新密码!' },
|
||||
{ pattern: /^(?=.*[a-z])(?=.*\d).{6,}$/, message: '用户密码至少要有数字和小写字母,并且长度至少6位!' }
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
created () {
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.edit({});
|
||||
},
|
||||
edit (record) {
|
||||
this.form.resetFields();
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'password'))
|
||||
});
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
this.visible = false;
|
||||
},
|
||||
handleOk () {
|
||||
const that = this;
|
||||
// 触发表单验证
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
that.confirmLoading = true;
|
||||
let formData = Object.assign(this.model, values);
|
||||
let bodyParam = {
|
||||
id: formData.id,
|
||||
password: md5(formData.password)
|
||||
}
|
||||
resetPwd(bodyParam).then((res)=>{
|
||||
if(res.code === 200){
|
||||
that.$emit('ok');
|
||||
}else{
|
||||
that.$message.warning(res.data.message);
|
||||
}
|
||||
}).finally(() => {
|
||||
that.confirmLoading = false;
|
||||
that.close();
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user