diff --git a/.husky/commit-msg b/.husky/commit-msg deleted file mode 100644 index 36158d9..0000000 --- a/.husky/commit-msg +++ /dev/null @@ -1 +0,0 @@ -npx --no-install commitlint --edit "$1" \ No newline at end of file diff --git a/.husky/commit-msg.bak b/.husky/commit-msg.bak new file mode 100644 index 0000000..70bd3dd --- /dev/null +++ b/.husky/commit-msg.bak @@ -0,0 +1 @@ +npx --no-install commitlint --edit "$1" diff --git a/.husky/pre-commit b/.husky/pre-commit.bak similarity index 100% rename from .husky/pre-commit rename to .husky/pre-commit.bak diff --git a/src/api/agri/batch.ts b/src/api/agri/batch.ts new file mode 100644 index 0000000..525f6d7 --- /dev/null +++ b/src/api/agri/batch.ts @@ -0,0 +1,24 @@ +import { http } from '@/http/http' + +export interface AgriBatchVO { + id: number + batchNo: string + plotId: number + plotName: string + cropId: number + cropName: string + farmerId: number + farmerName: string + varietyName: string + sowingDate?: string + transplantDate?: string + expectedHarvestDate?: string + actualHarvestDate?: string + status?: number + totalHarvestWeight?: number +} + +/** 获取批次简单列表(用于下拉选择) */ +export function getBatchSimpleList() { + return http.get('/agri/batch/simple-list') +} diff --git a/src/api/agri/operation.ts b/src/api/agri/operation.ts new file mode 100644 index 0000000..5ad6af8 --- /dev/null +++ b/src/api/agri/operation.ts @@ -0,0 +1,82 @@ +import type { PageParam, PageResult } from '@/http/types' +import { http } from '@/http/http' + +/** 操作类型枚举 */ +export const OPERATION_TYPE_OPTIONS = [ + { label: '播种', value: 0 }, + { label: '浇水', value: 1 }, + { label: '施肥', value: 2 }, + { label: '除草', value: 3 }, + { label: '打药', value: 4 }, + { label: '其他', value: 5 }, +] + +/** 操作类型映射 */ +export const OPERATION_TYPE_MAP: Record = { + 0: '播种', + 1: '浇水', + 2: '施肥', + 3: '除草', + 4: '打药', + 5: '其他', +} + +export interface AgriOperationVO { + id: number + batchId: number + batchNo: string + cropName: string + operationType: number + operationDate: string + operatorName?: string + workContent?: string + imageUrls?: string + remark?: string + createTime?: string +} + +export interface AgriOperationPageReqVO extends PageParam { + batchId?: number + operationType?: number +} + +export interface AgriOperationFormReqVO { + id?: number + batchId: number + operationType: number + operationDate: string + operatorName?: string + workContent?: string + imageUrls?: string + remark?: string +} + +/** 获取农事操作分页列表 */ +export function getOperationPage(params: AgriOperationPageReqVO) { + return http.get>('/agri/operation/page', params) +} + +/** 获取农事操作详情 */ +export function getOperation(id: number) { + return http.get(`/agri/operation/get?id=${id}`) +} + +/** 创建农事操作 */ +export function createOperation(data: AgriOperationFormReqVO) { + return http.post('/agri/operation/create', data) +} + +/** 更新农事操作 */ +export function updateOperation(data: AgriOperationFormReqVO) { + return http.put('/agri/operation/update', data) +} + +/** 删除农事操作 */ +export function deleteOperation(id: number) { + return http.delete(`/agri/operation/delete?id=${id}`) +} + +/** 导出农事操作 */ +export function exportOperation(params: AgriOperationPageReqVO) { + return http.get('/agri/operation/export', params, { responseType: 'blob' }) +} diff --git a/src/pages-agri/operation/form/index.vue b/src/pages-agri/operation/form/index.vue new file mode 100644 index 0000000..5822fa8 --- /dev/null +++ b/src/pages-agri/operation/form/index.vue @@ -0,0 +1,367 @@ + + + + + diff --git a/src/pages-agri/operation/index.vue b/src/pages-agri/operation/index.vue new file mode 100644 index 0000000..9bd7768 --- /dev/null +++ b/src/pages-agri/operation/index.vue @@ -0,0 +1,468 @@ + + + + + diff --git a/src/pages/index/index.ts b/src/pages/index/index.ts index 3fd5f5c..664bcd6 100644 --- a/src/pages/index/index.ts +++ b/src/pages/index/index.ts @@ -100,6 +100,14 @@ const menuGroupsData: MenuGroup[] = [ iconColor: '#52c41a', permission: 'agri:biz:harvest', }, + { + key: 'agriOperation', + name: '农事记录', + icon: 'note', + url: '/pages-agri/operation/index', + iconColor: '#fa8c16', + permission: 'agri:operation:query', + }, { key: 'agriTraceSnapshot', name: '溯源快照',