chore: initial commit
Some checks failed
Synchronize to Gitee / repo-sync (push) Has been cancelled
Typos Checking / Spell Check with Typos (push) Has been cancelled

This commit is contained in:
2026-06-23 11:56:23 +08:00
commit 72e2110987
2883 changed files with 367388 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import { AddLicenseUrl, GetLicenseUrl } from '@lib/shared/api/requrls/system/authorizedManagement';
import type { LicenseInfo } from '@lib/shared/models/system/authorizedManagement';
export default function useProductApi(CDR: CordysAxios) {
/**
* 授权管理相关API
*/
// 获取License
function getLicense() {
return CDR.get<LicenseInfo>({ url: GetLicenseUrl }, { ignoreCancelToken: true });
}
// 添加License
function addLicense(data: string) {
return CDR.post({ url: AddLicenseUrl, data });
}
return {
getLicense,
addLicense,
};
}

View File

@@ -0,0 +1,312 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddApiKeyUrl,
CancelCenterExportUrl,
CreateAuthUrl,
DeleteApiKeyUrl,
DeleteAuthUrl,
DisableApiKeyUrl,
EnableApiKeyUrl,
ExportCenterDownloadUrl,
GetApiKeyListUrl,
GetAuthDetailUrl,
GetAuthsUrl,
GetConfigEmailUrl,
GetConfigSynchronizationUrl,
GetDEOrgListUrl,
GetDETokenUrl,
GetExportCenterListUrl,
GetPageConfigUrl,
GetPersonalFollowUrl,
GetPersonalUrl,
GetTenderConfigUrl,
GetThirdPartyConfigUrl,
GetThirdPartyResourceUrl,
GetThirdTypeListUrl,
SavePageConfigUrl,
SendEmailCodeUrl,
SwitchThirdPartyUrl,
SyncDEUrl,
TestConfigEmailUrl,
TestConfigSynchronizationUrl,
UpdateApiKeyUrl,
UpdateAuthNameUrl,
UpdateAuthStatusUrl,
UpdateAuthUrl,
UpdateConfigEmailUrl,
UpdateConfigSynchronizationUrl,
UpdatePersonalUrl,
UpdateUserPasswordUrl,
} from '@lib/shared/api/requrls/system/business';
import { CompanyTypeEnum } from '@lib/shared/enums/commonEnum';
import type { CommonList } from '@lib/shared/models/common';
import { CustomerFollowPlanTableParams, FollowDetailItem } from '@lib/shared/models/customer';
import type {
ApiKey,
Auth,
AuthItem,
AuthTableQueryParams,
AuthUpdateParams,
ConfigEmailParams,
ThirdPartyResourceConfig,
DEOrgItem,
PageConfigReturns,
SavePageConfigParams,
ThirdPartyResource,
UpdateApiKeyParams,
ThirdPartyDEConfig,
} from '@lib/shared/models/system/business';
import {
ExportCenterItem,
ExportCenterListParams,
OptionDTO,
PersonalInfoRequest,
PersonalPassword,
SendEmailDTO,
} from '@lib/shared/models/system/business';
import { type DEToken, OrgUserInfo } from '@lib/shared/models/system/org';
export default function useProductApi(CDR: CordysAxios) {
// 获取邮件设置
function getConfigEmail() {
return CDR.get<ConfigEmailParams>({ url: GetConfigEmailUrl });
}
// 更新邮件设置
function updateConfigEmail(data: ConfigEmailParams) {
return CDR.post({ url: UpdateConfigEmailUrl, data });
}
// 邮件设置-测试连接
function testConfigEmail(data: ConfigEmailParams) {
return CDR.post({ url: TestConfigEmailUrl, data });
}
// 同步组织设置-测试连接
function testConfigSynchronization(data: ThirdPartyResourceConfig) {
return CDR.post({ url: TestConfigSynchronizationUrl, data }, { isReturnNativeResponse: true });
}
// 获取同步组织设置
function getConfigSynchronization() {
return CDR.get<ThirdPartyResourceConfig[]>({ url: GetConfigSynchronizationUrl }, { ignoreCancelToken: true });
}
// 更新同步组织设置
function updateConfigSynchronization(data: ThirdPartyResourceConfig) {
return CDR.post({ url: UpdateConfigSynchronizationUrl, data }, { isReturnNativeResponse: true });
}
// 根据类型获取开启的三方扫码设置
function getThirdConfigByType<T = ThirdPartyResourceConfig>(type: string, isReturnNativeResponse = false) {
return CDR.get<T>(
{ url: `${GetThirdPartyConfigUrl}/${type}` },
{
noErrorTip: true,
isReturnNativeResponse,
}
);
}
// 获取三方应用扫码类型集合
function getThirdTypeList() {
return CDR.get<OptionDTO[]>({ url: GetThirdTypeListUrl });
}
// 切换三方平台
function switchThirdParty(type: CompanyTypeEnum) {
return CDR.get({ url: SwitchThirdPartyUrl, params: { type } });
}
// 获取最新的三方同步来源
function getThirdPartyResource() {
return CDR.get<ThirdPartyResource>(
{ url: GetThirdPartyResourceUrl },
{
ignoreCancelToken: true,
}
);
}
// 获取认证设置列表
function getAuthList(data: AuthTableQueryParams) {
return CDR.post<CommonList<AuthItem>>({ url: GetAuthsUrl, data });
}
// 获取认证设置详情
function getAuthDetail(id: string) {
return CDR.get<AuthUpdateParams>({ url: `${GetAuthDetailUrl}/${id}` });
}
// 更新认证设置
function updateAuth(data: AuthUpdateParams) {
return CDR.post({ url: UpdateAuthUrl, data });
}
// 新建认证设置
function createAuth(data: Auth) {
return CDR.post({ url: CreateAuthUrl, data });
}
// 更新认证设置状态
function updateAuthStatus(id: string, enable: boolean) {
return CDR.get({ url: `${UpdateAuthStatusUrl}/${id}`, params: { enable } });
}
// 更新认证设置名称
function updateAuthName(id: string, name: string) {
return CDR.get({ url: `${UpdateAuthNameUrl}/${id}`, params: { name } });
}
// 删除认证设置
function deleteAuth(id: string) {
return CDR.get({ url: `${DeleteAuthUrl}/${id}` });
}
// 获取DEToken
function getDEToken(isModule = false) {
return CDR.get<DEToken>({ url: GetDETokenUrl, params: { isModule } });
}
// 同步 DE
function syncDE() {
return CDR.get({ url: SyncDEUrl });
}
// 获取第三方配置
function getThirdPartyConfig(type: string) {
return CDR.get<ThirdPartyResourceConfig>({ url: `${GetThirdPartyConfigUrl}/${type}` }, { noErrorTip: true });
}
// 获取 DE 组织列表
function getDEOrgList(data: ThirdPartyDEConfig) {
return CDR.post<DEOrgItem[]>({ url: GetDEOrgListUrl, data });
}
// 获取个人信息
function getPersonalInfo() {
return CDR.get<OrgUserInfo>({ url: GetPersonalUrl });
}
// 更新个人信息
function updatePersonalInfo(data: PersonalInfoRequest) {
return CDR.post({ url: UpdatePersonalUrl, data });
}
// 发送验证码
function sendEmailCode(email: SendEmailDTO) {
return CDR.post({ url: SendEmailCodeUrl, params: { email } });
}
// 修改密码
function updateUserPassword(data: PersonalPassword) {
return CDR.post({ url: UpdateUserPasswordUrl, data });
}
// 获取个人跟进计划
function getPersonalFollow(data: CustomerFollowPlanTableParams) {
return CDR.post<CommonList<FollowDetailItem>>({ url: GetPersonalFollowUrl, data });
}
// 个人中心导出列表
function getExportCenterList(data: ExportCenterListParams) {
return CDR.post<ExportCenterItem[]>({ url: GetExportCenterListUrl, data });
}
// 个人中心导出下载
function exportCenterDownload(taskId: string) {
return CDR.get(
{ url: `${ExportCenterDownloadUrl}/${taskId}`, responseType: 'blob' },
{ isTransformResponse: false }
);
}
// 个人中心取消导出
function cancelCenterExport(taskId: string) {
return CDR.get({ url: `${CancelCenterExportUrl}/${taskId}` });
}
// 个人中心 ApiKey
// 更新ApiKey
function updateApiKey(data: UpdateApiKeyParams) {
return CDR.post({ url: UpdateApiKeyUrl, data });
}
// 获取ApiKey列表
function getApiKeyList() {
return CDR.get<ApiKey[]>({ url: GetApiKeyListUrl });
}
// 开启ApiKey
function enableApiKey(id: string) {
return CDR.get({ url: EnableApiKeyUrl, params: id });
}
// 关闭ApiKey
function disableApiKey(id: string) {
return CDR.get({ url: DisableApiKeyUrl, params: id });
}
// 删除ApiKey
function deleteApiKey(id: string) {
return CDR.get({ url: DeleteApiKeyUrl, params: id });
}
// 新增ApiKey
function addApiKey() {
return CDR.get({ url: AddApiKeyUrl });
}
// 保存界面配置
function savePageConfig(data: SavePageConfigParams) {
return CDR.uploadFile({ url: SavePageConfigUrl }, data, 'files');
}
// 获取界面配置
function getPageConfig() {
return CDR.get<PageConfigReturns>({ url: GetPageConfigUrl }, { ignoreCancelToken: true });
}
// 获取招投标配置项
function getTenderConfig() {
return CDR.get<ThirdPartyResourceConfig>({ url: GetTenderConfigUrl }, { ignoreCancelToken: true });
}
return {
getConfigEmail,
updateConfigEmail,
testConfigEmail,
testConfigSynchronization,
getConfigSynchronization,
updateConfigSynchronization,
getThirdConfigByType,
getThirdTypeList,
getAuthList,
getAuthDetail,
updateAuth,
createAuth,
updateAuthStatus,
updateAuthName,
deleteAuth,
switchThirdParty,
getThirdPartyResource,
getPersonalInfo,
updatePersonalInfo,
sendEmailCode,
updateUserPassword,
getPersonalFollow,
getExportCenterList,
exportCenterDownload,
cancelCenterExport,
getDEToken,
syncDE,
getDEOrgList,
getThirdPartyConfig,
updateApiKey,
getApiKeyList,
enableApiKey,
disableApiKey,
deleteApiKey,
addApiKey,
savePageConfig,
getPageConfig,
getTenderConfig,
};
}

