From 6f1f32df626979e44fffdb6f0f0b5f97ba552e0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E5=88=9D?= <3236758982@qq.com> Date: Thu, 23 Apr 2026 19:57:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=8E=E7=BA=A2=E6=94=80=EF=BC=9AV2.0.001?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=9A=84=E5=86=9C=E4=B8=9A=E6=BA=AF?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- env/.env | 6 +- src/api/agri/biz/flow.ts | 74 ++++ src/api/agri/trace/snapshot.ts | 45 +++ src/pages-agri/biz-flow/index.vue | 437 ++++++++++++++++++++++++ src/pages-agri/trace-snapshot/index.vue | 334 ++++++++++++++++++ src/pages/index/index.ts | 22 ++ src/utils/agriTraceDict.ts | 18 + src/utils/index.ts | 2 +- vite.config.ts | 1 + 9 files changed, 935 insertions(+), 4 deletions(-) create mode 100644 src/api/agri/biz/flow.ts create mode 100644 src/api/agri/trace/snapshot.ts create mode 100644 src/pages-agri/biz-flow/index.vue create mode 100644 src/pages-agri/trace-snapshot/index.vue create mode 100644 src/utils/agriTraceDict.ts diff --git a/env/.env b/env/.env index 3ee0bd3..5d9b62c 100644 --- a/env/.env +++ b/env/.env @@ -1,4 +1,4 @@ -VITE_APP_TITLE = '芋道管理系统' +VITE_APP_TITLE = '亚为mom小程序' VITE_APP_PORT = 9000 VITE_UNI_APPID = '__UNI__D1E5001' @@ -39,8 +39,8 @@ VITE_APP_TENANT_ENABLE=true VITE_APP_CAPTCHA_ENABLE=false # 默认账户密码 VITE_APP_DEFAULT_LOGIN_TENANT_ID = 1 -VITE_APP_DEFAULT_LOGIN_USERNAME = admin -VITE_APP_DEFAULT_LOGIN_PASSWORD = admin123 +VITE_APP_DEFAULT_LOGIN_USERNAME = YAVII +VITE_APP_DEFAULT_LOGIN_PASSWORD = yavii123 # API 加解密 VITE_APP_API_ENCRYPT_ENABLE = true diff --git a/src/api/agri/biz/flow.ts b/src/api/agri/biz/flow.ts new file mode 100644 index 0000000..ff2eab2 --- /dev/null +++ b/src/api/agri/biz/flow.ts @@ -0,0 +1,74 @@ +import { http } from '@/http/http' + +export interface AgriHarvestSubmitReqVO { + batchType: string + productId?: number + productName?: string + plotId?: number + plotName?: string + farmerId?: number + quantity?: number + unit?: string + harvestTime?: string + remark?: string +} + +export interface AgriSortingSubmitReqVO { + batchId: number + weightResult?: number + unqualifiedCategory?: string + imageUrl?: string + remark?: string +} + +export interface AgriPackingSubmitReqVO { + batchId: number + netWeight?: number + labelCode?: string + packingTime?: string + remark?: string +} + +export interface AgriWarehouseInReqVO { + batchId: number + inMode?: string + warehouseTime?: string + remark?: string +} + +export interface AgriShipmentDispatchReqVO { + batchId: number + vehicleNo: string + boxCount?: number + shipmentTime?: string + remark?: string +} + +export interface AgriShipmentSignReqVO { + batchId: number + remark?: string +} + +export function submitHarvest(data: AgriHarvestSubmitReqVO) { + return http.post('/agri/biz/flow/harvest', data) +} + +export function submitSorting(data: AgriSortingSubmitReqVO) { + return http.post('/agri/biz/flow/sorting', data) +} + +export function submitPacking(data: AgriPackingSubmitReqVO) { + return http.post('/agri/biz/flow/packing', data) +} + +export function submitWarehouseIn(data: AgriWarehouseInReqVO) { + return http.post('/agri/biz/flow/warehouse-in', data) +} + +export function dispatchShipment(data: AgriShipmentDispatchReqVO) { + return http.post('/agri/biz/flow/shipment-dispatch', data) +} + +export function signShipment(data: AgriShipmentSignReqVO) { + return http.post('/agri/biz/flow/shipment-sign', data) +} diff --git a/src/api/agri/trace/snapshot.ts b/src/api/agri/trace/snapshot.ts new file mode 100644 index 0000000..a477fc7 --- /dev/null +++ b/src/api/agri/trace/snapshot.ts @@ -0,0 +1,45 @@ +import type { PageParam, PageResult } from '@/http/types' +import { http } from '@/http/http' + +export interface AgriTraceSnapshotVO { + id: number + traceCode: string + batchId: number + batchNo: string + productName?: string + plotName?: string + harvestTime?: string + harvestOperatorId?: number + harvestOperatorName?: string + packingTime?: string + packingOperatorId?: number + packingOperatorName?: string + warehouseTime?: string + warehouseOperatorId?: number + warehouseOperatorName?: string + shipmentTime?: string + shipmentOperatorId?: number + shipmentOperatorName?: string + vehicleNo?: string + invoiceStatus?: string + snapshotJson?: string +} + +export interface AgriTraceSnapshotPageReqVO extends PageParam { + batchId?: number + batchNo?: string + traceCode?: string + productName?: string +} + +export function getAgriTraceSnapshotPage(params: AgriTraceSnapshotPageReqVO) { + return http.get>('/agri/trace/snapshot/page', params) +} + +export function getAgriTraceSnapshot(id: number) { + return http.get(`/agri/trace/snapshot/get?id=${id}`) +} + +export function getAgriTraceSnapshotByTraceCode(traceCode: string) { + return http.get('/agri/trace/snapshot/get-by-trace-code', { traceCode }) +} diff --git a/src/pages-agri/biz-flow/index.vue b/src/pages-agri/biz-flow/index.vue new file mode 100644 index 0000000..bcd4858 --- /dev/null +++ b/src/pages-agri/biz-flow/index.vue @@ -0,0 +1,437 @@ + + + + + diff --git a/src/pages-agri/trace-snapshot/index.vue b/src/pages-agri/trace-snapshot/index.vue new file mode 100644 index 0000000..078e8f7 --- /dev/null +++ b/src/pages-agri/trace-snapshot/index.vue @@ -0,0 +1,334 @@ + + + + + diff --git a/src/pages/index/index.ts b/src/pages/index/index.ts index c8dc15d..3fd5f5c 100644 --- a/src/pages/index/index.ts +++ b/src/pages/index/index.ts @@ -88,6 +88,28 @@ const menuGroupsData: MenuGroup[] = [ }, ], }, + { + key: 'agri', + name: '农业溯源', + menus: [ + { + key: 'agriBizFlow', + name: '闭环操作台', + icon: 'flow', + url: '/pages-agri/biz-flow/index', + iconColor: '#52c41a', + permission: 'agri:biz:harvest', + }, + { + key: 'agriTraceSnapshot', + name: '溯源快照', + icon: 'scan', + url: '/pages-agri/trace-snapshot/index', + iconColor: '#1890ff', + permission: 'agri:trace-snapshot:query', + }, + ], + }, { key: 'stock', name: '库存管理', diff --git a/src/utils/agriTraceDict.ts b/src/utils/agriTraceDict.ts new file mode 100644 index 0000000..309bbe4 --- /dev/null +++ b/src/utils/agriTraceDict.ts @@ -0,0 +1,18 @@ +export const BATCH_TYPE_LABEL_MAP: Record = { + HARVEST: '采收批次', + SORTING: '分拣批次', + PACKING: '装箱批次', + WAREHOUSE: '仓储批次', + SHIPMENT: '发运批次' +} + +export const IN_MODE_LABEL_MAP: Record = { + BOX: '按箱入库', + PALLET: '按托入库' +} + +const toOptions = (labelMap: Record) => + Object.entries(labelMap).map(([value, label]) => ({ label, value })) + +export const BATCH_TYPE_OPTIONS = toOptions(BATCH_TYPE_LABEL_MAP) +export const IN_MODE_OPTIONS = toOptions(IN_MODE_LABEL_MAP) diff --git a/src/utils/index.ts b/src/utils/index.ts index df08cbe..7a6d830 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -124,7 +124,7 @@ export function getEnvBaseUrl() { // # 有些同学可能需要在微信小程序里面根据 develop、trial、release 分别设置上传地址,参考代码如下。 // TODO @芋艿:这个后续也要调整。 const VITE_SERVER_BASEURL__WEIXIN_DEVELOP = 'http://localhost:48080/admin-api' - const VITE_SERVER_BASEURL__WEIXIN_TRIAL = 'http://localhost:48080/admin-api' + const VITE_SERVER_BASEURL__WEIXIN_TRIAL = 'http://119.96.62.56:7004/admin-api' const VITE_SERVER_BASEURL__WEIXIN_RELEASE = 'http://localhost:48080/admin-api' // 微信小程序端环境区分 diff --git a/vite.config.ts b/vite.config.ts index c8df756..acf5a02 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -78,6 +78,7 @@ export default defineConfig(({ command, mode }) => { 'src/pages-infra', // “基础设施”模块 'src/pages-bpm', // “工作流程”模块 'src/pages-erp', // “采购管理”模块 + 'src/pages-agri', // “农业溯源”模块 ], dts: 'src/types/uni-pages.d.ts', }),