@somecat/financial-report 0.1.16 → 0.1.18

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 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,38 @@ 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),数据超过 100 或为负时按步长向上/向下自动扩展
95
+ (刻度过多时成倍放大步长,控制在 8 档内),保证折线不被裁切;
96
+ - X 轴标签按 `i/(n-1)` 均分,点过多时抽稀、拥挤时整组倾斜 45°;
97
+ - 无数据时只画坐标系并提示「暂无数据」。
98
+
99
+ 数据类型:`LinePoint { date: string|number, value: number }`
100
+
101
+ | Prop | 类型 | 默认值 | 说明 |
102
+ | --- | --- | --- | --- |
103
+ | `points` | `LinePoint[]` | 演示数据 | 折线数据 |
104
+ | `height` | `number` | `300` | 图表总高(含 X 轴标签区) |
105
+ | `yMin` / `yMax` | `number` | `0` / `100` | Y 轴区间下限/上限(数据越界时自动扩展) |
106
+ | `yStep` | `number` | `20` | Y 轴刻度步长 |
107
+ | `unit` | `string` | `%` | 刻度后缀 |
108
+ | `lineColor` | `string` | `var(--color-primary)` | 折线颜色(内部经 `resolveCssColor` 解析) |
109
+ | `areaOpacity` | `number` | `0.18` | 面积渐变顶部透明度 |
110
+ | `emptyText` | `string` | `暂无数据` | 无数据提示文案 |
111
+
78
112
  ### SectionLiability.vue
79
113
  Section 3 带息负债:双指标头部(指标 / 实际完成)+ 子标题「带息负债指标完成情况」+ 6 项条形图 + 备注。
80
114
  条形图与 `SectionSurplus` 同构,区别是数值恒为正、不区分正负,条形颜色按行序号红绿交替。
@@ -168,7 +202,13 @@ const reportData = {
168
202
  }
169
203
  ]
170
204
  },
171
- surplus: { bars: [], note: '备注:...' }
205
+ surplus: { bars: [], note: '备注:...' },
206
+ netGearing: {
207
+ points: [
208
+ { date: '2025-01', value: 76.2 },
209
+ { date: '2025-02', value: 82.6 }
210
+ ]
211
+ }
172
212
  }
173
213
 
174
214
  const exportPng = async () => {