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,177 @@
import { ThirdPartyResourceConfig } from '@lib/shared/models/system/business';
import type {
AddAgentModuleParams,
AddAgentParams,
AgentApplicationScript,
AgentModuleRenameParams,
AgentModuleTreeNode,
AgentPosParams,
AgentRenameParams,
AgentTableQueryParams,
ApplicationScriptParams,
UpdateAgentParams,
} from '../../models/agent';
import type { ModuleDragParams, TableQueryParams } from '../../models/common';
import {
addAgentUrl,
agentApplicationUrl,
agentCollectPageUrl,
agentCollectUrl,
agentDeleteUrl,
agentDetailUrl,
agentModuleAddUrl,
agentModuleCountUrl,
agentModuleDeleteUrl,
agentModuleMoveUrl,
agentModuleRenameUrl,
agentModuleTreeUrl,
agentOptionUrl,
agentPageUrl,
agentPosUrl,
agentScriptUrl,
agentWorkspaceUrl,
getMkAgentVersionUrl,
getMkApplicationUrl,
renameAgentUrl,
unCollectAgentUrl,
updateAgentUrl,
} from '../requrls/agent';
import type { CrmTreeNodeData } from '@cordys/web/src/components/pure/crm-tree/type';
import type { CordysAxios } from '@lib/shared/api/http/Axios';
export default function useAgentApi(CDR: CordysAxios) {
// 智能体模块重命名
function agentModuleRename(data: AgentModuleRenameParams) {
return CDR.post({ url: agentModuleRenameUrl, data });
}
// 智能体模块移动
function agentModuleMove(data: ModuleDragParams) {
return CDR.post({ url: agentModuleMoveUrl, data });
}
// 智能体模块删除
function agentModuleDelete(ids: string[]) {
return CDR.post({ url: agentModuleDeleteUrl, data: ids });
}
// 添加智能体模块
function agentModuleAdd(data: AddAgentModuleParams) {
return CDR.post({ url: agentModuleAddUrl, data });
}
// 获取智能体模块树
function getAgentModuleTree() {
return CDR.get<CrmTreeNodeData<AgentModuleTreeNode>[]>({ url: agentModuleTreeUrl });
}
// 获取智能体模块树数量
function getAgentModuleTreeCount() {
return CDR.get<Record<string, number>>({ url: agentModuleCountUrl });
}
// 更新智能体
function updateAgent(data: UpdateAgentParams) {
return CDR.post({ url: updateAgentUrl, data });
}
// 智能体重命名
function agentRename(data: AgentRenameParams) {
return CDR.post({ url: renameAgentUrl, data });
}
// 获取智能体列表
function getAgentPage(data: AgentTableQueryParams) {
return CDR.post({ url: agentPageUrl, data });
}
// 获取智能体收藏列表
function getAgentCollectPage(data: TableQueryParams) {
return CDR.post({ url: agentCollectPageUrl, data });
}
// 添加智能体
function addAgent(data: AddAgentParams) {
return CDR.post({ url: addAgentUrl, data });
}
// 取消收藏智能体
function unCollectAgent(id: string) {
return CDR.get({ url: `${unCollectAgentUrl}/${id}` });
}
// 获取智能体详情
function getAgentDetail(id: string) {
return CDR.get({ url: `${agentDetailUrl}/${id}` });
}
// 删除智能体
function agentDelete(id: string) {
return CDR.get({ url: `${agentDeleteUrl}/${id}` });
}
// 收藏智能体
function agentCollect(id: string) {
return CDR.get({ url: `${agentCollectUrl}/${id}` });
}
// 获取智能体选项
function getAgentOptions() {
return CDR.get({ url: agentOptionUrl });
}
// 获取智能体应用
function agentApplicationOptions(workspaceId: string) {
return CDR.get<AgentModuleRenameParams[]>({ url: `${agentApplicationUrl}/${workspaceId}` });
}
// 获取工作空间
function agentWorkspaceOptions() {
return CDR.get<AgentModuleRenameParams[]>({ url: agentWorkspaceUrl });
}
// 获取工作空间应用脚本
function getApplicationScript(data: ApplicationScriptParams) {
return CDR.post<AgentApplicationScript>({ url: agentScriptUrl, data });
}
// 获取智能体mk版本
function getMkAgentVersion() {
return CDR.get<'PE' | 'EE'>({ url: getMkAgentVersionUrl }, { noErrorTip: true });
}
// 智能体排序
function agentPos(data: AgentPosParams) {
return CDR.post({ url: agentPosUrl, data });
}
// 获取智能体mk应用配置
function getMkApplication() {
return CDR.get<ThirdPartyResourceConfig>({ url: getMkApplicationUrl });
}
return {
agentModuleRename,
agentModuleMove,
agentModuleDelete,
agentModuleAdd,
getAgentModuleTree,
getAgentModuleTreeCount,
updateAgent,
agentRename,
getAgentPage,
getAgentCollectPage,
addAgent,
unCollectAgent,
getAgentDetail,
agentDelete,
agentCollect,
getAgentOptions,
agentApplicationOptions,
agentWorkspaceOptions,
getApplicationScript,
getMkAgentVersion,
agentPos,
getMkApplication,
};
}

View File

@@ -0,0 +1,535 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddClueFollowPlanUrl,
AddClueFollowRecordUrl,
AddClueUrl,
AddClueViewUrl,
AddPoolLeadViewUrl,
AssignClueUrl,
BatchAssignClueUrl,
BatchDeleteCluePoolUrl,
BatchDeleteClueUrl,
BatchPickClueUrl,
BatchToPoolClueUrl,
BatchTransferClueUrl,
BatchUpdateCluePoolUrl,
BatchUpdateLeadUrl,
CancelClueFollowPlanUrl,
ClueTransitionCustomerUrl,
DeleteClueFollowPlanUrl,
DeleteClueFollowRecordUrl,
DeleteCluePoolUrl,
DeleteClueUrl,
DeleteClueViewUrl,
DeletePoolLeadViewUrl,
DownloadTemplateUrl,
DragClueViewUrl,
DragPoolLeadViewUrl,
EnableClueViewUrl,
EnablePoolLeadViewUrl,
ExportClueAllUrl,
ExportCluePoolAllUrl,
ExportCluePoolSelectedUrl,
ExportClueSelectedUrl,
FixedClueViewUrl,
FixedPoolLeadViewUrl,
GenerateLeadChartUrl,
GenerateLeadPoolChartUrl,
GetAdvancedCluePoolListUrl,
GetAdvancedSearchClueDetailUrl,
GetAdvancedSearchClueListUrl,
GetClueFollowPlanListUrl,
GetClueFollowPlanUrl,
GetClueFollowRecordListUrl,
GetClueFollowRecordUrl,
GetClueFormConfigUrl,
GetClueHeaderListUrl,
GetClueListUrl,
GetCluePoolFollowRecordListUrl,
GetCluePoolListUrl,
GetClueTabUrl,
GetClueTransitionCustomerListUrl,
GetClueUrl,
GetClueViewDetailUrl,
GetClueViewListUrl,
GetGlobalCluePoolListUrl,
GetGlobalSearchClueListUrl,
GetPoolClueUrl,
GetPoolLeadViewDetailUrl,
GetPoolLeadViewListUrl,
GetPoolOptionsUrl,
ImportLeadUrl,
MoveToPoolLeadUrl,
PickClueUrl,
PreCheckImportUrl,
ReTransitionCustomerUrl,
TransformClueUrl,
UpdateClueFollowPlanStatusUrl,
UpdateClueFollowPlanUrl,
UpdateClueFollowRecordUrl,
UpdateClueStatusUrl,
UpdateClueUrl,
UpdateClueViewUrl,
UpdatePoolLeadViewUrl,
} from '@lib/shared/api/requrls/clue';
import type {
AssignClueParams,
BatchAssignClueParams,
BatchPickClueParams,
ClueDetail,
ClueListItem,
CluePoolListItem,
CluePoolTableParams,
ClueTransitionCustomerParams,
ConvertClueParams,
PickClueParams,
SaveClueParams,
UpdateClueParams,
} from '@lib/shared/models/clue';
import type {
ChartResponseDataItem,
CommonList,
GenerateChartParams,
TableDraggedParams,
TableExportParams,
TableExportSelectedParams,
} from '@lib/shared/models/common';
import type {
BatchMoveToPublicPoolParams,
BatchUpdatePoolAccountParams,
CustomerContractTableParams,
CustomerFollowPlanTableParams,
CustomerFollowRecordTableParams,
CustomerTabHidden,
CustomerTableParams,
FollowDetailItem,
MoveToPublicPoolParams,
PoolTableExportParams,
SaveCustomerFollowPlanParams,
SaveCustomerFollowRecordParams,
TransferParams,
UpdateCustomerFollowPlanParams,
UpdateCustomerFollowRecordParams,
UpdateFollowPlanStatusParams,
} from '@lib/shared/models/customer';
import type { CluePoolItem, FormDesignConfigDetailParams } from '@lib/shared/models/system/module';
import { ValidateInfo } from '@lib/shared/models/system/org';
import type { ViewItem, ViewParams } from '@lib/shared/models/view';
export default function useProductApi(CDR: CordysAxios) {
// 添加线索
function addClue(data: SaveClueParams) {
return CDR.post({ url: AddClueUrl, data });
}
// 更新线索
function updateClue(data: UpdateClueParams) {
return CDR.post({ url: UpdateClueUrl, data });
}
// 更新线索状态
function updateClueStatus(data: { id: string; stage: string }) {
return CDR.post({ url: UpdateClueStatusUrl, data });
}
// 获取线索列表
function getClueList(data: CustomerTableParams) {
return CDR.post<CommonList<ClueListItem>>({ url: GetClueListUrl, data });
}
// 获取线索转为客户列表
function getClueTransitionCustomerList(data: CustomerTableParams) {
return CDR.post<CommonList<ClueListItem>>({ url: GetClueTransitionCustomerListUrl, data });
}
// 批量转移线索
function batchTransferClue(data: TransferParams) {
return CDR.post({ url: BatchTransferClueUrl, data });
}
// 线索合并客户
function reTransitionCustomer(data: { clueIds: (string | number)[]; customerId: string }) {
return CDR.post({ url: ReTransitionCustomerUrl, data });
}
// 批量移入线索池
function batchToCluePool(data: BatchMoveToPublicPoolParams) {
return CDR.post({ url: BatchToPoolClueUrl, data });
}
// 移入线索池
function moveToLeadPool(data: MoveToPublicPoolParams) {
return CDR.post({ url: MoveToPoolLeadUrl, data });
}
// 导出全量线索池列表
function exportCluePoolAll(data: PoolTableExportParams) {
return CDR.post({ url: ExportCluePoolAllUrl, data });
}
// 导出选中线索池列表
function exportCluePoolSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportCluePoolSelectedUrl, data });
}
// 批量删除线索
function batchDeleteClue(data: string[]) {
return CDR.post({ url: BatchDeleteClueUrl, data });
}
// 获取线索表单配置
function getClueFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetClueFormConfigUrl });
}
// 获取线索详情
function getClue(id: string) {
return CDR.get<ClueDetail>({ url: `${GetClueUrl}/${id}` });
}
// 删除线索
function deleteClue(id: string) {
return CDR.get({ url: `${DeleteClueUrl}/${id}` });
}
// 转为客户
function ClueTransitionCustomer(data: ClueTransitionCustomerParams) {
return CDR.post({ url: ClueTransitionCustomerUrl, data });
}
// 添加线索跟进记录
function addClueFollowRecord(data: SaveCustomerFollowRecordParams) {
return CDR.post({ url: AddClueFollowRecordUrl, data });
}
// 更新线索跟进记录
function updateClueFollowRecord(data: UpdateCustomerFollowRecordParams) {
return CDR.post({ url: UpdateClueFollowRecordUrl, data });
}
// 获取线索跟进记录列表
function getClueFollowRecordList(data: CustomerFollowRecordTableParams) {
return CDR.post<CommonList<FollowDetailItem>>({ url: GetClueFollowRecordListUrl, data });
}
// 删除线索跟进记录
function deleteClueFollowRecord(id: string) {
return CDR.get({ url: `${DeleteClueFollowRecordUrl}/${id}` });
}
// 获取线索跟进记录详情
function getClueFollowRecord(id: string) {
return CDR.get<FollowDetailItem>({ url: `${GetClueFollowRecordUrl}/${id}` });
}
// 添加线索跟进计划
function addClueFollowPlan(data: SaveCustomerFollowPlanParams) {
return CDR.post({ url: AddClueFollowPlanUrl, data });
}
// 更新线索跟进计划
function updateClueFollowPlan(data: UpdateCustomerFollowPlanParams) {
return CDR.post({ url: UpdateClueFollowPlanUrl, data });
}
// 删除线索跟进计划
function deleteClueFollowPlan(id: string) {
return CDR.get({ url: `${DeleteClueFollowPlanUrl}/${id}` });
}
// 获取线索跟进计划列表
function getClueFollowPlanList(data: CustomerFollowPlanTableParams) {
return CDR.post<CommonList<FollowDetailItem>>({ url: GetClueFollowPlanListUrl, data });
}
// 获取线索跟进计划详情
function getClueFollowPlan(id: string) {
return CDR.get<FollowDetailItem>({ url: `${GetClueFollowPlanUrl}/${id}` });
}
// 取消跟进计划
function cancelClueFollowPlan(id: string) {
return CDR.get({ url: `${CancelClueFollowPlanUrl}/${id}` });
}
// 获取线索负责人列表
function getClueHeaderList(data: CustomerContractTableParams) {
return CDR.get({ url: `${GetClueHeaderListUrl}/${data.sourceId}` });
}
// 线索池领取线索
function pickClue(data: PickClueParams) {
return CDR.post({ url: PickClueUrl, data });
}
// 获取线索池线索列表
function getCluePoolList(data: CluePoolTableParams) {
return CDR.post<CommonList<CluePoolListItem>>({ url: GetCluePoolListUrl, data });
}
// 批量领取线索池线索
function batchPickClue(data: BatchPickClueParams) {
return CDR.post({ url: BatchPickClueUrl, data });
}
// 批量删除线索池线索
function batchDeleteCluePool(data: string[]) {
return CDR.post({ url: BatchDeleteCluePoolUrl, data });
}
// 批量分配线索池线索
function batchAssignClue(data: BatchAssignClueParams) {
return CDR.post({ url: BatchAssignClueUrl, data });
}
// 批量更新线索池线索
function batchUpdateCluePool(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateCluePoolUrl, data });
}
// 分配线索池线索
function assignClue(data: AssignClueParams) {
return CDR.post({ url: AssignClueUrl, data });
}
// 获取当前用户线索池选项
function getPoolOptions() {
return CDR.get<CluePoolItem[]>({ url: GetPoolOptionsUrl });
}
// 删除线索池线索
function deleteCluePool(id: string) {
return CDR.get({ url: `${DeleteCluePoolUrl}/${id}` });
}
// 获取线索池跟进记录列表
function getCluePoolFollowRecordList(data: CustomerFollowRecordTableParams) {
return CDR.post<CommonList<FollowDetailItem>>({ url: GetCluePoolFollowRecordListUrl, data });
}
// 获取线索池详情
function getPoolClue(id: string) {
return CDR.get<ClueDetail>({ url: `${GetPoolClueUrl}/${id}` });
}
// 生成线索池图表
function generateLeadPoolChart(data: GenerateChartParams) {
return CDR.post<ChartResponseDataItem[]>({ url: GenerateLeadPoolChartUrl, data });
}
// 获取线索tab显隐藏
function getClueTab() {
return CDR.get<CustomerTabHidden>({ url: GetClueTabUrl });
}
// 更新线索跟进计划状态
function updateClueFollowPlanStatus(data: UpdateFollowPlanStatusParams) {
return CDR.post({ url: UpdateClueFollowPlanStatusUrl, data });
}
// 导出全量线索列表
function exportClueAll(data: TableExportParams) {
return CDR.post({ url: ExportClueAllUrl, data });
}
// 导出选中线索列表
function exportClueSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportClueSelectedUrl, data });
}
// 转换线索
function transformClue(data: ConvertClueParams) {
return CDR.post({ url: TransformClueUrl, data });
}
// 生成线索图表
function generateLeadChart(data: GenerateChartParams) {
return CDR.post<ChartResponseDataItem[]>({ url: GenerateLeadChartUrl, data });
}
// 视图
function addClueView(data: ViewParams) {
return CDR.post({ url: AddClueViewUrl, data });
}
function updateClueView(data: ViewParams) {
return CDR.post({ url: UpdateClueViewUrl, data });
}
function getClueViewList() {
return CDR.get<ViewItem[]>({ url: GetClueViewListUrl });
}
function getClueViewDetail(id: string) {
return CDR.get({ url: `${GetClueViewDetailUrl}/${id}` });
}
function fixedClueView(id: string) {
return CDR.get({ url: `${FixedClueViewUrl}/${id}` });
}
function enableClueView(id: string) {
return CDR.get({ url: `${EnableClueViewUrl}/${id}` });
}
function deleteClueView(id: string) {
return CDR.get({ url: `${DeleteClueViewUrl}/${id}` });
}
function dragClueView(data: TableDraggedParams) {
return CDR.post({ url: DragClueViewUrl, data });
}
function preCheckImportLead(file: File) {
return CDR.uploadFile<{ data: ValidateInfo }>({ url: PreCheckImportUrl }, { fileList: [file] }, 'file');
}
function downloadLeadTemplate() {
return CDR.get(
{
url: DownloadTemplateUrl,
responseType: 'blob',
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
function importLead(file: File) {
return CDR.uploadFile({ url: ImportLeadUrl }, { fileList: [file] }, 'file');
}
function getAdvancedSearchClueList(data: CustomerTableParams) {
return CDR.post<CommonList<ClueListItem>>({ url: GetAdvancedSearchClueListUrl, data }, { ignoreCancelToken: true });
}
function getAdvancedSearchClueDetail(data: CustomerTableParams) {
return CDR.post<CommonList<ClueListItem>>({ url: GetAdvancedSearchClueDetailUrl, data });
}
function getAdvancedCluePoolList(data: CluePoolTableParams) {
return CDR.post<CommonList<CluePoolListItem>>(
{ url: GetAdvancedCluePoolListUrl, data },
{ ignoreCancelToken: true }
);
}
function getGlobalSearchClueList(data: CustomerTableParams) {
return CDR.post<CommonList<ClueListItem>>({ url: GetGlobalSearchClueListUrl, data }, { ignoreCancelToken: true });
}
function getGlobalCluePoolList(data: CluePoolTableParams) {
return CDR.post<CommonList<CluePoolListItem>>({ url: GetGlobalCluePoolListUrl, data }, { ignoreCancelToken: true });
}
// 线索池视图
function addLeadPoolView(data: ViewParams) {
return CDR.post({ url: AddPoolLeadViewUrl, data });
}
function updateLeadPoolView(data: ViewParams) {
return CDR.post({ url: UpdatePoolLeadViewUrl, data });
}
function getLeadPoolViewList() {
return CDR.get<ViewItem[]>({ url: GetPoolLeadViewListUrl });
}
function getLeadPoolViewDetail(id: string) {
return CDR.get({ url: `${GetPoolLeadViewDetailUrl}/${id}` });
}
function fixedLeadPoolView(id: string) {
return CDR.get({ url: `${FixedPoolLeadViewUrl}/${id}` });
}
function enableLeadPoolView(id: string) {
return CDR.get({ url: `${EnablePoolLeadViewUrl}/${id}` });
}
function deleteLeadPoolView(id: string) {
return CDR.get({ url: `${DeletePoolLeadViewUrl}/${id}` });
}
function dragLeadPoolView(data: TableDraggedParams) {
return CDR.post({ url: DragPoolLeadViewUrl, data });
}
// 批量更新线索
function batchUpdateLead(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateLeadUrl, data });
}
return {
addClue,
updateClue,
updateClueStatus,
getClueList,
batchTransferClue,
batchToCluePool,
batchDeleteClue,
getClueFormConfig,
getClue,
deleteClue,
ClueTransitionCustomer,
addClueFollowRecord,
updateClueFollowRecord,
getClueFollowRecordList,
deleteClueFollowRecord,
getClueFollowRecord,
addClueFollowPlan,
updateClueFollowPlan,
deleteClueFollowPlan,
getClueFollowPlanList,
getClueFollowPlan,
cancelClueFollowPlan,
getClueHeaderList,
pickClue,
getCluePoolList,
batchPickClue,
batchDeleteCluePool,
batchAssignClue,
assignClue,
getPoolOptions,
deleteCluePool,
getCluePoolFollowRecordList,
getPoolClue,
getClueTab,
updateClueFollowPlanStatus,
exportClueAll,
exportClueSelected,
getClueTransitionCustomerList,
reTransitionCustomer,
moveToLeadPool,
addClueView,
deleteClueView,
fixedClueView,
getClueViewDetail,
getClueViewList,
updateClueView,
enableClueView,
dragClueView,
preCheckImportLead,
downloadLeadTemplate,
importLead,
getAdvancedSearchClueList,
getAdvancedCluePoolList,
getAdvancedSearchClueDetail,
getGlobalCluePoolList,
getGlobalSearchClueList,
exportCluePoolAll,
exportCluePoolSelected,
transformClue,
batchUpdateCluePool,
addLeadPoolView,
deleteLeadPoolView,
fixedLeadPoolView,
getLeadPoolViewDetail,
getLeadPoolViewList,
updateLeadPoolView,
enableLeadPoolView,
dragLeadPoolView,
batchUpdateLead,
generateLeadChart,
generateLeadPoolChart,
};
}

