密码修改优化

master
schry 2 years ago
parent 55abdf9518
commit 2ea9e5491c

@ -103,7 +103,7 @@
width="35%" width="35%"
v-if="isVisible" v-if="isVisible"
> >
<el-form :model="inputQuery" label-width="100px" :rules="rules" ref="inputQuery"> <el-form :model="inputQuery" label-width="100px" :rules="formRules" ref="dataForm">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="20"> <el-col :span="20">
<el-form-item prop="userName" label="用户账号:"> <el-form-item prop="userName" label="用户账号:">
@ -119,7 +119,7 @@
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="20"> <el-col :span="20">
<el-form-item prop="locInvCode" label="当前密码:"> <el-form-item prop="passWord" label="当前密码:">
<el-input <el-input
size="small" size="small"
placeholder="请输入当前密码" placeholder="请输入当前密码"
@ -132,7 +132,7 @@
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="20"> <el-col :span="20">
<el-form-item prop="locInvCode" label="新密码:"> <el-form-item prop="newPassword" label="新密码:">
<el-input <el-input
size="small" size="small"
placeholder="请输入新密码" placeholder="请输入新密码"
@ -146,7 +146,7 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="20"> <el-col :span="20">
<el-form-item prop="locInvCode" label="确认密码:"> <el-form-item prop="confirmPassword" label="确认密码:">
<el-input <el-input
size="small" size="small"
placeholder="请输入确认密码" placeholder="请输入确认密码"
@ -160,8 +160,8 @@
<div style='text-align: center; margin-bottom: 10px;margin-top: 18px ;'> <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="onSubmit"></el-button>
<el-button type="primary" @click="closeDialog"></el-button> <el-button @click="closeDialog"></el-button>
</div> </div>
</el-form> </el-form>
</el-dialog> </el-dialog>
@ -187,15 +187,15 @@ import router from "@/router";
export default { export default {
data() { data() {
let validatePass2 = (rule, value, callback) => { // let validatePass2 = (rule, value, callback) => {
if (value === "") { // if (value === "") {
callback(new Error("请再次输入密码")); // callback(new Error(""));
} else if (value !== this.inputQuery.passWord) { // } else if (value !== this.inputQuery.passWord) {
callback(new Error("两次输入密码不一致!")); // callback(new Error("!"));
} else { // } else {
callback(); // callback();
} // }
}; // };
return { return {
inputQuery: { inputQuery: {
passWord: "", passWord: "",
@ -216,19 +216,25 @@ export default {
locDeptCode: [ locDeptCode: [
{required: true, message: "请选择当前部门", trigger: "blur"} {required: true, message: "请选择当前部门", trigger: "blur"}
], ],
locInvCode: [ // locInvCode: [
{required: true, message: "请选择当前仓库", trigger: "blur"} // {required: true, message: "", trigger: "blur"}
// ],
password: [{required: true, message: "请输入密码", trigger: "blur"}],
newPassword: [{required: true, message: "请输入密码", trigger: "blur"}],
confirmPassword: [
{required: true, message: "请确认密码", trigger: "blur"},
// {validator: validatePass2, trigger: "blur"},
], ],
}, },
rules: { rules: {
password: [{required: true, message: "请输入密码", trigger: "blur"}], password: [{required: true, message: "请输入密码", trigger: "blur"}],
newPassword: [{required: true, message: "请输入密码", trigger: "blur"}],
confirmPassword: [ confirmPassword: [
{required: true, message: "请确认密码", trigger: "blur"}, {required: true, message: "请确认密码", trigger: "blur"},
{validator: validatePass2, trigger: "blur"}, // {validator: validatePass2, trigger: "blur"},
], ],
}, },
}; };
}, },
components: { components: {
@ -265,8 +271,16 @@ export default {
} }
}, },
methods: { methods: {
onSubmit(formName) { onSubmit() {
this.$refs[formName].validate((valid) => { if (this.inputQuery.newPassword != this.inputQuery.confirmPassword) {
this.$message.error("新密码与确认密码不一致!!!!");
return
}
if (this.inputQuery.passWord == this.inputQuery.newPassword) {
this.$message.error("旧密码与新密码不能相同!!!!");
return
}
this.$refs["dataForm"].validate((valid) => {
if (valid) { if (valid) {
this.loading = true; this.loading = true;
modifyPasswd(this.inputQuery).then((response) => { modifyPasswd(this.inputQuery).then((response) => {

@ -73,7 +73,7 @@
<el-divider style="margin: 15px"></el-divider> <el-divider style="margin: 15px"></el-divider>
<el-table v-loading="loading" :data="list" key="1" style="width: 100%" <el-table v-loading="loading" :data="list" key="1" style="width: 100%"
border> border highlight-current-row @row-click="getCompanyId">
<el-table-column label="序号" type="index"></el-table-column> <el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="注册企业" prop="companyName" show-overflow-tooltip></el-table-column> <el-table-column label="注册企业" prop="companyName" show-overflow-tooltip></el-table-column>
<el-table-column label="填报者身份" prop="companyName" show-overflow-tooltip> <el-table-column label="填报者身份" prop="companyName" show-overflow-tooltip>
@ -248,6 +248,9 @@ export default {
}, },
methods: { methods: {
getCompanyId(row) {
this.filterQuery.companyIdFk = row.id;
},
onReset() { onReset() {
this.$router.push({ this.$router.push({
path: "", path: "",

Loading…
Cancel
Save