|
|
@@ -1,6 +1,6 @@
|
|
1
|
1
|
# 养殖产业数据 — 前端技术方案
|
|
2
|
2
|
|
|
3
|
|
-> 依据:`养殖产业数据功能需求.md`、`养殖产业数据技术方案.md`;布局对齐原型 `Snipaste_2026-05-19_12-33-09.jpg`。字段 **小驼峰**,与接口一致。
|
|
|
3
|
+> 与 `doc/产业数据模型及服务/养殖产业数据/养殖产业数据前端技术方案.md` 保持一致。字段 **小驼峰**,与接口一致。
|
|
4
|
4
|
|
|
5
|
5
|
---
|
|
6
|
6
|
|
|
|
@@ -26,20 +26,18 @@
|
|
26
|
26
|
|
|
27
|
27
|
| 方法 | HTTP | 说明 |
|
|
28
|
28
|
| --- | --- | --- |
|
|
29
|
|
-| `getBreedingDashboard` | GET | `/dashboard`,Query 可选 `forceRefresh=true` |
|
|
|
29
|
+| `getBreedingDashboard` | GET | `/dashboard`,Query:`statYear`(默认当前年)、可选 `forceRefresh=true` |
|
|
30
|
30
|
|
|
31
|
31
|
---
|
|
32
|
32
|
|
|
33
|
33
|
## 3. 页面结构(单页四块)
|
|
34
|
34
|
|
|
35
|
|
-纵向滚动,块标题与需求 **§5.1** 一致。
|
|
36
|
|
-
|
|
37
|
35
|
| 区块 | 组件建议 | 数据节点 |
|
|
38
|
36
|
| --- | --- | --- |
|
|
39
|
|
-| 工具栏 | 右上角「刷新」`el-button`,`v-hasPermi` query | — |
|
|
|
37
|
+| 工具栏 | 年份 `el-select`(默认当前年)+「刷新」 | `statYear` |
|
|
40
|
38
|
| 产业总览 | 6 个指标卡片 | `data.overview` |
|
|
41
|
39
|
| 牦牛存栏变动 | 公/母数字 + ECharts 折线 | `data.inventoryChange` |
|
|
42
|
|
-| 牦牛年龄结构 | ECharts 环形图 | `data.ageStructure` |
|
|
|
40
|
+| 牦牛存栏结构 | ECharts 双层饼图 | `data.yakInventoryStructure` |
|
|
43
|
41
|
| 草场类型占比 | 可用/使用中数字 + 退化占比图 + 表格 | `data.grassland` |
|
|
44
|
42
|
|
|
45
|
43
|
页眉展示 **统计日** `statDate`、**统计年** `statYear`。
|
|
|
@@ -50,18 +48,11 @@
|
|
50
|
48
|
|
|
51
|
49
|
| 规则 | 实现 |
|
|
52
|
50
|
| --- | --- |
|
|
53
|
|
-| 首次进入 | `mounted` 调用 `getBreedingDashboard()`;全页 `v-loading` |
|
|
54
|
|
-| 刷新 | `forceRefresh=true`;`refreshing` 防重复点击 |
|
|
55
|
|
-| 失败 | `msg` 提示;**清空**本地 `dashboardData`,不保留上一用户数据 |
|
|
56
|
|
-| 空数据 | 数字 `0` 或 `—`;图表 `emptyChart` 文案 |
|
|
57
|
|
-| 未标注性别 | `unknownGenderCount > 0` 时展示「未标注性别:N 头」 |
|
|
58
|
|
-| 月趋势 | `monthlyTrend` 仅 1~当前月;X 轴 1~12,无数据月份不画点 |
|
|
59
|
|
-| 年龄/退化占比 | 接口 `ratio` 已为 0~100;展示加 `%`,保留 1 位小数 |
|
|
60
|
|
-| 单位 | 头、个、亩,与卡片文案一致 |
|
|
61
|
|
-
|
|
62
|
|
-**折线图**:`inventoryCount` 系列;当前月点应与总览「存栏总量」联调校验。
|
|
63
|
|
-
|
|
64
|
|
-**退化五档**:`degradationStats` 固定 5 项;图例用 `degradationLabel`。
|
|
|
51
|
+| 首次进入 | `mounted` 调用 `getBreedingDashboard({ statYear })`;默认当前年 |
|
|
|
52
|
+| 刷新 | `forceRefresh=true`;防重复点击 |
|
|
|
53
|
+| 月趋势 | 所选年 1~填报最大月 |
|
|
|
54
|
+| 存栏结构 | `yakInventoryStructure` 双层饼(内环大类、外环细分) |
|
|
|
55
|
+| 退化占比 | `degradationStats` 固定 5 项 |
|
|
65
|
56
|
|
|
66
|
57
|
---
|
|
67
|
58
|
|
|
|
@@ -69,65 +60,12 @@
|
|
69
|
60
|
|
|
70
|
61
|
| 项 | 说明 |
|
|
71
|
62
|
| --- | --- |
|
|
72
|
|
-| **语言包** | `livestockIndustry.breedingIndustry`(`lang/zh/livestockIndustry.js`、`lang/bo/livestockIndustry.js`) |
|
|
73
|
|
-| **Mixin** | `mixins/livestockIndustryLocaleMixin.js`:`biT` / `biCommon` / `biDash` |
|
|
74
|
|
-| **注册** | `lang/zh-CN.js`、`lang/bo.js` 引入 `livestockIndustry` |
|
|
|
63
|
+| **语言包** | `livestockIndustry.breedingIndustry` |
|
|
|
64
|
+| **Mixin** | `mixins/livestockIndustryLocaleMixin.js` |
|
|
75
|
65
|
|
|
76
|
66
|
---
|
|
77
|
67
|
|
|
78
|
68
|
## 6. 权限与菜单
|
|
79
|
69
|
|
|
80
|
70
|
- 菜单进入需 `dataModel:breedingIndustry:query`。
|
|
81
|
|
-- 无数据时仍可见页面;刷新按钮同权限。
|
|
82
|
71
|
- **无**导出、同步、编辑按钮。
|
|
83
|
|
-
|
|
84
|
|
----
|
|
85
|
|
-
|
|
86
|
|
-## 7. 交付清单
|
|
87
|
|
-
|
|
88
|
|
-- [x] `api/livestockIndustry/breedingIndustry.js`
|
|
89
|
|
-- [x] `views/livestockIndustry/breedingIndustry/index.vue`
|
|
90
|
|
-- [x] `lang/zh/livestockIndustry.js`、`lang/bo/livestockIndustry.js`
|
|
91
|
|
-- [x] `mixins/livestockIndustryLocaleMixin.js`
|
|
92
|
|
-- [ ] 菜单 SQL / 后台菜单配置(见后端技术方案 **§5**)
|
|
93
|
|
-- [ ] Playwright:进入页、刷新、四块有数据/空态(见测试用例 UI 章节)
|
|
94
|
|
-
|
|
95
|
|
----
|
|
96
|
|
-
|
|
97
|
|
-## 8. 联调说明
|
|
98
|
|
-
|
|
99
|
|
-**请求示例**:
|
|
100
|
|
-
|
|
101
|
|
-```http
|
|
102
|
|
-GET /dataModel/breedingIndustry/dashboard?forceRefresh=true
|
|
103
|
|
-Authorization: Bearer {token}
|
|
104
|
|
-```
|
|
105
|
|
-
|
|
106
|
|
-**响应结构**(`data` 节点):
|
|
107
|
|
-
|
|
108
|
|
-```json
|
|
109
|
|
-{
|
|
110
|
|
- "statDate": "2026-05-23",
|
|
111
|
|
- "statYear": 2026,
|
|
112
|
|
- "overview": {
|
|
113
|
|
- "inventoryTotal": 0,
|
|
114
|
|
- "annualOutbound": 0,
|
|
115
|
|
- "warningYakCount": 0,
|
|
116
|
|
- "pastureCount": 0,
|
|
117
|
|
- "grasslandCount": 0,
|
|
118
|
|
- "grasslandAreaMu": 0
|
|
119
|
|
- },
|
|
120
|
|
- "inventoryChange": {
|
|
121
|
|
- "bullCount": 0,
|
|
122
|
|
- "cowCount": 0,
|
|
123
|
|
- "unknownGenderCount": 0,
|
|
124
|
|
- "monthlyTrend": [{ "month": 1, "inventoryCount": 0 }]
|
|
125
|
|
- },
|
|
126
|
|
- "ageStructure": [{ "bandCode": "M1_6", "bandLabel": "1-6月龄", "count": 0, "ratio": 0 }],
|
|
127
|
|
- "grassland": {
|
|
128
|
|
- "availableCount": 0,
|
|
129
|
|
- "inUseCount": 0,
|
|
130
|
|
- "degradationStats": [{ "degradationLevel": 1, "degradationLabel": "未退化", "count": 0, "ratio": 0 }]
|
|
131
|
|
- }
|
|
132
|
|
-}
|
|
133
|
|
-```
|