diff --git a/backend/app/api/reports.py b/backend/app/api/reports.py index 87f3e6b5..4c52745b 100644 --- a/backend/app/api/reports.py +++ b/backend/app/api/reports.py @@ -1344,6 +1344,7 @@ BALANCE_SHEET_SECTIONS = [ {"codes": [("1101", 1)], "name": "交易性金融资产", "ns_category": "investing"}, {"codes": [("1122", 1)], "name": "应收账款", "ns_category": "operating"}, {"codes": [("1123", 1)], "name": "预付账款", "ns_category": "operating"}, + {"codes": [("1131", 1)], "name": "应收股利", "ns_category": "investing"}, {"codes": [("1221", 1)], "name": "其他应收款", "ns_category": "operating"}, {"codes": [("1405", 1)], "name": "存货", "ns_category": "operating"}, ], @@ -1354,6 +1355,7 @@ BALANCE_SHEET_SECTIONS = [ "category_label": "投资资产", "lines": [ {"codes": [("1511", 1)], "name": "长期股权投资", "ns_category": "investing"}, + {"codes": [("1501", 1)], "name": "持有至到期投资", "ns_category": "investing"}, {"codes": [("1601", 1), ("1602", -1)], "name": "固定资产净额", "ns_category": "operating"}, {"codes": [("1701", 1)], "name": "无形资产", "ns_category": "operating"}, ], @@ -1398,9 +1400,11 @@ BS_DEMO = { "1101": {"end": 250, "begin": 220}, "1122": {"end": 1100, "begin": 1050}, "1123": {"end": 180, "begin": 160}, + "1131": {"end": 120, "begin": 100}, "1221": {"end": 90, "begin": 80}, "1405": {"end": 930, "begin": 900}, "1511": {"end": 580, "begin": 550}, + "1501": {"end": 200, "begin": 180}, "1601|1602": {"end": 1220, "begin": 1150}, "1701": {"end": 130, "begin": 120}, "2001": {"end": 1500, "begin": 1300}, @@ -1413,7 +1417,7 @@ BS_DEMO = { "2502": {"end": 270, "begin": 250}, "4001": {"end": 500, "begin": 500}, "4002": {"end": 180, "begin": 175}, - "4103|4104": {"end": 460, "begin": 540}, + "4103|4104": {"end": 780, "begin": 820}, } BS_CATEGORY_CN = { diff --git a/backend/logs/uvicorn.log b/backend/logs/uvicorn.log new file mode 100644 index 00000000..0352e968 --- /dev/null +++ b/backend/logs/uvicorn.log @@ -0,0 +1,6 @@ +INFO: Started server process [700361] +INFO: Waiting for application startup. +2026-08-11 00:39:30 [INFO] cma: CMA数据库已初始化 +2026-08-11 00:39:30 [INFO] cma: 管理会计OS后端启动完成 +INFO: Application startup complete. +INFO: Uvicorn running on http://0.0.0.0:8010 (Press CTRL+C to quit) diff --git a/frontend/src/views/ReportCenter.vue b/frontend/src/views/ReportCenter.vue index bec743c7..7979f40b 100644 --- a/frontend/src/views/ReportCenter.vue +++ b/frontend/src/views/ReportCenter.vue @@ -4,6 +4,15 @@

📊 CMA管理报表

+ + + ([]) +const currentEntityId = ref(Number(localStorage.getItem('cma_entity_id') || 1)) + function getEntityId() { - return Number(localStorage.getItem('cma_entity_id') || 1) + return Number(localStorage.getItem('cma_entity_id') || currentEntityId.value || 1) +} + +async function loadEntities() { + try { + const r: any = await api.get('/entities') + entities.value = r.data || r || [] + const e = entities.value.find((x: any) => x.id === currentEntityId.value) + if (e) localStorage.setItem('cma_entity_name', e.short_name || e.name || '') + } catch { + entities.value = [] + } +} + +function onEntityChange(id: number) { + localStorage.setItem('cma_entity_id', String(id)) + const e = entities.value.find((x: any) => x.id === id) + if (e) localStorage.setItem('cma_entity_name', e.short_name || e.name || '') + ElMessage.success(`已切换企业:${e ? e.short_name + ' / ' + e.name : id}`) + loadAll() + loadStatutory() +} + +// 跨页面同步:其他页面切换企业时联动刷新 +if (typeof window !== 'undefined') { + window.addEventListener('storage', (ev: StorageEvent) => { + if (ev.key === 'cma_entity_id' && ev.newValue) { + currentEntityId.value = Number(ev.newValue) + loadAll() + loadStatutory() + } + }) } // API 配置 const api = axios.create({ baseURL: '/api/cma', timeout: 30000 }) api.interceptors.request.use((config: any) => { const token = localStorage.getItem('cma_token') - if (token) config.headers.Authorization = `'Bearer ' + token` + if (token) config.headers.Authorization = `Bearer ${token}` return config }) @@ -658,7 +702,8 @@ function switchNew30Format(fmt: string) { } function exportNew30() { - ElMessage.success('导出功能将在P2实现') + // 新30号准则利润表导出 → 复用对外法定报表Excel(Sheet1=五板块利润表+附注) + exportStatutory() } function openSubjectManage() { @@ -784,6 +829,7 @@ function bscScoreColor(score: number): string { function onPeriodChange() { loadAll() + loadStatutory() } // ── 加载 ── @@ -888,6 +934,7 @@ function onBudgetSort(sort: any) { } onMounted(() => { + loadEntities() loadKpiOptions() loadAll() loadStatutory() diff --git a/frontend/src/views/SubjectManage.vue b/frontend/src/views/SubjectManage.vue index 1f1778d7..875bc670 100644 --- a/frontend/src/views/SubjectManage.vue +++ b/frontend/src/views/SubjectManage.vue @@ -104,7 +104,7 @@ import axios from 'axios' const api = axios.create({ baseURL: '/api/cma', timeout: 30000 }) api.interceptors.request.use((config: any) => { const token = localStorage.getItem('cma_token') - if (token) config.headers.Authorization = `'Bearer ' + token` + if (token) config.headers.Authorization = `Bearer ${token}` return config })