View File

@@ -0,0 +1,57 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
getKeyUrl,
isLoginUrl,
loginUrl,
signoutUrl,
thirdCallbackUrl,
thirdOauthCallbackUrl,
} from '@lib/shared/api/requrls/system/login';
import type { LoginParams } from '@lib/shared/models/system/login';
import type { UserInfo } from '@lib/shared/models/user';
import type { Result } from '@lib/shared/types/axios';
import type { AxiosResponse } from 'axios';
export default function useProductApi(CDR: CordysAxios) {
// 登录
function login(data: LoginParams) {
return CDR.post<UserInfo>({ url: loginUrl, data });
}
// 登出
function signout() {
return CDR.get({ url: signoutUrl });
}
// 是否登录
function isLogin(isDisabledErrorTip = false) {
return CDR.get<UserInfo>({ url: isLoginUrl }, { ignoreCancelToken: true, noErrorTip: isDisabledErrorTip });
}
// 获取登录密钥
function getKey() {
return CDR.get<string>({ url: getKeyUrl });
}
// 三方二维码登录
function getThirdCallback(code: string, type: string) {
return CDR.get<UserInfo>({ url: `${thirdCallbackUrl}/${type}`, params: { code } });
}
// 三方oauth2登录
function getThirdOauthCallback(code: string, type: string) {
return CDR.get<AxiosResponse<Result<UserInfo>>>(
{ url: `${thirdOauthCallbackUrl}/${type}`, params: { code } },
{ ignoreCancelToken: true, isReturnNativeResponse: true, noErrorTip: true }
);
}
return {
login,
signout,
isLogin,
getKey,
getThirdCallback,
getThirdOauthCallback,
};
}

View File

