杂务:新增声明级注释覆盖率

This commit is contained in:
xiaowang
2026-05-23 18:44:57 +08:00
parent 8f038894e7
commit 844516988b
234 changed files with 8356 additions and 0 deletions
+132
View File
@@ -141,18 +141,70 @@ import { userApi } from '@/api/user'
import type { IdType } from '@/utils/id'
import { runWithGlobalLoading } from '@/utils/action-loading'
/**
* Purpose: router supports OrderView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
/**
* Purpose: orders supports OrderView.vue by holding or executing the orders page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const orders = ref<any[]>([])
/**
* Purpose: imageIdCache supports OrderView.vue by holding or executing the image id cache page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const imageIdCache = ref<Record<string, string>>({})
/**
* Purpose: pendingReviews supports OrderView.vue by holding or executing the pending reviews page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pendingReviews = ref<OrderArtistReviewVO[]>([])
/**
* Purpose: orderReviews supports OrderView.vue by holding or executing the order reviews page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const orderReviews = ref<Record<string, OrderArtistReviewVO[]>>({})
/**
* Purpose: pendingChangeRequests supports OrderView.vue by holding or executing the pending change requests page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pendingChangeRequests = ref<OrderArtistChangeRequestVO[]>([])
/**
* Purpose: reviewModalOpen supports OrderView.vue by holding or executing the review modal open page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const reviewModalOpen = ref(false)
/**
* Purpose: reviewSubmitting supports OrderView.vue by holding or executing the review submitting page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const reviewSubmitting = ref(false)
/**
* Purpose: activeReview supports OrderView.vue by holding or executing the active review page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const activeReview = ref<OrderArtistReviewVO | null>(null)
/**
* Purpose: rejectModalOpen supports OrderView.vue by holding or executing the reject modal open page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const rejectModalOpen = ref(false)
/**
* Purpose: changeProcessing supports OrderView.vue by holding or executing the change processing page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const changeProcessing = ref(false)
/**
* Purpose: activeChangeRequest supports OrderView.vue by holding or executing the active change request page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const activeChangeRequest = ref<OrderArtistChangeRequestVO | null>(null)
/**
* Purpose: filters supports OrderView.vue by holding or executing the filters page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const filters = reactive({
keyword: '',
status: 'all' as 'all' | number,
@@ -160,10 +212,18 @@ const filters = reactive({
minAmount: undefined as number | undefined,
maxAmount: undefined as number | undefined
})
/**
* Purpose: reviewForm supports OrderView.vue by holding or executing the review form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const reviewForm = reactive({
rating: undefined as number | undefined,
content: ''
})
/**
* Purpose: rejectForm supports OrderView.vue by holding or executing the reject form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const rejectForm = reactive({
rejectReason: ''
})
@@ -201,10 +261,18 @@ const statusClass = (status: number) => {
return 'cancelled'
}
/**
* Purpose: sameId supports OrderView.vue by holding or executing the same id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const sameId = (left: unknown, right: unknown) => {
return left !== undefined && left !== null && right !== undefined && right !== null && String(left) === String(right)
}
/**
* Purpose: embeddedForItem supports OrderView.vue by holding or executing the embedded for item page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const embeddedForItem = <T extends { orderItemId?: IdType }>(order: any, item: any, field: string): T | undefined => {
const itemValue = item?.[field] as T | undefined
if (itemValue) return itemValue
@@ -213,24 +281,40 @@ const embeddedForItem = <T extends { orderItemId?: IdType }>(order: any, item: a
return sameId(orderValue.orderItemId, item.id) || (order.items || []).length === 1 ? orderValue : undefined
}
/**
* Purpose: pendingReviewForItem supports OrderView.vue by holding or executing the pending review for item page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pendingReviewForItem = (order: any, item: any): OrderArtistReviewVO | undefined => {
const embedded = embeddedForItem<OrderArtistReviewVO>(order, item, 'pendingReview')
if (embedded) return embedded
return pendingReviews.value.find(review => sameId(review.orderId, order.id) && sameId(review.orderItemId, item.id))
}
/**
* Purpose: submittedReviewForItem supports OrderView.vue by holding or executing the submitted review for item page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const submittedReviewForItem = (order: any, item: any): OrderArtistReviewVO | undefined => {
const embedded = embeddedForItem<OrderArtistReviewVO>(order, item, 'reviewSummary')
if (embedded) return embedded
return (orderReviews.value[String(order.id)] || []).find(review => sameId(review.orderItemId, item.id) && Number(review.status) === 1)
}
/**
* Purpose: pendingChangeRequestForItem supports OrderView.vue by holding or executing the pending change request for item page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const pendingChangeRequestForItem = (order: any, item: any): OrderArtistChangeRequestVO | undefined => {
const embedded = embeddedForItem<OrderArtistChangeRequestVO>(order, item, 'pendingArtistChangeRequest')
if (embedded) return embedded
return pendingChangeRequests.value.find(request => sameId(request.orderId, order.id) && sameId(request.orderItemId, item.id))
}
/**
* Purpose: formatRating supports OrderView.vue by holding or executing the format rating page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const formatRating = (rating?: number) => {
return Number(rating || 0).toFixed(1)
}
@@ -244,6 +328,10 @@ const resetFilters = () => {
filters.maxAmount = undefined
}
/**
* Purpose: copyOrderNo supports OrderView.vue by holding or executing the copy order no page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const copyOrderNo = async (orderNo: string) => {
try {
await navigator.clipboard.writeText(orderNo)
@@ -253,6 +341,10 @@ const copyOrderNo = async (orderNo: string) => {
}
}
/**
* Purpose: loadPendingReviews supports OrderView.vue by holding or executing the load pending reviews page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadPendingReviews = async () => {
try {
pendingReviews.value = (await orderApi.getMyPendingReviews()) || []
@@ -261,6 +353,10 @@ const loadPendingReviews = async () => {
}
}
/**
* Purpose: loadOrderReviews supports OrderView.vue by holding or executing the load order reviews page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadOrderReviews = async () => {
const orderIds = orders.value.map(order => order.id).filter(Boolean)
const entries = await Promise.all(orderIds.map(async (orderId) => {
@@ -273,6 +369,10 @@ const loadOrderReviews = async () => {
orderReviews.value = Object.fromEntries(entries)
}
/**
* Purpose: loadPendingArtistChangeRequests supports OrderView.vue by holding or executing the load pending artist change requests page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const loadPendingArtistChangeRequests = async () => {
try {
pendingChangeRequests.value = (await orderApi.getMyPendingArtistChangeRequests()) || []
@@ -281,6 +381,10 @@ const loadPendingArtistChangeRequests = async () => {
}
}
/**
* Purpose: refreshOrderExtensions supports OrderView.vue by holding or executing the refresh order extensions page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const refreshOrderExtensions = async () => {
await Promise.all([
loadPendingReviews(),
@@ -319,6 +423,10 @@ const loadOrders = async () => {
}
}
/**
* Purpose: openReviewModal supports OrderView.vue by holding or executing the open review modal page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openReviewModal = (review?: OrderArtistReviewVO) => {
if (!review) return
activeReview.value = review
@@ -327,6 +435,10 @@ const openReviewModal = (review?: OrderArtistReviewVO) => {
reviewModalOpen.value = true
}
/**
* Purpose: closeReviewModal supports OrderView.vue by holding or executing the close review modal page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const closeReviewModal = () => {
reviewModalOpen.value = false
activeReview.value = null
@@ -334,6 +446,10 @@ const closeReviewModal = () => {
reviewForm.content = ''
}
/**
* Purpose: submitReview supports OrderView.vue by holding or executing the submit review page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const submitReview = async () => {
if (!activeReview.value) return
const rating = Number(reviewForm.rating)
@@ -363,6 +479,10 @@ const submitReview = async () => {
}
}
/**
* Purpose: approveArtistChange supports OrderView.vue by holding or executing the approve artist change page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const approveArtistChange = (request?: OrderArtistChangeRequestVO) => {
if (!request) return
Modal.confirm({
@@ -382,6 +502,10 @@ const approveArtistChange = (request?: OrderArtistChangeRequestVO) => {
})
}
/**
* Purpose: openRejectArtistChange supports OrderView.vue by holding or executing the open reject artist change page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const openRejectArtistChange = (request?: OrderArtistChangeRequestVO) => {
if (!request) return
activeChangeRequest.value = request
@@ -389,12 +513,20 @@ const openRejectArtistChange = (request?: OrderArtistChangeRequestVO) => {
rejectModalOpen.value = true
}
/**
* Purpose: closeRejectArtistChange supports OrderView.vue by holding or executing the close reject artist change page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const closeRejectArtistChange = () => {
rejectModalOpen.value = false
activeChangeRequest.value = null
rejectForm.rejectReason = ''
}
/**
* Purpose: submitRejectArtistChange supports OrderView.vue by holding or executing the submit reject artist change page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const submitRejectArtistChange = async () => {
if (!activeChangeRequest.value) return
changeProcessing.value = true