新增页面按钮目录与菜单同步三级按钮;增强我的订单(问题件/理赔件、费用、详情抽屉)、Nana 助手、联系客服、渠道问题模板及登录/RBAC 等相关功能。 Co-authored-by: Cursor <cursoragent@cursor.com>
77 lines
2.6 KiB
TypeScript
77 lines
2.6 KiB
TypeScript
import { axiosInstance } from '@/api/rbac'
|
|
import { assertBusinessOk, omsUrl, parseListPayload } from '@/api/oms/common'
|
|
|
|
export interface NoticeDto {
|
|
id?: number
|
|
noticeType?: 'notice' | 'message'
|
|
noticeTypeName?: string
|
|
title?: string
|
|
content?: string
|
|
isPopup?: 0 | 1
|
|
receiverType?: 'user' | 'customer'
|
|
receiverTypeName?: string
|
|
receiverIds?: Array<number | string>
|
|
receiverSelectionIds?: Array<number | string>
|
|
readCount?: number
|
|
receiverCount?: number
|
|
createTime?: string
|
|
updateTime?: string
|
|
}
|
|
|
|
export async function getNoticeList(params: {
|
|
page?: number
|
|
pageSize?: number
|
|
noticeType?: string
|
|
receiverType?: string
|
|
keyword?: string
|
|
}) {
|
|
const res = await axiosInstance.get(omsUrl('/system/notice/list'), { params })
|
|
return parseListPayload(res.data)
|
|
}
|
|
|
|
export async function createNotice(body: Omit<NoticeDto, 'id' | 'noticeTypeName' | 'receiverTypeName' | 'readCount' | 'receiverCount' | 'createTime' | 'updateTime'>) {
|
|
const res = await axiosInstance.post(omsUrl('/system/notice/create'), body)
|
|
assertBusinessOk(res.data)
|
|
}
|
|
|
|
export async function updateNotice(
|
|
body: Omit<NoticeDto, 'noticeTypeName' | 'receiverTypeName' | 'readCount' | 'receiverCount' | 'createTime' | 'updateTime'> & { id: number | string }
|
|
) {
|
|
const res = await axiosInstance.post(omsUrl('/system/notice/update'), body)
|
|
assertBusinessOk(res.data)
|
|
}
|
|
|
|
export async function deleteNotice(id: number | string) {
|
|
const res = await axiosInstance.post(omsUrl('/system/notice/delete'), { id })
|
|
assertBusinessOk(res.data)
|
|
}
|
|
|
|
export async function confirmNoticeRead(id: number | string) {
|
|
const res = await axiosInstance.post(omsUrl('/system/notice/read-confirm'), { id })
|
|
assertBusinessOk(res.data)
|
|
}
|
|
|
|
export interface NoticeReceiverOption {
|
|
value: number
|
|
label: string
|
|
extra?: string
|
|
}
|
|
|
|
export async function getNoticeReceiverOptions(params: {
|
|
receiverType: 'user' | 'customer'
|
|
keyword?: string
|
|
page?: number
|
|
pageSize?: number
|
|
}) {
|
|
const res = await axiosInstance.get(omsUrl('/system/notice/receiver-options'), { params })
|
|
const payload = res.data?.data ?? res.data?.Data ?? res.data ?? {}
|
|
const itemsRaw = payload.items ?? payload.Items ?? []
|
|
const total = Number(payload.total ?? payload.Total ?? 0)
|
|
const items = (Array.isArray(itemsRaw) ? itemsRaw : []).map((item: Record<string, unknown>) => ({
|
|
value: Number(item.value ?? item.Value ?? 0),
|
|
label: String(item.label ?? item.Label ?? ''),
|
|
extra: item.extra != null || item.Extra != null ? String(item.extra ?? item.Extra ?? '') : undefined,
|
|
})).filter((item) => item.value > 0)
|
|
return { items, total }
|
|
}
|