@@ -0,0 +1,133 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddAnnouncementUrl,
BatchSaveMessageTaskUrl,
CloseMessageUrl,
DeleteAnnouncementUrl,
GetAnnouncementDetailUrl,
GetAnnouncementListUrl,
GetHomeMessageUrl,
getMessageTaskConfigDetailUrl,
GetMessageTaskUrl,
GetNotificationCountUrl,
GetNotificationListUrl,
GetUnReadAnnouncement,
SaveMessageTaskUrl,
SetAllNotificationReadUrl,
SetNotificationReadUrl,
UpdateAnnouncementUrl,
} from '@lib/shared/api/requrls/system/message';
import type { CommonList } from '@lib/shared/models/common';
import type {
AnnouncementItemDetail,
AnnouncementSaveParams,
AnnouncementTableQueryParams,
MessageCenterItem,
MessageCenterQueryParams,
MessageConfigItem,
MessageSettingsConfig,
SaveMessageConfigParams,
} from '@lib/shared/models/system/message';
export default function useProductApi(CDR: CordysAxios) {
// 公告
// 添加公告
function addAnnouncement(data: AnnouncementSaveParams) {
return CDR.post({ url: AddAnnouncementUrl, data });
}
// 更新公告
function updateAnnouncement(data: AnnouncementSaveParams) {
return CDR.post({ url: UpdateAnnouncementUrl, data });
}
// 获取公告列表
function getAnnouncementList(data: AnnouncementTableQueryParams) {
return CDR.post<CommonList<AnnouncementItemDetail>>({ url: GetAnnouncementListUrl, data });
}
// 公告详情
function getAnnouncementDetail(id: string) {
return CDR.get<AnnouncementItemDetail>({ url: `${GetAnnouncementDetailUrl}/${id}` });
}
// 删除公告
function deleteAnnouncement(id: string) {
return CDR.get({ url: `${DeleteAnnouncementUrl}/${id}` });
}
// 消息中心
// 消息列表
function getNotificationList(data: MessageCenterQueryParams) {
return CDR.post<CommonList<MessageCenterItem>>({ url: GetNotificationListUrl, data });
}
// 具体消息类型具体状态的数量
function getNotificationCount(data: MessageCenterQueryParams) {
return CDR.post<{ key: string; count: number }[]>({ url: GetNotificationCountUrl, data });
}
// 设置消息已读
function setNotificationRead(id: string) {
return CDR.get({ url: `${SetNotificationReadUrl}/${id}` });
}
// 所有信息设置为已读消息
function setAllNotificationRead() {
return CDR.get({ url: SetAllNotificationReadUrl });
}
// 获取消息设置
function getMessageTask() {
return CDR.get<MessageConfigItem[]>({ url: GetMessageTaskUrl });
}
// 获取首页消息列表
function getHomeMessageList() {
return CDR.get<MessageCenterItem[]>({ url: GetHomeMessageUrl });
}
// 保存消息设置
function saveMessageTask(data: SaveMessageConfigParams) {
return CDR.post({ url: SaveMessageTaskUrl, data });
}
// 批量编辑消息设置
function batchSaveMessageTask(data: Pick<SaveMessageConfigParams, 'emailEnable' | 'sysEnable' | 'weComEnable'>) {
return CDR.post({ url: BatchSaveMessageTaskUrl, data });
}
// 关闭订阅消息SSE事件流
function closeMessageSubscribe(params: { userId: string; clientId: string }) {
return CDR.get({ url: CloseMessageUrl, params }, { ignoreCancelToken: true });
}
// 获取未读公告
function getUnReadAnnouncement() {
return CDR.get<MessageCenterItem[]>({ url: GetUnReadAnnouncement });
}
// 获取消息任务配置详情
function getMessageTaskConfigDetail(data: { module: string ,event:string}) {
return CDR.post<MessageSettingsConfig>({ url: getMessageTaskConfigDetailUrl, data });
}
return {
addAnnouncement,
updateAnnouncement,
getAnnouncementList,
getAnnouncementDetail,
deleteAnnouncement,
getNotificationList,
getNotificationCount,
setNotificationRead,
setAllNotificationRead,
getMessageTask,
saveMessageTask,
batchSaveMessageTask,
getHomeMessageList,
closeMessageSubscribe,
getUnReadAnnouncement,
getMessageTaskConfigDetail,
};
}

View File

