密码修改

master
1178634255 2 years ago
parent 8649809a15
commit 76bf1b4e3d

@ -74,4 +74,27 @@ export function updateInv(data) {
data: data
});
}
//获取当前登陆人用户信息
export function selectUser(query) {
return axios({
url: "/admin/auth/admin/selectUser",
method: "get",
params: query
});
}
export function modifyPasswd(data) {
return axios({
url: "/admin/auth/admin/updateUser",
method: "post",
data: data
});
}
export function filterByUser(query) {
return axios({
url: "/admin/auth/admin/selectUser",
method: "get",
params: query
});
}

@ -9,9 +9,8 @@
<template v-if="device!=='mobile'">
<div class="inv-hos-title">
<!-- <span style="font-weight: bold;color: #303133;">协和医院平潭分院</span>-->
<span
style="margin-left:8px;color: #2d8cf0;font-size: 14px;">部门:{{ deptName }}</span>
<span
style="margin-left:8px;color: #2d8cf0;font-size: 14px;">部门:{{ deptName }}</span>
<span
style="margin-right: 18px;margin-left:8px;color: #2d8cf0;font-size: 14px;">仓库:{{ inv }}</span>
<span style="font-weight: 500;color:rgb(51 48 48); font-size: 14px;">用户:{{ this.companyName }}</span>
@ -41,6 +40,9 @@
<el-dropdown-item divided @click.native="changeInv">
<span>切换仓库</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native="modifyPassword">
<span>修改密码</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
@ -103,6 +105,78 @@
</el-form>
</el-dialog>
<el-dialog
title="修改密码"
:visible.sync="isVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="35%"
v-if="isVisible"
>
<el-form :model="inputQuery" label-width="100px" :rules="rules" ref="inputQuery">
<el-row :gutter="20">
<el-col :span="20">
<el-form-item prop="userName" label="用户账号:">
<el-input
size="small"
placeholder="请输入登录用户账号"
v-model="inputQuery.userName"
@input="change()"
:disabled="true"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="20">
<el-form-item prop="locInvCode" label="当前密码:">
<el-input
size="small"
placeholder="请输入当前密码"
type="password"
v-model="inputQuery.passWord"
@input="change()"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="20">
<el-form-item prop="locInvCode" label="新密码:">
<el-input
size="small"
placeholder="请输入新密码"
type="password"
v-model="inputQuery.newPassword"
@input="change()"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="20">
<el-form-item prop="locInvCode" label="确认密码:">
<el-input
size="small"
placeholder="请输入确认密码"
type="password"
v-model="inputQuery.confirmPassword"
@input="change()"
></el-input>
</el-form-item>
</el-col>
</el-row>
<div style='text-align: center; margin-bottom: 10px;margin-top: 18px ;'>
<el-button type="primary" @click="onSubmit('inputQuery')"></el-button>
<el-button type="primary" @click="closeDialog"></el-button>
</div>
</el-form>
</el-dialog>
</div>
</template>
@ -119,21 +193,38 @@ import RuoYiDoc from '@/components/RuoYi/Doc'
import store from "@/store";
import {filterAllByUser} from "@/api/system/invWarehouse";
import {filterSubByInv, findByDeptUser} from "@/api/system/invSubWarehouse";
import {updateInv} from "@/api/auth/authAdmin";
import {updateInv, modifyPasswd,filterByUser} from "@/api/auth/authAdmin";
import {isRelogin} from "@/utils/request";
import router from "@/router";
export default {
data() {
let validatePass2 = (rule, value, callback) => {
if (value === "") {
callback(new Error("请再次输入密码"));
} else if (value !== this.inputQuery.password) {
callback(new Error("两次输入密码不一致!"));
} else {
callback();
}
};
return {
deptName: store.getters.locDeptName,
inv: store.getters.locInvName,
deptName: store.getters.locDeptName,
selInvVisible: false,
isVisible: false,
userInfo: {},
inputQuery: {
passWord: "",
newPassword: "",
confirmPassword: "",
userName: "",
locInvCode: "",
id:"",
},
deptList: [],
invList: [],
userName: '',
companyName: '',
formRules: {
locDeptCode: [
{required: true, message: "请选择当前部门", trigger: "blur"}
@ -143,6 +234,14 @@ export default {
],
},
rules: {
password: [{required: true, message: "请输入密码", trigger: "blur"}],
confirmPassword: [
{required: true, message: "请确认密码", trigger: "blur"},
{validator: validatePass2, trigger: "blur"},
],
},
};
},
components: {
@ -179,6 +278,33 @@ export default {
}
},
methods: {
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.loading = true;
modifyPasswd(this.inputQuery).then((response) => {
if (response.code === 20000) {
this.loading = false;
this.$confirm('密码重置成功,请点击确定重新登录', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = process.env.VUE_APP_CONTEXT_PATH;
})
}).catch(() => {
});
} else {
this.$message.error(response.message);
}
});
} else {
return false;
}
});
},
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},
@ -197,7 +323,9 @@ export default {
changeInv() {
this.selInvVisible = true;
this.getDeptList();
},
modifyPassword() {
this.isVisible = true;
},
getDeptList() {
@ -210,6 +338,16 @@ export default {
.catch(() => {
});
},
// getInputQuery() {
// this.inputQuery = [];
// filterByUser()
// .then((response) => {
// this.inputQuery = response.data || [];
// // this.getInvList();
// })
// .catch(() => {
// });
// },
deptChange() {
this.getInvList();
@ -219,8 +357,7 @@ export default {
getInvList() {
this.invList = [];
let query = {
deptCode: this.userInfo.locDeptCode,
type:1
deptCode: this.userInfo.locDeptCode
};
findByDeptUser(query)
.then((response) => {
@ -266,6 +403,8 @@ export default {
closeDialog() {
this.selInvVisible = false;
this.isVisible = false;
this.getDeptList()
this.resetForm();
},
@ -283,14 +422,17 @@ export default {
},
created() {
this.userName = this.$store.getters.name;
this.companyName = this.$store.getters.companyName;
this.userInfo = {
id: store.getters.adminId,
locInvCode: store.getters.locInvCode,
locDeptCode: store.getters.locDeptCode,
};
this.inputQuery = {
userName: this.userName,
id: this.userInfo.id,
};
// this.getInputQuery();
this.getDeptList();
//this.getInvList()

@ -17,7 +17,7 @@
:model="inputQuery"
:rules="rules"
ref="inputQuery"
style="margin-left: 20%"
style="margin-left: 20%"
>
<el-row :gutter="20">
<el-col :span="4">

Loading…
Cancel
Save