web修改
This commit is contained in:
68
urbanLifelineWeb/packages/shared/src/api/ai/agent.ts
Normal file
68
urbanLifelineWeb/packages/shared/src/api/ai/agent.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import { api } from '@/api/index'
|
||||
import type { ResultDomain, PageRequest } from '@/types'
|
||||
import type { TbAgent } from '@/types/ai'
|
||||
|
||||
/**
|
||||
* @description 智能体管理接口
|
||||
* @filename agent.ts
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
* @since 2025-12-19
|
||||
*/
|
||||
export const agentAPI = {
|
||||
baseUrl: '/urban-lifeline/ai/agent',
|
||||
|
||||
/**
|
||||
* 创建智能体
|
||||
* @param agent 智能体信息
|
||||
*/
|
||||
async createAgent(agent: TbAgent): Promise<ResultDomain<TbAgent>> {
|
||||
const response = await api.post<TbAgent>(`${this.baseUrl}`, agent)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新智能体
|
||||
* @param agent 智能体信息
|
||||
*/
|
||||
async updateAgent(agent: TbAgent): Promise<ResultDomain<TbAgent>> {
|
||||
const response = await api.put<TbAgent>(`${this.baseUrl}`, agent)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除智能体
|
||||
* @param agentId 智能体ID
|
||||
*/
|
||||
async deleteAgent(agentId: string): Promise<ResultDomain<TbAgent>> {
|
||||
const response = await api.delete<TbAgent>(`${this.baseUrl}/${agentId}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取智能体详情
|
||||
* @param agentId 智能体ID
|
||||
*/
|
||||
async getAgent(agentId: string): Promise<ResultDomain<TbAgent>> {
|
||||
const response = await api.get<TbAgent>(`${this.baseUrl}/${agentId}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询智能体
|
||||
* @param pageRequest 分页请求参数
|
||||
*/
|
||||
async getAgentPage(pageRequest: PageRequest<TbAgent>): Promise<ResultDomain<TbAgent>> {
|
||||
const response = await api.post<TbAgent>(`${this.baseUrl}/page`, pageRequest)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取智能体列表
|
||||
* @param filter 筛选条件
|
||||
*/
|
||||
async getAgentList(filter?: TbAgent): Promise<ResultDomain<TbAgent>> {
|
||||
const response = await api.get<TbAgent>(`${this.baseUrl}/list`, { params: filter })
|
||||
return response.data
|
||||
}
|
||||
}
|
||||
262
urbanLifelineWeb/packages/shared/src/api/ai/aiKnowledge.ts
Normal file
262
urbanLifelineWeb/packages/shared/src/api/ai/aiKnowledge.ts
Normal file
@@ -0,0 +1,262 @@
|
||||
import { api } from '@/api/index'
|
||||
import type { ResultDomain, PageRequest } from '@/types'
|
||||
import type { TbKnowledge, TbKnowledgeFile, SegmentRequestBody, DocumentStatusRequestBody } from '@/types/ai'
|
||||
|
||||
/**
|
||||
* @description AI知识库相关接口
|
||||
* @filename aiKnowledge.ts
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
* @since 2025-12-19
|
||||
*/
|
||||
export const aiKnowledgeAPI = {
|
||||
baseUrl: '/urban-lifeline/ai/knowledge',
|
||||
|
||||
// ====================== 知识库管理 ======================
|
||||
|
||||
/**
|
||||
* 创建知识库
|
||||
* @param knowledge 知识库信息
|
||||
*/
|
||||
async createKnowledge(knowledge: TbKnowledge): Promise<ResultDomain<TbKnowledge>> {
|
||||
const response = await api.post<TbKnowledge>(`${this.baseUrl}`, knowledge)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新知识库
|
||||
* @param knowledge 知识库信息
|
||||
*/
|
||||
async updateKnowledge(knowledge: TbKnowledge): Promise<ResultDomain<TbKnowledge>> {
|
||||
const response = await api.put<TbKnowledge>(`${this.baseUrl}`, knowledge)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除知识库
|
||||
* @param knowledgeId 知识库ID
|
||||
*/
|
||||
async deleteKnowledge(knowledgeId: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.delete<boolean>(`${this.baseUrl}/${knowledgeId}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取知识库详情
|
||||
* @param knowledgeId 知识库ID
|
||||
*/
|
||||
async getKnowledge(knowledgeId: string): Promise<ResultDomain<TbKnowledge>> {
|
||||
const response = await api.get<TbKnowledge>(`${this.baseUrl}/${knowledgeId}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询知识库列表
|
||||
* @param filter 筛选条件
|
||||
*/
|
||||
async listKnowledges(filter?: TbKnowledge): Promise<ResultDomain<TbKnowledge>> {
|
||||
const response = await api.post<TbKnowledge>(`${this.baseUrl}/list`, filter || {})
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询知识库
|
||||
* @param pageRequest 分页请求
|
||||
*/
|
||||
async pageKnowledges(pageRequest: PageRequest<TbKnowledge>): Promise<ResultDomain<TbKnowledge>> {
|
||||
const response = await api.post<TbKnowledge>(`${this.baseUrl}/page`, pageRequest)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取知识库统计信息
|
||||
* @param knowledgeId 知识库ID
|
||||
*/
|
||||
async getKnowledgeStats(knowledgeId: string): Promise<ResultDomain<TbKnowledge>> {
|
||||
const response = await api.get<TbKnowledge>(`${this.baseUrl}/${knowledgeId}/stats`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
// ====================== 文件管理 ======================
|
||||
|
||||
/**
|
||||
* 获取知识库文档列表
|
||||
* @param knowledgeId 知识库ID
|
||||
* @param page 页码
|
||||
* @param limit 每页条数
|
||||
*/
|
||||
async getDocumentList(knowledgeId: string, page = 1, limit = 20): Promise<ResultDomain<Record<string, any>>> {
|
||||
const response = await api.get<Record<string, any>>(`${this.baseUrl}/${knowledgeId}/documents`, {
|
||||
params: { page, limit }
|
||||
})
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 上传文件到知识库
|
||||
* @param file 文件
|
||||
* @param knowledgeId 知识库ID
|
||||
* @param indexingTechnique 索引方式
|
||||
*/
|
||||
async uploadToKnowledge(
|
||||
file: File,
|
||||
knowledgeId: string,
|
||||
indexingTechnique?: string
|
||||
): Promise<ResultDomain<TbKnowledgeFile>> {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
formData.append('knowledgeId', knowledgeId)
|
||||
if (indexingTechnique) {
|
||||
formData.append('indexingTechnique', indexingTechnique)
|
||||
}
|
||||
const response = await api.upload<TbKnowledgeFile>(`${this.baseUrl}/file/upload`, formData)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 批量上传文件到知识库
|
||||
* @param files 文件数组
|
||||
* @param knowledgeId 知识库ID
|
||||
* @param indexingTechnique 索引方式
|
||||
*/
|
||||
async batchUploadToKnowledge(
|
||||
files: File[],
|
||||
knowledgeId: string,
|
||||
indexingTechnique?: string
|
||||
): Promise<ResultDomain<TbKnowledgeFile>> {
|
||||
const formData = new FormData()
|
||||
files.forEach(file => formData.append('files', file))
|
||||
formData.append('knowledgeId', knowledgeId)
|
||||
if (indexingTechnique) {
|
||||
formData.append('indexingTechnique', indexingTechnique)
|
||||
}
|
||||
const response = await api.upload<TbKnowledgeFile>(`${this.baseUrl}/file/batch-upload`, formData)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新知识库文件(上传新版本)
|
||||
* @param file 文件
|
||||
* @param knowledgeId 知识库ID
|
||||
* @param fileRootId 文件根ID
|
||||
*/
|
||||
async updateFile(
|
||||
file: File,
|
||||
knowledgeId: string,
|
||||
fileRootId: string
|
||||
): Promise<ResultDomain<TbKnowledgeFile>> {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
formData.append('knowledgeId', knowledgeId)
|
||||
formData.append('fileRootId', fileRootId)
|
||||
const response = await api.uploadPut<TbKnowledgeFile>(`${this.baseUrl}/file/upload`, formData)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除知识库文件
|
||||
* @param fileId 文件ID
|
||||
*/
|
||||
async deleteFile(fileId: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.delete<boolean>(`${this.baseUrl}/file/${fileId}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取文件历史版本
|
||||
* @param fileRootId 文件根ID
|
||||
*/
|
||||
async getFileHistory(fileRootId: string): Promise<ResultDomain<TbKnowledgeFile>> {
|
||||
const response = await api.get<TbKnowledgeFile>(`${this.baseUrl}/file/${fileRootId}/history`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
// ====================== 文档分段管理 ======================
|
||||
|
||||
/**
|
||||
* 获取文档分段列表
|
||||
* @param datasetId Dify数据集ID
|
||||
* @param documentId Dify文档ID
|
||||
*/
|
||||
async getDocumentSegments(datasetId: string, documentId: string): Promise<ResultDomain<Record<string, any>>> {
|
||||
const response = await api.get<Record<string, any>>(
|
||||
`${this.baseUrl}/datasets/${datasetId}/documents/${documentId}/segments`
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建文档分段
|
||||
* @param datasetId Dify数据集ID
|
||||
* @param documentId Dify文档ID
|
||||
* @param requestBody 分段内容
|
||||
*/
|
||||
async createSegment(
|
||||
datasetId: string,
|
||||
documentId: string,
|
||||
requestBody: SegmentRequestBody
|
||||
): Promise<ResultDomain<string>> {
|
||||
const response = await api.post<string>(
|
||||
`${this.baseUrl}/datasets/${datasetId}/documents/${documentId}/segments`,
|
||||
requestBody
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新文档分段
|
||||
* @param datasetId Dify数据集ID
|
||||
* @param documentId Dify文档ID
|
||||
* @param segmentId 分段ID
|
||||
* @param requestBody 分段内容
|
||||
*/
|
||||
async updateSegment(
|
||||
datasetId: string,
|
||||
documentId: string,
|
||||
segmentId: string,
|
||||
requestBody: SegmentRequestBody
|
||||
): Promise<ResultDomain<string>> {
|
||||
const response = await api.patch<string>(
|
||||
`${this.baseUrl}/datasets/${datasetId}/documents/${documentId}/segments/${segmentId}`,
|
||||
requestBody
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除文档分段
|
||||
* @param datasetId Dify数据集ID
|
||||
* @param documentId Dify文档ID
|
||||
* @param segmentId 分段ID
|
||||
*/
|
||||
async deleteSegment(
|
||||
datasetId: string,
|
||||
documentId: string,
|
||||
segmentId: string
|
||||
): Promise<ResultDomain<string>> {
|
||||
const response = await api.delete<string>(
|
||||
`${this.baseUrl}/datasets/${datasetId}/documents/${documentId}/segments/${segmentId}`
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
|
||||
// ====================== 文档状态管理 ======================
|
||||
|
||||
/**
|
||||
* 更新文档状态(启用/禁用/归档)
|
||||
* @param datasetId Dify数据集ID
|
||||
* @param action 操作类型: enable/disable/archive/un_archive
|
||||
* @param requestBody 请求体
|
||||
*/
|
||||
async updateDocumentStatus(
|
||||
datasetId: string,
|
||||
action: 'enable' | 'disable' | 'archive' | 'un_archive',
|
||||
requestBody: DocumentStatusRequestBody
|
||||
): Promise<ResultDomain<string>> {
|
||||
const response = await api.patch<string>(
|
||||
`${this.baseUrl}/datasets/${datasetId}/documents/${action}/status`,
|
||||
requestBody
|
||||
)
|
||||
return response.data
|
||||
}
|
||||
}
|
||||
124
urbanLifelineWeb/packages/shared/src/api/ai/aichat.ts
Normal file
124
urbanLifelineWeb/packages/shared/src/api/ai/aichat.ts
Normal file
@@ -0,0 +1,124 @@
|
||||
import { api } from '@/api/index'
|
||||
import type { ResultDomain } from '@/types'
|
||||
import type { TbChat, TbChatMessage, ChatPrepareData, StopChatParams, CommentMessageParams, DifyFileInfo } from '@/types/ai'
|
||||
|
||||
/**
|
||||
* @description AI对话相关接口
|
||||
* @filename aichat.ts
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
* @since 2025-12-19
|
||||
*/
|
||||
export const aiChatAPI = {
|
||||
baseUrl: '/urban-lifeline/ai/chat',
|
||||
|
||||
// ====================== 会话管理 ======================
|
||||
|
||||
/**
|
||||
* 创建会话
|
||||
* @param chat 会话信息
|
||||
*/
|
||||
async createChat(chat: TbChat): Promise<ResultDomain<TbChat>> {
|
||||
const response = await api.post<TbChat>(`${this.baseUrl}/conversation`, chat)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新会话
|
||||
* @param chat 会话信息
|
||||
*/
|
||||
async updateChat(chat: TbChat): Promise<ResultDomain<TbChat>> {
|
||||
const response = await api.put<TbChat>(`${this.baseUrl}/conversation`, chat)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除会话
|
||||
* @param chat 会话信息
|
||||
*/
|
||||
async deleteChat(chat: TbChat): Promise<ResultDomain<TbChat>> {
|
||||
const response = await api.delete<TbChat>(`${this.baseUrl}/conversation`, { data: chat })
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取会话列表
|
||||
* @param filter 筛选条件
|
||||
*/
|
||||
async getChatList(filter: TbChat): Promise<ResultDomain<TbChat>> {
|
||||
const response = await api.get<TbChat>(`${this.baseUrl}/conversations`, { data: filter })
|
||||
return response.data
|
||||
},
|
||||
|
||||
// ====================== 消息管理 ======================
|
||||
|
||||
/**
|
||||
* 获取对话消息列表
|
||||
* @param filter 筛选条件
|
||||
*/
|
||||
async getMessageList(filter: TbChat): Promise<ResultDomain<TbChatMessage>> {
|
||||
const response = await api.post<TbChatMessage>(`${this.baseUrl}/messages`, filter)
|
||||
return response.data
|
||||
},
|
||||
|
||||
// ====================== 流式对话 ======================
|
||||
|
||||
/**
|
||||
* 准备流式对话会话数据
|
||||
* @param chatPrepareData 对话预处理数据
|
||||
*/
|
||||
async prepareStreamChat(chatPrepareData: ChatPrepareData): Promise<ResultDomain<string>> {
|
||||
const response = await api.post<string>(`${this.baseUrl}/stream/prepare`, chatPrepareData)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取流式对话SSE URL
|
||||
* @param sessionId 会话ID
|
||||
*/
|
||||
getStreamChatUrl(sessionId: string): string {
|
||||
return `${this.baseUrl}/stream?sessionId=${sessionId}`
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建流式对话 EventSource
|
||||
* @param sessionId 会话ID
|
||||
*/
|
||||
createStreamChat(sessionId: string): EventSource {
|
||||
const url = this.getStreamChatUrl(sessionId)
|
||||
return new EventSource(url)
|
||||
},
|
||||
|
||||
/**
|
||||
* 停止对话
|
||||
* @param params 停止参数
|
||||
*/
|
||||
async stopChat(params: StopChatParams): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.post<boolean>(`${this.baseUrl}/stop`, params)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 评价消息
|
||||
* @param params 评价参数
|
||||
*/
|
||||
async commentMessage(params: CommentMessageParams): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.post<boolean>(`${this.baseUrl}/comment`, params)
|
||||
return response.data
|
||||
},
|
||||
|
||||
// ====================== 文件上传 ======================
|
||||
|
||||
/**
|
||||
* 上传文件用于对话(图文多模态)
|
||||
* @param file 文件
|
||||
* @param agentId 智能体ID
|
||||
*/
|
||||
async uploadFileForChat(file: File, agentId: string): Promise<ResultDomain<DifyFileInfo>> {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
formData.append('agentId', agentId)
|
||||
const response = await api.uploadPut<DifyFileInfo>(`${this.baseUrl}/file/upload`, formData)
|
||||
return response.data
|
||||
}
|
||||
}
|
||||
3
urbanLifelineWeb/packages/shared/src/api/ai/index.ts
Normal file
3
urbanLifelineWeb/packages/shared/src/api/ai/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './agent'
|
||||
export * from './aichat'
|
||||
export * from './aiKnowledge'
|
||||
@@ -265,16 +265,17 @@ export const api = {
|
||||
},
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* 文件上传 (POST) - 使用 axios postForm
|
||||
*/
|
||||
upload<T = any>(url: string, formData: FormData, config?: CustomAxiosRequestConfig): Promise<AxiosResponse<ResultDomain<T>>> {
|
||||
return request.post<ResultDomain<T>>(url, formData, {
|
||||
...config,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
...(config?.headers as Record<string, string>)
|
||||
}
|
||||
});
|
||||
return request.postForm<ResultDomain<T>>(url, formData, config);
|
||||
},
|
||||
|
||||
/**
|
||||
* 文件上传 (PUT) - 使用 axios putForm
|
||||
*/
|
||||
uploadPut<T = any>(url: string, formData: FormData, config?: CustomAxiosRequestConfig): Promise<AxiosResponse<ResultDomain<T>>> {
|
||||
return request.putForm<ResultDomain<T>>(url, formData, config);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export * from './workcase'
|
||||
185
urbanLifelineWeb/packages/shared/src/api/workcase/workcase.ts
Normal file
185
urbanLifelineWeb/packages/shared/src/api/workcase/workcase.ts
Normal file
@@ -0,0 +1,185 @@
|
||||
import { api } from '@/api/index'
|
||||
import type { ResultDomain, PageRequest } from '@/types'
|
||||
import type { TbWorkcaseDTO, TbWorkcaseProcessDTO, TbWorkcaseDeviceDTO } from '@/types/workcase'
|
||||
|
||||
/**
|
||||
* @description 工单管理接口
|
||||
* @filename workcase.ts
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
* @since 2025-12-19
|
||||
*/
|
||||
export const workcaseAPI = {
|
||||
baseUrl: '/urban-lifeline/workcase',
|
||||
|
||||
// ========================= 工单管理 =========================
|
||||
|
||||
/**
|
||||
* 创建工单
|
||||
* @param workcase 工单信息
|
||||
*/
|
||||
async createWorkcase(workcase: TbWorkcaseDTO): Promise<ResultDomain<TbWorkcaseDTO>> {
|
||||
const response = await api.post<TbWorkcaseDTO>(`${this.baseUrl}`, workcase)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新工单
|
||||
* @param workcase 工单信息
|
||||
*/
|
||||
async updateWorkcase(workcase: TbWorkcaseDTO): Promise<ResultDomain<TbWorkcaseDTO>> {
|
||||
const response = await api.put<TbWorkcaseDTO>(`${this.baseUrl}`, workcase)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除工单
|
||||
* @param workcaseId 工单ID
|
||||
*/
|
||||
async deleteWorkcase(workcaseId: string): Promise<ResultDomain<TbWorkcaseDTO>> {
|
||||
const response = await api.delete<TbWorkcaseDTO>(`${this.baseUrl}/${workcaseId}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取工单详情
|
||||
* @param workcaseId 工单ID
|
||||
*/
|
||||
async getWorkcaseById(workcaseId: string): Promise<ResultDomain<TbWorkcaseDTO>> {
|
||||
const response = await api.get<TbWorkcaseDTO>(`${this.baseUrl}/${workcaseId}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询工单列表
|
||||
* @param filter 筛选条件
|
||||
*/
|
||||
async getWorkcaseList(filter?: TbWorkcaseDTO): Promise<ResultDomain<TbWorkcaseDTO>> {
|
||||
const response = await api.post<TbWorkcaseDTO>(`${this.baseUrl}/list`, filter || {})
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询工单
|
||||
* @param pageRequest 分页请求
|
||||
*/
|
||||
async getWorkcasePage(pageRequest: PageRequest<TbWorkcaseDTO>): Promise<ResultDomain<TbWorkcaseDTO>> {
|
||||
const response = await api.post<TbWorkcaseDTO>(`${this.baseUrl}/page`, pageRequest)
|
||||
return response.data
|
||||
},
|
||||
|
||||
// ========================= CRM同步接口 =========================
|
||||
|
||||
/**
|
||||
* 同步工单到CRM
|
||||
* @param workcase 工单信息
|
||||
*/
|
||||
async syncWorkcaseToCrm(workcase: TbWorkcaseDTO): Promise<ResultDomain<void>> {
|
||||
const response = await api.post<void>(`${this.baseUrl}/sync/crm`, workcase)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 接收CRM工单更新(CRM回调)
|
||||
* @param jsonBody JSON字符串
|
||||
*/
|
||||
async receiveWorkcaseFromCrm(jsonBody: string): Promise<ResultDomain<void>> {
|
||||
const response = await api.post<void>(`${this.baseUrl}/receive/crm`, jsonBody)
|
||||
return response.data
|
||||
},
|
||||
|
||||
// ========================= 工单处理过程 =========================
|
||||
|
||||
/**
|
||||
* 创建工单处理过程
|
||||
* @param process 处理过程信息
|
||||
*/
|
||||
async createWorkcaseProcess(process: TbWorkcaseProcessDTO): Promise<ResultDomain<TbWorkcaseProcessDTO>> {
|
||||
const response = await api.post<TbWorkcaseProcessDTO>(`${this.baseUrl}/process`, process)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新工单处理过程
|
||||
* @param process 处理过程信息
|
||||
*/
|
||||
async updateWorkcaseProcess(process: TbWorkcaseProcessDTO): Promise<ResultDomain<TbWorkcaseProcessDTO>> {
|
||||
const response = await api.put<TbWorkcaseProcessDTO>(`${this.baseUrl}/process`, process)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除工单处理过程
|
||||
* @param processId 处理过程ID
|
||||
*/
|
||||
async deleteWorkcaseProcess(processId: string): Promise<ResultDomain<TbWorkcaseProcessDTO>> {
|
||||
const response = await api.delete<TbWorkcaseProcessDTO>(`${this.baseUrl}/process/${processId}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询工单处理过程列表
|
||||
* @param filter 筛选条件
|
||||
*/
|
||||
async getWorkcaseProcessList(filter?: TbWorkcaseProcessDTO): Promise<ResultDomain<TbWorkcaseProcessDTO>> {
|
||||
const response = await api.post<TbWorkcaseProcessDTO>(`${this.baseUrl}/process/list`, filter || {})
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询工单处理过程
|
||||
* @param pageRequest 分页请求
|
||||
*/
|
||||
async getWorkcaseProcessPage(pageRequest: PageRequest<TbWorkcaseProcessDTO>): Promise<ResultDomain<TbWorkcaseProcessDTO>> {
|
||||
const response = await api.post<TbWorkcaseProcessDTO>(`${this.baseUrl}/process/page`, pageRequest)
|
||||
return response.data
|
||||
},
|
||||
|
||||
// ========================= 工单设备管理 =========================
|
||||
|
||||
/**
|
||||
* 创建工单设备
|
||||
* @param device 设备信息
|
||||
*/
|
||||
async createWorkcaseDevice(device: TbWorkcaseDeviceDTO): Promise<ResultDomain<TbWorkcaseDeviceDTO>> {
|
||||
const response = await api.post<TbWorkcaseDeviceDTO>(`${this.baseUrl}/device`, device)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新工单设备
|
||||
* @param device 设备信息
|
||||
*/
|
||||
async updateWorkcaseDevice(device: TbWorkcaseDeviceDTO): Promise<ResultDomain<TbWorkcaseDeviceDTO>> {
|
||||
const response = await api.put<TbWorkcaseDeviceDTO>(`${this.baseUrl}/device`, device)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除工单设备
|
||||
* @param workcaseId 工单ID
|
||||
* @param device 设备名称
|
||||
*/
|
||||
async deleteWorkcaseDevice(workcaseId: string, device: string): Promise<ResultDomain<TbWorkcaseDeviceDTO>> {
|
||||
const response = await api.delete<TbWorkcaseDeviceDTO>(`${this.baseUrl}/device/${workcaseId}/${device}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询工单设备列表
|
||||
* @param filter 筛选条件
|
||||
*/
|
||||
async getWorkcaseDeviceList(filter?: TbWorkcaseDeviceDTO): Promise<ResultDomain<TbWorkcaseDeviceDTO>> {
|
||||
const response = await api.post<TbWorkcaseDeviceDTO>(`${this.baseUrl}/device/list`, filter || {})
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询工单设备
|
||||
* @param pageRequest 分页请求
|
||||
*/
|
||||
async getWorkcaseDevicePage(pageRequest: PageRequest<TbWorkcaseDeviceDTO>): Promise<ResultDomain<TbWorkcaseDeviceDTO>> {
|
||||
const response = await api.post<TbWorkcaseDeviceDTO>(`${this.baseUrl}/device/page`, pageRequest)
|
||||
return response.data
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user