feat(workbench): keep progress detail return context
This commit is contained in:
@@ -95,6 +95,10 @@ export function useAppShell() {
|
||||
})
|
||||
|
||||
const detailMode = computed(() => route.name === 'app-document-detail')
|
||||
const detailReturnTarget = computed(() => String(route.query.returnTo || '').trim())
|
||||
const detailBackLabel = computed(() => (
|
||||
detailReturnTarget.value === 'workbench' ? '返回首页' : '返回单据中心'
|
||||
))
|
||||
const detailAlerts = computed(() => (
|
||||
detailMode.value
|
||||
? buildDetailAlerts(selectedRequest.value, { currentUser: currentUser.value })
|
||||
@@ -398,16 +402,38 @@ export function useAppShell() {
|
||||
)
|
||||
}
|
||||
|
||||
function openRequestDetail(request) {
|
||||
function buildDocumentDetailQuery(options = {}) {
|
||||
const nextQuery = { ...route.query }
|
||||
const returnTo = String(options.returnTo || '').trim()
|
||||
if (returnTo === 'workbench') {
|
||||
nextQuery.returnTo = 'workbench'
|
||||
} else {
|
||||
delete nextQuery.returnTo
|
||||
}
|
||||
return nextQuery
|
||||
}
|
||||
|
||||
function buildDocumentReturnQuery() {
|
||||
const { returnTo, ...nextQuery } = route.query
|
||||
return nextQuery
|
||||
}
|
||||
|
||||
function openRequestDetail(request, options = {}) {
|
||||
selectedRequestSnapshot.value = request || null
|
||||
router.push({
|
||||
name: 'app-document-detail',
|
||||
params: { requestId: request.claimId || request.id }
|
||||
params: { requestId: request.claimId || request.id },
|
||||
query: buildDocumentDetailQuery(options)
|
||||
})
|
||||
}
|
||||
|
||||
function closeRequestDetail() {
|
||||
router.push({ name: 'app-documents' })
|
||||
if (detailReturnTarget.value === 'workbench') {
|
||||
router.push({ name: 'app-workbench' })
|
||||
return
|
||||
}
|
||||
|
||||
router.push({ name: 'app-documents', query: buildDocumentReturnQuery() })
|
||||
}
|
||||
|
||||
async function handleRequestUpdated() {
|
||||
@@ -423,7 +449,7 @@ export function useAppShell() {
|
||||
|
||||
await reloadRequests()
|
||||
selectedRequestSnapshot.value = null
|
||||
router.push({ name: 'app-documents' })
|
||||
router.push({ name: 'app-documents', query: buildDocumentReturnQuery() })
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -465,6 +491,7 @@ export function useAppShell() {
|
||||
smartEntryRevealToken,
|
||||
smartEntrySessionId,
|
||||
detailAlerts,
|
||||
detailBackLabel,
|
||||
toast,
|
||||
topBarView
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user