diff --git a/src/pages.json b/src/pages.json index 74db6c5..53c48c3 100644 --- a/src/pages.json +++ b/src/pages.json @@ -155,12 +155,6 @@ "navigationBarTitleText": "审批详情" } }, - { - "path": "pages/consumables/temp-catalog", - "style": { - "navigationBarTitleText": "耗材种类管理" - } - }, { "path": "pages/fixed-assets/scan", "style": { diff --git a/src/pages/api/consumable-temp.oneapi.json b/src/pages/api/consumable-temp.oneapi.json index c406d2a..432ca6d 100644 --- a/src/pages/api/consumable-temp.oneapi.json +++ b/src/pages/api/consumable-temp.oneapi.json @@ -3,11 +3,11 @@ "info": { "title": "智能配送耗材临时申请 API", "version": "1.0.0", - "description": "智能配送系统的耗材临时申请管理 API,支持申请创建、审批、物料明细管理和目录管理" + "description": "智能配送系统的耗材临时申请管理 API,支持申请创建、审批、物料明细管理和易耗品种类查询" }, "servers": [ { - "url": "http://localhost:3000", + "url": "http://localhost:8090", "description": "开发服务器" } ], @@ -49,10 +49,6 @@ "remark": { "type": "string", "description": "备注" - }, - "catalogId": { - "type": "string", - "description": "关联的目录ID" } }, "required": [ @@ -129,10 +125,6 @@ "remark": { "type": "string", "description": "备注" - }, - "catalogId": { - "type": "string", - "description": "关联的目录ID" } }, "required": [ @@ -219,10 +211,6 @@ "type": "string", "description": "备注" }, - "catalogId": { - "type": "string", - "description": "关联的目录ID" - }, "id": { "type": "string" } @@ -263,61 +251,6 @@ "status" ] }, - "CatalogCreate": { - "type": "object", - "properties": { - "name": { - "type": "string", - "minLength": 1, - "example": "办公用品", - "description": "目录名称" - }, - "spec": { - "type": "string", - "example": "标准", - "description": "规格" - }, - "unit": { - "type": "string", - "example": "个", - "description": "单位" - }, - "isActive": { - "type": "boolean", - "default": true, - "description": "是否激活" - } - }, - "required": [ - "name" - ] - }, - "CatalogUpdate": { - "type": "object", - "properties": { - "name": { - "type": "string", - "minLength": 1, - "example": "办公用品", - "description": "目录名称" - }, - "spec": { - "type": "string", - "example": "标准", - "description": "规格" - }, - "unit": { - "type": "string", - "example": "个", - "description": "单位" - }, - "isActive": { - "type": "boolean", - "default": true, - "description": "是否激活" - } - } - }, "RequestItemResponse": { "type": "object", "properties": { @@ -355,10 +288,6 @@ "type": "string", "description": "备注" }, - "catalogId": { - "type": "string", - "description": "关联的目录ID" - }, "id": { "type": "string", "description": "物料明细ID" @@ -489,10 +418,6 @@ "type": "string", "description": "备注" }, - "catalogId": { - "type": "string", - "description": "关联的目录ID" - }, "id": { "type": "string", "description": "物料明细ID" @@ -538,48 +463,201 @@ "items" ] }, - "CatalogResponse": { + "SKUResponse": { "type": "object", "properties": { "id": { - "type": "string", - "description": "目录ID" + "type": "number", + "description": "SKU ID" }, - "name": { - "type": "string", - "description": "目录名称" - }, - "spec": { + "skuCode": { "type": "string", "nullable": true, - "description": "规格" + "description": "SKU编码" + }, + "specification": { + "type": "string", + "nullable": true, + "description": "规格型号", + "example": "A4 70g" + }, + "barcode": { + "type": "string", + "description": "条形码" + }, + "supplierId": { + "type": "number", + "nullable": true, + "description": "供应商ID" + }, + "purchasePrice": { + "type": "number", + "nullable": true, + "description": "采购价格", + "example": 25.5 + }, + "sellingPrice": { + "type": "number", + "nullable": true, + "description": "销售价格", + "example": 30 }, "unit": { "type": "string", "nullable": true, - "description": "单位" + "description": "单位", + "example": "包" }, - "isActive": { - "type": "boolean", - "description": "是否激活" + "minStock": { + "type": "number", + "nullable": true, + "description": "最小库存" }, - "createdAt": { - "type": "string", - "description": "创建时间" + "maxStock": { + "type": "number", + "nullable": true, + "description": "最大库存" }, - "updatedAt": { - "type": "string", - "description": "更新时间" + "status": { + "type": "number", + "nullable": true, + "description": "状态:0-正常,1-停用" } }, "required": [ "id", - "name", - "spec", + "skuCode", + "specification", + "barcode", + "supplierId", + "purchasePrice", + "sellingPrice", "unit", - "isActive", - "createdAt", - "updatedAt" + "minStock", + "maxStock", + "status" + ] + }, + "GoodsWithSKUResponse": { + "type": "object", + "properties": { + "id": { + "type": "number", + "description": "商品ID" + }, + "goodsName": { + "type": "string", + "description": "商品名称", + "example": "打印纸" + }, + "categoryId": { + "type": "number", + "nullable": true, + "description": "分类ID" + }, + "brand": { + "type": "string", + "nullable": true, + "description": "品牌" + }, + "status": { + "type": "number", + "nullable": true, + "description": "状态:0-正常,1-停用" + }, + "hospId": { + "type": "string", + "nullable": true, + "description": "医院ID" + }, + "skus": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number", + "description": "SKU ID" + }, + "skuCode": { + "type": "string", + "nullable": true, + "description": "SKU编码" + }, + "specification": { + "type": "string", + "nullable": true, + "description": "规格型号", + "example": "A4 70g" + }, + "barcode": { + "type": "string", + "description": "条形码" + }, + "supplierId": { + "type": "number", + "nullable": true, + "description": "供应商ID" + }, + "purchasePrice": { + "type": "number", + "nullable": true, + "description": "采购价格", + "example": 25.5 + }, + "sellingPrice": { + "type": "number", + "nullable": true, + "description": "销售价格", + "example": 30 + }, + "unit": { + "type": "string", + "nullable": true, + "description": "单位", + "example": "包" + }, + "minStock": { + "type": "number", + "nullable": true, + "description": "最小库存" + }, + "maxStock": { + "type": "number", + "nullable": true, + "description": "最大库存" + }, + "status": { + "type": "number", + "nullable": true, + "description": "状态:0-正常,1-停用" + } + }, + "required": [ + "id", + "skuCode", + "specification", + "barcode", + "supplierId", + "purchasePrice", + "sellingPrice", + "unit", + "minStock", + "maxStock", + "status" + ] + }, + "description": "SKU列表(规格/价格等信息)" + } + }, + "required": [ + "id", + "goodsName", + "categoryId", + "brand", + "status", + "hospId", + "skus" ] }, "ErrorResponse": { @@ -680,10 +758,6 @@ "remark": { "type": "string", "description": "备注" - }, - "catalogId": { - "type": "string", - "description": "关联的目录ID" } }, "required": [ @@ -815,10 +889,6 @@ "type": "string", "description": "备注" }, - "catalogId": { - "type": "string", - "description": "关联的目录ID" - }, "id": { "type": "string", "description": "物料明细ID" @@ -1078,10 +1148,6 @@ "type": "string", "description": "备注" }, - "catalogId": { - "type": "string", - "description": "关联的目录ID" - }, "id": { "type": "string", "description": "物料明细ID" @@ -1292,10 +1358,6 @@ "type": "string", "description": "备注" }, - "catalogId": { - "type": "string", - "description": "关联的目录ID" - }, "id": { "type": "string", "description": "物料明细ID" @@ -1464,10 +1526,6 @@ "type": "string", "description": "备注" }, - "catalogId": { - "type": "string", - "description": "关联的目录ID" - }, "id": { "type": "string" } @@ -1595,10 +1653,6 @@ "type": "string", "description": "备注" }, - "catalogId": { - "type": "string", - "description": "关联的目录ID" - }, "id": { "type": "string", "description": "物料明细ID" @@ -1865,10 +1919,6 @@ "type": "string", "description": "备注" }, - "catalogId": { - "type": "string", - "description": "关联的目录ID" - }, "id": { "type": "string", "description": "物料明细ID" @@ -2005,10 +2055,6 @@ "remark": { "type": "string", "description": "备注" - }, - "catalogId": { - "type": "string", - "description": "关联的目录ID" } }, "required": [ @@ -2064,10 +2110,6 @@ "type": "string", "description": "备注" }, - "catalogId": { - "type": "string", - "description": "关联的目录ID" - }, "id": { "type": "string", "description": "物料明细ID" @@ -2185,10 +2227,6 @@ "remark": { "type": "string", "description": "备注" - }, - "catalogId": { - "type": "string", - "description": "关联的目录ID" } } } @@ -2240,10 +2278,6 @@ "type": "string", "description": "备注" }, - "catalogId": { - "type": "string", - "description": "关联的目录ID" - }, "id": { "type": "string", "description": "物料明细ID" @@ -2327,119 +2361,19 @@ } } }, - "/api/consumable-temp-catalog": { - "post": { - "tags": [ - "Consumable Catalog" - ], - "summary": "创建耗材目录", - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "minLength": 1, - "example": "办公用品", - "description": "目录名称" - }, - "spec": { - "type": "string", - "example": "标准", - "description": "规格" - }, - "unit": { - "type": "string", - "example": "个", - "description": "单位" - }, - "isActive": { - "type": "boolean", - "default": true, - "description": "是否激活" - } - }, - "required": [ - "name" - ] - } - } - } - }, - "responses": { - "201": { - "description": "创建成功", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "目录ID" - }, - "name": { - "type": "string", - "description": "目录名称" - }, - "spec": { - "type": "string", - "nullable": true, - "description": "规格" - }, - "unit": { - "type": "string", - "nullable": true, - "description": "单位" - }, - "isActive": { - "type": "boolean", - "description": "是否激活" - }, - "createdAt": { - "type": "string", - "description": "创建时间" - }, - "updatedAt": { - "type": "string", - "description": "更新时间" - } - }, - "required": [ - "id", - "name", - "spec", - "unit", - "isActive", - "createdAt", - "updatedAt" - ] - } - }, - "required": [ - "data" - ] - } - } - } - } - } - }, + "/api/consumable-goods": { "get": { "tags": [ - "Consumable Catalog" + "Consumable Goods" ], - "summary": "查询耗材目录列表", + "summary": "查询易耗品种类列表(含规格/价格)", + "description": "联合查询商品和 SKU 信息,返回商品及其所有规格、价格等详细信息", "parameters": [ { "schema": { "type": "string", - "description": "页码" + "description": "页码", + "example": "1" }, "required": false, "description": "页码", @@ -2449,7 +2383,8 @@ { "schema": { "type": "string", - "description": "每页数量" + "description": "每页数量", + "example": "20" }, "required": false, "description": "每页数量", @@ -2459,20 +2394,42 @@ { "schema": { "type": "string", - "description": "是否激活" + "description": "状态:0-正常,1-停用", + "example": "0" }, "required": false, - "description": "是否激活", - "name": "isActive", + "description": "状态:0-正常,1-停用", + "name": "status", "in": "query" }, { "schema": { "type": "string", - "description": "搜索关键词" + "description": "医院ID" }, "required": false, - "description": "搜索关键词", + "description": "医院ID", + "name": "hospId", + "in": "query" + }, + { + "schema": { + "type": "string", + "description": "分类ID" + }, + "required": false, + "description": "分类ID", + "name": "categoryId", + "in": "query" + }, + { + "schema": { + "type": "string", + "description": "搜索关键词(商品名称)", + "example": "打印纸" + }, + "required": false, + "description": "搜索关键词(商品名称)", "name": "q", "in": "query" } @@ -2491,44 +2448,122 @@ "type": "object", "properties": { "id": { - "type": "string", - "description": "目录ID" + "type": "number", + "description": "商品ID" }, - "name": { + "goodsName": { "type": "string", - "description": "目录名称" + "description": "商品名称", + "example": "打印纸" }, - "spec": { + "categoryId": { + "type": "number", + "nullable": true, + "description": "分类ID" + }, + "brand": { "type": "string", "nullable": true, - "description": "规格" + "description": "品牌" }, - "unit": { + "status": { + "type": "number", + "nullable": true, + "description": "状态:0-正常,1-停用" + }, + "hospId": { "type": "string", "nullable": true, - "description": "单位" + "description": "医院ID" }, - "isActive": { - "type": "boolean", - "description": "是否激活" - }, - "createdAt": { - "type": "string", - "description": "创建时间" - }, - "updatedAt": { - "type": "string", - "description": "更新时间" + "skus": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number", + "description": "SKU ID" + }, + "skuCode": { + "type": "string", + "nullable": true, + "description": "SKU编码" + }, + "specification": { + "type": "string", + "nullable": true, + "description": "规格型号", + "example": "A4 70g" + }, + "barcode": { + "type": "string", + "description": "条形码" + }, + "supplierId": { + "type": "number", + "nullable": true, + "description": "供应商ID" + }, + "purchasePrice": { + "type": "number", + "nullable": true, + "description": "采购价格", + "example": 25.5 + }, + "sellingPrice": { + "type": "number", + "nullable": true, + "description": "销售价格", + "example": 30 + }, + "unit": { + "type": "string", + "nullable": true, + "description": "单位", + "example": "包" + }, + "minStock": { + "type": "number", + "nullable": true, + "description": "最小库存" + }, + "maxStock": { + "type": "number", + "nullable": true, + "description": "最大库存" + }, + "status": { + "type": "number", + "nullable": true, + "description": "状态:0-正常,1-停用" + } + }, + "required": [ + "id", + "skuCode", + "specification", + "barcode", + "supplierId", + "purchasePrice", + "sellingPrice", + "unit", + "minStock", + "maxStock", + "status" + ] + }, + "description": "SKU列表(规格/价格等信息)" } }, "required": [ "id", - "name", - "spec", - "unit", - "isActive", - "createdAt", - "updatedAt" + "goodsName", + "categoryId", + "brand", + "status", + "hospId", + "skus" ] } }, @@ -2566,20 +2601,21 @@ } } }, - "/api/consumable-temp-catalog/{id}": { + "/api/consumable-goods/{id}": { "get": { "tags": [ - "Consumable Catalog" + "Consumable Goods" ], - "summary": "获取耗材目录详情", + "summary": "获取易耗品种类详情(含规格/价格)", + "description": "获取单个商品及其所有 SKU 规格、价格等详细信息", "parameters": [ { "schema": { "type": "string", - "description": "目录ID" + "description": "商品ID" }, "required": true, - "description": "目录ID", + "description": "商品ID", "name": "id", "in": "path" } @@ -2596,44 +2632,122 @@ "type": "object", "properties": { "id": { - "type": "string", - "description": "目录ID" + "type": "number", + "description": "商品ID" }, - "name": { + "goodsName": { "type": "string", - "description": "目录名称" + "description": "商品名称", + "example": "打印纸" }, - "spec": { + "categoryId": { + "type": "number", + "nullable": true, + "description": "分类ID" + }, + "brand": { "type": "string", "nullable": true, - "description": "规格" + "description": "品牌" }, - "unit": { + "status": { + "type": "number", + "nullable": true, + "description": "状态:0-正常,1-停用" + }, + "hospId": { "type": "string", "nullable": true, - "description": "单位" + "description": "医院ID" }, - "isActive": { - "type": "boolean", - "description": "是否激活" - }, - "createdAt": { - "type": "string", - "description": "创建时间" - }, - "updatedAt": { - "type": "string", - "description": "更新时间" + "skus": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "number", + "description": "SKU ID" + }, + "skuCode": { + "type": "string", + "nullable": true, + "description": "SKU编码" + }, + "specification": { + "type": "string", + "nullable": true, + "description": "规格型号", + "example": "A4 70g" + }, + "barcode": { + "type": "string", + "description": "条形码" + }, + "supplierId": { + "type": "number", + "nullable": true, + "description": "供应商ID" + }, + "purchasePrice": { + "type": "number", + "nullable": true, + "description": "采购价格", + "example": 25.5 + }, + "sellingPrice": { + "type": "number", + "nullable": true, + "description": "销售价格", + "example": 30 + }, + "unit": { + "type": "string", + "nullable": true, + "description": "单位", + "example": "包" + }, + "minStock": { + "type": "number", + "nullable": true, + "description": "最小库存" + }, + "maxStock": { + "type": "number", + "nullable": true, + "description": "最大库存" + }, + "status": { + "type": "number", + "nullable": true, + "description": "状态:0-正常,1-停用" + } + }, + "required": [ + "id", + "skuCode", + "specification", + "barcode", + "supplierId", + "purchasePrice", + "sellingPrice", + "unit", + "minStock", + "maxStock", + "status" + ] + }, + "description": "SKU列表(规格/价格等信息)" } }, "required": [ "id", - "name", - "spec", - "unit", - "isActive", - "createdAt", - "updatedAt" + "goodsName", + "categoryId", + "brand", + "status", + "hospId", + "skus" ] } }, @@ -2668,163 +2782,6 @@ } } } - }, - "put": { - "tags": [ - "Consumable Catalog" - ], - "summary": "更新耗材目录", - "parameters": [ - { - "schema": { - "type": "string", - "description": "目录ID" - }, - "required": true, - "description": "目录ID", - "name": "id", - "in": "path" - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "minLength": 1, - "example": "办公用品", - "description": "目录名称" - }, - "spec": { - "type": "string", - "example": "标准", - "description": "规格" - }, - "unit": { - "type": "string", - "example": "个", - "description": "单位" - }, - "isActive": { - "type": "boolean", - "default": true, - "description": "是否激活" - } - } - } - } - } - }, - "responses": { - "200": { - "description": "更新成功", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "目录ID" - }, - "name": { - "type": "string", - "description": "目录名称" - }, - "spec": { - "type": "string", - "nullable": true, - "description": "规格" - }, - "unit": { - "type": "string", - "nullable": true, - "description": "单位" - }, - "isActive": { - "type": "boolean", - "description": "是否激活" - }, - "createdAt": { - "type": "string", - "description": "创建时间" - }, - "updatedAt": { - "type": "string", - "description": "更新时间" - } - }, - "required": [ - "id", - "name", - "spec", - "unit", - "isActive", - "createdAt", - "updatedAt" - ] - } - }, - "required": [ - "data" - ] - } - } - } - }, - "404": { - "description": "未找到", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "error": { - "type": "string", - "description": "错误信息" - }, - "details": { - "nullable": true, - "description": "详细错误信息" - } - }, - "required": [ - "error" - ] - } - } - } - } - } - }, - "delete": { - "tags": [ - "Consumable Catalog" - ], - "summary": "停用耗材目录", - "parameters": [ - { - "schema": { - "type": "string", - "description": "目录ID" - }, - "required": true, - "description": "目录ID", - "name": "id", - "in": "path" - } - ], - "responses": { - "204": { - "description": "停用成功" - } - } } } } diff --git a/src/pages/api/consumable-temp.ts b/src/pages/api/consumable-temp.ts index 2434f74..28408b2 100644 --- a/src/pages/api/consumable-temp.ts +++ b/src/pages/api/consumable-temp.ts @@ -47,14 +47,28 @@ export interface ConsumableRequest { items: RequestItem[] } -export interface CatalogItem { - id?: string - name: string - spec?: string +export interface SKUResponse { + id: number + skuCode?: string + specification?: string + barcode: string + supplierId?: number + purchasePrice?: number + sellingPrice?: number unit?: string - isActive?: boolean - createdAt?: string - updatedAt?: string + minStock?: number + maxStock?: number + status?: number +} + +export interface GoodsWithSKU { + id: number + goodsName: string + categoryId?: number + brand?: string + status?: number + hospId?: string + skus: SKUResponse[] } export interface ListQuery { @@ -66,10 +80,12 @@ export interface ListQuery { to?: string } -export interface CatalogQuery { +export interface GoodsQuery { page?: number pageSize?: number - isActive?: boolean + status?: number + hospId?: string + categoryId?: number q?: string } @@ -148,41 +164,18 @@ export default { }) }, - // 创建耗材目录 - createCatalog(data: Partial) { - return request('/api/consumable-temp-catalog', { - method: 'POST', - data - }) - }, - - // 查询目录列表 - getCatalogList(params?: CatalogQuery) { - return request('/api/consumable-temp-catalog', { + // 查询易耗品种类列表(含规格/价格) + getConsumableGoods(params?: GoodsQuery) { + return request('/api/consumable-goods', { method: 'GET', data: params }) }, - // 获取目录详情 - getCatalogDetail(id: string) { - return request(`/api/consumable-temp-catalog/${id}`, { + // 获取易耗品种类详情(含规格/价格) + getConsumableGoodsDetail(id: number) { + return request(`/api/consumable-goods/${id}`, { method: 'GET' }) - }, - - // 更新目录 - updateCatalog(id: string, data: Partial) { - return request(`/api/consumable-temp-catalog/${id}`, { - method: 'PUT', - data - }) - }, - - // 停用目录 - deleteCatalog(id: string) { - return request(`/api/consumable-temp-catalog/${id}`, { - method: 'DELETE' - }) } } diff --git a/src/pages/api/user.ts b/src/pages/api/user.ts index 9cf025b..f454ef0 100644 --- a/src/pages/api/user.ts +++ b/src/pages/api/user.ts @@ -2,6 +2,9 @@ import { formatTime, formatDate, formatDateTime, BASE_URL, getHeaders } from './ //@ts-ignore import md5 from '@/utils/md5.js' +import util from '@/utils/util.js' + +import config from '@/config' export function login(username: string, password: string): Promise<{ code: number; @@ -39,9 +42,36 @@ export function login(username: string, password: string): Promise<{ header: getHeaders(), - success: (res) => { + success: async (res) => { + + + + if (res.statusCode === 200) { - resolve(res.data as any); + try { + const res_ = await util.request({ + url: config.urls.login, + method: 'POST', + data: { + username: username, + password: md5.hexMD5(username + password), + typecode: '007' + } + }) + if (res_?.data?.code === 0) { + const staff = res_.data.data.userLoginInfo + // 兼容旧逻辑,附加 role 别名 + uni.setStorageSync('staff', { ...staff, role: staff.role_ids }) + uni.setStorageSync('token', res_.data.token) + resolve(res.data as any); + + } else { + uni.showToast({ title: res_?.data?.msg || '登录失败', icon: 'error', duration: 3000 }) + } + } catch (err: any) { + // util.request 已有统一错误提示 + console.warn('login error', err) + } } else { reject(res); } diff --git a/src/pages/consumables/temp-approve.vue b/src/pages/consumables/temp-approve.vue index 1f73e30..083a726 100644 --- a/src/pages/consumables/temp-approve.vue +++ b/src/pages/consumables/temp-approve.vue @@ -1,43 +1,93 @@