From 2a38cf5bc0a3c0838e37b35991df508b24e96894 Mon Sep 17 00:00:00 2001 From: huang <1724659546@qq.com> Date: Thu, 27 Nov 2025 17:33:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0swag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/swagger.json | 34 ++++++++++++++++++++++++++-------- src/api/inventory.js | 1 + src/router/index.js | 2 ++ src/utils/format.js | 4 ++-- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/docs/swagger.json b/docs/swagger.json index 6908f5fb..069ef5ff 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -3387,6 +3387,12 @@ ], "summary": "获取当前库存列表", "parameters": [ + { + "type": "boolean", + "description": "只查询有库存的原料", + "name": "has_stock", + "in": "query" + }, { "type": "string", "description": "排序字段, 例如 \"stock DESC\"", @@ -3710,6 +3716,7 @@ }, { "enum": [ + 7, -1, 0, 1, @@ -3719,12 +3726,12 @@ 5, -1, 5, - 6, - 7 + 6 ], "type": "integer", "format": "int32", "x-enum-varnames": [ + "_numLevels", "DebugLevel", "InfoLevel", "WarnLevel", @@ -3734,8 +3741,7 @@ "FatalLevel", "_minLevel", "_maxLevel", - "InvalidLevel", - "_numLevels" + "InvalidLevel" ], "name": "level", "in": "query" @@ -7262,6 +7268,10 @@ "type": "string", "maxLength": 255 }, + "max_addition_ratio": { + "description": "最大添加比例", + "type": "number" + }, "name": { "description": "原料名称", "type": "string", @@ -8819,6 +8829,10 @@ "id": { "type": "integer" }, + "max_addition_ratio": { + "description": "最大添加比例", + "type": "number" + }, "name": { "type": "string" }, @@ -9859,6 +9873,10 @@ "type": "string", "maxLength": 255 }, + "max_addition_ratio": { + "description": "最大添加比例", + "type": "number" + }, "name": { "description": "原料名称", "type": "string", @@ -10581,6 +10599,7 @@ "type": "integer", "format": "int32", "enum": [ + 7, -1, 0, 1, @@ -10590,10 +10609,10 @@ 5, -1, 5, - 6, - 7 + 6 ], "x-enum-varnames": [ + "_numLevels", "DebugLevel", "InfoLevel", "WarnLevel", @@ -10603,8 +10622,7 @@ "FatalLevel", "_minLevel", "_maxLevel", - "InvalidLevel", - "_numLevels" + "InvalidLevel" ] } }, diff --git a/src/api/inventory.js b/src/api/inventory.js index e5a04f80..a72c0614 100644 --- a/src/api/inventory.js +++ b/src/api/inventory.js @@ -51,6 +51,7 @@ import { PaginationDTO, Response, StockLogSourceType } from '../enums'; /** * @typedef {object} GetCurrentStockListParams + * @property {boolean} [has_stock] - 只查询有库存的原料 * @property {string} [order_by] - 排序字段, 例如 "stock DESC" * @property {number} [page] - 页码 * @property {number} [page_size] - 每页数量 diff --git a/src/router/index.js b/src/router/index.js index d6a76cb2..b21bb368 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -28,6 +28,7 @@ import NutrientList from '../views/feed/NutrientList.vue'; // 修正拼写错误 import PigAgeStageList from '../views/feed/PigAgeStageList.vue'; // 导入 PigAgeStageList 组件 import PigBreedList from '../views/feed/PigBreedList.vue'; // 导入 PigBreedList 组件 import RecipeList from '../views/feed/RecipeList.vue'; +import StockManagement from '../views/inventory/StockManagement.vue'; const routes = [ @@ -45,6 +46,7 @@ const routes = [ {path: '/feed/pig-age-stages', component: PigAgeStageList, meta: {requiresAuth: true, title: '年龄阶段管理'}}, // 添加年龄阶段管理路由 {path: '/feed/pig-breeds', component: PigBreedList, meta: {requiresAuth: true, title: '品种管理'}}, // 添加品种管理路由 {path: '/feed/recipes', component: RecipeList, meta: {requiresAuth: true, title: '配方管理'}}, + {path: '/inventory/stock', component: StockManagement, meta: {requiresAuth: true, title: '库存管理'}}, {path: '/monitor/device-command-logs', component: DeviceCommandLogView, meta: {requiresAuth: true, title: '设备命令日志'}}, {path: '/monitor/medication-logs', component: MedicationLogsView, meta: {requiresAuth: true, title: '用药记录'}}, diff --git a/src/utils/format.js b/src/utils/format.js index 6efbde9a..a844ae7d 100644 --- a/src/utils/format.js +++ b/src/utils/format.js @@ -4,8 +4,8 @@ * @returns {string} - 格式化后的字符串,如果输入无效则返回空字符串或提示 */ export function formatRFC3339(rfc3339String) { - if (!rfc3339String) { - return '--'; // 或者返回空字符串 '' + if (!rfc3339String || rfc3339String.startsWith('0001-01-01')) { + return '--'; } try {