@@ -0,0 +1,507 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddClueCapacityUrl,
AddCluePoolUrl,
AddCustomerCapacityUrl,
AddCustomerPoolUrl,
addOpportunityRuleUrl,
AddReasonUrl,
CheckRepeatUrl,
DeleteAttachmentUrl,
DeleteClueCapacityUrl,
DeleteCluePoolUrl,
DeleteCustomerCapacityUrl,
DeleteCustomerPoolUrl,
deleteOpportunityUrl,
DeleteReasonUrl,
DownloadAttachmentUrl,
DownloadPictureUrl,
GetClueCapacityPageUrl,
GetCluePoolPageUrl,
GetCustomerCapacityPageUrl,
GetCustomerPoolPageUrl,
GetFieldClueListUrl,
GetFieldContractListUrl,
GetFieldInvoiceListUrl,
GetFieldContractPaymentPlanListUrl,
GetFieldContractPaymentRecordListUrl,
GetFieldContactListUrl,
GetFieldCustomerListUrl,
GetFieldDeptTreeUrl,
GetFieldDeptUerTreeUrl,
GetFieldOpportunityListUrl,
GetFieldProductListUrl,
GetFormDesignConfigUrl,
GetModuleMaskSearchConfigUrl,
getModuleNavConfigListUrl,
GetModuleTopNavListUrl,
getOpportunityListUrl,
GetReasonConfigUrl,
GetReasonUrl,
GetSearchConfigUrl,
ModuleMaskSearchConfigUrl,
moduleNavListSortUrl,
ModuleRoleTreeUrl,
ModuleUserDeptTreeUrl,
NoPickCluePoolUrl,
NoPickCustomerPoolUrl,
PreviewAttachmentUrl,
PreviewPictureUrl,
QuickUpdateCluePoolUrl,
QuickUpdateCustomerPoolUrl,
ResetSearchConfigUrl,
SaveFormDesignConfigUrl,
SearchConfigUrl,
SetModuleTopNavSortUrl,
SortReasonUrl,
SwitchCluePoolStatusUrl,
SwitchCustomerPoolStatusUrl,
switchOpportunityStatusUrl,
toggleModuleNavStatusUrl,
UpdateClueCapacityUrl,
GetFieldDisplayListUrl,
UpdateCluePoolUrl,
UpdateCustomerCapacityUrl,
UpdateCustomerPoolUrl,
updateOpportunityRuleUrl,
UpdateReasonEnableUrl,
UpdateReasonUrl,
UploadTempAttachmentUrl,
UploadTempFileUrl,
GetFieldPriceListUrl,
GetFieldQuotationListUrl,
GetFieldBusinessTitleListUrl,
SetDisplayAdvancedUrl,
GetAdvancedSwitchUrl,
GetFieldRefDetailListUrl,
GetFieldOrderListUrl,
GetFieldCustomFormListUrl,
GetFieldConfigUrl,
} from '@lib/shared/api/requrls/system/module';
import { QuotationItem } from '@lib/shared/models/opportunity';
import { ModuleConfigEnum, ReasonTypeEnum } from '@lib/shared/enums/moduleEnum';
import type { ClueListItem } from '@lib/shared/models/clue';
import type { CommonList, TableQueryParams } from '@lib/shared/models/common';
import type { CustomerContractListItem, CustomerListItem } from '@lib/shared/models/customer';
import type { ProductListItem } from '@lib/shared/models/product';
import type {
CapacityItem,
CapacityParams,
CheckRepeatInfo,
CheckRepeatParams,
CluePoolItem,
CluePoolParams,
DefaultSearchSetFormModel,
FormDesignConfigDetailParams,
FormDesignDataSourceTableQueryParams,
GetRefDataSourceFieldParams,
ModuleNavBaseInfoItem,
ModuleNavTopItem,
ModuleSortParams,
OpportunityItem,
OpportunityParams,
ReasonConfig,
ReasonItem,
ReasonParams,
RefDataSourceFieldItem,
SaveFormDesignConfigParams,
SortReasonParams,
UpdateReasonEnableParams,
} from '@lib/shared/models/system/module';
import type { DeptUserTreeNode } from '@lib/shared/models/system/role';
import type { Result } from '@lib/shared/types/axios';
import { FormDesignKeyEnum } from '@lib/shared/enums/formDesignEnum';
import type { BusinessTitleItem, ContractItem, PaymentPlanItem, PaymentRecordItem } from '@lib/shared/models/contract';
import type { OrderItem } from '@lib/shared/models/order';
import { CustomFormPageItem, type CustomFormDetail } from '@lib/shared/models/customForm';
export default function useProductApi(CDR: CordysAxios) {
// 模块首页-导航模块列表
function getModuleNavConfigList(data: { organizationId: string }) {
return CDR.post<ModuleNavBaseInfoItem[]>({ url: getModuleNavConfigListUrl, data });
}
// 模块首页-导航模块排序
function moduleNavListSort(data: ModuleSortParams) {
return CDR.post({ url: moduleNavListSortUrl, data });
}
// 模块首页-导航模块状态切换
function toggleModuleNavStatus(id: string) {
return CDR.get({ url: `${toggleModuleNavStatusUrl}/${id}` });
}
// 模块首页-顶导配置列表
function getModuleTopNavList() {
return CDR.get<ModuleNavTopItem[]>({ url: GetModuleTopNavListUrl });
}
// 模块首页-导航模块排序
function setTopNavListSort(data: ModuleSortParams) {
return CDR.post({ url: SetModuleTopNavSortUrl, data });
}
// 获取部门用户树
function getModuleUserDeptTree() {
return CDR.get<DeptUserTreeNode[]>({ url: ModuleUserDeptTreeUrl });
}
// 获取角色树
function getModuleRoleTree() {
return CDR.get<DeptUserTreeNode[]>({ url: ModuleRoleTreeUrl });
}
// 模块-商机-商机规则列表
function getOpportunityRuleList(data: TableQueryParams) {
return CDR.post<CommonList<OpportunityItem>>({ url: getOpportunityListUrl, data });
}
// 模块-商机-添加商机规则
function addOpportunityRule(data: OpportunityParams) {
return CDR.post({ url: addOpportunityRuleUrl, data });
}
// 模块-商机-更新商机规则
function updateOpportunityRule(data: OpportunityParams) {
return CDR.post({ url: updateOpportunityRuleUrl, data });
}
// 模块-商机-更新商机规则状态
function switchOpportunityStatus(ruleId: string) {
return CDR.get({ url: `${switchOpportunityStatusUrl}/${ruleId}` });
}
// 模块-商机-删除商机规则
function deleteOpportunity(ruleId: string) {
return CDR.get({ url: `${deleteOpportunityUrl}/${ruleId}` });
}
// 线索池相关API
function getCluePoolPage(data: TableQueryParams) {
return CDR.post<CommonList<CluePoolItem>>({ url: GetCluePoolPageUrl, data });
}
function addCluePool(data: CluePoolParams) {
return CDR.post({ url: AddCluePoolUrl, data });
}
function updateCluePool(data: CluePoolParams, quick = false) {
return CDR.post({ url: quick ? QuickUpdateCluePoolUrl : UpdateCluePoolUrl, data });
}
function switchCluePoolStatus(id: string) {
return CDR.get({ url: `${SwitchCluePoolStatusUrl}/${id}` });
}
function deleteModuleCluePool(id: string) {
return CDR.get({ url: `${DeleteCluePoolUrl}/${id}` });
}
function noPickCluePool(id: string) {
return CDR.get({ url: `${NoPickCluePoolUrl}/${id}` });
}
// 库容相关API
function getCapacityPage(type: ModuleConfigEnum) {
return CDR.get<CapacityItem[]>({
url: type === ModuleConfigEnum.CLUE_MANAGEMENT ? GetClueCapacityPageUrl : GetCustomerCapacityPageUrl,
});
}
function deleteCapacity(id: string, type: ModuleConfigEnum) {
return CDR.get({
url: `${type === ModuleConfigEnum.CLUE_MANAGEMENT ? DeleteClueCapacityUrl : DeleteCustomerCapacityUrl}/${id}`,
});
}
function updateCapacity(data: CapacityParams, type: ModuleConfigEnum) {
return CDR.post({
url: type === ModuleConfigEnum.CLUE_MANAGEMENT ? UpdateClueCapacityUrl : UpdateCustomerCapacityUrl,
data,
});
}
function addCapacity(data: CapacityParams, type: ModuleConfigEnum) {
return CDR.post({
url: type === ModuleConfigEnum.CLUE_MANAGEMENT ? AddClueCapacityUrl : AddCustomerCapacityUrl,
data,
});
}
// 公海相关API
function getCustomerPoolPage(data: TableQueryParams) {
return CDR.post<CommonList<CluePoolItem>>({ url: GetCustomerPoolPageUrl, data });
}
function addCustomerPool(data: CluePoolParams) {
return CDR.post({ url: AddCustomerPoolUrl, data });
}
function updateCustomerPool(data: CluePoolParams, quick = false) {
return CDR.post({ url: quick ? QuickUpdateCustomerPoolUrl : UpdateCustomerPoolUrl, data });
}
function switchCustomerPoolStatus(id: string) {
return CDR.get({ url: `${SwitchCustomerPoolStatusUrl}/${id}` });
}
function deleteCustomerPool(id: string) {
return CDR.get({ url: `${DeleteCustomerPoolUrl}/${id}` });
}
function noPickCustomerPool(id: string) {
return CDR.get({ url: `${NoPickCustomerPoolUrl}/${id}` });
}
// 表单设计
function saveFormDesignConfig(data: SaveFormDesignConfigParams) {
return CDR.post({ url: SaveFormDesignConfigUrl, data });
}
function getFormDesignConfig(id: string) {
return CDR.get<FormDesignConfigDetailParams>(
{ url: `${GetFormDesignConfigUrl}/${id}` },
{ ignoreCancelToken: true }
);
}
function getFieldDeptUerTree() {
return CDR.get<DeptUserTreeNode[]>({ url: GetFieldDeptUerTreeUrl });
}
function getFieldDeptTree() {
return CDR.get<DeptUserTreeNode[]>({ url: GetFieldDeptTreeUrl }, { ignoreCancelToken: true });
}
function getFieldClueList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<ClueListItem>>({ url: GetFieldClueListUrl, data });
}
function getFieldContractList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<ContractItem>>({ url: GetFieldContractListUrl, data });
}
function getFieldInvoiceList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<ContractItem>>({ url: GetFieldInvoiceListUrl, data });
}
function getFieldContractPaymentPlanList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<PaymentPlanItem>>({ url: GetFieldContractPaymentPlanListUrl, data });
}
function getFieldContractPaymentRecordList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<PaymentRecordItem>>({ url: GetFieldContractPaymentRecordListUrl, data });
}
function getFieldContactList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<CustomerContractListItem>>({ url: GetFieldContactListUrl, data });
}
function getFieldCustomerList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<CustomerListItem>>({ url: GetFieldCustomerListUrl, data });
}
function getFieldOpportunityList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<OpportunityItem>>({ url: GetFieldOpportunityListUrl, data });
}
function getFieldProductList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<ProductListItem>>({ url: GetFieldProductListUrl, data });
}
function getFieldCustomFormList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<CustomFormPageItem>>({ url: GetFieldCustomFormListUrl, data });
}
function checkRepeat(data: CheckRepeatParams) {
return CDR.post<CheckRepeatInfo>({ url: CheckRepeatUrl, data }, { ignoreCancelToken: true });
}
function uploadTempFile(file: File | null) {
return CDR.uploadFile<Result<string[]>>({ url: UploadTempFileUrl }, { fileList: [file] }, 'files', true);
}
function uploadTempAttachment(file: File | null) {
return CDR.uploadFile<Result<string[]>>({ url: UploadTempAttachmentUrl }, { fileList: [file] }, 'files', true);
}
function previewAttachment(id: string) {
return CDR.get({ url: `${PreviewAttachmentUrl}/${id}` });
}
function downloadAttachment(id: string) {
return CDR.get({ url: `${DownloadAttachmentUrl}/${id}`, responseType: 'blob' }, { isTransformResponse: false });
}
function deleteAttachment(id: string) {
return CDR.get({ url: `${DeleteAttachmentUrl}/${id}` });
}
function previewPicture(id: string) {
return CDR.get({ url: `${PreviewPictureUrl}/${id}` });
}
function downloadPicture(id: string) {
return CDR.get({ url: `${DownloadPictureUrl}/${id}` });
}
// 模块配置-原因配置
function getReasonList(type: ReasonTypeEnum) {
return CDR.get<ReasonItem[]>({ url: `${GetReasonUrl}/${type}` });
}
function addReason(data: ReasonParams) {
return CDR.post({ url: AddReasonUrl, data });
}
function updateReason(data: ReasonParams) {
return CDR.post({ url: UpdateReasonUrl, data });
}
function deleteReasonItem(id: string) {
return CDR.get({ url: `${DeleteReasonUrl}/${id}` });
}
function getReasonConfig(type: ReasonTypeEnum) {
return CDR.get<ReasonConfig>({ url: `${GetReasonConfigUrl}/${type}` });
}
function updateReasonEnable(data: UpdateReasonEnableParams) {
return CDR.post<ReasonConfig>({ url: UpdateReasonEnableUrl, data });
}
function sortReason(data: SortReasonParams) {
return CDR.post({ url: SortReasonUrl, data });
}
function searchConfig(data: DefaultSearchSetFormModel) {
return CDR.post({ url: SearchConfigUrl, data });
}
function getSearchConfig() {
return CDR.get<DefaultSearchSetFormModel>({ url: GetSearchConfigUrl });
}
function resetSearchConfig() {
return CDR.get({ url: ResetSearchConfigUrl });
}
function moduleSearchMaskConfig(data: Record<string, any>) {
return CDR.post({ url: ModuleMaskSearchConfigUrl, data });
}
function getModuleSearchMaskConfig() {
return CDR.get<Pick<DefaultSearchSetFormModel, 'searchFields'>>({ url: GetModuleMaskSearchConfigUrl });
}
function getFieldPriceList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<ClueListItem>>({ url: GetFieldPriceListUrl, data });
}
function getFieldQuotationList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<QuotationItem>>({ url: GetFieldQuotationListUrl, data });
}
function getFieldOrderList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<OrderItem>>({ url: GetFieldOrderListUrl, data });
}
function getFieldDisplayList(formKey: FormDesignKeyEnum | string) {
return CDR.get<FormDesignConfigDetailParams>({ url: `${GetFieldDisplayListUrl}/${formKey}` });
}
function getFieldBusinessTitleList(data: FormDesignDataSourceTableQueryParams) {
return CDR.post<CommonList<BusinessTitleItem>>({ url: GetFieldBusinessTitleListUrl, data });
}
function getDatasourceRefDetailList(data: GetRefDataSourceFieldParams) {
return CDR.post<RefDataSourceFieldItem[]>({ url: GetFieldRefDetailListUrl, data }, { ignoreCancelToken: true });
}
// 设置高级筛选开关
function setDisplayAdvanced() {
return CDR.get({ url: SetDisplayAdvancedUrl });
}
// 高级筛选开关
function getAdvancedSwitch() {
return CDR.get({ url: GetAdvancedSwitchUrl });
}
function getDatasourceFieldConfig(type: FormDesignKeyEnum | string, approvalTaskId?: string) {
return CDR.get<FormDesignConfigDetailParams | CustomFormDetail>({ url: `${GetFieldConfigUrl}/${type}` });
}
return {
getFieldDisplayList,
getModuleNavConfigList,
moduleNavListSort,
toggleModuleNavStatus,
getModuleUserDeptTree,
getModuleRoleTree,
getOpportunityRuleList,
addOpportunityRule,
updateOpportunityRule,
switchOpportunityStatus,
deleteOpportunity,
getCluePoolPage,
addCluePool,
updateCluePool,
switchCluePoolStatus,
deleteModuleCluePool,
noPickCluePool,
getCapacityPage,
updateCapacity,
addCapacity,
deleteCapacity,
getCustomerPoolPage,
addCustomerPool,
updateCustomerPool,
switchCustomerPoolStatus,
deleteCustomerPool,
noPickCustomerPool,
saveFormDesignConfig,
getFormDesignConfig,
getFieldDeptUerTree,
getFieldDeptTree,
getFieldClueList,
getFieldContractList,
getFieldInvoiceList,
getFieldContractPaymentPlanList,
getFieldContractPaymentRecordList,
getFieldContactList,
getFieldCustomerList,
getFieldOpportunityList,
getFieldProductList,
checkRepeat,
uploadTempFile,
previewPicture,
downloadPicture,
getReasonList,
addReason,
updateReason,
deleteReasonItem,
getReasonConfig,
updateReasonEnable,
sortReason,
searchConfig,
getSearchConfig,
resetSearchConfig,
moduleSearchMaskConfig,
getModuleSearchMaskConfig,
getModuleTopNavList,
setTopNavListSort,
setDisplayAdvanced,
getAdvancedSwitch,
uploadTempAttachment,
previewAttachment,
deleteAttachment,
downloadAttachment,
getFieldPriceList,
getFieldQuotationList,
getFieldOrderList,
getFieldBusinessTitleList,
getDatasourceRefDetailList,
getFieldCustomFormList,
getDatasourceFieldConfig,
};
}

