杂务:新增声明级注释覆盖率
This commit is contained in:
@@ -219,6 +219,10 @@
|
||||
*/
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
/**
|
||||
* Purpose: Shop supports OrdersView.vue by holding or executing the shop page or API role.
|
||||
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
import { adminOrderApi, adminShopApi, type Shop } from '@/api/admin'
|
||||
import { usePermission } from '@/utils/permission'
|
||||
import type { IdType } from '@/utils/id'
|
||||
@@ -229,12 +233,32 @@ import AdminMobileCardList from '@/components/admin/AdminMobileCardList.vue'
|
||||
import AdminResponsiveModal from '@/components/admin/AdminResponsiveModal.vue'
|
||||
|
||||
const { isMobile } = useAdminViewport()
|
||||
/**
|
||||
* Purpose: orders supports OrdersView.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[]>([])
|
||||
/** loading is a reactive state variable used by the template and event handlers. */
|
||||
const loading = ref(false)
|
||||
/**
|
||||
* Purpose: shopLoading supports OrdersView.vue by holding or executing the shop loading 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 shopLoading = ref(false)
|
||||
/**
|
||||
* Purpose: currentOrder supports OrdersView.vue by holding or executing the current order 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 currentOrder = ref<any | null>(null)
|
||||
/**
|
||||
* Purpose: currentUserType supports OrdersView.vue by holding or executing the current user type 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 currentUserType = ref<number | null>(null)
|
||||
/**
|
||||
* Purpose: currentUserInfo supports OrdersView.vue by holding or executing the current user info 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 currentUserInfo = (() => {
|
||||
try {
|
||||
const cached = localStorage.getItem('adminUserInfo') || sessionStorage.getItem('adminUserInfo')
|
||||
@@ -246,14 +270,50 @@ const currentUserInfo = (() => {
|
||||
})()
|
||||
/** keyword is a reactive state variable used by the template and event handlers. */
|
||||
const keyword = ref('')
|
||||
/**
|
||||
* Purpose: statusFilter supports OrdersView.vue by holding or executing the status filter 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 statusFilter = ref<'all' | string>('all')
|
||||
/**
|
||||
* Purpose: shopList supports OrdersView.vue by holding or executing the shop list 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 shopList = ref<Shop[]>([])
|
||||
/**
|
||||
* Purpose: shopFilter supports OrdersView.vue by holding or executing the shop filter 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 shopFilter = ref<string | undefined>()
|
||||
/**
|
||||
* Purpose: artistKeyword supports OrdersView.vue by holding or executing the artist keyword 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 artistKeyword = ref('')
|
||||
/**
|
||||
* Purpose: userKeyword supports OrdersView.vue by holding or executing the user keyword 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 userKeyword = ref('')
|
||||
/**
|
||||
* Purpose: createRange supports OrdersView.vue by holding or executing the create range 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 createRange = ref<[string, string] | undefined>()
|
||||
/**
|
||||
* Purpose: appointmentRange supports OrdersView.vue by holding or executing the appointment range 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 appointmentRange = ref<[string, string] | undefined>()
|
||||
/**
|
||||
* Purpose: minAmount supports OrdersView.vue by holding or executing the min amount 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 minAmount = ref<number | undefined>()
|
||||
/**
|
||||
* Purpose: maxAmount supports OrdersView.vue by holding or executing the max amount 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 maxAmount = ref<number | undefined>()
|
||||
const { hasPermission, loadUserPermissions } = usePermission()
|
||||
|
||||
@@ -266,6 +326,10 @@ const detailVisible = computed({
|
||||
const canProcessOrders = computed(() => hasPermission('order:process'))
|
||||
/** isArtist is a reactive state variable used by the template and event handlers. */
|
||||
const isArtist = computed(() => currentUserType.value === 3)
|
||||
/**
|
||||
* Purpose: statusOptions supports OrdersView.vue by holding or executing the status options 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 statusOptions = [
|
||||
{ label: '全部状态', value: 'all' },
|
||||
{ label: '待处理', value: '1' },
|
||||
@@ -301,12 +365,20 @@ const filteredOrders = computed(() => {
|
||||
})
|
||||
})
|
||||
|
||||
/**
|
||||
* Purpose: matchText supports OrdersView.vue by holding or executing the match text 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 matchText = (needle: string, values: any[]) => {
|
||||
const normalized = needle.trim().toLowerCase()
|
||||
if (!normalized) return true
|
||||
return values.some(value => String(value ?? '').toLowerCase().includes(normalized))
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: matchRange supports OrdersView.vue by holding or executing the match range 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 matchRange = (value: string | undefined, range?: [string, string], candidates?: string[]) => {
|
||||
if (!range?.length) return true
|
||||
const values = candidates?.length ? candidates : [value]
|
||||
@@ -319,6 +391,10 @@ const matchRange = (value: string | undefined, range?: [string, string], candida
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: resetFilters supports OrdersView.vue by holding or executing the reset 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 resetFilters = () => {
|
||||
keyword.value = ''
|
||||
statusFilter.value = 'all'
|
||||
@@ -332,6 +408,10 @@ const resetFilters = () => {
|
||||
void loadOrders()
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: columns supports OrdersView.vue by holding or executing the columns 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 columns = [
|
||||
{ title: '订单编号', dataIndex: 'orderNo', key: 'orderNo' },
|
||||
{ title: '用户ID', dataIndex: 'userId', key: 'userId', width: 100 },
|
||||
@@ -343,6 +423,10 @@ const columns = [
|
||||
{ title: '操作', key: 'actions', width: 180 }
|
||||
]
|
||||
|
||||
/**
|
||||
* Purpose: itemColumns supports OrdersView.vue by holding or executing the item columns 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 itemColumns = [
|
||||
{ title: '商品ID', dataIndex: 'productId', key: 'productId', width: 100 },
|
||||
{ title: '商品名称', dataIndex: 'productTitle', key: 'productTitle' },
|
||||
@@ -361,6 +445,10 @@ const statusColor = (status: number) => {
|
||||
return 'default'
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: normalizeUserType supports OrdersView.vue by holding or executing the normalize user type 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 normalizeUserType = (value: unknown) => {
|
||||
const type = Number(value)
|
||||
return Number.isFinite(type) ? type : null
|
||||
@@ -371,6 +459,10 @@ const resolveCurrentUserType = () => {
|
||||
currentUserType.value = normalizeUserType(currentUserInfo?.type)
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: normalizeShopId supports OrdersView.vue by holding or executing the normalize shop 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 normalizeShopId = (value: unknown) => {
|
||||
if (value === undefined || value === null || value === '') {
|
||||
return undefined
|
||||
@@ -378,8 +470,16 @@ const normalizeShopId = (value: unknown) => {
|
||||
return String(value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: getShopOptionValue supports OrdersView.vue by holding or executing the get shop option value 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 getShopOptionValue = (shop: Shop) => normalizeShopId((shop as any).id) || ''
|
||||
|
||||
/**
|
||||
* Purpose: loadShopOptions supports OrdersView.vue by holding or executing the load shop options 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 loadShopOptions = async () => {
|
||||
shopLoading.value = true
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user