|
|
@@ -980,43 +980,84 @@ let srmdone = ref(0);
|
|
|
|
|
|
let ehrtodo = ref(0);
|
|
|
const loadHomeData = async () => {
|
|
|
- await loadNoticeList(activeNoticeTab.value);
|
|
|
+ try {
|
|
|
+ await loadNoticeList(activeNoticeTab.value);
|
|
|
+ } catch (error) {
|
|
|
+ console.error("loadNoticeList failed:", error);
|
|
|
+ }
|
|
|
|
|
|
if (!userStore.getUser.username) return;
|
|
|
|
|
|
+ const withFallback = async <T,>(
|
|
|
+ request: Promise<T>,
|
|
|
+ fallback: T,
|
|
|
+ requestName: string,
|
|
|
+ ): Promise<T> => {
|
|
|
+ try {
|
|
|
+ return await request;
|
|
|
+ } catch (error) {
|
|
|
+ console.error(`${requestName} failed:`, error);
|
|
|
+ return fallback;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
const [oaRes, crmRes, crmDoneRes, srmRes, ehrRes, newsRes] =
|
|
|
await Promise.all([
|
|
|
- getOATasks({
|
|
|
- id: userStore.getUser.username,
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- }),
|
|
|
- await getCRMTasks({
|
|
|
- id: userStore.getUser.username,
|
|
|
- type: "pending",
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- }),
|
|
|
- await getCRMTasks({
|
|
|
- id: userStore.getUser.username,
|
|
|
- type: "approved",
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- }),
|
|
|
- await getSRMTasks({
|
|
|
- id: userStore.getUser.username,
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- }),
|
|
|
- await getEHRTasks({
|
|
|
- id: userStore.getUser.username,
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- }),
|
|
|
- getNews({
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- }),
|
|
|
+ withFallback(
|
|
|
+ getOATasks({
|
|
|
+ id: userStore.getUser.username,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ }),
|
|
|
+ { todoList: [], todoCount: 0, doneCount: 0 },
|
|
|
+ "getOATasks",
|
|
|
+ ),
|
|
|
+ withFallback(
|
|
|
+ getCRMTasks({
|
|
|
+ id: userStore.getUser.username,
|
|
|
+ type: "pending",
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ }),
|
|
|
+ { todoCount: 0 },
|
|
|
+ "getCRMTasks(pending)",
|
|
|
+ ),
|
|
|
+ withFallback(
|
|
|
+ getCRMTasks({
|
|
|
+ id: userStore.getUser.username,
|
|
|
+ type: "approved",
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ }),
|
|
|
+ { todoCount: 0 },
|
|
|
+ "getCRMTasks(approved)",
|
|
|
+ ),
|
|
|
+ withFallback(
|
|
|
+ getSRMTasks({
|
|
|
+ id: userStore.getUser.username,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ }),
|
|
|
+ { todoCount: 0, doneCount: 0 },
|
|
|
+ "getSRMTasks",
|
|
|
+ ),
|
|
|
+ withFallback(
|
|
|
+ getEHRTasks({
|
|
|
+ id: userStore.getUser.username,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ }),
|
|
|
+ { todoCount: 0 },
|
|
|
+ "getEHRTasks",
|
|
|
+ ),
|
|
|
+ withFallback(
|
|
|
+ getNews({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ }),
|
|
|
+ { list: [] },
|
|
|
+ "getNews",
|
|
|
+ ),
|
|
|
]);
|
|
|
|
|
|
oaTasks.value = oaRes.todoList.slice(0, 3);
|