View File

@@ -0,0 +1,207 @@
import type { CrmTreeNodeData } from '@cordys/web/src/components/pure/crm-tree/type';
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
addDepartmentUrl,
addUserUrl,
batchEditUserUrl,
batchEnableUserUrl,
batchResetPasswordUrl,
checkDeleteDepartmentUrl,
checkSyncUserFromThirdUrl,
deleteDepartmentUrl,
deleteUserCheckUrl,
deleteUserUrl,
getDepartmentTreeUrl,
getAdminOptionsUrl,
getOrgDepartmentUserUrl,
CheckSyncUrl,
getRoleOptionsUrl,
getUserDetailUrl,
getUserListUrl,
getUserOptionsUrl,
importUserPreCheckUrl,
importUserUrl,
renameDepartmentUrl,
resetUserPasswordUrl,
setCommanderUrl,
sortDepartmentUrl,
syncOrgUrl,
updateUserNameUrl,
updateUserUrl,
} from '@lib/shared/api/requrls/system/org';
import type { CommonList } from '@lib/shared/models/common';
import type {
DepartmentItemParams,
DragNodeParams,
MemberItem,
MemberParams,
SetCommanderParams,
UpdateDepartmentItemParams,
UserTableQueryParams,
ValidateInfo,
} from '@lib/shared/models/system/org';
import type { DeptUserTreeNode } from '@lib/shared/models/system/role';
export default function useProductApi(CDR: CordysAxios) {
// 组织架构-部门树查询
function getDepartmentTree() {
return CDR.get<CrmTreeNodeData[]>({ url: getDepartmentTreeUrl });
}
// 组织架构-添加子部门
function addDepartment(data: DepartmentItemParams) {
return CDR.post({ url: addDepartmentUrl, data });
}
// 组织架构-重命名部门
function renameDepartment(data: UpdateDepartmentItemParams) {
return CDR.post({ url: renameDepartmentUrl, data });
}
// 组织架构-设置部门负责人
function setCommander(data: SetCommanderParams) {
return CDR.post({ url: setCommanderUrl, data });
}
// 组织架构-删除部门
function deleteDepartment(data: (string | number)[]) {
return CDR.post({ url: deleteDepartmentUrl, data });
}
// 组织架构-删除部门校验
function checkDeleteDepartment(data: (string | number)[]) {
return CDR.post({ url: checkDeleteDepartmentUrl, data });
}
// 组织架构-部门排序
function sortDepartment(data: DragNodeParams) {
return CDR.post({ url: sortDepartmentUrl, data });
}
// 用户(员工)-添加员工
function addUser(data: MemberParams) {
return CDR.post({ url: addUserUrl, data });
}
// 用户(员工)-更新员工
function updateUser(data: MemberParams) {
return CDR.post({ url: updateUserUrl, data });
}
// 用户(员工)-更新员工姓名
function updateOrgUserName(data: { userId: string; name: string }) {
return CDR.post({ url: updateUserNameUrl, data });
}
// 用户(员工)-列表查询
function getUserList(data: UserTableQueryParams) {
return CDR.post<CommonList<MemberItem>>({ url: getUserListUrl, data });
}
// 用户(员工)-员工详情
function getUserDetail(userId: string) {
return CDR.get<MemberParams>({ url: `${getUserDetailUrl}/${userId}` });
}
// 用户(员工)-批量启用|禁用
function batchToggleStatusUser(data: UserTableQueryParams) {
return CDR.post({ url: batchEnableUserUrl, data });
}
// 用户(员工)-批量重置密码
function batchResetUserPassword(data: UserTableQueryParams) {
return CDR.post({ url: batchResetPasswordUrl, data });
}
// 用户(员工)-重置密码
function resetUserPassword(userId: string) {
return CDR.get({ url: `${resetUserPasswordUrl}/${userId}` });
}
// 用户(员工)- 同步组织架构
function syncOrg(type: string) {
return CDR.get({ url: `${syncOrgUrl}/${type}` });
}
// 用户(员工)-批量编辑
function batchEditUser(data: UserTableQueryParams) {
return CDR.post({ url: batchEditUserUrl, data });
}
// 用户(员工)-excel导入检查
function importUserPreCheck(file: File) {
return CDR.uploadFile<{ data: ValidateInfo }>({ url: importUserPreCheckUrl }, { fileList: [file] }, 'file');
}
// 用户(员工)-获取用户下拉
function getUserOptions() {
return CDR.get({ url: getUserOptionsUrl });
}
// 用户(员工)-获取审批管理员下拉
function getAdminOptions() {
return CDR.get<{ id: string; name: string }[]>({ url: getAdminOptionsUrl });
}
// 用户(员工)-获取角色下拉
function getRoleOptions() {
return CDR.get({ url: getRoleOptionsUrl });
}
// 用户(员工)-excel导入
function importUsers(file: File) {
return CDR.uploadFile({ url: importUserUrl }, { fileList: [file] }, 'file');
}
// 用户(员工)-删除员工
function deleteUser(userId: string) {
return CDR.get({ url: `${deleteUserUrl}/${userId}` });
}
// 用户(员工)-删除员工校验
function deleteUserCheck(userId: string) {
return CDR.get({ url: `${deleteUserCheckUrl}/${userId}` });
}
// 用户(员工)-是否同步三方校验
function checkSyncUserFromThird() {
return CDR.get({ url: checkSyncUserFromThirdUrl });
}
// 获取当前部门下组织架构
function getOrgDepartmentUser(data: { id: string }) {
return CDR.get<DeptUserTreeNode[]>({ url: `${getOrgDepartmentUserUrl}/${data.id}` });
}
function checkSync() {
return CDR.get<boolean>({ url: CheckSyncUrl });
}
return {
getDepartmentTree,
addDepartment,
renameDepartment,
setCommander,
deleteDepartment,
addUser,
updateUser,
getUserList,
getUserDetail,
batchToggleStatusUser,
batchResetUserPassword,
resetUserPassword,
syncOrg,
batchEditUser,
importUserPreCheck,
getUserOptions,
getAdminOptions,
getRoleOptions,
importUsers,
deleteUser,
deleteUserCheck,
checkSyncUserFromThird,
checkDeleteDepartment,
sortDepartment,
updateOrgUserName,
getOrgDepartmentUser,
checkSync,
};
}