View File

@@ -0,0 +1,901 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import type { FormDesignConfigDetailParams } from '@lib/shared/models/system/module';
import type { TableQueryParams } from '@lib/shared/models/common';
import { ValidateInfo } from '@lib/shared/models/system/org';
import {
ContractPageUrl,
ContractAddUrl,
ContractUpdateUrl,
ContractDeleteUrl,
GetContractDetailUrl,
GetContractFormConfigUrl,
GetContractTabUrl,
ChangeContractStatusUrl,
GetContractFormSnapshotConfigUrl,
ExportContractAllUrl,
ExportContractSelectedUrl,
GenerateContractChartUrl,
AddContractViewUrl,
UpdateContractViewUrl,
GetContractViewListUrl,
GetContractViewDetailUrl,
FixedContractViewUrl,
EnableContractViewUrl,
DeleteContractViewUrl,
DragContractViewUrl,
PaymentPlanPageUrl,
PaymentPlanAddUrl,
ContractPaymentPlanPageUrl,
PaymentPlanUpdateUrl,
PaymentPlanDeleteUrl,
GetPaymentPlanDetailUrl,
GetPaymentPlanFormConfigUrl,
GetPaymentPlanTabUrl,
ExportPaymentPlanAllUrl,
ExportPaymentPlanSelectedUrl,
GeneratePaymentPlanChartUrl,
AddPaymentPlanViewUrl,
UpdatePaymentPlanViewUrl,
GetPaymentPlanViewListUrl,
GetPaymentPlanViewDetailUrl,
FixedPaymentPlanViewUrl,
EnablePaymentPlanViewUrl,
DeletePaymentPlanViewUrl,
DragPaymentPlanViewUrl,
BatchApproveContractUrl,
BatchUpdateContractUrl,
ApproveContractUrl,
RevokeContractUrl,
PaymentRecordPageUrl,
PaymentRecordAddUrl,
PaymentRecordUpdateUrl,
PaymentRecordDeleteUrl,
GetPaymentRecordDetailUrl,
GetPaymentRecordFormConfigUrl,
GetPaymentRecordTabUrl,
ExportPaymentRecordAllUrl,
ExportPaymentRecordSelectedUrl,
AddPaymentRecordViewUrl,
UpdatePaymentRecordViewUrl,
GetPaymentRecordViewListUrl,
GetPaymentRecordViewDetailUrl,
FixedPaymentRecordViewUrl,
EnablePaymentRecordViewUrl,
DeletePaymentRecordViewUrl,
DragPaymentRecordViewUrl,
PreCheckPaymentRecordImportUrl,
DownloadPaymentRecordTemplateUrl,
ImportPaymentRecordUrl,
DownloadBusinessTitleTemplateUrl,
ImportBusinessTitleUrl,
PreCheckBusinessTitleImportUrl,
BusinessTitlePageUrl,
BusinessTitleAddUrl,
BusinessTitleUpdateUrl,
BusinessTitleDeleteUrl,
GetBusinessTitleDetailUrl,
BusinessTitleRevokeUrl,
GetBusinessTitleInvoiceCheckUrl,
ExportBusinessTitleSelectedUrl,
ExportBusinessTitleAllUrl,
GetBusinessTitleThirdQueryUrl,
GetBusinessTitleThirdQueryOptionUrl,
BusinessTitleConfigUrl,
BusinessTitleFormConfigSwitchUrl,
ContractInvoicedAddUrl,
ContractInvoicedUpdateUrl,
ContractInvoicedApprovalUrl,
ContractInvoicedDeleteUrl,
ContractInvoicedBatchDeleteUrl,
ContractInvoicedDetailUrl,
ContractInvoicedExportAllUrl,
ContractInvoicedExportSelectedUrl,
ContractInvoicedFormConfigSnapshotUrl,
ContractInvoicedFormConfigUrl,
ContractInvoicedPageUrl,
ContractInvoicedRevokeUrl,
ContractInvoicedTabUrl,
DeleteContractInvoicedViewUrl,
DragContractInvoicedViewUrl,
EnableContractInvoicedViewUrl,
FixedContractInvoicedViewUrl,
GetContractInvoicedViewDetailUrl,
ListContractInvoicedViewUrl,
UpdateContractInvoicedViewUrl,
AddContractInvoicedViewUrl,
BusinessTitleModuleFormUrl,
ContractInvoicedInContractPageUrl,
GetContractDetailSnapshotUrl,
ContractInvoicedDetailSnapshotUrl,
ContractStatisticUrl,
SortContractUrl,
GetPaymentRecordStatisticUrl,
UpdateContractStatusUrl,
UpdateContractStatusRollbackUrl,
SortContractStatusUrl,
AddContractStatusUrl,
GetContractStatusConfigUrl,
DeleteContractStatusUrl,
UpdateContractStageUrl,
SwitchContractCirculationTypeUrl,
SaveContractCirculationConfigUrl,
} from '@lib/shared/api/requrls/contract';
import type { CustomerTabHidden } from '@lib/shared/models/customer';
import type {
ChartResponseDataItem,
CommonList,
GenerateChartParams,
TableDraggedParams,
TableExportParams,
TableExportSelectedParams,
} from '@lib/shared/models/common';
import type { ViewItem, ViewParams } from '@lib/shared/models/view';
import type {
ContractDetail,
ContractItem,
SaveContractParams,
UpdateContractParams,
PaymentPlanItem,
PaymentPlanDetail,
SavePaymentPlanParams,
UpdatePaymentPlanParams,
ApprovalContractParams,
PaymentRecordItem,
PaymentRecordDetail,
SavePaymentRecordParams,
UpdatePaymentRecordParams,
BusinessTitleItem,
SaveBusinessTitleParams,
BusinessTitleValidateConfig,
ContractInvoiceTableQueryParam,
ContractInvoiceItem,
SaveContractInvoiceParams,
UpdateContractInvoiceParams,
ContractInvoiceDetail,
} from '@lib/shared/models/contract';
import type {
BatchOperationResult,
BatchUpdateQuotationStatusParams,
SaveCirculationConfigParams,
UpdateStageParams,
StageBoardDraggedParams,
StageBoardPageQueryParams,
} from '@lib/shared/models/opportunity';
import type { BatchUpdatePoolAccountParams } from '@lib/shared/models/customer';
import {
StageBaseParams,
OpportunityStageConfig,
UpdateOpportunityStageRollbackParams,
UpdateStageBaseParams,
} from '@lib/shared/models/opportunity';
import type { CirculationTypeEnum } from '@lib/shared/enums/opportunityEnum';
export default function useContractApi(CDR: CordysAxios) {
// 合同列表
function getContractList(data: StageBoardPageQueryParams) {
return CDR.post<CommonList<ContractItem>>({ url: ContractPageUrl, data }, { ignoreCancelToken: true });
}
// 合同看板拖拽排序
function sortContract(data: StageBoardDraggedParams) {
return CDR.post({ url: SortContractUrl, data });
}
// 添加合同
function addContract(data: SaveContractParams) {
return CDR.post({ url: ContractAddUrl, data });
}
// 更新合同
function updateContract(data: UpdateContractParams, approvalTaskId?: string) {
return CDR.post({ url: ContractUpdateUrl, data, params: { approvalTaskId } });
}
// 删除合同
function deleteContract(id: string) {
return CDR.get({ url: `${ContractDeleteUrl}/${id}` });
}
// 合同详情
function getContractDetail(id: string, approvalTaskId?: string) {
return CDR.get<ContractDetail>({ url: `${GetContractDetailUrl}/${id}`, params: { approvalTaskId } });
}
// 合同详情快照
function getContractDetailSnapshot(id: string, approvalTaskId?: string) {
return CDR.get<ContractDetail>({ url: `${GetContractDetailSnapshotUrl}/${id}`, params: { approvalTaskId } });
}
// 获取合同表单配置
function getContractFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({
url: GetContractFormConfigUrl,
});
}
function getContractFormSnapshotConfig(id?: string, approvalTaskId?: string) {
return CDR.get<FormDesignConfigDetailParams>({
url: `${GetContractFormSnapshotConfigUrl}/${id}`,
params: { approvalTaskId },
});
}
function changeContractStatus(data: UpdateStageParams) {
return CDR.post({ url: `${ChangeContractStatusUrl}`, data });
}
// 获取合同tab显隐藏
function getContractTab() {
return CDR.get<CustomerTabHidden>({ url: GetContractTabUrl });
}
// 导出全量合同列表
function exportContractAll(data: TableExportParams) {
return CDR.post({ url: ExportContractAllUrl, data });
}
// 导出选中合同列表
function exportContractSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportContractSelectedUrl, data });
}
// 生成合同图表
function generateContractChart(data: GenerateChartParams) {
return CDR.post<ChartResponseDataItem[]>({
url: GenerateContractChartUrl,
data,
});
}
function batchApproveContract(data: BatchUpdateQuotationStatusParams) {
return CDR.post<BatchOperationResult>({ url: BatchApproveContractUrl, data });
}
function batchUpdateContract(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateContractUrl, data });
}
function approvalContract(data: ApprovalContractParams) {
return CDR.post({ url: ApproveContractUrl, data });
}
function revokeContract(id: string) {
return CDR.get({ url: `${RevokeContractUrl}/${id}` });
}
// 视图
function addContractView(data: ViewParams) {
return CDR.post({ url: AddContractViewUrl, data });
}
function updateContractView(data: ViewParams) {
return CDR.post({ url: UpdateContractViewUrl, data });
}
function getContractViewList() {
return CDR.get<ViewItem[]>({ url: GetContractViewListUrl });
}
function getContractViewDetail(id: string) {
return CDR.get({ url: `${GetContractViewDetailUrl}/${id}` });
}
function fixedContractView(id: string) {
return CDR.get({ url: `${FixedContractViewUrl}/${id}` });
}
function enableContractView(id: string) {
return CDR.get({ url: `${EnableContractViewUrl}/${id}` });
}
function deleteContractView(id: string) {
return CDR.get({ url: `${DeleteContractViewUrl}/${id}` });
}
function dragContractView(data: TableDraggedParams) {
return CDR.post({ url: DragContractViewUrl, data });
}
// 回款计划列表
function getPaymentPlanList(data: TableQueryParams) {
return CDR.post<CommonList<PaymentPlanItem>>({ url: PaymentPlanPageUrl, data });
}
function getContractPaymentPlanList(data: TableQueryParams) {
return CDR.post<CommonList<PaymentPlanItem>>({ url: ContractPaymentPlanPageUrl, data });
}
// 添加回款计划
function addPaymentPlan(data: SavePaymentPlanParams) {
return CDR.post({ url: PaymentPlanAddUrl, data });
}
// 更新回款计划
function updatePaymentPlan(data: UpdatePaymentPlanParams) {
return CDR.post({ url: PaymentPlanUpdateUrl, data });
}
// 删除回款计划
function deletePaymentPlan(id: string) {
return CDR.get({ url: `${PaymentPlanDeleteUrl}/${id}` });
}
// 回款计划详情
function getPaymentPlanDetail(id: string) {
return CDR.get<PaymentPlanDetail>({ url: `${GetPaymentPlanDetailUrl}/${id}` });
}
// 获取回款计划表单配置
function getPaymentPlanFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({
url: GetPaymentPlanFormConfigUrl,
});
}
// 获取回款计划 tab 显隐
function getPaymentPlanTab() {
return CDR.get<CustomerTabHidden>({ url: GetPaymentPlanTabUrl });
}
// 导出全量回款计划
function exportPaymentPlanAll(data: TableExportParams) {
return CDR.post({ url: ExportPaymentPlanAllUrl, data });
}
// 导出选中回款计划
function exportPaymentPlanSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportPaymentPlanSelectedUrl, data });
}
// 生成回款计划图表
function generatePaymentPlanChart(data: GenerateChartParams) {
return CDR.post<ChartResponseDataItem[]>({
url: GeneratePaymentPlanChartUrl,
data,
});
}
// 添加视图
function addPaymentPlanView(data: ViewParams) {
return CDR.post({ url: AddPaymentPlanViewUrl, data });
}
// 更新视图
function updatePaymentPlanView(data: ViewParams) {
return CDR.post({ url: UpdatePaymentPlanViewUrl, data });
}
// 获取视图列表
function getPaymentPlanViewList() {
return CDR.get<ViewItem[]>({ url: GetPaymentPlanViewListUrl });
}
// 获取视图详情
function getPaymentPlanViewDetail(id: string) {
return CDR.get({ url: `${GetPaymentPlanViewDetailUrl}/${id}` });
}
// 固定视图
function fixedPaymentPlanView(id: string) {
return CDR.get({ url: `${FixedPaymentPlanViewUrl}/${id}` });
}
// 启用视图
function enablePaymentPlanView(id: string) {
return CDR.get({ url: `${EnablePaymentPlanViewUrl}/${id}` });
}
// 删除视图
function deletePaymentPlanView(id: string) {
return CDR.get({ url: `${DeletePaymentPlanViewUrl}/${id}` });
}
// 拖拽排序视图
function dragPaymentPlanView(data: TableDraggedParams) {
return CDR.post({ url: DragPaymentPlanViewUrl, data });
}
// 回款记录列表
function getPaymentRecordList(data: TableQueryParams) {
return CDR.post<CommonList<PaymentRecordItem>>({ url: PaymentRecordPageUrl, data }, { ignoreCancelToken: true });
}
// 添加回款记录
function addPaymentRecord(data: SavePaymentRecordParams) {
return CDR.post({ url: PaymentRecordAddUrl, data });
}
// 更新回款记录
function updatePaymentRecord(data: UpdatePaymentRecordParams) {
return CDR.post({ url: PaymentRecordUpdateUrl, data });
}
// 删除回款记录
function deletePaymentRecord(id: string) {
return CDR.get({ url: `${PaymentRecordDeleteUrl}/${id}` });
}
// 回款记录详情
function getPaymentRecordDetail(id: string) {
return CDR.get<PaymentRecordDetail>({ url: `${GetPaymentRecordDetailUrl}/${id}` });
}
// 获取回款记录表单配置
function getPaymentRecordFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({
url: GetPaymentRecordFormConfigUrl,
});
}
// 获取回款记录 tab 显隐
function getPaymentRecordTab() {
return CDR.get<CustomerTabHidden>({ url: GetPaymentRecordTabUrl });
}
// 导出全量回款记录
function exportPaymentRecordAll(data: TableExportParams) {
return CDR.post({ url: ExportPaymentRecordAllUrl, data });
}
// 导出选中回款记录
function exportPaymentRecordSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportPaymentRecordSelectedUrl, data });
}
// 添加视图
function addPaymentRecordView(data: ViewParams) {
return CDR.post({ url: AddPaymentRecordViewUrl, data });
}
// 更新视图
function updatePaymentRecordView(data: ViewParams) {
return CDR.post({ url: UpdatePaymentRecordViewUrl, data });
}
// 获取视图列表
function getPaymentRecordViewList() {
return CDR.get<ViewItem[]>({ url: GetPaymentRecordViewListUrl });
}
// 获取视图详情
function getPaymentRecordViewDetail(id: string) {
return CDR.get({ url: `${GetPaymentRecordViewDetailUrl}/${id}` });
}
// 固定视图
function fixedPaymentRecordView(id: string) {
return CDR.get({ url: `${FixedPaymentRecordViewUrl}/${id}` });
}
// 启用视图
function enablePaymentRecordView(id: string) {
return CDR.get({ url: `${EnablePaymentRecordViewUrl}/${id}` });
}
// 删除视图
function deletePaymentRecordView(id: string) {
return CDR.get({ url: `${DeletePaymentRecordViewUrl}/${id}` });
}
// 拖拽排序视图
function dragPaymentRecordView(data: TableDraggedParams) {
return CDR.post({ url: DragPaymentRecordViewUrl, data });
}
function preCheckImportContractPaymentRecord(file: File) {
return CDR.uploadFile<{ data: ValidateInfo }>(
{ url: PreCheckPaymentRecordImportUrl },
{ fileList: [file] },
'file'
);
}
function downloadContractPaymentRecordTemplate() {
return CDR.get(
{
url: DownloadPaymentRecordTemplateUrl,
responseType: 'blob',
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
function importContractPaymentRecord(file: File) {
return CDR.uploadFile({ url: ImportPaymentRecordUrl }, { fileList: [file] }, 'file');
}
// 合同-工商抬头导入
function preCheckImportBusinessTitle(file: File, importType?: string) {
return CDR.uploadFile<{ data: ValidateInfo }>(
{ url: PreCheckBusinessTitleImportUrl },
{ fileList: [file], request: { importType } },
'file'
);
}
function downloadBusinessTitleTemplate() {
return CDR.get(
{
url: DownloadBusinessTitleTemplateUrl,
responseType: 'blob',
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
function importBusinessTitle(file: File, importType?: string) {
return CDR.uploadFile({ url: ImportBusinessTitleUrl }, { fileList: [file], request: { importType } }, 'file');
}
// 工商抬头列表
function getBusinessTitleList(data: TableQueryParams) {
return CDR.post<CommonList<BusinessTitleItem>>({ url: BusinessTitlePageUrl, data }, { ignoreCancelToken: true });
}
// 添加工商抬头
function addBusinessTitle(data: SaveBusinessTitleParams) {
return CDR.post({ url: BusinessTitleAddUrl, data });
}
// 更新工商抬头
function updateBusinessTitle(data: SaveBusinessTitleParams) {
return CDR.post({ url: BusinessTitleUpdateUrl, data });
}
// 删除工商抬头
function deleteBusinessTitle(id: string) {
return CDR.get({ url: `${BusinessTitleDeleteUrl}/${id}` });
}
//撤销工商抬头
function revokeBusinessTitle(id: string) {
return CDR.get({ url: `${BusinessTitleRevokeUrl}/${id}` });
}
// 工商抬头详情
function getBusinessTitleDetail(id: string) {
return CDR.get<BusinessTitleItem>({ url: `${GetBusinessTitleDetailUrl}/${id}` });
}
// 工商抬头发票核验
function getBusinessTitleInvoiceCheck(id: string) {
return CDR.get({ url: `${GetBusinessTitleInvoiceCheckUrl}/${id}` });
}
// 导出全量工商抬头
function exportBusinessTitleAll(data: TableExportParams) {
return CDR.post({ url: ExportBusinessTitleAllUrl, data });
}
// 导出选中的工商抬头
function exportBusinessTitleSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportBusinessTitleSelectedUrl, data });
}
// 第三方接口分页模糊查询工商名称
function getBusinessTitleThirdQueryOption(data: TableQueryParams) {
return CDR.post<CommonList<string[]>>({ url: GetBusinessTitleThirdQueryOptionUrl, data });
}
// 第三方接口查询工商抬头信息
function getBusinessTitleThirdQuery(keyword: string) {
return CDR.get({ url: GetBusinessTitleThirdQueryUrl, params: { keyword } });
}
// 获取工商抬头表单校验配置
function getBusinessTitleConfig() {
return CDR.get<BusinessTitleValidateConfig[]>({ url: BusinessTitleConfigUrl });
}
// 工商抬头表单配置开关
function switchBusinessTitleFormConfig(id: string) {
return CDR.get({ url: `${BusinessTitleFormConfigSwitchUrl}/${id}` });
}
// 获取工商抬头表单字段
function getBusinessTitleModuleForm() {
return CDR.get<FormDesignConfigDetailParams>({ url: BusinessTitleModuleFormUrl });
}
// 发票列表
function getInvoicedList(data: ContractInvoiceTableQueryParam) {
return CDR.post<CommonList<ContractInvoiceItem>>({ url: ContractInvoicedPageUrl, data });
}
// 合同下的发票列表
function getInvoicedInContractList(data: ContractInvoiceTableQueryParam) {
return CDR.post<CommonList<ContractInvoiceItem>>({ url: ContractInvoicedInContractPageUrl, data });
}
// 添加发票
function addInvoiced(data: SaveContractInvoiceParams) {
return CDR.post({ url: ContractInvoicedAddUrl, data });
}
// 更新发票
function updateInvoiced(data: UpdateContractInvoiceParams, approvalTaskId?: string) {
return CDR.post({ url: ContractInvoicedUpdateUrl, data, params: { approvalTaskId } });
}
// 发票详情
function getInvoicedDetail(id: string, approvalTaskId?: string) {
return CDR.get<ContractInvoiceDetail>({ url: `${ContractInvoicedDetailUrl}/${id}`, params: { approvalTaskId } });
}
// 发票详情快照
function getInvoicedDetailSnapshot(id: string, approvalTaskId?: string) {
return CDR.get<ContractInvoiceDetail>({
url: `${ContractInvoicedDetailSnapshotUrl}/${id}`,
params: { approvalTaskId },
});
}
// 获取发票表单配置
function getInvoicedFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({
url: ContractInvoicedFormConfigUrl,
});
}
// 获取发票表单配置快照
function getInvoicedFormSnapshotConfig(id?: string, approvalTaskId?: string) {
return CDR.get<FormDesignConfigDetailParams>({
url: `${ContractInvoicedFormConfigSnapshotUrl}/${id}`,
params: { approvalTaskId },
});
}
// 发票审批
function approvalInvoiced(data: ApprovalContractParams) {
return CDR.post({ url: ContractInvoicedApprovalUrl, data });
}
// 发票撤回
function revokeInvoiced(id: string) {
return CDR.get({ url: `${ContractInvoicedRevokeUrl}/${id}` });
}
// 删除发票
function deleteInvoiced(id: string) {
return CDR.get({ url: `${ContractInvoicedDeleteUrl}/${id}` });
}
// 发票批量删除
function batchDeleteInvoiced(ids: string[]) {
return CDR.post({ url: ContractInvoicedBatchDeleteUrl, data: ids });
}
// 导出全量发票
function exportInvoicedAll(data: TableExportParams) {
return CDR.post({ url: ContractInvoicedExportAllUrl, data });
}
// 导出选中发票
function exportInvoicedSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ContractInvoicedExportSelectedUrl, data });
}
// 获取发票 tab 显隐
function getInvoicedTab() {
return CDR.get<CustomerTabHidden>({ url: ContractInvoicedTabUrl });
}
// 添加发票视图
function addContractInvoicedView(data: ViewParams) {
return CDR.post({ url: AddContractInvoicedViewUrl, data });
}
// 更新发票视图
function updateContractInvoicedView(data: ViewParams) {
return CDR.post({ url: UpdateContractInvoicedViewUrl, data });
}
// 获取发票视图列表
function getContractInvoicedViewList() {
return CDR.get<ViewItem[]>({ url: ListContractInvoicedViewUrl });
}
// 获取发票视图详情
function getContractInvoicedViewDetail(id: string) {
return CDR.get({ url: `${GetContractInvoicedViewDetailUrl}/${id}` });
}
// 固定发票视图
function fixedContractInvoicedView(id: string) {
return CDR.get({ url: `${FixedContractInvoicedViewUrl}/${id}` });
}
// 启用/禁用发票视图
function enableContractInvoicedView(id: string) {
return CDR.get({ url: `${EnableContractInvoicedViewUrl}/${id}` });
}
// 删除发票视图
function deleteContractInvoicedView(id: string) {
return CDR.get({ url: `${DeleteContractInvoicedViewUrl}/${id}` });
}
// 拖拽发票视图排序
function dragContractInvoicedView(data: TableDraggedParams) {
return CDR.post({ url: DragContractInvoicedViewUrl, data });
}
// 合同统计
function getContractStatistic(data: TableQueryParams) {
return CDR.post({ url: ContractStatisticUrl, data }, { ignoreCancelToken: true });
}
// 回款记录统计
function getPaymentRecordStatistic(data: TableQueryParams) {
return CDR.post({ url: GetPaymentRecordStatisticUrl, data }, { ignoreCancelToken: true });
}
// 更新合同状态配置
function updateContractStatus(data: UpdateStageBaseParams) {
return CDR.post({ url: UpdateContractStatusUrl, data });
}
// 合同状态回退配置
function updateContractStatusRollback(data: UpdateOpportunityStageRollbackParams) {
return CDR.post({ url: UpdateContractStatusRollbackUrl, data });
}
// 合同状态排序
function sortContractStatus(data: string[]) {
return CDR.post({ url: SortContractStatusUrl, data });
}
// 添加合同状态
function addContractStatus(data: StageBaseParams) {
return CDR.post({ url: AddContractStatusUrl, data });
}
// 获取合同状态配置
function getContractStatusConfig() {
return CDR.get<OpportunityStageConfig>({ url: GetContractStatusConfigUrl }, { ignoreCancelToken: true });
}
// 删除合同状态
function deleteContractStatus(id: string) {
return CDR.get({ url: `${DeleteContractStatusUrl}/${id}` });
}
// 更新阶段
function updateContractStage(data: { id: string; stage: string }) {
return CDR.post({ url: UpdateContractStageUrl, data });
}
// 保存高级流转配置
function saveContractAdvanceConfig(data: SaveCirculationConfigParams) {
return CDR.post({ url: SaveContractCirculationConfigUrl, data });
}
// 切换流转配置
function switchContractCirculationType(type: CirculationTypeEnum) {
return CDR.get({ url: `${SwitchContractCirculationTypeUrl}/${type}` });
}
return {
exportContractAll,
exportContractSelected,
generateContractChart,
getContractDetail,
getContractDetailSnapshot,
getContractList,
sortContract,
getContractTab,
getContractViewDetail,
getContractViewList,
addContractView,
updateContractView,
fixedContractView,
enableContractView,
deleteContractView,
dragContractView,
addContract,
updateContract,
deleteContract,
changeContractStatus,
getContractFormConfig,
getContractFormSnapshotConfig,
batchApproveContract,
batchUpdateContract,
approvalContract,
revokeContract,
getContractStatistic,
// 回款计划
getPaymentPlanList,
getContractPaymentPlanList,
addPaymentPlan,
updatePaymentPlan,
deletePaymentPlan,
getPaymentPlanDetail,
getPaymentPlanFormConfig,
getPaymentPlanTab,
exportPaymentPlanAll,
exportPaymentPlanSelected,
generatePaymentPlanChart,
addPaymentPlanView,
updatePaymentPlanView,
getPaymentPlanViewList,
getPaymentPlanViewDetail,
fixedPaymentPlanView,
enablePaymentPlanView,
deletePaymentPlanView,
dragPaymentPlanView,
// 回款记录
getPaymentRecordFormConfig,
addPaymentRecord,
updatePaymentRecord,
getPaymentRecordDetail,
getPaymentRecordList,
deletePaymentRecord,
getPaymentRecordTab,
exportPaymentRecordAll,
exportPaymentRecordSelected,
addPaymentRecordView,
updatePaymentRecordView,
getPaymentRecordViewList,
getPaymentRecordViewDetail,
fixedPaymentRecordView,
enablePaymentRecordView,
deletePaymentRecordView,
dragPaymentRecordView,
preCheckImportContractPaymentRecord,
importContractPaymentRecord,
downloadContractPaymentRecordTemplate,
getPaymentRecordStatistic,
// 合同工商抬头
preCheckImportBusinessTitle,
downloadBusinessTitleTemplate,
importBusinessTitle,
getBusinessTitleList,
addBusinessTitle,
updateBusinessTitle,
deleteBusinessTitle,
revokeBusinessTitle,
getBusinessTitleDetail,
getBusinessTitleInvoiceCheck,
exportBusinessTitleAll,
exportBusinessTitleSelected,
getBusinessTitleThirdQuery,
getBusinessTitleThirdQueryOption,
getBusinessTitleConfig,
switchBusinessTitleFormConfig,
getBusinessTitleModuleForm,
// 发票
getInvoicedList,
getInvoicedInContractList,
addInvoiced,
updateInvoiced,
getInvoicedDetail,
getInvoicedDetailSnapshot,
getInvoicedFormConfig,
getInvoicedFormSnapshotConfig,
approvalInvoiced,
revokeInvoiced,
deleteInvoiced,
batchDeleteInvoiced,
exportInvoicedAll,
exportInvoicedSelected,
addContractInvoicedView,
updateContractInvoicedView,
getContractInvoicedViewList,
getContractInvoicedViewDetail,
fixedContractInvoicedView,
enableContractInvoicedView,
deleteContractInvoicedView,
dragContractInvoicedView,
getInvoicedTab,
// 合同阶段
updateContractStatus,
updateContractStatusRollback,
sortContractStatus,
addContractStatus,
getContractStatusConfig,
deleteContractStatus,
updateContractStage,
saveContractAdvanceConfig,
switchContractCirculationType,
};
}

