70 lines
1.7 KiB
JavaScript
70 lines
1.7 KiB
JavaScript
import request from "@/utils/request.js";
|
|
/**
|
|
* 获取工单列表
|
|
* @param {Object} params 查询参数
|
|
* @returns {Promise}
|
|
*/
|
|
|
|
export function getTickerList(count, page, status) {
|
|
return request.get('/api/v1/admin/work_order/list', { count, page, status })
|
|
}
|
|
|
|
// 待处理
|
|
export function getPendingTicketList(count, page) {
|
|
return getTickerList(count,page,0)
|
|
}
|
|
|
|
// 进行中
|
|
export function getProcessingTicketList(count, page) {
|
|
return getTickerList(count,page,1)
|
|
}
|
|
|
|
//已回复
|
|
export function getRepliedTicketList(count, page) {
|
|
return getTickerList(count,page,2)
|
|
}
|
|
|
|
// 已解决
|
|
export function getCompletedTicketList(count, page) {
|
|
return getTickerList(count,page,3)
|
|
}
|
|
|
|
// 获取详情
|
|
export function getTicketDetail(work_id) {
|
|
return request.get('/api/v1/admin/work_order/detail', { work_id })
|
|
}
|
|
|
|
// 回复
|
|
export function replyTicket(work_id, content, files) {
|
|
return request.post('/api/v1/admin/work_order/reply', { work_id, content, files })
|
|
}
|
|
|
|
// 关闭工单
|
|
export function closeTicket(work_id) {
|
|
return request.post('/api/v1/admin/work_order/close', { work_id })
|
|
}
|
|
|
|
export function getFile(file_id) {
|
|
return request.get('/api/v1/tool/file/down', { file_id })
|
|
}
|
|
|
|
// 获取用户头像
|
|
export function getUserAvatar(user_id) {
|
|
// TODO: 实现获取用户头像的逻辑
|
|
return `https://avatar.example.com/${user_id}`
|
|
}
|
|
|
|
// 获取文件图片
|
|
export async function getFileImage(file_id) {
|
|
let resp = await getFile(file_id)
|
|
console.log(resp.data.content)
|
|
return resp.data.content
|
|
}
|
|
|
|
// 解析多个文件ID为图片URL数组
|
|
export async function parseFilesToImages(files) {
|
|
if (!files || files === '') return []
|
|
|
|
const fileIds = files.split(',')
|
|
return await Promise.all(fileIds.map(async (id) => await getFileImage(id.trim())))
|
|
} |