feat: new

This commit is contained in:
luo
2026-09-16 16:32:08 +08:00
parent 6a1543f9f6
commit 8bd9de15cd
22 changed files with 2502 additions and 33 deletions

View File

@@ -61,7 +61,6 @@
const getCategoryText = (category) => ({
approval: '审批',
expiry: '临期',
exchange: '换货',
sync: '同步',
system: '系统'
}[category] || '通知');
@@ -73,17 +72,6 @@
critical: '严重'
}[severity] || '提示');
const getNotificationPriority = (item) => {
const severityRank = { info: 10, warning: 20, error: 30, critical: 40 };
const remainingDays = Number(item?.days_until_expiry ?? item?.days_remaining ?? item?.remaining_days);
const expiryLevel = String(item?.expiry_level || '').toLowerCase();
if (item?.category === 'expiry' && ((Number.isFinite(remainingDays) && remainingDays >= 0 && remainingDays <= 3) ||
['0_3', '0-3', '0~3', 'critical'].includes(expiryLevel))) {
return 100;
}
return severityRank[item?.severity] || 0;
};
const loadUnreadCount = async () => {
try {
const data = await notificationApi.getUnreadCount();
@@ -98,7 +86,7 @@
loading.value = true;
try {
const data = await notificationApi.getList(page.value, pageSize);
const items = (data?.items || []).sort((a, b) => getNotificationPriority(b) - getNotificationPriority(a));
const items = (data?.items || []);
if (append) {
notifications.push(...items);
} else {