View File

@@ -0,0 +1,204 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddCustomFormUrl,
GetCustomFormAdminUrl,
GetCustomFormRoleUserDeptTreeUrl,
GetCustomFormRoleUserRoleTreeUrl,
GetCustomFormRoleListUrl,
GetCustomFormRoleUsersUrl,
GetCustomFormUrl,
RelateCustomFormMemberUrl,
RemoveCustomFormMemberUrl,
SaveCustomFormAdminUrl,
UpdateCustomFormUrl,
GetCustomFormDataDetailUrl,
GetCustomFormDataPageUrl,
AddCustomFormDataUrl,
UpdateCustomFormDataUrl,
DeleteCustomFormDataUrl,
BatchDeleteCustomFormDataUrl,
BatchUpdateCustomFormDataUrl,
GetCustomFormListUrl,
GetCustomFormOptionsUrl,
DeleteCustomFormUrl,
EnableCustomFormUrl,
DisableCustomFormUrl,
PreCheckCustomFormImportUrl,
DownloadCustomFormTemplateUrl,
ImportCustomFormUrl,
CustomFormExportAllUrl,
CustomFormExportSelectedUrl,
} from '@lib/shared/api/requrls/customForm';
import type { CommonList, TableExportParams, TableExportSelectedParams } from '@lib/shared/models/common';
import type {
AddCustomFormDataParams,
BatchUpdateCustomFormDataParams,
CustomFormAdminParams,
CustomFormDataDetail,
CustomFormDetail,
CustomFormItem,
CustomFormMemberItem,
CustomFormRoleItem,
CustomFormRoleUserQueryParams,
CustomFormPageItem,
CustomFormSaveRequest,
GetCustomFormDataPageParams,
RelateCustomFormMemberParams,
UpdateCustomFormDataParams,
} from '@lib/shared/models/customForm';
import type { SelectedUsersItem } from '@lib/shared/models/system/module';
import type { DeptUserTreeNode } from '@lib/shared/models/system/role';
import { ValidateInfo } from '@lib/shared/models/system/org';
export default function useCustomFormApi(CDR: CordysAxios) {
function addCustomForm(data: CustomFormSaveRequest) {
return CDR.post({ url: AddCustomFormUrl, data });
}
function updateCustomForm(data: CustomFormSaveRequest) {
return CDR.post({ url: UpdateCustomFormUrl, data });
}
function getCustomFormDetail(id?: string) {
return CDR.get<CustomFormDetail>({ url: `${GetCustomFormUrl}/${id}` });
}
function getCustomFormAdmins(customFormId: string) {
return CDR.get<SelectedUsersItem[]>({ url: `${GetCustomFormAdminUrl}/${customFormId}` });
}
function saveCustomFormAdmins(data: CustomFormAdminParams) {
return CDR.post({ url: SaveCustomFormAdminUrl, data });
}
// 表单成员
function relateCustomFormMember(data: RelateCustomFormMemberParams) {
return CDR.post({ url: RelateCustomFormMemberUrl, data });
}
function getCustomFormRoles(customFormId: string) {
return CDR.get<CustomFormRoleItem[]>({ url: `${GetCustomFormRoleListUrl}/${customFormId}` });
}
function getCustomFormRoleUsers(data: CustomFormRoleUserQueryParams) {
return CDR.post<CommonList<CustomFormMemberItem>>({ url: GetCustomFormRoleUsersUrl, data });
}
function getCustomFormRoleUserDeptTree() {
return CDR.get<DeptUserTreeNode[]>({ url: GetCustomFormRoleUserDeptTreeUrl });
}
function getCustomFormRoleUserRoleTree() {
return CDR.get<DeptUserTreeNode[]>({ url: GetCustomFormRoleUserRoleTreeUrl });
}
function removeCustomFormMember(data: RelateCustomFormMemberParams) {
return CDR.post({ url: RemoveCustomFormMemberUrl, data });
}
function deleteCustomForm(id: string) {
return CDR.get({ url: `${DeleteCustomFormUrl}/${id}` });
}
function enableCustomForm(id: string) {
return CDR.get({ url: `${EnableCustomFormUrl}/${id}` });
}
function disableCustomForm(id: string) {
return CDR.get({ url: `${DisableCustomFormUrl}/${id}` });
}
function getCustomFormList() {
return CDR.get<CustomFormItem[]>({ url: GetCustomFormListUrl });
}
function getCustomFormDataDetail(id: string) {
return CDR.get<CustomFormDataDetail>({ url: `${GetCustomFormDataDetailUrl}/${id}` });
}
function getCustomFormDataPage(data: GetCustomFormDataPageParams) {
return CDR.post<CommonList<CustomFormPageItem>>({ url: GetCustomFormDataPageUrl, data });
}
function addCustomFormData(data: AddCustomFormDataParams) {
return CDR.post({ url: AddCustomFormDataUrl, data });
}
function updateCustomFormData(data: UpdateCustomFormDataParams) {
return CDR.post({ url: UpdateCustomFormDataUrl, data });
}
function deleteCustomFormData(id: string) {
return CDR.get({ url: `${DeleteCustomFormDataUrl}/${id}` });
}
function batchDeleteCustomFormData(ids: string[]) {
return CDR.post({ url: BatchDeleteCustomFormDataUrl, data: ids });
}
function batchUpdateCustomFormData(data: BatchUpdateCustomFormDataParams) {
return CDR.post({ url: BatchUpdateCustomFormDataUrl, data });
}
function getCustomFormOptions() {
return CDR.get<CustomFormItem[]>({ url:GetCustomFormOptionsUrl });
}
function preCheckImportCustomForm(file: File, customFormId?: string) {
return CDR.uploadFile<{ data: ValidateInfo }>({ url: PreCheckCustomFormImportUrl, params:{ customFormId } }, { fileList: [file] }, 'file');
}
function downloadCustomFormTemplate(customFormId?: string) {
return CDR.get(
{
url: DownloadCustomFormTemplateUrl,
responseType: 'blob',
params:{ customFormId },
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
function importCustomForm(file: File, customFormId?: string) {
return CDR.uploadFile({ url: ImportCustomFormUrl, params:{ customFormId } }, { fileList: [file] }, 'file');
}
function exportCustomFormAll(data: TableExportParams) {
return CDR.post({ url: CustomFormExportAllUrl, data });
}
function exportCustomFormSelected(data: TableExportSelectedParams) {
return CDR.post({ url: CustomFormExportSelectedUrl, data });
}
return {
addCustomForm,
updateCustomForm,
getCustomFormDetail,
saveCustomFormAdmins,
getCustomFormAdmins,
relateCustomFormMember,
getCustomFormRoles,
getCustomFormRoleUsers,
getCustomFormRoleUserDeptTree,
getCustomFormRoleUserRoleTree,
removeCustomFormMember,
getCustomFormList,
getCustomFormDataDetail,
getCustomFormDataPage,
addCustomFormData,
updateCustomFormData,
deleteCustomFormData,
batchDeleteCustomFormData,
batchUpdateCustomFormData,
getCustomFormOptions,
deleteCustomForm,
enableCustomForm,
disableCustomForm,
preCheckImportCustomForm,
downloadCustomFormTemplate,
importCustomForm,
exportCustomFormAll,
exportCustomFormSelected,
};
}

View File

@@ -0,0 +1,932 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddAccountPoolViewUrl,
AddContactViewUrl,
AddCustomerCollaborationUrl,
AddCustomerContactUrl,
AddCustomerFollowPlanUrl,
AddCustomerFollowRecordUrl,
AddCustomerOpenSeaUrl,
AddCustomerRelationItemUrl,
AddCustomerUrl,
AddCustomerViewUrl,
AssignOpenSeaCustomerUrl,
BatchAssignOpenSeaCustomerUrl,
BatchDeleteCustomerCollaborationUrl,
BatchDeleteCustomerUrl,
BatchDeleteOpenSeaCustomerUrl,
BatchMoveCustomerUrl,
BatchPickOpenSeaCustomerUrl,
BatchTransferCustomerUrl,
BatchUpdateAccountUrl,
BatchUpdateContactUrl,
CancelCustomerFollowPlanUrl,
CheckOpportunityContactUrl,
ContactListUnderCustomerUrl,
DeleteAccountPoolViewUrl,
DeleteContactViewUrl,
DeleteCustomerCollaborationUrl,
DeleteCustomerContactUrl,
DeleteCustomerFollowPlanUrl,
DeleteCustomerFollowRecordUrl,
DeleteCustomerOpenSeaUrl,
DeleteCustomerRelationItemUrl,
DeleteCustomerUrl,
DeleteCustomerViewUrl,
DeleteOpenSeaCustomerUrl,
DisableCustomerContactUrl,
DownloadAccountTemplateUrl,
DownloadContactTemplateUrl,
DragAccountPoolViewUrl,
DragContactViewUrl,
DragCustomerViewUrl,
EnableAccountPoolViewUrl,
EnableContactViewUrl,
EnableCustomerContactUrl,
EnableCustomerViewUrl,
ExportContactAllUrl,
ExportContactSelectedUrl,
ExportCustomerAllUrl,
ExportCustomerSelectedUrl,
ExportOpenSeaCustomerAllUrl,
ExportOpenSeaCustomerSelectedUrl,
FixedAccountPoolViewUrl,
FixedContactViewUrl,
FixedCustomerViewUrl,
GenerateCustomerChartUrl,
generateCustomerContactChartUrl,
generateCustomerPoolChartUrl,
GetAccountPoolViewDetailUrl,
GetAccountPoolViewListUrl,
GetAdvancedCustomerContactListUrl,
GetAdvancedCustomerListUrl,
GetAdvancedOpenSeaCustomerListUrl,
GetContactViewDetailUrl,
GetContactViewListUrl,
GetCustomerCollaborationListUrl,
GetCustomerContactFormConfigUrl,
GetCustomerContactListUrl,
GetCustomerContactTabUrl,
GetCustomerContactUrl,
GetCustomerFollowPlanFormConfigUrl,
GetCustomerFollowPlanListUrl,
GetCustomerFollowPlanUrl,
GetCustomerFollowRecordFormConfigUrl,
GetCustomerFollowRecordListUrl,
GetCustomerFollowRecordUrl,
GetCustomerFormConfigUrl,
GetCustomerHeaderListUrl,
GetCustomerListUrl,
GetCustomerOpenSeaFollowRecordListUrl,
GetCustomerOpenSeaListUrl,
GetCustomerOpportunityListUrl,
GetCustomerOptionsUrl,
GetCustomerRelationListUrl,
GetCustomerTabUrl,
GetCustomerUrl,
GetCustomerViewDetailUrl,
GetCustomerViewListUrl,
GetGlobalCustomerContactListUrl,
GetGlobalCustomerListUrl,
GetGlobalModuleCountUrl,
GetGlobalOpenSeaCustomerListUrl,
GetOpenSeaCustomerListUrl,
GetOpenSeaCustomerUrl,
GetOpenSeaOptionsUrl,
ImportAccountUrl,
ImportContactUrl,
IsCustomerOpenSeaNoPickUrl,
MergeAccountPageUrl,
MergeAccountUrl,
MoveToCustomerUrl,
PickOpenSeaCustomerUrl,
PoolAccountBatchUpdateUrl,
PreCheckAccountImportUrl,
PreCheckContactImportUrl,
SaveCustomerRelationUrl,
SwitchCustomerOpenSeaUrl,
UpdateAccountPoolViewUrl,
UpdateContactViewUrl,
UpdateCustomerCollaborationUrl,
UpdateCustomerContactUrl,
UpdateCustomerFollowPlanStatusUrl,
UpdateCustomerFollowPlanUrl,
UpdateCustomerFollowRecordUrl,
UpdateCustomerOpenSeaUrl,
UpdateCustomerRelationItemUrl,
UpdateCustomerUrl,
UpdateCustomerViewUrl,
GetAccountContractListUrl,
GetAccountContractStatisticUrl,
GetAccountPaymentListUrl,
GetAccountPaymentStatisticUrl,
GetAccountPaymentRecordStatisticUrl,
GetAccountPaymentRecordListUrl,
GetAccountInvoiceListUrl,
GetAccountInvoiceStatisticUrl,
GetAccountOrderListUrl,
} from '@lib/shared/api/requrls/customer';
import type {
ChartResponseDataItem,
CommonList,
GenerateChartParams,
TableDraggedParams,
TableExportParams,
TableExportSelectedParams,
TableQueryParams,
} from '@lib/shared/models/common';
import type {
AddCustomerCollaborationParams,
AddCustomerRelationItemParams,
AssignOpenSeaCustomerParams,
BatchAssignOpenSeaCustomerParams,
BatchMoveToPublicPoolParams,
BatchOperationOpenSeaCustomerParams,
BatchUpdatePoolAccountParams,
CollaborationItem,
CustomerContractListItem,
CustomerContractTableParams,
CustomerDetail,
CustomerFollowPlanListItem,
CustomerFollowPlanTableParams,
CustomerFollowRecordListItem,
CustomerFollowRecordTableParams,
CustomerInvoiceItem,
CustomerInvoicePageQueryParams,
CustomerInvoiceStatistic,
CustomerListItem,
CustomerOpenSeaListItem,
CustomerOpportunityTableParams,
CustomerOptionsItem,
CustomerTabHidden,
CustomerTableParams,
FollowDetailItem,
MergeAccountParams,
MoveToPublicPoolParams,
OpenSeaCustomerTableParams,
PickOpenSeaCustomerParams,
PoolTableExportParams,
RelationItem,
RelationListItem,
SaveCustomerContractParams,
SaveCustomerFollowPlanParams,
SaveCustomerFollowRecordParams,
SaveCustomerOpenSeaParams,
SaveCustomerParams,
TransferParams,
UpdateCustomerCollaborationParams,
UpdateCustomerContractParams,
UpdateCustomerFollowPlanParams,
UpdateCustomerFollowRecordParams,
UpdateCustomerOpenSeaParams,
UpdateCustomerParams,
UpdateCustomerRelationItemParams,
UpdateFollowPlanStatusParams,
} from '@lib/shared/models/customer';
import type { OrderItem } from '@lib/shared/models/order';
import type { CluePoolItem, FormDesignConfigDetailParams, OpportunityItem } from '@lib/shared/models/system/module';
import { ValidateInfo } from '@lib/shared/models/system/org';
import type { ViewItem, ViewParams } from '@lib/shared/models/view';
import type { ContractItem, PaymentPlanItem, PaymentRecordItem } from '@lib/shared/models/contract';
export default function useProductApi(CDR: CordysAxios) {
// 添加客户
function addCustomer(data: SaveCustomerParams) {
return CDR.post({ url: AddCustomerUrl, data });
}
// 更新客户
function updateCustomer(data: UpdateCustomerParams) {
return CDR.post({ url: UpdateCustomerUrl, data });
}
// 获取客户列表
function getCustomerList(data: CustomerTableParams) {
return CDR.post<CommonList<CustomerListItem>>({ url: GetCustomerListUrl, data });
}
// 获取客户表单配置
function getCustomerFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetCustomerFormConfigUrl });
}
// 获取客户详情
function getCustomer(id: string, approvalTaskId?: string) {
return CDR.get<CustomerDetail>({ url: `${GetCustomerUrl}/${id}`, params: { approvalTaskId } });
}
// 删除客户
function deleteCustomer(id: string) {
return CDR.get({ url: `${DeleteCustomerUrl}/${id}` });
}
// 批量删除客户
function batchDeleteCustomer(batchIds: (string | number)[]) {
return CDR.post({ url: BatchDeleteCustomerUrl, data: batchIds });
}
// 批量转移客户
function batchTransferCustomer(data: TransferParams) {
return CDR.post({ url: BatchTransferCustomerUrl, data });
}
// 批量移入公海
function batchMoveCustomer(data: BatchMoveToPublicPoolParams) {
return CDR.post({ url: BatchMoveCustomerUrl, data });
}
// 批量移入公海
function moveCustomerToPool(data: MoveToPublicPoolParams) {
return CDR.post({ url: MoveToCustomerUrl, data });
}
// 批量更新公海客户
function batchUpdateOpenSeaCustomer(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: PoolAccountBatchUpdateUrl, data });
}
// 批量更新客户
function batchUpdateAccount(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateAccountUrl, data });
}
// 批量更新联系人
function batchUpdateContact(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateContactUrl, data });
}
// 生成客户图表
function generateCustomerChart(data: GenerateChartParams) {
return CDR.post<ChartResponseDataItem[]>({ url: GenerateCustomerChartUrl, data });
}
// 添加客户跟进记录
function addCustomerFollowRecord(data: SaveCustomerFollowRecordParams) {
return CDR.post({ url: AddCustomerFollowRecordUrl, data });
}
// 更新客户跟进记录
function updateCustomerFollowRecord(data: UpdateCustomerFollowRecordParams) {
return CDR.post({ url: UpdateCustomerFollowRecordUrl, data });
}
// 删除客户跟进记录
function deleteCustomerFollowRecord(id: string) {
return CDR.get({ url: `${DeleteCustomerFollowRecordUrl}/${id}` });
}
// 获取客户跟进记录列表
function getCustomerFollowRecordList(data: CustomerFollowRecordTableParams) {
return CDR.post<CommonList<CustomerFollowRecordListItem>>({ url: GetCustomerFollowRecordListUrl, data });
}
// 获取客户跟进记录表单配置
function getCustomerFollowRecordFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetCustomerFollowRecordFormConfigUrl });
}
// 获取客户跟进记录详情
function getCustomerFollowRecord(id: string) {
return CDR.get<CustomerFollowRecordListItem>({ url: `${GetCustomerFollowRecordUrl}/${id}` });
}
// 添加客户跟进计划
function addCustomerFollowPlan(data: SaveCustomerFollowPlanParams) {
return CDR.post({ url: AddCustomerFollowPlanUrl, data });
}
// 更新客户跟进计划
function updateCustomerFollowPlan(data: UpdateCustomerFollowPlanParams) {
return CDR.post({ url: UpdateCustomerFollowPlanUrl, data });
}
// 删除客户跟进计划
function deleteCustomerFollowPlan(id: string) {
return CDR.get({ url: `${DeleteCustomerFollowPlanUrl}/${id}` });
}
// 获取客户跟进计划列表
function getCustomerFollowPlanList(data: CustomerFollowPlanTableParams) {
return CDR.post<CommonList<CustomerFollowPlanListItem>>({ url: GetCustomerFollowPlanListUrl, data });
}
// 取消客户跟进计划
function cancelCustomerFollowPlan(id: string) {
return CDR.get({ url: `${CancelCustomerFollowPlanUrl}/${id}` });
}
// 获取客户跟进计划表单配置
function getCustomerFollowPlanFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetCustomerFollowPlanFormConfigUrl });
}
// 获取客户跟进计划详情
function getCustomerFollowPlan(id: string) {
return CDR.get<FollowDetailItem>({ url: `${GetCustomerFollowPlanUrl}/${id}` });
}
// 添加客户联系人
function addCustomerContact(data: SaveCustomerContractParams) {
return CDR.post({ url: AddCustomerContactUrl, data });
}
// 获取客户联系人列表
function getCustomerContactList(data: CustomerContractTableParams) {
return CDR.post<CommonList<CustomerContractListItem>>({ url: GetCustomerContactListUrl, data });
}
// 更新客户联系人
function updateCustomerContact(data: UpdateCustomerContractParams) {
return CDR.post({ url: UpdateCustomerContactUrl, data });
}
// 禁用客户联系人
function disableCustomerContact(id: string, reason: string) {
return CDR.post({ url: `${DisableCustomerContactUrl}/${id}`, data: { reason } });
}
// 获取客户联系人表单配置
function getCustomerContactFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetCustomerContactFormConfigUrl });
}
// 获取客户联系人详情
function getCustomerContact(id: string) {
return CDR.get<CustomerContractListItem>({ url: `${GetCustomerContactUrl}/${id}` });
}
// 获取客户的发票记录
function getCustomerInvoiceList(data: CustomerInvoicePageQueryParams) {
return CDR.post<CommonList<CustomerInvoiceItem>>({ url: GetAccountInvoiceListUrl, data });
}
// 获取客户发票统计
function getCustomerInvoiceStatistic(id: string) {
return CDR.get<CustomerInvoiceStatistic[]>({ url: `${GetAccountInvoiceStatisticUrl}/${id}` });
}
// 获取客户的订单
function getCustomerOrderList(data: TableQueryParams) {
return CDR.post<CommonList<OrderItem>>({ url: GetAccountOrderListUrl, data });
}
// 启用客户联系人
function enableCustomerContact(id: string) {
return CDR.get({ url: `${EnableCustomerContactUrl}/${id}` });
}
// 删除客户联系人
function deleteCustomerContact(id: string) {
return CDR.get({ url: `${DeleteCustomerContactUrl}/${id}` });
}
// 生成客户联系人图表
function generateCustomerContactChart(data: GenerateChartParams) {
return CDR.post<ChartResponseDataItem[]>({ url: generateCustomerContactChartUrl, data });
}
// 是否绑定商机
function checkOpportunity(id: string) {
return CDR.get({ url: `${CheckOpportunityContactUrl}/${id}` });
}
// 客户下的联系人列表
function getContactListUnderCustomer(data: { id: string }) {
return CDR.get({ url: `${ContactListUnderCustomerUrl}/${data.id}` });
}
// 添加公海
function addCustomerOpenSea(data: SaveCustomerOpenSeaParams) {
return CDR.post({ url: AddCustomerOpenSeaUrl, data });
}
// 更新公海
function updateCustomerOpenSea(data: UpdateCustomerOpenSeaParams) {
return CDR.post({ url: UpdateCustomerOpenSeaUrl, data });
}
// 获取公海列表
function getCustomerOpenSeaList(data: TableQueryParams) {
return CDR.post<CommonList<CustomerOpenSeaListItem>>({ url: GetCustomerOpenSeaListUrl, data });
}
// 启用/禁用公海
function switchCustomerOpenSea(id: string) {
return CDR.get({ url: `${SwitchCustomerOpenSeaUrl}/${id}` });
}
// 删除公海
function deleteCustomerOpenSea(id: string) {
return CDR.get({ url: `${DeleteCustomerOpenSeaUrl}/${id}` });
}
// 公海是否存在未领取线索
function isCustomerOpenSeaNoPick(id: string) {
return CDR.get<boolean>({ url: `${IsCustomerOpenSeaNoPickUrl}/${id}` });
}
// 获取公海客户列表
function getOpenSeaCustomerList(data: OpenSeaCustomerTableParams) {
return CDR.post<CommonList<CustomerOpenSeaListItem>>({ url: GetOpenSeaCustomerListUrl, data });
}
// 领取公海客户
function pickOpenSeaCustomer(data: PickOpenSeaCustomerParams) {
return CDR.post({ url: PickOpenSeaCustomerUrl, data });
}
// 批量领取公海客户
function batchPickOpenSeaCustomer(data: BatchOperationOpenSeaCustomerParams) {
return CDR.post({ url: BatchPickOpenSeaCustomerUrl, data });
}
// 批量删除公海客户
function batchDeleteOpenSeaCustomer(data: BatchOperationOpenSeaCustomerParams) {
return CDR.post({ url: BatchDeleteOpenSeaCustomerUrl, data });
}
// 批量分配公海客户
function batchAssignOpenSeaCustomer(data: BatchAssignOpenSeaCustomerParams) {
return CDR.post({ url: BatchAssignOpenSeaCustomerUrl, data });
}
// 分配公海客户
function assignOpenSeaCustomer(data: AssignOpenSeaCustomerParams) {
return CDR.post({ url: AssignOpenSeaCustomerUrl, data });
}
// 获取公海选项
function getOpenSeaOptions() {
return CDR.get<CluePoolItem[]>({ url: GetOpenSeaOptionsUrl });
}
// 获取公海客户详情
function getOpenSeaCustomer(id: string) {
return CDR.get<CustomerDetail>({ url: `${GetOpenSeaCustomerUrl}/${id}` });
}
// 删除公海客户
function deleteOpenSeaCustomer(id: string) {
return CDR.get({ url: `${DeleteOpenSeaCustomerUrl}/${id}` });
}
// 导出全量客户列表
function exportCustomerOpenSeaAll(data: PoolTableExportParams) {
return CDR.post({ url: ExportOpenSeaCustomerAllUrl, data });
}
// 导出选中客户列表
function exportCustomerOpenSeaSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportOpenSeaCustomerSelectedUrl, data });
}
// 获取客户负责人列表
function getCustomerHeaderList(data: CustomerContractTableParams) {
return CDR.get({ url: `${GetCustomerHeaderListUrl}/${data.sourceId}` });
}
// 保存客户关系
function saveCustomerRelation(customerId: string, data: RelationItem[]) {
return CDR.post({ url: `${SaveCustomerRelationUrl}/${customerId}`, data });
}
// 获取客户关系列表
function getCustomerRelationList(customerId: string) {
return CDR.get<RelationListItem[]>({ url: `${GetCustomerRelationListUrl}/${customerId}` });
}
// 获取客户协作成员列表
function getCustomerCollaborationList({ customerId }: { customerId: string }) {
return CDR.get<CollaborationItem[]>({ url: `${GetCustomerCollaborationListUrl}/${customerId}` });
}
// 更新单条客户关系
function updateCustomerRelationItem(customerId: string, data: UpdateCustomerRelationItemParams) {
return CDR.post({ url: `${UpdateCustomerRelationItemUrl}/${customerId}`, data });
}
// 添加单条客户关系
function addCustomerRelationItem(customerId: string, data: AddCustomerRelationItemParams) {
return CDR.post({ url: `${AddCustomerRelationItemUrl}/${customerId}`, data });
}
// 删除单条客户关系
function deleteCustomerRelationItem(id: string) {
return CDR.get({ url: `${DeleteCustomerRelationItemUrl}/${id}` });
}
// 批量删除客户协作成员
function batchDeleteCustomerCollaboration(data: string[]) {
return CDR.post({ url: BatchDeleteCustomerCollaborationUrl, data });
}
// 更新客户协作成员
function updateCustomerCollaboration(data: UpdateCustomerCollaborationParams) {
return CDR.post({ url: UpdateCustomerCollaborationUrl, data });
}
// 添加客户协作成员
function addCustomerCollaboration(data: AddCustomerCollaborationParams) {
return CDR.post({ url: AddCustomerCollaborationUrl, data });
}
// 删除客户协作成员
function deleteCustomerCollaboration(id: string) {
return CDR.get({ url: `${DeleteCustomerCollaborationUrl}/${id}` });
}
// 获取客户选项列表
function getCustomerOptions(data: TableQueryParams) {
return CDR.post<CommonList<CustomerOptionsItem>>({ url: GetCustomerOptionsUrl, data });
}
// 获取客户公海跟进记录列表
function getCustomerOpenSeaFollowRecordList(data: CustomerFollowRecordTableParams) {
return CDR.post<CommonList<CustomerFollowRecordListItem>>({ url: GetCustomerOpenSeaFollowRecordListUrl, data });
}
// 生成客户公海图表
function generateCustomerPoolChart(data: GenerateChartParams) {
return CDR.post<ChartResponseDataItem[]>({ url: generateCustomerPoolChartUrl, data });
}
// 获取客户tab显隐藏
function getCustomerTab() {
return CDR.get<CustomerTabHidden>({ url: GetCustomerTabUrl });
}
// 获取客户联系人tab显隐藏
function getCustomerContactTab() {
return CDR.get<CustomerTabHidden>({ url: GetCustomerContactTabUrl });
}
// 更新客户跟进计划状态
function updateCustomerFollowPlanStatus(data: UpdateFollowPlanStatusParams) {
return CDR.post({ url: UpdateCustomerFollowPlanStatusUrl, data });
}
// 获取客户商机列表
function getCustomerOpportunityPage(data: CustomerOpportunityTableParams) {
return CDR.post<CommonList<OpportunityItem>>({ url: GetCustomerOpportunityListUrl, data });
}
// 导出全量客户列表
function exportCustomerAll(data: TableExportParams) {
return CDR.post({ url: ExportCustomerAllUrl, data });
}
// 导出选中客户列表
function exportCustomerSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportCustomerSelectedUrl, data });
}
// 导出全量联系人列表
function exportContactAll(data: TableExportParams) {
return CDR.post({ url: ExportContactAllUrl, data });
}
// 导出选中联系人列表
function exportContactSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportContactSelectedUrl, data });
}
// 视图
function addCustomerView(data: ViewParams) {
return CDR.post({ url: AddCustomerViewUrl, data });
}
function updateCustomerView(data: ViewParams) {
return CDR.post({ url: UpdateCustomerViewUrl, data });
}
function getCustomerViewList() {
return CDR.get<ViewItem[]>({ url: GetCustomerViewListUrl });
}
function getCustomerViewDetail(id: string) {
return CDR.get({ url: `${GetCustomerViewDetailUrl}/${id}` });
}
function fixedCustomerView(id: string) {
return CDR.get({ url: `${FixedCustomerViewUrl}/${id}` });
}
function enableCustomerView(id: string) {
return CDR.get({ url: `${EnableCustomerViewUrl}/${id}` });
}
function deleteCustomerView(id: string) {
return CDR.get({ url: `${DeleteCustomerViewUrl}/${id}` });
}
function dragCustomerView(data: TableDraggedParams) {
return CDR.post({ url: DragCustomerViewUrl, data });
}
function addContactView(data: ViewParams) {
return CDR.post({ url: AddContactViewUrl, data });
}
function updateContactView(data: ViewParams) {
return CDR.post({ url: UpdateContactViewUrl, data });
}
function getContactViewList() {
return CDR.get<ViewItem[]>({ url: GetContactViewListUrl });
}
function getContactViewDetail(id: string) {
return CDR.get({ url: `${GetContactViewDetailUrl}/${id}` });
}
function fixedContactView(id: string) {
return CDR.get({ url: `${FixedContactViewUrl}/${id}` });
}
function enableContactView(id: string) {
return CDR.get({ url: `${EnableContactViewUrl}/${id}` });
}
function deleteContactView(id: string) {
return CDR.get({ url: `${DeleteContactViewUrl}/${id}` });
}
function dragContactView(data: TableDraggedParams) {
return CDR.post({ url: DragContactViewUrl, data });
}
function geAdvancedCustomerList(data: CustomerTableParams) {
return CDR.post<CommonList<CustomerListItem>>(
{ url: GetAdvancedCustomerListUrl, data },
{ ignoreCancelToken: true }
);
}
function getAdvancedOpenSeaCustomerList(data: OpenSeaCustomerTableParams) {
return CDR.post<CommonList<CustomerOpenSeaListItem>>(
{ url: GetAdvancedOpenSeaCustomerListUrl, data },
{ ignoreCancelToken: true }
);
}
function getAdvancedCustomerContactList(data: CustomerContractTableParams) {
return CDR.post<CommonList<CustomerContractListItem>>(
{ url: GetAdvancedCustomerContactListUrl, data },
{ ignoreCancelToken: true }
);
}
function getGlobalCustomerList(data: TableQueryParams) {
return CDR.post<CommonList<CustomerListItem>>({ url: GetGlobalCustomerListUrl, data }, { ignoreCancelToken: true });
}
function getGlobalOpenSeaCustomerList(data: TableQueryParams) {
return CDR.post<CommonList<CustomerOpenSeaListItem>>(
{ url: GetGlobalOpenSeaCustomerListUrl, data },
{ ignoreCancelToken: true }
);
}
function getGlobalCustomerContactList(data: TableQueryParams) {
return CDR.post<CommonList<CustomerContractListItem>>(
{ url: GetGlobalCustomerContactListUrl, data },
{ ignoreCancelToken: true }
);
}
function getGlobalModuleCount(keyword: string) {
return CDR.post<{ key: string; count: number }[]>(
{ url: `${GetGlobalModuleCountUrl}?keyword=${keyword}` },
{ ignoreCancelToken: true }
);
}
// 客户导入
function preCheckImportAccount(file: File) {
return CDR.uploadFile<{ data: ValidateInfo }>({ url: PreCheckAccountImportUrl }, { fileList: [file] }, 'file');
}
function downloadAccountTemplate() {
return CDR.get(
{
url: DownloadAccountTemplateUrl,
responseType: 'blob',
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
function importAccount(file: File) {
return CDR.uploadFile({ url: ImportAccountUrl }, { fileList: [file] }, 'file');
}
// 联系人导入
function preCheckImportContact(file: File) {
return CDR.uploadFile<{ data: ValidateInfo }>({ url: PreCheckContactImportUrl }, { fileList: [file] }, 'file');
}
function downloadContactTemplate() {
return CDR.get(
{
url: DownloadContactTemplateUrl,
responseType: 'blob',
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
function importContact(file: File) {
return CDR.uploadFile({ url: ImportContactUrl }, { fileList: [file] }, 'file');
}
// 公海视图
function addAccountPoolView(data: ViewParams) {
return CDR.post({ url: AddAccountPoolViewUrl, data });
}
function updateAccountPoolView(data: ViewParams) {
return CDR.post({ url: UpdateAccountPoolViewUrl, data });
}
function getAccountPoolViewList() {
return CDR.get<ViewItem[]>({ url: GetAccountPoolViewListUrl });
}
function getAccountPoolViewDetail(id: string) {
return CDR.get({ url: `${GetAccountPoolViewDetailUrl}/${id}` });
}
function fixedAccountPoolView(id: string) {
return CDR.get({ url: `${FixedAccountPoolViewUrl}/${id}` });
}
function enableAccountPoolView(id: string) {
return CDR.get({ url: `${EnableAccountPoolViewUrl}/${id}` });
}
function deleteAccountPoolView(id: string) {
return CDR.get({ url: `${DeleteAccountPoolViewUrl}/${id}` });
}
function dragAccountPoolView(data: TableDraggedParams) {
return CDR.post({ url: DragAccountPoolViewUrl, data });
}
function mergeAccount(data: MergeAccountParams) {
return CDR.post({ url: MergeAccountUrl, data });
}
function mergeAccountPage(data: TableQueryParams) {
return CDR.post({ url: MergeAccountPageUrl, data });
}
function getAccountContract(data: TableQueryParams) {
return CDR.post<CommonList<ContractItem>>({ url: GetAccountContractListUrl, data });
}
function getAccountContractStatistic(id: string) {
return CDR.get({ url: `${GetAccountContractStatisticUrl}/${id}` });
}
function getAccountPayment(data: TableQueryParams) {
return CDR.post<CommonList<PaymentPlanItem>>({ url: GetAccountPaymentListUrl, data });
}
function getAccountPaymentStatistic(id: string) {
return CDR.get({ url: `${GetAccountPaymentStatisticUrl}/${id}` });
}
function getAccountPaymentRecord(data: TableQueryParams) {
return CDR.post<CommonList<PaymentRecordItem>>({ url: GetAccountPaymentRecordListUrl, data });
}
function getAccountPaymentRecordStatistic(id: string) {
return CDR.get({ url: `${GetAccountPaymentRecordStatisticUrl}/${id}` });
}
return {
addCustomer,
updateCustomer,
getCustomerList,
getCustomerContactTab,
getCustomerFormConfig,
getCustomer,
deleteCustomer,
getGlobalCustomerList,
getGlobalOpenSeaCustomerList,
getGlobalCustomerContactList,
getGlobalModuleCount,
batchDeleteCustomer,
batchTransferCustomer,
batchMoveCustomer,
addCustomerFollowRecord,
updateCustomerFollowRecord,
deleteCustomerFollowRecord,
getCustomerFollowRecordList,
getCustomerFollowRecordFormConfig,
getCustomerFollowRecord,
addCustomerFollowPlan,
updateCustomerFollowPlan,
deleteCustomerFollowPlan,
getCustomerFollowPlanList,
cancelCustomerFollowPlan,
getCustomerFollowPlanFormConfig,
getCustomerFollowPlan,
addCustomerContact,
getCustomerContactList,
updateCustomerContact,
disableCustomerContact,
getCustomerContactFormConfig,
getCustomerContact,
enableCustomerContact,
deleteCustomerContact,
checkOpportunity,
getContactListUnderCustomer,
addCustomerOpenSea,
updateCustomerOpenSea,
getCustomerOpenSeaList,
switchCustomerOpenSea,
deleteCustomerOpenSea,
isCustomerOpenSeaNoPick,
getOpenSeaCustomerList,
getCustomerOpportunityPage,
pickOpenSeaCustomer,
batchPickOpenSeaCustomer,
batchDeleteOpenSeaCustomer,
batchAssignOpenSeaCustomer,
assignOpenSeaCustomer,
getOpenSeaOptions,
getOpenSeaCustomer,
deleteOpenSeaCustomer,
getCustomerHeaderList,
saveCustomerRelation,
getCustomerRelationList,
getCustomerCollaborationList,
batchDeleteCustomerCollaboration,
updateCustomerCollaboration,
addCustomerCollaboration,
deleteCustomerCollaboration,
getCustomerOptions,
getCustomerOpenSeaFollowRecordList,
updateCustomerRelationItem,
addCustomerRelationItem,
deleteCustomerRelationItem,
getCustomerTab,
updateCustomerFollowPlanStatus,
exportCustomerAll,
exportContactAll,
exportContactSelected,
exportCustomerSelected,
moveCustomerToPool,
addCustomerView,
deleteCustomerView,
fixedCustomerView,
getCustomerViewDetail,
getCustomerViewList,
updateCustomerView,
enableCustomerView,
dragCustomerView,
addContactView,
deleteContactView,
fixedContactView,
getContactViewDetail,
getContactViewList,
updateContactView,
enableContactView,
dragContactView,
geAdvancedCustomerList,
getAdvancedOpenSeaCustomerList,
getAdvancedCustomerContactList,
exportCustomerOpenSeaAll,
exportCustomerOpenSeaSelected,
preCheckImportAccount,
downloadAccountTemplate,
importAccount,
preCheckImportContact,
downloadContactTemplate,
importContact,
batchUpdateOpenSeaCustomer,
addAccountPoolView,
deleteAccountPoolView,
fixedAccountPoolView,
getAccountPoolViewDetail,
getAccountPoolViewList,
updateAccountPoolView,
enableAccountPoolView,
dragAccountPoolView,
batchUpdateAccount,
batchUpdateContact,
mergeAccount,
mergeAccountPage,
generateCustomerChart,
generateCustomerPoolChart,
generateCustomerContactChart,
getAccountContract,
getAccountContractStatistic,
getAccountPayment,
getAccountPaymentStatistic,
getAccountPaymentRecord,
getAccountPaymentRecordStatistic,
getCustomerInvoiceList,
getCustomerOrderList,
getCustomerInvoiceStatistic,
};
}

View File

@@ -0,0 +1,133 @@
import type { CommonList, TableQueryParams } from '../../models/common';
import type {
DashboardAddModuleParams,
DashboardAddParams,
DashboardDetail,
DashboardDragParams,
DashboardModuleDragParams,
DashboardModuleRenameParams,
DashboardRenameParams,
DashboardTableItem,
DashboardTableQueryParams,
DashboardUpdateParams,
} from '../../models/dashboard';
import {
dashboardAddUrl,
dashboardCollectPageUrl,
dashboardCollectUrl,
dashboardDeleteUrl,
dashboardDetailUrl,
dashboardDragUrl,
dashboardModuleAddUrl,
dashboardModuleCountUrl,
dashboardModuleDeleteUrl,
dashboardModuleDragUrl,
dashboardModuleRenameUrl,
dashboardModuleTreeUrl,
dashboardPageUrl,
dashboardRenameUrl,
dashboardUnCollectUrl,
dashboardUpdateUrl,
} from '../requrls/dashboard';
import type { CordysAxios } from '@lib/shared/api/http/Axios';
export default function useDashboardApi(CDR: CordysAxios) {
// 重命名仪表板模块
function dashboardModuleRename(data: DashboardModuleRenameParams) {
return CDR.post({ url: dashboardModuleRenameUrl, data });
}
// 删除仪表板模块
function dashboardModuleDelete(ids: string[]) {
return CDR.post({ url: dashboardModuleDeleteUrl, data: ids });
}
// 添加仪表板模块
function dashboardModuleAdd(data: DashboardAddModuleParams) {
return CDR.post({ url: dashboardModuleAddUrl, data });
}
// 更新仪表板
function dashboardUpdate(data: DashboardUpdateParams) {
return CDR.post({ url: dashboardUpdateUrl, data });
}
// 重命名仪表板
function dashboardRename(data: DashboardRenameParams) {
return CDR.post({ url: dashboardRenameUrl, data });
}
// 添加仪表板
function dashboardAdd(data: DashboardAddParams) {
return CDR.post({ url: dashboardAddUrl, data });
}
// 获取仪表板详情
function dashboardDetail(id: string) {
return CDR.get<DashboardDetail>({ url: `${dashboardDetailUrl}/${id}` });
}
// 删除仪表板
function dashboardDelete(id: string) {
return CDR.get({ url: `${dashboardDeleteUrl}/${id}` });
}
// 获取仪表板模块树
function dashboardModuleTree() {
return CDR.get({ url: dashboardModuleTreeUrl });
}
// 获取仪表板模块数量
function dashboardModuleCount() {
return CDR.get({ url: dashboardModuleCountUrl });
}
// 仪表板拖拽
function dashboardDrag(data: DashboardDragParams) {
return CDR.post({ url: dashboardDragUrl, data });
}
// 仪表板模块拖拽
function dashboardModuleDrag(data: DashboardModuleDragParams) {
return CDR.post({ url: dashboardModuleDragUrl, data });
}
// 获取仪表板列表
function dashboardPage(data: DashboardTableQueryParams) {
return CDR.post<CommonList<DashboardTableItem>>({ url: dashboardPageUrl, data });
}
// 获取仪表板收藏列表
function dashboardCollectPage(data: TableQueryParams) {
return CDR.post<CommonList<DashboardTableItem>>({ url: dashboardCollectPageUrl, data });
}
// 收藏仪表板
function dashboardCollect(id: string) {
return CDR.get({ url: `${dashboardCollectUrl}/${id}` });
}
// 取消收藏仪表板
function dashboardUnCollect(id: string) {
return CDR.get({ url: `${dashboardUnCollectUrl}/${id}` });
}
return {
dashboardModuleRename,
dashboardModuleDelete,
dashboardModuleAdd,
dashboardUpdate,
dashboardRename,
dashboardAdd,
dashboardDetail,
dashboardDelete,
dashboardModuleTree,
dashboardPage,
dashboardCollectPage,
dashboardCollect,
dashboardUnCollect,
dashboardModuleCount,
dashboardModuleDrag,
dashboardDrag,
};
}

View File

@@ -0,0 +1,199 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddFollowPlanViewUrl,
AddFollowRecordViewUrl,
DeleteFollowPlanUrl,
DeleteFollowPlanViewUrl,
DeleteFollowRecordUrl,
DeleteFollowRecordViewUrl,
DragFollowPlanViewUrl,
DragFollowRecordViewUrl,
EnableFollowPlanViewUrl,
EnableFollowRecordViewUrl,
FixedFollowPlanViewUrl,
FixedFollowRecordViewUrl,
GetFollowPlanPageUrl,
GetFollowPlanTabUrl,
GetFollowPlanUrl,
GetFollowPlanViewDetailUrl,
GetFollowPlanViewListUrl,
GetFollowRecordPageUrl,
GetFollowRecordTabUrl,
GetFollowRecordUrl,
GetFollowRecordViewDetailUrl,
GetFollowRecordViewListUrl,
UpdateFollowPlanStatusUrl,
UpdateFollowPlanUrl,
UpdateFollowPlanViewUrl,
UpdateFollowRecordUrl,
AddFollowRecordUrl,
AddFollowPlanUrl,
UpdateFollowRecordViewUrl,
} from '@lib/shared/api/requrls/follow';
import type { CommonList, TableDraggedParams } from '@lib/shared/models/common';
import type {
CustomerFollowRecordTableParams,
CustomerTabHidden,
FollowDetailItem,
UpdateCustomerFollowRecordParams,
UpdateFollowPlanStatusParams,
} from '@lib/shared/models/customer';
import type { ViewItem, ViewParams } from '@lib/shared/models/view';
export default function useFollowApi(CDR: CordysAxios) {
// 跟进记录列表
function getFollowRecordPage(data: CustomerFollowRecordTableParams) {
return CDR.post<CommonList<FollowDetailItem>>({ url: GetFollowRecordPageUrl, data });
}
// 跟进记录详情
function getFollowRecordDetail(id: string) {
return CDR.get<FollowDetailItem>({ url: `${GetFollowRecordUrl}/${id}` });
}
// 获取tab显隐藏
function getFollowRecordTab() {
return CDR.get<CustomerTabHidden>({ url: GetFollowRecordTabUrl });
}
function deleteFollowRecord(id: string) {
return CDR.get({ url: `${DeleteFollowRecordUrl}/${id}` });
}
// 跟进计划列表
function getFollowPLanPage(data: CustomerFollowRecordTableParams) {
return CDR.post<CommonList<FollowDetailItem>>({ url: GetFollowPlanPageUrl, data });
}
// 跟进记录详情
function getFollowPlanDetail(id: string) {
return CDR.get<FollowDetailItem>({ url: `${GetFollowPlanUrl}/${id}` });
}
function updateFollowRecord(data: UpdateCustomerFollowRecordParams) {
return CDR.post({ url: UpdateFollowRecordUrl, data });
}
function addFollowRecord(data: UpdateCustomerFollowRecordParams) {
return CDR.post({ url: AddFollowRecordUrl, data });
}
// 获取tab显隐藏
function getFollowPlanTab() {
return CDR.get<CustomerTabHidden>({ url: GetFollowPlanTabUrl });
}
function deleteFollowPlan(id: string) {
return CDR.get({ url: `${DeleteFollowPlanUrl}/${id}` });
}
function updateFollowPlanStatus(data: UpdateFollowPlanStatusParams) {
return CDR.post({ url: UpdateFollowPlanStatusUrl, data });
}
function updateFollowPlan(data: UpdateCustomerFollowRecordParams) {
return CDR.post({ url: UpdateFollowPlanUrl, data });
}
function addFollowPlan(data: UpdateCustomerFollowRecordParams) {
return CDR.post({ url: AddFollowPlanUrl, data });
}
// 视图
function addFollowRecordView(data: ViewParams) {
return CDR.post({ url: AddFollowRecordViewUrl, data });
}
function updateFollowRecordView(data: ViewParams) {
return CDR.post({ url: UpdateFollowRecordViewUrl, data });
}
function getFollowRecordViewList() {
return CDR.get<ViewItem[]>({ url: GetFollowRecordViewListUrl });
}
function getFollowRecordViewDetail(id: string) {
return CDR.get({ url: `${GetFollowRecordViewDetailUrl}/${id}` });
}
function fixedFollowRecordView(id: string) {
return CDR.get({ url: `${FixedFollowRecordViewUrl}/${id}` });
}
function enableFollowRecordView(id: string) {
return CDR.get({ url: `${EnableFollowRecordViewUrl}/${id}` });
}
function deleteFollowRecordView(id: string) {
return CDR.get({ url: `${DeleteFollowRecordViewUrl}/${id}` });
}
function dragFollowRecordView(data: TableDraggedParams) {
return CDR.post({ url: DragFollowRecordViewUrl, data });
}
// 跟进计划视图
function addFollowPlanView(data: ViewParams) {
return CDR.post({ url: AddFollowPlanViewUrl, data });
}
function updateFollowPlanView(data: ViewParams) {
return CDR.post({ url: UpdateFollowPlanViewUrl, data });
}
function getFollowPlanViewList() {
return CDR.get<ViewItem[]>({ url: GetFollowPlanViewListUrl });
}
function getFollowPlanViewDetail(id: string) {
return CDR.get({ url: `${GetFollowPlanViewDetailUrl}/${id}` });
}
function fixedFollowPlanView(id: string) {
return CDR.get({ url: `${FixedFollowPlanViewUrl}/${id}` });
}
function enableFollowPlanView(id: string) {
return CDR.get({ url: `${EnableFollowPlanViewUrl}/${id}` });
}
function deleteFollowPlanView(id: string) {
return CDR.get({ url: `${DeleteFollowPlanViewUrl}/${id}` });
}
function dragFollowPlanView(data: TableDraggedParams) {
return CDR.post({ url: DragFollowPlanViewUrl, data });
}
return {
getFollowPlanDetail,
getFollowPLanPage,
getFollowRecordDetail,
getFollowRecordPage,
deleteFollowRecord,
getFollowRecordTab,
getFollowPlanTab,
deleteFollowPlan,
updateFollowPlanStatus,
updateFollowPlan,
updateFollowRecord,
addFollowRecord,
addFollowPlan,
addFollowRecordView,
updateFollowRecordView,
getFollowRecordViewList,
getFollowRecordViewDetail,
fixedFollowRecordView,
enableFollowRecordView,
deleteFollowRecordView,
dragFollowRecordView,
addFollowPlanView,
updateFollowPlanView,
getFollowPlanViewList,
getFollowPlanViewDetail,
fixedFollowPlanView,
enableFollowPlanView,
deleteFollowPlanView,
dragFollowPlanView,
};
}

View File

@@ -0,0 +1,37 @@
import type { FollowOptStatisticDetail, GetHomeStatisticParams, HomeLeadStatisticDetail, HomeWinOrderDetail } from '../../models/home';
import { HomeDepartmentTree, HomeFollowOpportunity, HomeLeadStatistic, HomeSuccessOpportunity, HomeOpportunityUnderwayUrl } from '../requrls/home';
import { CrmTreeNodeData } from '@cordys/web/src/components/pure/crm-tree/type';
import type { CordysAxios } from '@lib/shared/api/http/Axios';
export default function useHomeApi(CDR: CordysAxios) {
// 用户部门权限树
function getHomeDepartmentTree() {
return CDR.get<CrmTreeNodeData[]>({ url: HomeDepartmentTree });
}
// 跟进商机统计
function getHomeFollowOpportunity(data: GetHomeStatisticParams) {
return CDR.post<FollowOptStatisticDetail>({ url: HomeFollowOpportunity, data });
}
// 线索统计
function getHomeLeadStatistic(data: GetHomeStatisticParams) {
return CDR.post<HomeLeadStatisticDetail>({ url: HomeLeadStatistic, data });
}
function getHomeSuccessOptStatistic(data: GetHomeStatisticParams) {
return CDR.post<HomeWinOrderDetail>({ url: HomeSuccessOpportunity, data });
}
function getHomeOpportunityUnderwayStatistic(data: GetHomeStatisticParams) {
return CDR.post<HomeWinOrderDetail>({ url: HomeOpportunityUnderwayUrl, data });
}
return {
getHomeDepartmentTree,
getHomeFollowOpportunity,
getHomeLeadStatistic,
getHomeSuccessOptStatistic,
getHomeOpportunityUnderwayStatistic,
};
}

View File

@@ -0,0 +1,551 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddBusinessViewUrl,
AddOpportunityStageUrl,
AddOptFollowPlanUrl,
AddOptFollowRecordUrl,
AddQuotationUrl,
AddQuotationViewUrl,
AdvancedSearchOptDetailUrl,
AdvancedSearchOptPageUrl,
ApprovalQuotationUrl,
BatchApproveUrl,
BatchUpdateQuotationUrl,
BatchUpdateOpportunityUrl,
BatchVoidedUrl,
CancelOptFollowPlanUrl,
DeleteBusinessViewUrl,
DeleteOpportunityStageUrl,
DeleteOptFollowPlanUrl,
DeleteOptFollowRecordUrl,
DeleteQuotationUrl,
DeleteQuotationViewUrl,
DownloadOptTemplateUrl,
DownloadQuotationUrl,
DragBusinessViewUrl,
DragQuotationViewUrl,
EnableBusinessViewUrl,
EnableQuotationViewUrl,
ExportOpportunityAllUrl,
ExportOpportunitySelectedUrl,
FixedBusinessViewUrl,
FixedQuotationViewUrl,
GenerateOpportunityChartUrl,
GetBusinessViewDetailUrl,
GetBusinessViewListUrl,
GetOpportunityContactListUrl,
GetOpportunityStageConfigUrl,
GetOptDetailUrl,
GetOptFollowPlanUrl,
GetOptFollowRecordUrl,
GetOptFormConfigUrl,
GetOptStatisticUrl,
GetOptTabUrl,
GetQuotationDetailUrl,
GetQuotationFormConfigUrl,
GetQuotationSnapshotDetailUrl,
GetQuotationSnapshotFormConfigUrl,
GetQuotationTabUrl,
GetQuotationViewDetailUrl,
GetQuotationViewListUrl,
GlobalSearchOptPageUrl,
ImportOpportunityUrl,
OptAddUrl,
OptBatchDeleteUrl,
OptBatchTransferUrl,
OptDeleteUrl,
OptFollowPlanPageUrl,
OptFollowRecordListUrl,
OptPageUrl,
OptUpdateStageUrl,
OptUpdateUrl,
PreCheckOptImportUrl,
QuotationPageUrl,
RevokeQuotationUrl,
SortOpportunityStageUrl,
SortOpportunityUrl,
UpdateBusinessViewUrl,
UpdateOpportunityStageRollbackUrl,
UpdateOpportunityStageUrl,
UpdateOptFollowPlanStatusUrl,
UpdateOptFollowPlanUrl,
UpdateOptFollowRecordUrl,
UpdateQuotationUrl,
UpdateQuotationViewUrl,
VoidQuotationUrl,
} from '@lib/shared/api/requrls/opportunity';
import type {
ChartResponseDataItem,
CommonList,
GenerateChartParams,
TableDraggedParams,
TableExportParams,
TableExportSelectedParams,
TableQueryParams,
} from '@lib/shared/models/common';
import type {
BatchUpdatePoolAccountParams,
CustomerContractTableParams,
CustomerFollowPlanTableParams,
CustomerFollowRecordTableParams,
CustomerTabHidden,
FollowDetailItem,
SaveCustomerFollowPlanParams,
SaveCustomerFollowRecordParams,
TransferParams,
UpdateCustomerFollowPlanParams,
UpdateCustomerFollowRecordParams,
UpdateFollowPlanStatusParams,
} from '@lib/shared/models/customer';
import type {
AddOpportunityStageParams,
ApproveQuotation,
BatchOperationResult,
BatchUpdateQuotationStatusParams,
BatchVoidQuotationStatusParams,
StageBoardPageQueryParams,
StageBoardDraggedParams,
OpportunityDetail,
OpportunityItem,
OpportunityStageConfig,
QuotationItem,
QuotationQueryParams,
SaveOpportunityParams,
SaveQuotationParams,
UpdateOpportunityParams,
UpdateOpportunityStageParams,
UpdateOpportunityStageRollbackParams,
UpdateQuotationParams,
} from '@lib/shared/models/opportunity';
import type { FormDesignConfigDetailParams } from '@lib/shared/models/system/module';
import { ValidateInfo } from '@lib/shared/models/system/org';
import type { ViewItem, ViewParams } from '@lib/shared/models/view';
export default function useProductApi(CDR: CordysAxios) {
// 商机列表
function getOpportunityList(data: StageBoardPageQueryParams) {
return CDR.post<CommonList<OpportunityItem>>({ url: OptPageUrl, data }, { ignoreCancelToken: true });
}
// 添加商机
function addOpportunity(data: SaveOpportunityParams) {
return CDR.post({ url: OptAddUrl, data });
}
// 更新商机
function updateOpportunity(data: UpdateOpportunityParams) {
return CDR.post({ url: OptUpdateUrl, data });
}
// 商机详情
function getOpportunityDetail(id: string) {
return CDR.get<OpportunityDetail>({ url: `${GetOptDetailUrl}/${id}` });
}
// 商机看板拖拽排序
function sortOpportunity(data: StageBoardDraggedParams) {
return CDR.post({ url: SortOpportunityUrl, data });
}
// 获取商机表单配置
function getOptFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetOptFormConfigUrl });
}
// 商机跟进记录列表
function getOptFollowRecordList(data: CustomerFollowRecordTableParams) {
return CDR.post<CommonList<FollowDetailItem>>({ url: OptFollowRecordListUrl, data });
}
// 删除商机跟进记录
function deleteOptFollowRecord(id: string) {
return CDR.get({ url: `${DeleteOptFollowRecordUrl}/${id}` });
}
// 添加商机跟进记录
function addOptFollowRecord(data: SaveCustomerFollowRecordParams) {
return CDR.post({ url: AddOptFollowRecordUrl, data });
}
// 更新商机跟进记录
function updateOptFollowRecord(data: UpdateCustomerFollowRecordParams) {
return CDR.post({ url: UpdateOptFollowRecordUrl, data });
}
// 获取商机跟进记录详情
function getOptFollowRecord(id: string) {
return CDR.get<FollowDetailItem>({ url: `${GetOptFollowRecordUrl}/${id}` });
}
// 跟进计划列表
function getOptFollowPlanList(data: CustomerFollowPlanTableParams) {
return CDR.post<CommonList<FollowDetailItem>>({ url: OptFollowPlanPageUrl, data });
}
// 添加商机跟进计划
function addOptFollowPlan(data: SaveCustomerFollowPlanParams) {
return CDR.post({ url: AddOptFollowPlanUrl, data });
}
// 更新商机跟进计划
function updateOptFollowPlan(data: UpdateCustomerFollowPlanParams) {
return CDR.post({ url: UpdateOptFollowPlanUrl, data });
}
// 删除商机跟进计划
function deleteOptFollowPlan(id: string) {
return CDR.get({ url: `${DeleteOptFollowPlanUrl}/${id}` });
}
// 获取商机跟进计划详情
function getOptFollowPlan(id: string) {
return CDR.get<FollowDetailItem>({ url: `${GetOptFollowPlanUrl}/${id}` });
}
// 取消商机跟进计划
function cancelOptFollowPlan(id: string) {
return CDR.get({ url: `${CancelOptFollowPlanUrl}/${id}` });
}
// 批量转移商机
function transferOpt(data: TransferParams) {
return CDR.post({ url: OptBatchTransferUrl, data });
}
// 批量删除商机
function batchDeleteOpt(data: (string | number)[]) {
return CDR.post({ url: OptBatchDeleteUrl, data });
}
// 删除商机
function deleteOpt(id: string) {
return CDR.get({ url: `${OptDeleteUrl}/${id}` });
}
// 更新商机阶段
function updateOptStage(data: { id: string; stage: string; failureReason?: string | null }) {
return CDR.post({ url: OptUpdateStageUrl, data });
}
// 获取商机tab显隐藏
function getOptTab() {
return CDR.get<CustomerTabHidden>({ url: GetOptTabUrl });
}
// 获取商机联系人列表
function getOpportunityContactList(data: CustomerContractTableParams) {
return CDR.get({ url: `${GetOpportunityContactListUrl}/${data.id}` });
}
// 更新商机跟进计划状态
function updateOptFollowPlanStatus(data: UpdateFollowPlanStatusParams) {
return CDR.post({ url: UpdateOptFollowPlanStatusUrl, data });
}
// 导出全量商机列表
function exportOpportunityAll(data: TableExportParams) {
return CDR.post({ url: ExportOpportunityAllUrl, data });
}
// 导出选中商机列表
function exportOpportunitySelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportOpportunitySelectedUrl, data });
}
// 商机列表的金额数据
function getOptStatistic(data: TableQueryParams) {
return CDR.post({ url: GetOptStatisticUrl, data }, { ignoreCancelToken: true });
}
// 更新商机阶段配置
function updateOpportunityStage(data: UpdateOpportunityStageParams) {
return CDR.post({ url: UpdateOpportunityStageUrl, data });
}
// 商机阶段回退配置
function updateOpportunityStageRollback(data: UpdateOpportunityStageRollbackParams) {
return CDR.post({ url: UpdateOpportunityStageRollbackUrl, data });
}
// 商机阶段排序
function sortOpportunityStage(data: string[]) {
return CDR.post({ url: SortOpportunityStageUrl, data });
}
// 添加商机阶段
function addOpportunityStage(data: AddOpportunityStageParams) {
return CDR.post({ url: AddOpportunityStageUrl, data });
}
// 获取商机阶段配置
function getOpportunityStageConfig() {
return CDR.get<OpportunityStageConfig>({ url: GetOpportunityStageConfigUrl }, { ignoreCancelToken: true });
}
// 删除商机阶段
function deleteOpportunityStage(id: string) {
return CDR.get({ url: `${DeleteOpportunityStageUrl}/${id}` });
}
// 生成商机图表
function generateOpportunityChart(data: GenerateChartParams) {
return CDR.post<ChartResponseDataItem[]>({ url: GenerateOpportunityChartUrl, data });
}
// 商机视图
function addBusinessView(data: ViewParams) {
return CDR.post({ url: AddBusinessViewUrl, data });
}
function updateBusinessView(data: ViewParams) {
return CDR.post({ url: UpdateBusinessViewUrl, data });
}
function getBusinessViewList() {
return CDR.get<ViewItem[]>({ url: GetBusinessViewListUrl });
}
function getBusinessViewDetail(id: string) {
return CDR.get({ url: `${GetBusinessViewDetailUrl}/${id}` });
}
function fixedBusinessView(id: string) {
return CDR.get({ url: `${FixedBusinessViewUrl}/${id}` });
}
function enableBusinessView(id: string) {
return CDR.get({ url: `${EnableBusinessViewUrl}/${id}` });
}
function deleteBusinessView(id: string) {
return CDR.get({ url: `${DeleteBusinessViewUrl}/${id}` });
}
function dragBusinessView(data: TableDraggedParams) {
return CDR.post({ url: DragBusinessViewUrl, data });
}
function globalSearchOptPage(data: TableQueryParams) {
return CDR.post<CommonList<OpportunityItem>>({ url: GlobalSearchOptPageUrl, data }, { ignoreCancelToken: true });
}
function advancedSearchOptPage(data: TableQueryParams) {
return CDR.post<CommonList<OpportunityItem>>({ url: AdvancedSearchOptPageUrl, data }, { ignoreCancelToken: true });
}
function advancedSearchOptDetail(data: TableQueryParams) {
return CDR.post<CommonList<OpportunityItem>>({ url: AdvancedSearchOptDetailUrl, data });
}
function preCheckImportOpt(file: File) {
return CDR.uploadFile<{ data: ValidateInfo }>({ url: PreCheckOptImportUrl }, { fileList: [file] }, 'file');
}
function downloadOptTemplate() {
return CDR.get(
{
url: DownloadOptTemplateUrl,
responseType: 'blob',
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
function importOpportunity(file: File) {
return CDR.uploadFile({ url: ImportOpportunityUrl }, { fileList: [file] }, 'file');
}
// 批量更新商机
function batchUpdateOpportunity(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateOpportunityUrl, data });
}
// 获取商机报价单tab显隐藏
function getQuotationTab() {
return CDR.get<CustomerTabHidden>({ url: GetQuotationTabUrl });
}
// 报价单视图
function addQuotationView(data: ViewParams) {
return CDR.post({ url: AddQuotationViewUrl, data });
}
function updateQuotationView(data: ViewParams) {
return CDR.post({ url: UpdateQuotationViewUrl, data });
}
function getQuotationViewList() {
return CDR.get<ViewItem[]>({ url: GetQuotationViewListUrl });
}
function getQuotationViewDetail(id: string) {
return CDR.get({ url: `${GetQuotationViewDetailUrl}/${id}` });
}
function fixedQuotationView(id: string) {
return CDR.get({ url: `${FixedQuotationViewUrl}/${id}` });
}
function enableQuotationView(id: string) {
return CDR.get({ url: `${EnableQuotationViewUrl}/${id}` });
}
function deleteQuotationView(id: string) {
return CDR.get({ url: `${DeleteQuotationViewUrl}/${id}` });
}
function dragQuotationView(data: TableDraggedParams) {
return CDR.post({ url: DragQuotationViewUrl, data });
}
// 报价单
// 报价列表
function getQuotationList(data: QuotationQueryParams) {
return CDR.post<CommonList<QuotationItem>>({ url: QuotationPageUrl, data });
}
// 添加报价
function addQuotation(data: SaveQuotationParams) {
return CDR.post({ url: AddQuotationUrl, data });
}
// 更新报价
function updateQuotation(data: UpdateQuotationParams, approvalTaskId?: string) {
return CDR.post({ url: UpdateQuotationUrl, data, params: { approvalTaskId } });
}
// 报价详情
function getQuotationDetail(id: string, approvalTaskId?: string) {
return CDR.get<QuotationItem>({ url: `${GetQuotationDetailUrl}/${id}`, params: { approvalTaskId } });
}
// 报价单快照详情
function getQuotationSnapshotDetail(id: string, approvalTaskId?: string) {
return CDR.get<QuotationItem>({ url: `${GetQuotationSnapshotDetailUrl}/${id}`, params: { approvalTaskId } });
}
// 获取报价表单配置
function getQuotationFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetQuotationFormConfigUrl });
}
// 获取报价表单快照配置
function getQuotationSnapshotFormConfig(id?: string, approvalTaskId?: string) {
return CDR.get<FormDesignConfigDetailParams>({
url: `${GetQuotationSnapshotFormConfigUrl}/${id}`,
params: { approvalTaskId },
});
}
// 删除报价
function deleteQuotation(id: string) {
return CDR.get({ url: `${DeleteQuotationUrl}/${id}` });
}
// 作废报价
function voidQuotation(id: string) {
return CDR.get({ url: `${VoidQuotationUrl}/${id}` });
}
// 审批报价
function approvalQuotation(data: ApproveQuotation) {
return CDR.post({ url: ApprovalQuotationUrl, data });
}
// 撤销报价
function revokeQuotation(id: string) {
return CDR.get({ url: `${RevokeQuotationUrl}/${id}` });
}
function batchApprove(data: BatchUpdateQuotationStatusParams) {
return CDR.post<BatchOperationResult>({ url: BatchApproveUrl, data });
}
function batchVoided(data: BatchVoidQuotationStatusParams) {
return CDR.post<BatchOperationResult>({ url: BatchVoidedUrl, data });
}
function batchUpdateQuotation(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateQuotationUrl, data });
}
function downloadQuotation(id: string) {
return CDR.get({ url: `${DownloadQuotationUrl}/${id}` });
}
return {
getOpportunityList,
addOpportunity,
updateOpportunity,
getOpportunityDetail,
getOptFormConfig,
getOptFollowRecordList,
deleteOptFollowRecord,
addOptFollowRecord,
updateOptFollowRecord,
getOptFollowRecord,
getOptFollowPlanList,
addOptFollowPlan,
updateOptFollowPlan,
deleteOptFollowPlan,
getOptFollowPlan,
cancelOptFollowPlan,
transferOpt,
batchDeleteOpt,
deleteOpt,
updateOptStage,
getOptTab,
getOpportunityContactList,
updateOptFollowPlanStatus,
exportOpportunityAll,
exportOpportunitySelected,
addBusinessView,
deleteBusinessView,
fixedBusinessView,
getBusinessViewDetail,
getBusinessViewList,
updateBusinessView,
enableBusinessView,
dragBusinessView,
advancedSearchOptPage,
globalSearchOptPage,
advancedSearchOptDetail,
preCheckImportOpt,
downloadOptTemplate,
importOpportunity,
getOptStatistic,
batchUpdateOpportunity,
sortOpportunity,
updateOpportunityStage,
updateOpportunityStageRollback,
sortOpportunityStage,
addOpportunityStage,
getOpportunityStageConfig,
deleteOpportunityStage,
generateOpportunityChart,
getQuotationTab,
addQuotationView,
deleteQuotationView,
fixedQuotationView,
getQuotationViewDetail,
getQuotationViewList,
updateQuotationView,
enableQuotationView,
dragQuotationView,
getQuotationList,
addQuotation,
updateQuotation,
getQuotationDetail,
getQuotationSnapshotDetail,
getQuotationFormConfig,
getQuotationSnapshotFormConfig,
deleteQuotation,
approvalQuotation,
voidQuotation,
revokeQuotation,
batchApprove,
batchVoided,
batchUpdateQuotation,
downloadQuotation,
};
}