View File

@@ -0,0 +1,195 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
ApprovalPermissionsUrl,
AddApprovalProcessUrl,
UpdateApprovalProcessUrl,
DeleteApprovalProcessUrl,
ApprovalProcessDetailUrl,
ToggleApprovalProcessUrl,
ApprovalProcessPageUrl,
GetApprovalConfigDetailUrl,
GetResourceApprovingDetailUrl,
ReviewResourceUrl,
RevokeResourceUrl,
GetApprovalResourceDetailUrl,
GetProcessedApprovalTodosUrl,
GetPendingApprovalTodosUrl,
GetInitiatedApprovalTodosUrl,
GetCcApprovalTodosUrl,
RejectApprovalUrl,
BackApprovalUrl,
AddSignApprovalUrl,
GetTodoStatisticUrl,
AgreeApprovalUrl,
RevokeApprovalUrl,
BatchRejectApprovalUrl,
BatchApprovalApprovalUrl,
TestApprovalWebHookUrl,
} from '@lib/shared/api/requrls/system/process';
import {
AddApprovalProcessParams,
ApprovalPermissionsDetail,
ApprovalProcessDetail,
ApprovalProcessItem,
ApprovalWebhookConfig,
CommonApprovalActionParams,
UpdateApprovalProcessParams,
type ApprovalAddSignParams,
type ApprovalBackParams,
type ApprovalDetail,
type ApprovalOperationParams,
type ApprovalTodoItem,
type ApprovalTodoTableParams,
type BatchApprovalParams,
type BatchRejectApprovalParams,
type TodoStatistic,
} from '@lib/shared/models/system/process';
import type { CommonList } from '@lib/shared/models/common';
import type { TableQueryParams } from '@lib/shared/models/common';
export default function useProcessApi(CDR: CordysAxios) {
// 审批流数据权限
function getApprovalPermissions(type: string) {
return CDR.get<ApprovalPermissionsDetail>({ url: `${ApprovalPermissionsUrl}/${type}` });
}
// 审批流配置详情 用于列表里边查询对应状态审批流详情
function getApprovalConfigDetail(type: string) {
return CDR.get<ApprovalProcessDetail>({ url: `${GetApprovalConfigDetailUrl}/${type}` });
}
// 审批流数据权限
function getApprovalProcessList(data: TableQueryParams) {
return CDR.post<CommonList<ApprovalProcessItem>>({ url: ApprovalProcessPageUrl, data });
}
// 添加审批流
function addApprovalProcess(data: AddApprovalProcessParams) {
return CDR.post({ url: AddApprovalProcessUrl, data });
}
// 更新审批流
function updateApprovalProcess(data: UpdateApprovalProcessParams) {
return CDR.post({ url: UpdateApprovalProcessUrl, data });
}
// 审批流详情
function approvalProcessDetail(id: string) {
return CDR.get<ApprovalProcessDetail>({ url: `${ApprovalProcessDetailUrl}/${id}` });
}
// 删除审批流
function deleteApprovalProcess(id: string) {
return CDR.get({ url: `${DeleteApprovalProcessUrl}/${id}` });
}
// 切换审批流
function toggleApprovalProcess(id: string, enable: boolean) {
return CDR.get({ url: `${ToggleApprovalProcessUrl}/${id}`, params: { enable } });
}
// 获取对应资源审批状态详情用于(列表小卡片)
function getResourceApprovingDetail(sourceId: string) {
return CDR.get({ url: `${GetResourceApprovingDetailUrl}/${sourceId}` });
}
// 获取已处理审批待办列表
function getProcessedApprovalList(data: ApprovalTodoTableParams) {
return CDR.post<CommonList<ApprovalTodoItem>>({ url: GetProcessedApprovalTodosUrl, data });
}
// 获取待处理审批待办列表
function getPendingApprovalList(data: ApprovalTodoTableParams) {
return CDR.post<CommonList<ApprovalTodoItem>>({ url: GetPendingApprovalTodosUrl, data });
}
// 获取我发起的审批待办列表
function getInitiatedApprovalList(data: ApprovalTodoTableParams) {
return CDR.post<CommonList<ApprovalTodoItem>>({ url: GetInitiatedApprovalTodosUrl, data });
}
// 获取抄送我的审批待办列表
function getCcApprovalList(data: ApprovalTodoTableParams) {
return CDR.post<CommonList<ApprovalTodoItem>>({ url: GetCcApprovalTodosUrl, data });
}
// 驳回
function rejectApproval(data: ApprovalOperationParams) {
return CDR.post({ url: RejectApprovalUrl, data });
}
// 退回
function backApproval(data: ApprovalBackParams) {
return CDR.post({ url: BackApprovalUrl, data });
}
// 加签
function addSignApproval(data: ApprovalAddSignParams) {
return CDR.post({ url: AddSignApprovalUrl, data });
}
// 撤回
function revokeApproval(data: { id: string }) {
return CDR.post({ url: RevokeApprovalUrl, data });
}
// 同意
function agreeApproval(data: ApprovalOperationParams) {
return CDR.post({ url: AgreeApprovalUrl, data });
}
// 批量驳回
function batchRejectApproval(data: BatchRejectApprovalParams) {
return CDR.post({ url: BatchRejectApprovalUrl, data });
}
// 批量同意
function batchAgreeApproval(data: BatchApprovalParams) {
return CDR.post({ url: BatchApprovalApprovalUrl, data });
}
// 获取审批资源详情
function getApprovalResourceDetail(id: string) {
return CDR.get<ApprovalDetail>({ url: `${GetApprovalResourceDetailUrl}/${id}` });
}
// 获取待办统计
function getTodoStatistic() {
return CDR.get<TodoStatistic>({ url: GetTodoStatisticUrl });
}
// 提审
function reviewResource(data: CommonApprovalActionParams) {
return CDR.post({ url: ReviewResourceUrl, data });
}
// 撤销
function revokeResource(data: CommonApprovalActionParams) {
return CDR.post({ url: RevokeResourceUrl, data });
}
// WebHook连接测试
function testApprovalWebHook(data: ApprovalWebhookConfig) {
return CDR.post({ url: TestApprovalWebHookUrl, data });
}
return {
getApprovalProcessList,
getApprovalPermissions,
addApprovalProcess,
updateApprovalProcess,
approvalProcessDetail,
deleteApprovalProcess,
toggleApprovalProcess,
getApprovalConfigDetail,
getResourceApprovingDetail,
reviewResource,
revokeResource,
getProcessedApprovalList,
getPendingApprovalList,
getInitiatedApprovalList,
getCcApprovalList,
rejectApproval,
backApproval,
addSignApproval,
getApprovalResourceDetail,
getTodoStatistic,
revokeApproval,
agreeApproval,
batchRejectApproval,
batchAgreeApproval,
testApprovalWebHook,
};
}

