|
|
@@ -217,9 +217,9 @@
|
|
|
const loading = ref(false);
|
|
|
const deleteModalVisible = ref(false);
|
|
|
const deleteLoading = ref(false);
|
|
|
- const currentDeleteId = ref<number>(0);
|
|
|
+ const currentDeleteId = ref<string>('');
|
|
|
/** 正在打开的案件 id:打开期间禁用其它打开操作并显示全局 loading */
|
|
|
- const openingCaseId = ref<number | null>(null);
|
|
|
+ const openingCaseId = ref<string | null>(null);
|
|
|
const [showOpeningLoading, hideOpeningLoading, setOpeningTip] = useLoading({
|
|
|
tip: '正在打开案件…',
|
|
|
});
|
|
|
@@ -251,11 +251,16 @@
|
|
|
const timestamp = new Date(rawTime.replace(/-/g, '/')).getTime();
|
|
|
return Number.isNaN(timestamp) ? 0 : timestamp;
|
|
|
}
|
|
|
+ /** 案件 ID 是雪花 Long,超出 JS number 安全整数范围:按定长字符串比较,避免精度丢失 */
|
|
|
+ const normalizeCaseId = (value?: string) => String(value ?? '0').padStart(20, '0');
|
|
|
+ const compareCaseIdDesc = (left: CaseInfo, right: CaseInfo) =>
|
|
|
+ normalizeCaseId(right.id) > normalizeCaseId(left.id) ? 1 : normalizeCaseId(right.id) < normalizeCaseId(left.id) ? -1 : 0;
|
|
|
+
|
|
|
const filteredCaseList = computed(() => {
|
|
|
const sortedList = [...caseList.value].sort((left, right) => {
|
|
|
const timeDiff = getCaseSortTime(right) - getCaseSortTime(left);
|
|
|
if (timeDiff !== 0) return timeDiff;
|
|
|
- return Number(right.id || 0) - Number(left.id || 0);
|
|
|
+ return compareCaseIdDesc(left, right);
|
|
|
});
|
|
|
|
|
|
if (!searchKeyword.value) {
|
|
|
@@ -281,7 +286,7 @@
|
|
|
return classMap[type || ''] || '';
|
|
|
}
|
|
|
|
|
|
- async function handleDelete(id: number) {
|
|
|
+ async function handleDelete(id: string) {
|
|
|
currentDeleteId.value = id;
|
|
|
deleteModalVisible.value = true;
|
|
|
}
|
|
|
@@ -291,7 +296,7 @@
|
|
|
try {
|
|
|
// 案件已归属个人,后端不再校验案件密码
|
|
|
await deleteById(currentDeleteId.value);
|
|
|
- const index = caseList.value.findIndex((item) => item.id === currentDeleteId.value);
|
|
|
+ const index = caseList.value.findIndex((item) => String(item.id || '') === String(currentDeleteId.value));
|
|
|
if (index > -1) {
|
|
|
caseList.value.splice(index, 1);
|
|
|
}
|
|
|
@@ -305,21 +310,21 @@
|
|
|
|
|
|
function cancelDelete() {
|
|
|
deleteModalVisible.value = false;
|
|
|
- currentDeleteId.value = 0;
|
|
|
+ currentDeleteId.value = '';
|
|
|
}
|
|
|
|
|
|
/** 打开案件:案件归属当前用户,无需再输案件密码 */
|
|
|
- async function handleOpen(id: number) {
|
|
|
+ async function handleOpen(id: string) {
|
|
|
await doOpenCase(id);
|
|
|
}
|
|
|
|
|
|
- async function doOpenCase(id: number) {
|
|
|
+ async function doOpenCase(id: string) {
|
|
|
// 打开案件要初始化数据源、重建路由并跳转,期间给一层全局 loading,避免界面像卡死
|
|
|
if (openingCaseId.value !== null) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- const matchedCase = caseList.value.find((item) => Number(item.id) === Number(id));
|
|
|
+ const matchedCase = caseList.value.find((item) => String(item.id || '') === String(id));
|
|
|
openingCaseId.value = id;
|
|
|
setOpeningTip(matchedCase?.name ? `正在打开「${matchedCase.name}」…` : '正在打开案件…');
|
|
|
showOpeningLoading();
|
|
|
@@ -367,7 +372,7 @@
|
|
|
loadCaseList();
|
|
|
}
|
|
|
|
|
|
- async function handleOpenCreatedCase(payload: { id: number; onFinished?: (success: boolean) => void }) {
|
|
|
+ async function handleOpenCreatedCase(payload: { id: string; onFinished?: (success: boolean) => void }) {
|
|
|
const success = await doOpenCase(payload.id);
|
|
|
payload.onFinished?.(success);
|
|
|
}
|