模块取出
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
export * from './workcase'
|
||||
export * from './workcaseChat'
|
||||
185
urbanLifelineWeb/packages/workcase/src/api/workcase/workcase.ts
Normal file
185
urbanLifelineWeb/packages/workcase/src/api/workcase/workcase.ts
Normal file
@@ -0,0 +1,185 @@
|
||||
import { api } from 'shared/api'
|
||||
import type { ResultDomain, PageRequest } from 'shared/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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
import { api } from 'shared/api'
|
||||
import type { ResultDomain, PageRequest } from 'shared/types'
|
||||
import type {
|
||||
TbChatRoomDTO,
|
||||
TbChatRoomMemberDTO,
|
||||
TbChatRoomMessageDTO,
|
||||
TbCustomerServiceDTO,
|
||||
TbWordCloudDTO,
|
||||
ChatRoomVO,
|
||||
ChatMemberVO,
|
||||
ChatRoomMessageVO,
|
||||
CustomerServiceVO
|
||||
} from '@/types/workcase'
|
||||
|
||||
/**
|
||||
* @description 工单对话相关接口(ChatRoom、客服、词云管理)
|
||||
* @filename workcaseChat.ts
|
||||
* @author cascade
|
||||
* @copyright xyzh
|
||||
* @since 2025-12-22
|
||||
*/
|
||||
export const workcaseChatAPI = {
|
||||
baseUrl: '/urban-lifeline/workcase/chat',
|
||||
|
||||
// ====================== ChatRoom聊天室管理 ======================
|
||||
|
||||
/**
|
||||
* 创建聊天室
|
||||
*/
|
||||
async createChatRoom(chatRoom: TbChatRoomDTO): Promise<ResultDomain<TbChatRoomDTO>> {
|
||||
const response = await api.post<TbChatRoomDTO>(`${this.baseUrl}/room`, chatRoom)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新聊天室
|
||||
*/
|
||||
async updateChatRoom(chatRoom: TbChatRoomDTO): Promise<ResultDomain<TbChatRoomDTO>> {
|
||||
const response = await api.put<TbChatRoomDTO>(`${this.baseUrl}/room`, chatRoom)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 关闭聊天室
|
||||
*/
|
||||
async closeChatRoom(roomId: string, closedBy: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.post<boolean>(`${this.baseUrl}/room/${roomId}/close`, null, {
|
||||
params: { closedBy }
|
||||
})
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取聊天室详情
|
||||
*/
|
||||
async getChatRoomById(roomId: string): Promise<ResultDomain<TbChatRoomDTO>> {
|
||||
const response = await api.get<TbChatRoomDTO>(`${this.baseUrl}/room/${roomId}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询聊天室
|
||||
*/
|
||||
async getChatRoomPage(pageRequest: PageRequest<TbChatRoomDTO>): Promise<ResultDomain<ChatRoomVO>> {
|
||||
const response = await api.post<ChatRoomVO>(`${this.baseUrl}/room/page`, pageRequest)
|
||||
return response.data
|
||||
},
|
||||
|
||||
// ====================== ChatRoom成员管理 ======================
|
||||
|
||||
/**
|
||||
* 添加聊天室成员
|
||||
*/
|
||||
async addChatRoomMember(member: TbChatRoomMemberDTO): Promise<ResultDomain<TbChatRoomMemberDTO>> {
|
||||
const response = await api.post<TbChatRoomMemberDTO>(`${this.baseUrl}/room/member`, member)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 移除聊天室成员
|
||||
*/
|
||||
async removeChatRoomMember(memberId: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.delete<boolean>(`${this.baseUrl}/room/member/${memberId}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取聊天室成员列表
|
||||
*/
|
||||
async getChatRoomMemberList(roomId: string): Promise<ResultDomain<ChatMemberVO>> {
|
||||
const response = await api.get<ChatMemberVO>(`${this.baseUrl}/room/${roomId}/members`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
// ====================== ChatRoom消息管理 ======================
|
||||
|
||||
/**
|
||||
* 发送聊天室消息
|
||||
*/
|
||||
async sendMessage(message: TbChatRoomMessageDTO): Promise<ResultDomain<TbChatRoomMessageDTO>> {
|
||||
const response = await api.post<TbChatRoomMessageDTO>(`${this.baseUrl}/room/message`, message)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询聊天室消息
|
||||
*/
|
||||
async getChatMessagePage(pageRequest: PageRequest<TbChatRoomMessageDTO>): Promise<ResultDomain<ChatRoomMessageVO>> {
|
||||
const response = await api.post<ChatRoomMessageVO>(`${this.baseUrl}/room/message/page`, pageRequest)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除聊天室消息
|
||||
*/
|
||||
async deleteMessage(messageId: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.delete<boolean>(`${this.baseUrl}/room/message/${messageId}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
// ====================== 客服人员管理 ======================
|
||||
|
||||
/**
|
||||
* 添加客服人员
|
||||
*/
|
||||
async addCustomerService(customerService: TbCustomerServiceDTO): Promise<ResultDomain<TbCustomerServiceDTO>> {
|
||||
const response = await api.post<TbCustomerServiceDTO>(`${this.baseUrl}/customer-service`, customerService)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新客服人员
|
||||
*/
|
||||
async updateCustomerService(customerService: TbCustomerServiceDTO): Promise<ResultDomain<TbCustomerServiceDTO>> {
|
||||
const response = await api.put<TbCustomerServiceDTO>(`${this.baseUrl}/customer-service`, customerService)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除客服人员
|
||||
*/
|
||||
async deleteCustomerService(userId: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.delete<boolean>(`${this.baseUrl}/customer-service/${userId}`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询客服人员
|
||||
*/
|
||||
async getCustomerServicePage(pageRequest: PageRequest<TbCustomerServiceDTO>): Promise<ResultDomain<CustomerServiceVO>> {
|
||||
const response = await api.post<CustomerServiceVO>(`${this.baseUrl}/customer-service/page`, pageRequest)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新客服在线状态
|
||||
*/
|
||||
async updateCustomerServiceStatus(userId: string, status: string): Promise<ResultDomain<boolean>> {
|
||||
const response = await api.post<boolean>(`${this.baseUrl}/customer-service/${userId}/status`, null, {
|
||||
params: { status }
|
||||
})
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取可接待客服列表
|
||||
*/
|
||||
async getAvailableCustomerServices(): Promise<ResultDomain<CustomerServiceVO>> {
|
||||
const response = await api.get<CustomerServiceVO>(`${this.baseUrl}/customer-service/available`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 自动分配客服
|
||||
*/
|
||||
async assignCustomerService(roomId: string): Promise<ResultDomain<CustomerServiceVO>> {
|
||||
const response = await api.post<CustomerServiceVO>(`${this.baseUrl}/room/${roomId}/assign`)
|
||||
return response.data
|
||||
},
|
||||
|
||||
// ====================== 词云管理 ======================
|
||||
|
||||
/**
|
||||
* 添加词云
|
||||
*/
|
||||
async addWordCloud(wordCloud: TbWordCloudDTO): Promise<ResultDomain<TbWordCloudDTO>> {
|
||||
const response = await api.post<TbWordCloudDTO>(`${this.baseUrl}/wordcloud`, wordCloud)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新词云
|
||||
*/
|
||||
async updateWordCloud(wordCloud: TbWordCloudDTO): Promise<ResultDomain<TbWordCloudDTO>> {
|
||||
const response = await api.put<TbWordCloudDTO>(`${this.baseUrl}/wordcloud`, wordCloud)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询词云列表
|
||||
*/
|
||||
async getWordCloudList(filter: TbWordCloudDTO): Promise<ResultDomain<TbWordCloudDTO>> {
|
||||
const response = await api.post<TbWordCloudDTO>(`${this.baseUrl}/wordcloud/list`, filter)
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* 分页查询词云
|
||||
*/
|
||||
async getWordCloudPage(pageRequest: PageRequest<TbWordCloudDTO>): Promise<ResultDomain<TbWordCloudDTO>> {
|
||||
const response = await api.post<TbWordCloudDTO>(`${this.baseUrl}/wordcloud/page`, pageRequest)
|
||||
return response.data
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user