|  |  |  | 
|---|
|  |  |  | // member: { emits: { onClick: (role) => openMemberDialog(role) } }, | 
|---|
|  |  |  | disabledBtn: { | 
|---|
|  |  |  | emits: { onClick: (role) => roleEnableOrForbid(role) }, | 
|---|
|  |  |  | props: { type: 'danger' }, | 
|---|
|  |  |  | extraProps: { | 
|---|
|  |  |  | hide: (row) => row.isLocked, | 
|---|
|  |  |  | hide: (row) => row.isDisabled, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | enableBtn: { | 
|---|
|  |  |  | emits: { onClick: (role) => roleEnableOrForbid(role) }, | 
|---|
|  |  |  | extraProps: { | 
|---|
|  |  |  | hide: (row) => !row.isLocked, | 
|---|
|  |  |  | hide: (row) => !row.isDisabled, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | userType: extraParamState.userType, | 
|---|
|  |  |  | clientType: extraParamState.clientType, | 
|---|
|  |  |  | keywords: extraParamState.queryCondition, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | let res = await roleServices.getRoles(params, { | 
|---|
|  |  |  | showLoading: !state.loading, | 
|---|
|  |  |  | 
|---|
|  |  |  | detail: detail, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | handleAdd(); | 
|---|
|  |  |  | handleAdd({ | 
|---|
|  |  |  | userType: extraParamState.userType, | 
|---|
|  |  |  | clientType: extraParamState.clientType, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (error) {} | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | async function roleEnableOrForbid(row: API.GetRolesQueryResultItem) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | // await Message.tipMessage(`是否${!row.isEnable ? '启用' : '禁用'}角色`); | 
|---|
|  |  |  | // let res = await userServices.roleEnableOrForbid({ | 
|---|
|  |  |  | //   id: row.id, | 
|---|
|  |  |  | //   isEnable: !row.isEnable, | 
|---|
|  |  |  | // }); | 
|---|
|  |  |  | // if (res) { | 
|---|
|  |  |  | //   Message.successMessage('操作成功'); | 
|---|
|  |  |  | //   getList(paginationState.pageIndex); | 
|---|
|  |  |  | //   refetch({ type: 'inactive' }); | 
|---|
|  |  |  | //   return !!res; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | await Message.tipMessage(`是否${row.isDisabled ? '启用' : '禁用'}角色`); | 
|---|
|  |  |  | let res = await roleServices.setRoleIsDisabled({ | 
|---|
|  |  |  | ids: [row.id], | 
|---|
|  |  |  | isDisabled: !row.isDisabled, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | if (res) { | 
|---|
|  |  |  | Message.successMessage('操作成功'); | 
|---|
|  |  |  | getList(paginationState.pageIndex); | 
|---|
|  |  |  | return !!res; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (error) {} | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } catch (error) {} | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | async function handleAuthorize(selectedMenuIds: string[], resourceIds: string[]) { | 
|---|
|  |  |  | async function handleAuthorize(selectedMenuIds: string[]) { | 
|---|
|  |  |  | console.log('selectedMenuIds: ', selectedMenuIds); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | // let params: API.SaveRoleCommand = { | 
|---|
|  |  |  | //   ...authorizeForm.detail, | 
|---|
|  |  |  | //   menuIds: selectedMenuIds, | 
|---|
|  |  |  | //   resources: resourceIds.map((x) => ({ | 
|---|
|  |  |  | //     resourceId: x, | 
|---|
|  |  |  | //     dataPower: EnumRoleWebApiDataPower.All, | 
|---|
|  |  |  | //   })), | 
|---|
|  |  |  | // }; | 
|---|
|  |  |  | // let res = await roleServices.saveRole(params); | 
|---|
|  |  |  | // if (res) { | 
|---|
|  |  |  | //   Message.successMessage('操作成功'); | 
|---|
|  |  |  | //   getList(paginationState.pageIndex); | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | let params: API.SaveRoleCommand = { | 
|---|
|  |  |  | ...authorizeForm.detail, | 
|---|
|  |  |  | menuIds: selectedMenuIds, | 
|---|
|  |  |  | // resources: resourceIds.map((x) => ({ | 
|---|
|  |  |  | //   resourceId: x, | 
|---|
|  |  |  | //   dataPower: EnumRoleWebApiDataPower.All, | 
|---|
|  |  |  | // })), | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | let res = await roleServices.saveRole(params); | 
|---|
|  |  |  | if (res) { | 
|---|
|  |  |  | Message.successMessage('操作成功'); | 
|---|
|  |  |  | getList(paginationState.pageIndex); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (error) {} | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|