@somecat/financial-report 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -1
- package/dist/financial-report.css +1 -1
- package/dist/financial-report.es.js +635 -440
- package/dist/financial-report.umd.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,6 +24,8 @@ h5-app/
|
|
|
24
24
|
│ │ ├── SectionLiability.vue # Section 3 带息负债(6 项条形图,红绿交替 + 双指标头部)
|
|
25
25
|
│ │ ├── SectionSupplyChain.vue # Section 4 供应链融资余额(分段柱状图)
|
|
26
26
|
│ │ ├── SectionSurplus.vue # Section 5 资金结余(5 项条形图 + 双指标头部)
|
|
27
|
+
│ │ ├── SectionNetGearing.vue # Section 6 净借贷比(折线面积图,固定 0–100%)
|
|
28
|
+
│ │ ├── LineAreaChart.vue # 折线面积图(SVG 画线/面积 + HTML 画刻度)
|
|
27
29
|
│ │ └── StackedColumnChart.vue # 分段(堆叠)柱状图,纯 SVG 自封装
|
|
28
30
|
│ ├── styles/ # 设计变量 / report 样式(样式隔离)
|
|
29
31
|
│ ├── utils/ # color.js(CSS 变量解析,保障截图颜色一致)
|
|
@@ -75,6 +77,37 @@ Section 4 供应链融资余额:仅分段柱状图,不展示卡片头部指
|
|
|
75
77
|
(左柱"供应链融资"按融资品种构成,右柱"到期"按到期时间分布)。
|
|
76
78
|
Props:`groups`(结构同 `StackedColumnChart` 的 `groups`)。
|
|
77
79
|
|
|
80
|
+
### SectionNetGearing.vue
|
|
81
|
+
Section 6 净借贷比:卡片内标题「净借贷比走势图」+ 右侧「单位:%」+ 折线面积图
|
|
82
|
+
(复用 `StatCard` 的子标题行,`stats` 传空数组即不渲染头部指标区)。
|
|
83
|
+
|
|
84
|
+
Props:`points`(`[{ date, value }]`,`value` 为百分数值如 `76.2`;不传时使用演示数据)、
|
|
85
|
+
`subtitle`、`unitLabel`、`chartHeight`(默认 300)。
|
|
86
|
+
|
|
87
|
+
### LineAreaChart.vue(折线面积图,自封装)
|
|
88
|
+
纯 SVG + HTML 绝对定位实现,无 echarts 依赖,适配 html-to-image PNG 导出:
|
|
89
|
+
|
|
90
|
+
- 折线、面积与网格线用 SVG `path` / div 绘制,刻度与日期标签用 HTML 文本
|
|
91
|
+
(html-to-image 克隆进 foreignObject 后 SVG `<text>` 排版会错位);
|
|
92
|
+
- SVG 使用 `viewBox="0 0 100 100"` + `preserveAspectRatio="none"` 横向自适应,
|
|
93
|
+
折线 `vector-effect="non-scaling-stroke"` 保证线宽不被拉伸;
|
|
94
|
+
- Y 轴固定区间(默认 0–100,步长 20),越界数值按区间夹紧;
|
|
95
|
+
- X 轴标签按 `i/(n-1)` 均分,点过多时抽稀、拥挤时整组倾斜 45°;
|
|
96
|
+
- 无数据时只画坐标系并提示「暂无数据」。
|
|
97
|
+
|
|
98
|
+
数据类型:`LinePoint { date: string|number, value: number }`
|
|
99
|
+
|
|
100
|
+
| Prop | 类型 | 默认值 | 说明 |
|
|
101
|
+
| --- | --- | --- | --- |
|
|
102
|
+
| `points` | `LinePoint[]` | 演示数据 | 折线数据 |
|
|
103
|
+
| `height` | `number` | `300` | 图表总高(含 X 轴标签区) |
|
|
104
|
+
| `yMin` / `yMax` | `number` | `0` / `100` | Y 轴区间 |
|
|
105
|
+
| `yStep` | `number` | `20` | Y 轴刻度步长 |
|
|
106
|
+
| `unit` | `string` | `%` | 刻度后缀 |
|
|
107
|
+
| `lineColor` | `string` | `var(--color-primary)` | 折线颜色(内部经 `resolveCssColor` 解析) |
|
|
108
|
+
| `areaOpacity` | `number` | `0.18` | 面积渐变顶部透明度 |
|
|
109
|
+
| `emptyText` | `string` | `暂无数据` | 无数据提示文案 |
|
|
110
|
+
|
|
78
111
|
### SectionLiability.vue
|
|
79
112
|
Section 3 带息负债:双指标头部(指标 / 实际完成)+ 子标题「带息负债指标完成情况」+ 6 项条形图 + 备注。
|
|
80
113
|
条形图与 `SectionSurplus` 同构,区别是数值恒为正、不区分正负,条形颜色按行序号红绿交替。
|
|
@@ -168,7 +201,13 @@ const reportData = {
|
|
|
168
201
|
}
|
|
169
202
|
]
|
|
170
203
|
},
|
|
171
|
-
surplus: { bars: [], note: '备注:...' }
|
|
204
|
+
surplus: { bars: [], note: '备注:...' },
|
|
205
|
+
netGearing: {
|
|
206
|
+
points: [
|
|
207
|
+
{ date: '2025-01', value: 76.2 },
|
|
208
|
+
{ date: '2025-02', value: 82.6 }
|
|
209
|
+
]
|
|
210
|
+
}
|
|
172
211
|
}
|
|
173
212
|
|
|
174
213
|
const exportPng = async () => {
|