# 有无畜户数据填报 — 前端技术方案 > 依据:同目录功能需求、技术方案;交互对齐疫苗接种等村×年月填报;字段 **小驼峰**。 --- ## 1. 页面与路由 | 项 | 说明 | | --- | --- | | **Vue 路径** | `ruoyi-ui/src/views/dataModel/livestockOwnershipHousehold/index.vue` | | **组件名** | `LivestockOwnershipHousehold` | | **菜单配置** | 组件路径:`dataModel/livestockOwnershipHousehold/index` | | **权限前缀** | `dataModel:livestockOwnershipHousehold:list\|query\|add\|edit\|remove\|import\|export` | --- ## 2. API 模块 | 项 | 说明 | | --- | --- | | **文件** | `ruoyi-ui/src/api/dataModel/livestockOwnershipHousehold.js` | | **Base** | `/dataModel/livestockOwnershipHousehold` | CRUD、`yearOptions` / `monthOptions` / `townOptions` / `villageTree`、导入 `importData`、模板 `importTemplate`、导出 `export`(可选 `townDeptId`)与同类村级填报模块同构;模板/导出均为 **GET + blob**。 | 方法 | 路径 | 说明 | | --- | --- | --- | | `listLivestockOwnershipHousehold` | GET `/list` | 分页;筛选年、月、乡镇、村 | | `getLivestockOwnershipHousehold` | GET `/{id}` | 详情 | | `addLivestockOwnershipHousehold` | POST `/` | 新增 | | `updateLivestockOwnershipHousehold` | PUT `/` | 修改 | | `delLivestockOwnershipHousehold` | DELETE `/{ids}` | 删除 | | `listLivestockOwnershipHouseholdYearOptions` | GET `/yearOptions` | 年份下拉 | | `listLivestockOwnershipHouseholdMonthOptions` | GET `/monthOptions` | 月份下拉 | | `listLivestockOwnershipHouseholdTownOptions` | GET `/townOptions` | 乡镇下拉 | | `listLivestockOwnershipHouseholdVillageTree` | GET `/villageTree` | 县→乡镇→村树 | | `importLivestockOwnershipHousehold` | POST `/importData` | FormData:`file` + `statYear` + `statMonth` | | `downloadLivestockOwnershipHouseholdTemplate` | GET `/importTemplate` | 模板 blob | | `exportLivestockOwnershipHousehold` | GET `/export` | 参数:`statYear`、`statMonth`、可选 `townDeptId` | --- ## 3. 页面结构 1. **筛选**:年、月、乡镇、村(村可搜索)。 2. **列表**:年、月、乡镇、村;有畜户(户数/人数/有劳力/牲畜数);无畜户(户数/人数/有劳力);操作。 3. **新增/编辑**:选村(标签「乡镇 / 村」);新增默认本年本月;计数字段选填、非负整数。 4. **详情**:与表单同分区;查看含乡镇;数值带单位。 5. **导入**:选年月 → upsert 摘要;任一行失败整批不写(后端)。 6. **导出**:选年月;乡镇打开时带入列表当前筛选,清空=全部。 ### 表单 / 查看分区 | 分区 | 内容 | | --- | --- | | 基本信息 | 年月、村(查看含乡镇) | | 有畜户 | 户数(户)、人数(人)、有劳力(人)、牲畜数(头只) | | 无畜户 | 户数(户)、人数(人)、有劳力(人) | | — | 备注 | ### 字段映射 | 界面 | 字段 | | --- | --- | | 有畜户户数 | `withLivestockHouseholdCount` | | 有畜户人数 | `withLivestockPopulationCount` | | 有畜户有劳力 | `withLivestockLaborCount` | | 有畜户牲畜数 | `withLivestockAnimalCount` | | 无畜户户数 | `withoutLivestockHouseholdCount` | | 无畜户人数 | `withoutLivestockPopulationCount` | | 无畜户有劳力 | `withoutLivestockLaborCount` | --- ## 4. 业务规则 | 规则 | 实现 | | --- | --- | | 唯一键 | 年 + 月 + 村(提交只传 `villageDeptId`;乡镇由后端反推) | | 必填 | 年、月、村 | | 计数 | 七项可选;非负整数 | | 不可未来月 | 表单 / 导入 / 导出校验 | | 导入 | 同年同月同村 upsert | --- ## 5. 国际化 `dataModel.livestockOwnershipHousehold`(`lang/zh|bo/dataModel.js`);页面 `dmNs = 'livestockOwnershipHousehold'`,复用 `dataModelLocaleMixin`。查看表单使用 `dm-view-form`。 --- ## 6. 联调说明 1. 执行 `sql/biz_livestock_ownership_household.sql`。 2. 菜单组件 `dataModel/livestockOwnershipHousehold/index`,权限见 §1。 3. 验证:新增默认年月、分区填报、导入 upsert、导出乡镇带入列表筛选。 --- ## 7. 文件清单 | 类型 | 路径 | | --- | --- | | 页面 | `ruoyi-ui/src/views/dataModel/livestockOwnershipHousehold/index.vue` | | API | `ruoyi-ui/src/api/dataModel/livestockOwnershipHousehold.js` | | i18n | `lang/zh/dataModel.js`、`lang/bo/dataModel.js` → `livestockOwnershipHousehold` | | 前端技术方案 | 本文档 | --- ## 8. 修订记录 | 版本 | 说明 | | --- | --- | | 1.0 | 初版:村×年月;CRUD + upsert 导入 + 导出;有畜户/无畜户分区 |