fix(pl): 区分用证详情权限失败与网络异常以保留完整账目保护。
This commit is contained in:
1 parent
fb45466c0c
commit
6eba9c1aae
2 files changed
+36
-5
No files matched your search
@@ -78,7 +78,7 @@
|
||||
>
|
||||
<el-alert
|
||||
v-if="details[row.id]?.error"
|
||||
title="段次用证加载失败"
|
||||
:title="details[row.id]?.error"
|
||||
type="error"
|
||||
:closable="false"
|
||||
><el-button @click="loadDetail(row.id)"
|
||||
@@ -221,7 +221,7 @@
|
||||
rows = ref<(Plan & { quotaStatus: string })[]>([])
|
||||
const dialog = ref<InstanceType<typeof PlPlanQuotaDialog>>()
|
||||
const expandedIds = ref<string[]>([])
|
||||
const details = reactive<Record<string, { loading: boolean; data?: PlanQuota; error?: boolean }>>(
|
||||
const details = reactive<Record<string, { loading: boolean; data?: PlanQuota; error?: string }>>(
|
||||
{}
|
||||
)
|
||||
function clearDetails() {
|
||||
@@ -230,15 +230,21 @@
|
||||
}
|
||||
async function loadDetail(id: string) {
|
||||
const current = epoch
|
||||
const state = reactive<{ loading: boolean; data?: PlanQuota; error?: boolean }>({
|
||||
const state = reactive<{ loading: boolean; data?: PlanQuota; error?: string }>({
|
||||
loading: true
|
||||
})
|
||||
details[id] = state
|
||||
try {
|
||||
const value = await planQuotaApi.get(id)
|
||||
if (current === epoch && details[id] === state) state.data = value
|
||||
} catch {
|
||||
if (current === epoch && details[id] === state) state.error = true
|
||||
} catch (error) {
|
||||
if (current === epoch && details[id] === state) {
|
||||
const status = (error as { response?: { status?: number } })?.response?.status
|
||||
state.error =
|
||||
status === 403 || status === 404
|
||||
? '计划或证件不可读取,无法展示完整用证详情'
|
||||
: '段次用证加载失败,请重试'
|
||||
}
|
||||
} finally {
|
||||
if (current === epoch && details[id] === state) state.loading = false
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user