1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<template>
  <div class="app-container financial-reconciliation-page">
    <el-alert
      v-if="runtimeError"
      title="财务对账页面加载失败"
      type="error"
      :description="runtimeError"
      show-icon
      :closable="false"
    />
    <ReconciliationWorkspace v-else :key="workspaceKey" />
    <el-button v-if="runtimeError" type="primary" class="retry-button" @click="retry">
      重新加载
    </el-button>
  </div>
</template>
 
<script setup>
import { nextTick, onErrorCaptured, ref } from "vue";
import ReconciliationWorkspace from "./ReconciliationWorkspace.vue";
 
const runtimeError = ref("");
const workspaceKey = ref(0);
 
onErrorCaptured((error) => {
  console.error("财务对账页面运行异常:", error);
  runtimeError.value = error?.stack || error?.message || String(error);
  return false;
});
 
const retry = async () => {
  runtimeError.value = "";
  await nextTick();
  workspaceKey.value += 1;
};
</script>
 
<style scoped>
.financial-reconciliation-page {
  min-height: calc(100vh - 84px);
  background: #fff;
}
.retry-button {
  margin-top: 16px;
}
</style>