|  |  | 
 |  |  |   useFormDialog, | 
 |  |  | } from '@bole-core/components'; | 
 |  |  | import { useAccess } from '@/hooks'; | 
 |  |  | import * as userServices from '@/services/api/User'; | 
 |  |  | import { RoleClientType } from '@/constants'; | 
 |  |  | import { Message, OrderInputType } from '@bole-core/core'; | 
 |  |  | import { Message } from '@bole-core/core'; | 
 |  |  | import AddOrEditAccountDialog from './components/AddOrEditAccountDialog.vue'; | 
 |  |  |  | 
 |  |  | defineOptions({ | 
 |  |  | 
 |  |  | } = useTable( | 
 |  |  |   async ({ pageIndex, pageSize }, extraParamState) => { | 
 |  |  |     try { | 
 |  |  |       let params: API.QueryUserPageInput = { | 
 |  |  |         pageModel: { | 
 |  |  |           rows: pageSize, | 
 |  |  |           page: pageIndex, | 
 |  |  |           orderInput: extraParamState.orderInput, | 
 |  |  |         }, | 
 |  |  |         searchKey: extraParamState.keyword, | 
 |  |  |       }; | 
 |  |  |       let res = await userServices.getUserPage(params, { | 
 |  |  |         showLoading: !state.loading, | 
 |  |  |       }); | 
 |  |  |       return res; | 
 |  |  |       // let params: API.QueryUserPageInput = { | 
 |  |  |       //   pageModel: { | 
 |  |  |       //     rows: pageSize, | 
 |  |  |       //     page: pageIndex, | 
 |  |  |       //     orderInput: extraParamState.orderInput, | 
 |  |  |       //   }, | 
 |  |  |       //   searchKey: extraParamState.keyword, | 
 |  |  |       // }; | 
 |  |  |       // let res = await userServices.getUserPage(params, { | 
 |  |  |       //   showLoading: !state.loading, | 
 |  |  |       // }); | 
 |  |  |       // return res; | 
 |  |  |       return {}; | 
 |  |  |     } catch (error) {} | 
 |  |  |   }, | 
 |  |  |   { | 
 |  |  |     defaultExtraParams: { | 
 |  |  |       orderInput: [{ property: 'id', order: OrderInputType.Desc }], | 
 |  |  |       orderInput: [{ property: 'id', order: EnumPagedListOrder.Desc }], | 
 |  |  |       keyword: '', | 
 |  |  |     }, | 
 |  |  |     columnsRenderProps: { | 
 |  |  | 
 |  |  | 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 userServices.updateAccount(params); | 
 |  |  |     } else { | 
 |  |  |       res = await userServices.createAccount(params); | 
 |  |  |     } | 
 |  |  |     if (res) { | 
 |  |  |       Message.successMessage('操作成功'); | 
 |  |  |       getList(isEdit ? paginationState.pageIndex : 1); | 
 |  |  |     } | 
 |  |  |     // 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 userServices.updateAccount(params); | 
 |  |  |     // } else { | 
 |  |  |     //   res = await userServices.createAccount(params); | 
 |  |  |     // } | 
 |  |  |     // if (res) { | 
 |  |  |     //   Message.successMessage('操作成功'); | 
 |  |  |     //   getList(isEdit ? paginationState.pageIndex : 1); | 
 |  |  |     // } | 
 |  |  |   } catch (error) {} | 
 |  |  | } | 
 |  |  | </script> |