feat: 新30号准则适配 — 三表完善+认证头修复+企业联动

This commit is contained in:
Hermes CI Fix
2026-08-11 00:40:43 +08:00
parent 4081361b05
commit dcc7e2194d
4 changed files with 62 additions and 5 deletions
+5 -1
View File
@@ -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 = {
+6
View File
@@ -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)
+50 -3
View File
@@ -4,6 +4,15 @@
<div class="report-header">
<h3 class="page-title">📊 CMA管理报表</h3>
<div class="header-right">
<el-select
v-model="currentEntityId"
size="small"
style="width:180px"
placeholder="选择企业"
@change="onEntityChange"
>
<el-option v-for="e in entities" :key="e.id" :label="e.short_name + ' / ' + e.name" :value="e.id" />
</el-select>
<el-date-picker
v-model="reportPeriod"
type="month"
@@ -568,15 +577,50 @@ const loading = ref(false)
const activeTab = ref('profit')
const reportPeriod = ref('2026-06')
// ── 企业选择(新30号准则报表联动)──
const entities = ref<any[]>([])
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()
+1 -1
View File
@@ -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
})