View File

@@ -0,0 +1,119 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
BatchRemoveRoleMemberUrl,
CreateRoleUrl,
DeleteRoleUrl,
GetDeptTreeUrl,
GetPermissionsUrl,
GetRoleDeptTreeUrl,
GetRoleDetailUrl,
GetRoleMemberTreeUrl,
GetRoleMemberUrl,
GetRolesUrl,
GetUserOptionUrl,
RelateRoleUrl,
RemoveRoleMemberUrl,
UpdateRoleUrl,
} from '@lib/shared/api/requrls/system/role';
import type { CommonList } from '@lib/shared/models/common';
import type {
DeptTreeNode,
DeptUserTreeNode,
PermissionTreeNode,
RelateRoleMemberParams,
RoleCreateParams,
RoleDetail,
RoleItem,
RoleMemberItem,
RoleMemberTableQueryParams,
RoleUpdateParams,
} from '@lib/shared/models/system/role';
export default function useProductApi(CDR: CordysAxios) {
// 角色关联用户
function relateRoleMember(data: RelateRoleMemberParams) {
return CDR.post({ url: RelateRoleUrl, data });
}
// 获取角色关联用户列表
function getRoleMember(data: RoleMemberTableQueryParams) {
return CDR.post<CommonList<RoleMemberItem>>({ url: GetRoleMemberUrl, data });
}
// 批量移除角色关联用户
function batchRemoveRoleMember(data: (string | number)[]) {
return CDR.post({ url: BatchRemoveRoleMemberUrl, data });
}
// 更新角色
function updateRole(data: RoleUpdateParams) {
return CDR.post({ url: UpdateRoleUrl, data });
}
// 新建角色
function createRole(data: RoleCreateParams) {
return CDR.post({ url: CreateRoleUrl, data });
}
// 获取角色关联用户树
function getRoleMemberTree(params: { roleId: string }) {
return CDR.get({ url: `${GetRoleMemberTreeUrl}/${params.roleId}` });
}
// 获取部门用户树
function getRoleDeptUserTree(params: { roleId: string }) {
return CDR.get<DeptUserTreeNode[]>({ url: `${GetRoleDeptTreeUrl}/${params.roleId}` });
}
// 获取部门树
function getRoleDeptTree() {
return CDR.get<DeptTreeNode[]>({ url: GetDeptTreeUrl });
}
// 移除角色关联用户
function removeRoleMember(id: string) {
return CDR.get({ url: `${RemoveRoleMemberUrl}/${id}` });
}
// 获取全量权限
function getPermissions() {
return CDR.get<PermissionTreeNode[]>({ url: GetPermissionsUrl });
}
// 获取角色列表
function getRoles() {
return CDR.get<RoleItem[]>({ url: GetRolesUrl });
}
// 获取角色详情
function getRoleDetail(id: string) {
return CDR.get<RoleDetail>({ url: `${GetRoleDetailUrl}/${id}` });
}
// 删除角色
function deleteRole(id: string) {
return CDR.get({ url: `${DeleteRoleUrl}/${id}` });
}
// 获取用户列表
function getUsers(data: { roleId: string }) {
return CDR.get<RoleItem[]>({ url: `${GetUserOptionUrl}/${data.roleId}` });
}
return {
relateRoleMember,
getRoleMember,
batchRemoveRoleMember,
updateRole,
createRole,
getRoleMemberTree,
getRoleDeptUserTree,
getRoleDeptTree,
removeRoleMember,
getPermissions,
getRoles,
getRoleDetail,
deleteRole,
getUsers,
};
}