From b7426e2384b85e92ec1b59061bdada9b4f5c69ec Mon Sep 17 00:00:00 2001 From: wupengfei <834520024@qq.com> Date: 星期三, 23 四月 2025 16:12:40 +0800 Subject: [PATCH] feat: 接口 --- src/views/Account/AccountManageList.vue | 79 ++++++++++++++++++++++++--------------- 1 files changed, 49 insertions(+), 30 deletions(-) diff --git a/src/views/Account/AccountManageList.vue b/src/views/Account/AccountManageList.vue index 77fa4ba..5a287cb 100644 --- a/src/views/Account/AccountManageList.vue +++ b/src/views/Account/AccountManageList.vue @@ -38,6 +38,7 @@ defineOperationBtns, } from '@bole-core/components'; import * as userRoleServices from '@/services/api/UserRole'; +import * as accountServices from '@/services/api/Account'; import { Message, OrderInputType } from '@bole-core/core'; import AddOrEditAccountDialog from './components/AddOrEditAccountDialog.vue'; import ResetPasswordDialog from './components/ResetPasswordDialog.vue'; @@ -50,7 +51,7 @@ const column: API.CustomModuleColumnDto[] = [ { id: '1', - enCode: 'changeFlag', + enCode: 'userName', name: '璐﹀彿', }, { @@ -60,12 +61,12 @@ }, { id: '3', - enCode: 'idNumber', + enCode: 'phoneNumber', name: '鎵嬫満鍙�', }, { id: '4', - enCode: 'workType', + enCode: 'remark', name: '澶囨敞', }, ]; @@ -86,7 +87,7 @@ name: '閲嶇疆瀵嗙爜', }, emits: { - onClick: (role) => handleResetPasswordAdd(), + onClick: (role) => openResetPasswordDialog(role), }, }, ]); @@ -162,30 +163,27 @@ }); async function handleAddOrEdit() { - // try { - // let isEdit = !!editForm.id; - // let params: API.CreateAccountInput = { - // name: editForm.name, - // userName: editForm.userName, - // remark: editForm.remark, - // password: editForm.password, - // phoneNumber: editForm.phoneNumber, - // channel: editForm.channel, - // // clientId: RoleClientType.RoleBackendClientId, - // roleNames: [editForm.roleName], - // }; - // let res; - // if (isEdit) { - // (params as API.UpdateAccountInput).id = editForm.id; - // res = await accountServices.updateAccount(params); - // } else { - // res = await accountServices.createAccount(params); - // } - // if (res) { - // Message.successMessage('鎿嶄綔鎴愬姛'); - // getList(isEdit ? paginationState.pageIndex : 1); - // } - // } catch (error) {} + try { + let isEdit = !!editForm.id; + let params: API.CreateAccountInput = { + name: editForm.name, + userName: editForm.userName, + remark: editForm.remark, + phoneNumber: editForm.phoneNumber, + }; + let res; + if (isEdit) { + (params as API.UpdateGovermentClientUserInput).id = editForm.id; + res = await userRoleServices.updateGovermentClientUser(params); + } else { + (params as API.CreateGoverUserInput).password = editForm.password; + res = await userRoleServices.createGovermentClientUser(params); + } + if (res) { + Message.successMessage('鎿嶄綔鎴愬姛'); + getList(isEdit ? paginationState.pageIndex : 1); + } + } catch (error) {} } const { @@ -193,10 +191,31 @@ handleAdd: handleResetPasswordAdd, editForm: resetPasswordEditForm, } = useFormDialog({ - onConfirm: handleAddOrEdit, + onConfirm: resetPassword, defaultFormParams: { - id: '', + userId: '', password: '', }, }); + +function openResetPasswordDialog(row: API.UserDto) { + handleResetPasswordAdd({ + userId: row.id, + password: '', + }); +} + +async function resetPassword() { + try { + let params: API.ResetPasswordBaseInput = { + userId: resetPasswordEditForm.userId, + password: resetPasswordEditForm.password, + }; + let res = await accountServices.resetPassword(params); + if (res) { + Message.successMessage('鎿嶄綔鎴愬姛'); + getList(paginationState.pageIndex); + } + } catch (error) {} +} </script> -- Gitblit v1.9.1