View File

@@ -0,0 +1,240 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddOrderUrl,
AddOrderViewUrl,
BatchUpdateOrderUrl,
DeleteOrderUrl,
UpdateOrderStageUrl,
DeleteOrderViewUrl,
DragOrderViewUrl,
EnableOrderViewUrl,
FixedOrderViewUrl,
GetOrderDetailUrl,
OrderPageUrl,
SortOrderUrl,
OrderDetailSnapshotUrl,
OrderFormConfigUrl,
OrderFormConfigSnapshotUrl,
OrderInContractPageUrl,
GetOrderTabUrl,
GetOrderViewDetailUrl,
GetOrderViewListUrl,
UpdateOrderUrl,
UpdateOrderViewUrl,
UpdateOrderStatusUrl,
UpdateOrderStatusRollbackUrl,
SortOrderStatusUrl,
AddOrderStatusUrl,
GetOrderStatusConfigUrl,
DeleteOrderStatusUrl,
DownloadOrderUrl,
OrderStatisticUrl,
SaveAdvanceConfigUrl,
SwitchOrderCirculationTypeUrl,
} from '@lib/shared/api/requrls/order';
import type { FormDesignConfigDetailParams } from '@lib/shared/models/system/module';
import type { CommonList, TableDraggedParams } from '@lib/shared/models/common';
import type { BatchUpdatePoolAccountParams, CustomerTabHidden } from '@lib/shared/models/customer';
import type { OrderItem, UpdateOrderParams } from '@lib/shared/models/order';
import type { TableQueryParams } from '@lib/shared/models/common';
import type { ViewItem, ViewParams } from '@lib/shared/models/view';
import {
StageBoardPageQueryParams,
StageBoardDraggedParams,
StageBaseParams,
OpportunityStageConfig,
UpdateOpportunityStageRollbackParams,
UpdateStageBaseParams,
type SaveCirculationConfigParams,
type UpdateStageParams,
} from '@lib/shared/models/opportunity';
import type { CirculationTypeEnum } from '@lib/shared/enums/opportunityEnum';
export default function useOrderApi(CDR: CordysAxios) {
// 列表
function getOrderList(data: StageBoardPageQueryParams) {
return CDR.post<CommonList<OrderItem>>({ url: OrderPageUrl, data }, { ignoreCancelToken: true });
}
// 合同下的列表
function getOrderInContractList(data: TableQueryParams) {
return CDR.post<CommonList<OrderItem>>({ url: OrderInContractPageUrl, data });
}
// 订单详情
function getOrderDetail(id: string, approvalTaskId?: string) {
return CDR.get<OrderItem>({ url: `${GetOrderDetailUrl}/${id}`, params: { approvalTaskId } });
}
// 详情快照
function getOrderDetailSnapshot(id: string, approvalTaskId?: string) {
return CDR.get<OrderItem>({ url: `${OrderDetailSnapshotUrl}/${id}`, params: { approvalTaskId } });
}
// 新增订单
function addOrder(data: UpdateOrderParams) {
return CDR.post({ url: AddOrderUrl, data });
}
// 更新订单
function updateOrder(data: UpdateOrderParams, approvalTaskId?: string) {
return CDR.post({ url: UpdateOrderUrl, data, params: { approvalTaskId } });
}
// 批量更新订单
function batchUpdateOrder(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateOrderUrl, data });
}
// 删除订单
function deleteOrder(id: string) {
return CDR.get({ url: `${DeleteOrderUrl}/${id}` });
}
// 获取表单配置
function getOrderFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({
url: OrderFormConfigUrl,
});
}
// 获取表单配置快照
function getOrderFormSnapshotConfig(id?: string, approvalTaskId?: string) {
return CDR.get<FormDesignConfigDetailParams>({
url: `${OrderFormConfigSnapshotUrl}/${id}`,
params: { approvalTaskId },
});
}
function downloadOrder(id: string) {
return CDR.get({ url: `${DownloadOrderUrl}/${id}` });
}
// 获取订单tab显隐配置
function getOrderTab() {
return CDR.get<CustomerTabHidden>({ url: GetOrderTabUrl });
}
// 视图管理
function addOrderView(data: ViewParams) {
return CDR.post({ url: AddOrderViewUrl, data });
}
function updateOrderView(data: ViewParams) {
return CDR.post({ url: UpdateOrderViewUrl, data });
}
function getOrderViewList() {
return CDR.get<ViewItem[]>({ url: GetOrderViewListUrl });
}
function getOrderViewDetail(id: string) {
return CDR.get({ url: `${GetOrderViewDetailUrl}/${id}` });
}
function fixedOrderView(id: string) {
return CDR.get({ url: `${FixedOrderViewUrl}/${id}` });
}
function enableOrderView(id: string) {
return CDR.get({ url: `${EnableOrderViewUrl}/${id}` });
}
function deleteOrderView(id: string) {
return CDR.get({ url: `${DeleteOrderViewUrl}/${id}` });
}
function dragOrderView(data: TableDraggedParams) {
return CDR.post({ url: DragOrderViewUrl, data });
}
// 更新订单状态配置
function updateOrderStatus(data: UpdateStageBaseParams) {
return CDR.post({ url: UpdateOrderStatusUrl, data });
}
// 订单状态回退配置
function updateOrderStatusRollback(data: UpdateOpportunityStageRollbackParams) {
return CDR.post({ url: UpdateOrderStatusRollbackUrl, data });
}
// 订单状态排序
function sortOrderStatus(data: string[]) {
return CDR.post({ url: SortOrderStatusUrl, data });
}
// 添加订单状态
function addOrderStatus(data: StageBaseParams) {
return CDR.post({ url: AddOrderStatusUrl, data });
}
// 获取订单状态配置
function getOrderStatusConfig() {
return CDR.get<OpportunityStageConfig>({ url: GetOrderStatusConfigUrl }, { ignoreCancelToken: true });
}
// 删除订单状态
function deleteOrderStatus(id: string) {
return CDR.get({ url: `${DeleteOrderStatusUrl}/${id}` });
}
// 更新阶段
function updateOrderStage(data: UpdateStageParams) {
return CDR.post({ url: UpdateOrderStageUrl, data });
}
// 订单看板拖拽排序
function sortOrder(data: StageBoardDraggedParams) {
return CDR.post({ url: SortOrderUrl, data });
}
// 订单统计
function getOrderStatistic(data: TableQueryParams) {
return CDR.post({ url: OrderStatisticUrl, data }, { ignoreCancelToken: true });
}
// 保存高级流转配置
function saveAdvanceConfig(data: SaveCirculationConfigParams) {
return CDR.post({ url: SaveAdvanceConfigUrl, data });
}
// 切换流转配置
function switchOrderCirculationType(type: CirculationTypeEnum) {
return CDR.get({ url: `${SwitchOrderCirculationTypeUrl}/${type}` });
}
return {
getOrderFormConfig,
getOrderFormSnapshotConfig,
addOrder,
getOrderDetail,
getOrderDetailSnapshot,
updateOrder,
batchUpdateOrder,
deleteOrder,
getOrderList,
getOrderInContractList,
getOrderTab,
addOrderView,
updateOrderView,
getOrderViewList,
getOrderViewDetail,
fixedOrderView,
enableOrderView,
deleteOrderView,
dragOrderView,
updateOrderStatus,
updateOrderStatusRollback,
sortOrderStatus,
addOrderStatus,
getOrderStatusConfig,
deleteOrderStatus,
updateOrderStage,
sortOrder,
downloadOrder,
getOrderStatistic,
switchOrderCirculationType,
saveAdvanceConfig,
};
}

