用户管理加密修改

This commit is contained in:
zzyuan 2025-07-04 13:17:39 +08:00
parent 30c255f407
commit 8834022505
2 changed files with 28 additions and 9 deletions

View File

@ -279,7 +279,9 @@
this.tableListData = response.rows;
this.total = Number(response.total);
this.tableListData.forEach(item=>{
if(item.contactTel){
this.$set(item,"contactTel",decryptWithSM4(item.contactTel))
}
})
this.loading = false;
});

View File

@ -758,7 +758,7 @@ import { validateNewPassword } from '@/utils/validate'
import store from "@/store";
import { imgUpLoadTwo } from '@/api/system/upload'
import { decryptWithSM4,encryptWithSM4 } from '@/utils/sm';
export default {
name: 'User',
dicts: [
@ -1000,6 +1000,11 @@ export default {
(response) => {
this.userList = response.rows
this.total = response.total
this.userList.forEach(item=>{
if(item.phonenumber){
this.$set(item,"phonenumber",decryptWithSM4(item.phonenumber))
}
})
this.loading = false
},
)
@ -1153,6 +1158,12 @@ export default {
const userId = row.userId || this.ids
getUser(userId).then((response) => {
this.form = response.data
if(this.form.phonenumber){
this.$set(this.form,"phonenumber",decryptWithSM4(response.data.phonenumber))
}
if(this.form.email){
this.$set(this.form,"email",decryptWithSM4(response.data.email))
}
const loginType = response.data.loginType
if (loginType) {
this.loginTypeArr = loginType.split(',')
@ -1252,13 +1263,12 @@ export default {
}
validateNewPassword(null, value, errorMessage)
},
})
.then(({ value }) => {
resetUserPwd(row.userId, value).then((response) => {
}).then(({ value }) => {
let password = encryptWithSM4(value)
resetUserPwd(row.userId, password).then((response) => {
this.$modal.msgSuccess('修改成功,新密码是:' + value)
})
})
.catch(() => {})
}).catch(() => {})
},
/** 分配角色操作 */
handleAuthRole: function (row) {
@ -1282,15 +1292,22 @@ export default {
this.form.effectiveStartDay = null
this.form.effectiveEndDay = null
}
let param = Object.assign({},this.form)
if (valid) {
if (this.form.userId != undefined) {
updateUser(this.form).then((response) => {
if(param.phonenumber&&param.phonenumber!=""){
this.$set(param,"phonenumber",encryptWithSM4(param.phonenumber))
}
if(param.email&&param.email!=""){
this.$set(param,"email",encryptWithSM4(param.email))
}
if (param.userId != undefined) {
updateUser(param).then((response) => {
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addUser(this.form).then((response) => {
addUser(param).then((response) => {
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()