fix: 判断是否修改密码
This commit is contained in:
parent
4c0e8d0ec3
commit
52de73f6fc
4
src/typings/api.d.ts
vendored
4
src/typings/api.d.ts
vendored
@ -1150,9 +1150,9 @@ declare namespace Api {
|
|||||||
/** 用户名 */
|
/** 用户名 */
|
||||||
username: string;
|
username: string;
|
||||||
/** 密码 */
|
/** 密码 */
|
||||||
password: string;
|
password: string | null;
|
||||||
/** 确认密码 */
|
/** 确认密码 */
|
||||||
checkPassword: string;
|
checkPassword?: string;
|
||||||
/** 角色 */
|
/** 角色 */
|
||||||
role: Role;
|
role: Role;
|
||||||
/** 组 */
|
/** 组 */
|
||||||
|
@ -72,7 +72,7 @@ const rules = computed<RuleRecord>(() => {
|
|||||||
return {
|
return {
|
||||||
username: [defaultRequiredRule],
|
username: [defaultRequiredRule],
|
||||||
password: formRules.pwd,
|
password: formRules.pwd,
|
||||||
checkPassword: createConfirmPwdRule(model.password),
|
checkPassword: createConfirmPwdRule(model.password!),
|
||||||
role: [defaultRequiredRule],
|
role: [defaultRequiredRule],
|
||||||
permissions: [defaultRequiredRule]
|
permissions: [defaultRequiredRule]
|
||||||
};
|
};
|
||||||
@ -101,13 +101,10 @@ async function handleSubmit() {
|
|||||||
await validate();
|
await validate();
|
||||||
// request
|
// request
|
||||||
if (props.operateType === 'add') {
|
if (props.operateType === 'add') {
|
||||||
const { username, password, checkPassword, role, permissions } = model;
|
const { username, password, role, permissions } = model;
|
||||||
const passwordMd5 = md5(password);
|
|
||||||
const checkPasswordMd5 = md5(checkPassword);
|
|
||||||
const { error } = await fetchAddUser({
|
const { error } = await fetchAddUser({
|
||||||
username,
|
username,
|
||||||
password: passwordMd5,
|
password: md5(password!),
|
||||||
checkPassword: checkPasswordMd5,
|
|
||||||
role,
|
role,
|
||||||
permissions
|
permissions
|
||||||
});
|
});
|
||||||
@ -116,20 +113,18 @@ async function handleSubmit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (props.operateType === 'edit') {
|
if (props.operateType === 'edit') {
|
||||||
const { id, username, password, checkPassword, role, permissions } = model;
|
const { id, username, password, role, permissions } = model;
|
||||||
const passwordMd5 = md5(password);
|
|
||||||
const checkPasswordMd5 = md5(checkPassword);
|
|
||||||
const { error } = await fetchEditUser({
|
const { error } = await fetchEditUser({
|
||||||
id,
|
id,
|
||||||
username,
|
username,
|
||||||
password: passwordMd5,
|
password: updatePass.value ? md5(password!) : null,
|
||||||
checkPassword: checkPasswordMd5,
|
|
||||||
role,
|
role,
|
||||||
permissions
|
permissions
|
||||||
});
|
});
|
||||||
if (error) return;
|
if (error) return;
|
||||||
window.$message?.success($t('common.updateSuccess'));
|
window.$message?.success($t('common.updateSuccess'));
|
||||||
}
|
}
|
||||||
|
|
||||||
closeDrawer();
|
closeDrawer();
|
||||||
emit('submitted');
|
emit('submitted');
|
||||||
}
|
}
|
||||||
@ -219,7 +214,6 @@ function updatePermissions(p: OptionValue[]) {
|
|||||||
</NFormItem>
|
</NFormItem>
|
||||||
<NFormItem v-if="model.role === 1" :label="$t('page.userManager.permissions')" path="permissions">
|
<NFormItem v-if="model.role === 1" :label="$t('page.userManager.permissions')" path="permissions">
|
||||||
<NTransfer
|
<NTransfer
|
||||||
ref="transfer"
|
|
||||||
v-model:value="valueRef"
|
v-model:value="valueRef"
|
||||||
virtual-scroll
|
virtual-scroll
|
||||||
:options="groupConfigs"
|
:options="groupConfigs"
|
||||||
|
Loading…
Reference in New Issue
Block a user