View File

@@ -0,0 +1,222 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import {
AddProductPriceUrl,
AddProductUrl,
BatchDeleteProductUrl,
BatchUpdateProductPriceUrl,
BatchUpdateProductUrl,
DeleteProductPriceUrl,
DeleteProductUrl,
DownloadProductPriceTemplateUrl,
DownloadProductTemplateUrl,
DragSortProductPriceUrl,
DragSortProductUrl,
ExportAllProductPriceUrl,
ExportProductPriceUrl,
GetProductFormConfigUrl,
GetProductListUrl,
GetProductOptionsUrl,
GetProductPriceFormConfigUrl,
GetProductPriceListUrl,
GetProductPriceUrl,
GetProductUrl,
ImportProductPriceUrl,
ImportProductUrl,
PreCheckImportProductPriceUrl,
PreCheckProductImportUrl,
UpdateProductPriceUrl,
UpdateProductUrl,
CopyProductPriceUrl,
} from '@lib/shared/api/requrls/product';
import type {
CommonList,
TableDraggedParams,
TableExportParams,
TableExportSelectedParams,
TableQueryParams,
} from '@lib/shared/models/common';
import { BatchUpdatePoolAccountParams } from '@lib/shared/models/customer';
import type {
AddPriceParams,
ProductListItem,
SaveProductParams,
UpdatePriceParams,
UpdateProductParams,
} from '@lib/shared/models/product';
import type { FormDesignConfigDetailParams } from '@lib/shared/models/system/module';
import { ValidateInfo } from '@lib/shared/models/system/org';
export default function useProductApi(CDR: CordysAxios) {
// 添加产品
function addProduct(data: SaveProductParams) {
return CDR.post({ url: AddProductUrl, data });
}
// 更新产品
function updateProduct(data: UpdateProductParams) {
return CDR.post({ url: UpdateProductUrl, data });
}
// 获取产品列表
function getProductList(data: TableQueryParams) {
return CDR.post<CommonList<ProductListItem>>({ url: GetProductListUrl, data });
}
// 获取产品表单配置
function getProductFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetProductFormConfigUrl });
}
// 获取产品详情
function getProduct(id: string) {
return CDR.get<ProductListItem>({ url: `${GetProductUrl}/${id}` });
}
// 删除产品
function deleteProduct(id: string) {
return CDR.get({ url: `${DeleteProductUrl}/${id}` });
}
// 批量删除产品
function batchDeleteProduct(data: (string | number)[]) {
return CDR.post({ url: BatchDeleteProductUrl, data });
}
// 批量更新产品
function batchUpdateProduct(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateProductUrl, data });
}
// 拖拽排序产品
function dragSortProduct(data: TableDraggedParams) {
return CDR.post({ url: DragSortProductUrl, data });
}
function preCheckImportProduct(file: File) {
return CDR.uploadFile<{ data: ValidateInfo }>({ url: PreCheckProductImportUrl }, { fileList: [file] }, 'file');
}
function downloadProductTemplate() {
return CDR.get(
{
url: DownloadProductTemplateUrl,
responseType: 'blob',
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
function importProduct(file: File) {
return CDR.uploadFile({ url: ImportProductUrl }, { fileList: [file] }, 'file');
}
// 获取意向产品选项
function getProductOptions() {
return CDR.get<{ id: string; name: string }[]>({ url: GetProductOptionsUrl });
}
// 更新价格表
function updateProductPrice(data: UpdatePriceParams) {
return CDR.post({ url: UpdateProductPriceUrl, data });
}
// 批量更新价格表
function batchUpdateProductPrice(data: BatchUpdatePoolAccountParams) {
return CDR.post({ url: BatchUpdateProductPriceUrl, data });
}
// 获取价格表列表
function getProductPriceList(data: TableQueryParams) {
return CDR.post({ url: GetProductPriceListUrl, data });
}
// 添加价格表
function addProductPrice(data: AddPriceParams) {
return CDR.post({ url: AddProductPriceUrl, data });
}
// 获取价格表详情
function getProductPrice(id: string) {
return CDR.get<ProductListItem>({ url: `${GetProductPriceUrl}/${id}` });
}
// 删除价格表
function deleteProductPrice(id: string) {
return CDR.get({ url: `${DeleteProductPriceUrl}/${id}` });
}
// 获取价格表单配置
function getProductPriceFormConfig() {
return CDR.get<FormDesignConfigDetailParams>({ url: GetProductPriceFormConfigUrl });
}
// 拖拽排序价格表
function dragSortProductPrice(data: TableDraggedParams) {
return CDR.post({ url: DragSortProductPriceUrl, data });
}
// 下载价格表模板
function downloadProductPriceTemplate() {
return CDR.get(
{
url: DownloadProductPriceTemplateUrl,
responseType: 'blob',
},
{ isTransformResponse: false, isReturnNativeResponse: true }
);
}
// 预检查导入价格表
function preCheckImportProductPrice(file: File) {
return CDR.uploadFile<{ data: ValidateInfo }>({ url: PreCheckImportProductPriceUrl }, { fileList: [file] }, 'file');
}
// 导入价格表
function importProductPrice(file: File) {
return CDR.uploadFile({ url: ImportProductPriceUrl }, { fileList: [file] }, 'file');
}
// 导出所有的价格表
function exportProductPriceAll(data: TableExportParams) {
return CDR.post({ url: ExportAllProductPriceUrl, data });
}
// 导出选择的价格表
function exportProductPriceSelected(data: TableExportSelectedParams) {
return CDR.post({ url: ExportProductPriceUrl, data });
}
// 复制价格表
function copyProductPrice(id: string) {
return CDR.get({ url: `${CopyProductPriceUrl}/${id}` });
}
return {
addProduct,
updateProduct,
getProductList,
getProductFormConfig,
getProduct,
deleteProduct,
batchDeleteProduct,
batchUpdateProduct,
dragSortProduct,
preCheckImportProduct,
downloadProductTemplate,
importProduct,
getProductOptions,
updateProductPrice,
getProductPriceList,
addProductPrice,
getProductPrice,
deleteProductPrice,
getProductPriceFormConfig,
dragSortProductPrice,
batchUpdateProductPrice,
downloadProductPriceTemplate,
exportProductPriceAll,
exportProductPriceSelected,
preCheckImportProductPrice,
importProductPrice,
copyProductPrice,
};
}

View File

@@ -0,0 +1,19 @@
import type { CordysAxios } from '@lib/shared/api/http/Axios';
import { LocaleChangeUrl, VersionUrl } from '@lib/shared/api/requrls/sys';
import type { SystemVersion } from '@lib/shared/models/common';
export default function useSysApi(CDR: CordysAxios) {
// 获取系统版本信息
function getSystemVersion() {
return CDR.get<SystemVersion>({ url: VersionUrl });
}
function changeLocaleBackEnd(language: string) {
return CDR.post({ url: LocaleChangeUrl, data: { language } });
}
return {
getSystemVersion,
changeLocaleBackEnd,
};
}

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,
};
}