refactor: enforce 800 line source limits
This commit is contained in:
@@ -151,7 +151,7 @@
|
||||
v-else-if="activeView === 'documents' && detailMode && selectedRequest"
|
||||
:request="selectedRequest"
|
||||
:back-label="detailBackLabel"
|
||||
@back-to-requests="closeRequestDetail"
|
||||
@back-to-requests="handleDocumentDetailBack"
|
||||
@open-assistant="openSmartEntry"
|
||||
@request-updated="handleRequestUpdated"
|
||||
@request-deleted="handleDetailRequestDeleted"
|
||||
@@ -362,6 +362,7 @@ const {
|
||||
smartEntryRevealToken,
|
||||
smartEntrySessionId,
|
||||
toast,
|
||||
detailReturnTarget,
|
||||
topBarView
|
||||
} = useAppShell()
|
||||
|
||||
@@ -370,6 +371,7 @@ const ENTERPRISE_DISPLAY_NAME = '远光软件股份有限公司'
|
||||
const filteredNavItems = computed(() => filterNavItemsByAccess(navItems, currentUser.value))
|
||||
const isAiShellMode = computed(() => workbenchMode.value === 'ai')
|
||||
const isWorkbenchAiMode = computed(() => activeView.value === 'workbench' && workbenchMode.value === 'ai')
|
||||
const DOCUMENT_DETAIL_RETURN_TARGETS = new Set(['workbench', 'conversation'])
|
||||
const DETAIL_TOPBAR_FALLBACKS = {
|
||||
audit: {
|
||||
title: '规则中心详情',
|
||||
@@ -412,6 +414,40 @@ const resolvedDetailKpis = computed(() => (
|
||||
customDetailTopBarActive.value ? detailTopBarPayload.value?.kpis || [] : []
|
||||
))
|
||||
|
||||
function resolveDocumentDetailReturnTarget(value) {
|
||||
const target = String(value || '').trim()
|
||||
return DOCUMENT_DETAIL_RETURN_TARGETS.has(target) ? target : ''
|
||||
}
|
||||
|
||||
function resolveActiveAiConversationSnapshot() {
|
||||
const conversationId = String(aiActiveConversationId.value || '').trim()
|
||||
if (!conversationId) {
|
||||
return null
|
||||
}
|
||||
const history = aiConversationHistory.value.length
|
||||
? aiConversationHistory.value
|
||||
: loadAiWorkbenchConversationHistory(currentUser.value || {})
|
||||
return history.find((item) => String(item.id || item.conversationId || '').trim() === conversationId) || null
|
||||
}
|
||||
|
||||
async function handleDocumentDetailBack() {
|
||||
const shouldRestoreConversation = detailReturnTarget.value === 'conversation'
|
||||
const activeConversation = shouldRestoreConversation ? resolveActiveAiConversationSnapshot() : null
|
||||
const navigation = closeRequestDetail()
|
||||
if (navigation && typeof navigation.then === 'function') {
|
||||
await navigation
|
||||
}
|
||||
|
||||
if (!shouldRestoreConversation || !activeConversation) {
|
||||
return
|
||||
}
|
||||
|
||||
workbenchMode.value = 'ai'
|
||||
sidebarCollapsed.value = false
|
||||
await nextTick()
|
||||
dispatchAiSidebarCommand('open-recent', activeConversation)
|
||||
}
|
||||
|
||||
function openWorkbenchDocument(payload = {}) {
|
||||
const payloadClaimId = String(payload.claimId || payload.claim_id || '').trim()
|
||||
const payloadId = String(payload.id || '').trim()
|
||||
@@ -436,13 +472,12 @@ function openWorkbenchDocument(payload = {}) {
|
||||
|| String(item.claimNo || '').trim() === requestId
|
||||
|| String(item.documentNo || '').trim() === requestId
|
||||
))
|
||||
const returnTo = (
|
||||
String(payload.returnTo || '').trim() === 'workbench'
|
||||
|| String(payload.source || '').trim() === 'workbench'
|
||||
const explicitReturnTo = resolveDocumentDetailReturnTarget(payload.returnTo)
|
||||
const fallbackToWorkbench = (
|
||||
String(payload.source || '').trim() === 'workbench'
|
||||
|| activeView.value === 'workbench'
|
||||
)
|
||||
? 'workbench'
|
||||
: ''
|
||||
const returnTo = explicitReturnTo || (fallbackToWorkbench ? 'workbench' : '')
|
||||
const payloadIdIsBusinessNo = isBusinessDocumentReference(payloadId)
|
||||
const fallbackClaimId = payloadClaimId || (payloadClaimNo || payloadIdIsBusinessNo ? '' : payloadId || requestId)
|
||||
const fallbackClaimNo = payloadClaimNo || (payloadIdIsBusinessNo ? payloadId : fallbackClaimId ? '' : requestId)
|
||||
|
||||
Reference in New Issue
Block a user