diff --git a/src/App.vue b/src/App.vue
index c2446a7..a2caec4 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,17 +1,38 @@
diff --git a/src/config.js b/src/config.ts
similarity index 97%
rename from src/config.js
rename to src/config.ts
index c523d5a..e790975 100644
--- a/src/config.js
+++ b/src/config.ts
@@ -110,3 +110,9 @@ export default {
unloadSpecimentPic: "/API/specimentransport/finishpic/upload/",
},
};
+
+export const enum AssetRole {
+ DEVICE_MANAGER = 0b100,
+ TEAM_LEAD = 0b010,
+ CONSUMABLES_MANAGER = 0b001
+}
\ No newline at end of file
diff --git a/src/pages.json b/src/pages.json
index 9f07267..bcbd209 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -118,8 +118,43 @@
"style": {
"navigationBarTitleText": "易耗品盘点(进行中)"
}
- }
-,
+ },
+ {
+ "path": "pages/consumables/temp-request",
+ "style": {
+ "navigationBarTitleText": "临时易耗品申请"
+ }
+ },
+ {
+ "path": "pages/consumables/temp-request-create",
+ "style": {
+ "navigationBarTitleText": "新建申请"
+ }
+ },
+ {
+ "path": "pages/consumables/temp-request-detail",
+ "style": {
+ "navigationBarTitleText": "申请详情"
+ }
+ },
+ {
+ "path": "pages/consumables/temp-approve",
+ "style": {
+ "navigationBarTitleText": "临时易耗品审批"
+ }
+ },
+ {
+ "path": "pages/consumables/temp-approve-detail",
+ "style": {
+ "navigationBarTitleText": "审批详情"
+ }
+ },
+ {
+ "path": "pages/consumables/temp-catalog",
+ "style": {
+ "navigationBarTitleText": "耗材种类管理"
+ }
+ },
{
"path": "pages/fixed-assets/scan",
"style": {
diff --git a/src/pages/api/assets.ts b/src/pages/api/assets.ts
new file mode 100644
index 0000000..9db4863
--- /dev/null
+++ b/src/pages/api/assets.ts
@@ -0,0 +1,142 @@
+import { formatTime, formatDate, formatDateTime, BASE_URL, getHeaders } from './index.js';
+
+// 定义借用资产接口
+interface BorrowAsset {
+ borrowId: number;
+ assetId: number;
+ assetName: string;
+ borrowDate: string;
+ returnDate: string | null;
+ actualReturnDate: string | null;
+ borrowerId: string;
+ borrowerName: string;
+ borrowerMobile: string;
+ borrowDepartmentId: string | null;
+ borrowDepartmentName: string | null;
+ location: string | null;
+ lenderId: string | null;
+ lenderName: string | null;
+ lenderMobile: string | null;
+ approverId: string | null;
+ approverName: string | null;
+ approverMobile: string | null;
+ registrantId: string | null;
+ registrantName: string | null;
+ registrantMobile: string | null;
+ registrantDate: string | null;
+ isReturn: number;
+ note: string;
+ deleteFlag: number;
+}
+
+// 定义分页响应接口
+interface PagedResponse {
+ total: number;
+ list: T[];
+ pageNum: number;
+ pageSize: number;
+ size: number;
+ startRow: number;
+ endRow: number;
+ pages: number;
+ prePage: number;
+ nextPage: number;
+ isFirstPage: boolean;
+ isLastPage: boolean;
+ hasPreviousPage: boolean;
+ hasNextPage: boolean;
+ navigatePages: number;
+ navigatepageNums: number[];
+ navigateFirstPage: number;
+ navigateLastPage: number;
+}
+
+// 定义 API 响应接口
+interface ApiResponse {
+ code: number;
+ msg: string;
+ token: string | null;
+ data: T;
+}
+
+// 借用列表
+/* {
+ "code": 0,
+ "msg": "查询成功",
+ "token": null,
+ "data": {
+ "total": 16,
+ "list": [
+ {
+ "borrowId": 49,
+ "assetId": 83,
+ "assetName": "和法国哈哈",
+ "borrowDate": "2025-09-07",
+ "returnDate": "2025-09-01",
+ "actualReturnDate": null,
+ "borrowerId": "40288083894a5a38018999ea74ff0135",
+ "borrowerName": "熊三",
+ "borrowerMobile": "123",
+ "borrowDepartmentId": null,
+ "borrowDepartmentName": null,
+ "location": null,
+ "lenderId": null,
+ "lenderName": null,
+ "lenderMobile": null,
+ "approverId": null,
+ "approverName": null,
+ "approverMobile": null,
+ "registrantId": "null",
+ "registrantName": null,
+ "registrantMobile": null,
+ "registrantDate": "2025-09-29",
+ "isReturn": 0,
+ "note": "123213",
+ "deleteFlag": 0
+ },...
+ ],
+ "pageNum": 1,
+ "pageSize": 10,
+ "size": 10,
+ "startRow": 1,
+ "endRow": 10,
+ "pages": 2,
+ "prePage": 0,
+ "nextPage": 2,
+ "isFirstPage": true,
+ "isLastPage": false,
+ "hasPreviousPage": false,
+ "hasNextPage": true,
+ "navigatePages": 8,
+ "navigatepageNums": [
+ 1,
+ 2
+ ],
+ "navigateFirstPage": 1,
+ "navigateLastPage": 2
+ }
+} */
+export function getLentAssetsList(page: number, pageSize: number, searchParams: any): Promise>> {
+ return new Promise((resolve, reject) => {
+ uni.request({
+ url: `${BASE_URL}/api/asset/borrow/page`,
+ method: 'POST',
+ header: getHeaders(),
+ data: {
+ pageNum: page,
+ pageSize,
+ ...searchParams
+ },
+ success: (res) => {
+ if (res.statusCode === 200) {
+ resolve(res.data as ApiResponse>);
+ } else {
+ reject(res);
+ }
+ },
+ fail: (err) => {
+ reject(err);
+ }
+ });
+ });
+}
diff --git a/src/pages/api/consumable-temp.oneapi.json b/src/pages/api/consumable-temp.oneapi.json
new file mode 100644
index 0000000..c406d2a
--- /dev/null
+++ b/src/pages/api/consumable-temp.oneapi.json
@@ -0,0 +1,2831 @@
+{
+ "openapi": "3.0.0",
+ "info": {
+ "title": "智能配送耗材临时申请 API",
+ "version": "1.0.0",
+ "description": "智能配送系统的耗材临时申请管理 API,支持申请创建、审批、物料明细管理和目录管理"
+ },
+ "servers": [
+ {
+ "url": "http://localhost:3000",
+ "description": "开发服务器"
+ }
+ ],
+ "components": {
+ "schemas": {
+ "RequestItem": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "example": "打印纸",
+ "description": "物料名称"
+ },
+ "spec": {
+ "type": "string",
+ "example": "A4",
+ "description": "规格"
+ },
+ "quantity": {
+ "type": "integer",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 10,
+ "description": "数量"
+ },
+ "unit": {
+ "type": "string",
+ "example": "箱",
+ "description": "单位"
+ },
+ "estimatedUnitCost": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 25.5,
+ "description": "预估单价"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ },
+ "catalogId": {
+ "type": "string",
+ "description": "关联的目录ID"
+ }
+ },
+ "required": [
+ "name",
+ "quantity"
+ ]
+ },
+ "CreateRequest": {
+ "type": "object",
+ "properties": {
+ "applicantName": {
+ "type": "string",
+ "example": "张三",
+ "description": "申请人姓名"
+ },
+ "applicantPhone": {
+ "type": "string",
+ "minLength": 3,
+ "example": "13800138000",
+ "description": "申请人电话"
+ },
+ "department": {
+ "type": "string",
+ "example": "技术部",
+ "description": "部门"
+ },
+ "reason": {
+ "type": "string",
+ "example": "日常办公",
+ "description": "申请原因"
+ },
+ "neededAt": {
+ "type": "string",
+ "nullable": true,
+ "format": "date",
+ "example": "2025-10-10T00:00:00Z",
+ "description": "需要时间"
+ },
+ "items": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "example": "打印纸",
+ "description": "物料名称"
+ },
+ "spec": {
+ "type": "string",
+ "example": "A4",
+ "description": "规格"
+ },
+ "quantity": {
+ "type": "integer",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 10,
+ "description": "数量"
+ },
+ "unit": {
+ "type": "string",
+ "example": "箱",
+ "description": "单位"
+ },
+ "estimatedUnitCost": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 25.5,
+ "description": "预估单价"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ },
+ "catalogId": {
+ "type": "string",
+ "description": "关联的目录ID"
+ }
+ },
+ "required": [
+ "name",
+ "quantity"
+ ]
+ },
+ "minItems": 1,
+ "description": "物料明细列表"
+ }
+ },
+ "required": [
+ "applicantPhone",
+ "items"
+ ]
+ },
+ "UpdateRequest": {
+ "type": "object",
+ "properties": {
+ "applicantName": {
+ "type": "string",
+ "example": "张三",
+ "description": "申请人姓名"
+ },
+ "applicantPhone": {
+ "type": "string",
+ "minLength": 3,
+ "example": "13800138000",
+ "description": "申请人电话"
+ },
+ "department": {
+ "type": "string",
+ "example": "技术部",
+ "description": "部门"
+ },
+ "reason": {
+ "type": "string",
+ "example": "日常办公",
+ "description": "申请原因"
+ },
+ "neededAt": {
+ "type": "string",
+ "nullable": true,
+ "format": "date",
+ "example": "2025-10-10T00:00:00Z",
+ "description": "需要时间"
+ },
+ "items": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "example": "打印纸",
+ "description": "物料名称"
+ },
+ "spec": {
+ "type": "string",
+ "example": "A4",
+ "description": "规格"
+ },
+ "quantity": {
+ "type": "integer",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 10,
+ "description": "数量"
+ },
+ "unit": {
+ "type": "string",
+ "example": "箱",
+ "description": "单位"
+ },
+ "estimatedUnitCost": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 25.5,
+ "description": "预估单价"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ },
+ "catalogId": {
+ "type": "string",
+ "description": "关联的目录ID"
+ },
+ "id": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "name",
+ "quantity"
+ ]
+ }
+ }
+ }
+ },
+ "UpdateStatus": {
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "string",
+ "enum": [
+ "PENDING",
+ "APPROVED",
+ "REJECTED",
+ "CANCELLED",
+ "COMPLETED"
+ ],
+ "description": "状态",
+ "example": "APPROVED"
+ },
+ "approverId": {
+ "type": "string",
+ "description": "审批人ID"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ }
+ },
+ "required": [
+ "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": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "example": "打印纸",
+ "description": "物料名称"
+ },
+ "spec": {
+ "type": "string",
+ "example": "A4",
+ "description": "规格"
+ },
+ "quantity": {
+ "type": "integer",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 10,
+ "description": "数量"
+ },
+ "unit": {
+ "type": "string",
+ "example": "箱",
+ "description": "单位"
+ },
+ "estimatedUnitCost": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 25.5,
+ "description": "预估单价"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ },
+ "catalogId": {
+ "type": "string",
+ "description": "关联的目录ID"
+ },
+ "id": {
+ "type": "string",
+ "description": "物料明细ID"
+ },
+ "requestId": {
+ "type": "string",
+ "description": "关联的请求ID"
+ },
+ "createdAt": {
+ "type": "string",
+ "description": "创建时间"
+ },
+ "updatedAt": {
+ "type": "string",
+ "description": "更新时间"
+ }
+ },
+ "required": [
+ "name",
+ "quantity",
+ "id",
+ "requestId",
+ "createdAt",
+ "updatedAt"
+ ]
+ },
+ "RequestResponse": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "请求ID"
+ },
+ "applicantName": {
+ "type": "string",
+ "nullable": true,
+ "description": "申请人姓名"
+ },
+ "applicantPhone": {
+ "type": "string",
+ "description": "申请人电话"
+ },
+ "department": {
+ "type": "string",
+ "nullable": true,
+ "description": "部门"
+ },
+ "reason": {
+ "type": "string",
+ "nullable": true,
+ "description": "申请原因"
+ },
+ "status": {
+ "type": "string",
+ "enum": [
+ "PENDING",
+ "APPROVED",
+ "REJECTED",
+ "CANCELLED",
+ "COMPLETED"
+ ],
+ "description": "状态"
+ },
+ "approverId": {
+ "type": "string",
+ "nullable": true,
+ "description": "审批人ID"
+ },
+ "approvedAt": {
+ "type": "string",
+ "nullable": true,
+ "description": "审批时间"
+ },
+ "neededAt": {
+ "type": "string",
+ "nullable": true,
+ "description": "需要时间"
+ },
+ "remark": {
+ "type": "string",
+ "nullable": true,
+ "description": "备注"
+ },
+ "createdAt": {
+ "type": "string",
+ "description": "创建时间"
+ },
+ "updatedAt": {
+ "type": "string",
+ "description": "更新时间"
+ },
+ "items": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "example": "打印纸",
+ "description": "物料名称"
+ },
+ "spec": {
+ "type": "string",
+ "example": "A4",
+ "description": "规格"
+ },
+ "quantity": {
+ "type": "integer",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 10,
+ "description": "数量"
+ },
+ "unit": {
+ "type": "string",
+ "example": "箱",
+ "description": "单位"
+ },
+ "estimatedUnitCost": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 25.5,
+ "description": "预估单价"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ },
+ "catalogId": {
+ "type": "string",
+ "description": "关联的目录ID"
+ },
+ "id": {
+ "type": "string",
+ "description": "物料明细ID"
+ },
+ "requestId": {
+ "type": "string",
+ "description": "关联的请求ID"
+ },
+ "createdAt": {
+ "type": "string",
+ "description": "创建时间"
+ },
+ "updatedAt": {
+ "type": "string",
+ "description": "更新时间"
+ }
+ },
+ "required": [
+ "name",
+ "quantity",
+ "id",
+ "requestId",
+ "createdAt",
+ "updatedAt"
+ ]
+ },
+ "description": "物料明细列表"
+ }
+ },
+ "required": [
+ "id",
+ "applicantName",
+ "applicantPhone",
+ "department",
+ "reason",
+ "status",
+ "approverId",
+ "approvedAt",
+ "neededAt",
+ "remark",
+ "createdAt",
+ "updatedAt",
+ "items"
+ ]
+ },
+ "CatalogResponse": {
+ "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"
+ ]
+ },
+ "ErrorResponse": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "string",
+ "description": "错误信息"
+ },
+ "details": {
+ "nullable": true,
+ "description": "详细错误信息"
+ }
+ },
+ "required": [
+ "error"
+ ]
+ }
+ },
+ "parameters": {}
+ },
+ "paths": {
+ "/api/consumable-temp-requests": {
+ "post": {
+ "tags": [
+ "Consumable Requests"
+ ],
+ "summary": "创建耗材临时申请",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "applicantName": {
+ "type": "string",
+ "example": "张三",
+ "description": "申请人姓名"
+ },
+ "applicantPhone": {
+ "type": "string",
+ "minLength": 3,
+ "example": "13800138000",
+ "description": "申请人电话"
+ },
+ "department": {
+ "type": "string",
+ "example": "技术部",
+ "description": "部门"
+ },
+ "reason": {
+ "type": "string",
+ "example": "日常办公",
+ "description": "申请原因"
+ },
+ "neededAt": {
+ "type": "string",
+ "nullable": true,
+ "format": "date",
+ "example": "2025-10-10T00:00:00Z",
+ "description": "需要时间"
+ },
+ "items": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "example": "打印纸",
+ "description": "物料名称"
+ },
+ "spec": {
+ "type": "string",
+ "example": "A4",
+ "description": "规格"
+ },
+ "quantity": {
+ "type": "integer",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 10,
+ "description": "数量"
+ },
+ "unit": {
+ "type": "string",
+ "example": "箱",
+ "description": "单位"
+ },
+ "estimatedUnitCost": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 25.5,
+ "description": "预估单价"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ },
+ "catalogId": {
+ "type": "string",
+ "description": "关联的目录ID"
+ }
+ },
+ "required": [
+ "name",
+ "quantity"
+ ]
+ },
+ "minItems": 1,
+ "description": "物料明细列表"
+ }
+ },
+ "required": [
+ "applicantPhone",
+ "items"
+ ]
+ }
+ }
+ }
+ },
+ "responses": {
+ "201": {
+ "description": "创建成功",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "请求ID"
+ },
+ "applicantName": {
+ "type": "string",
+ "nullable": true,
+ "description": "申请人姓名"
+ },
+ "applicantPhone": {
+ "type": "string",
+ "description": "申请人电话"
+ },
+ "department": {
+ "type": "string",
+ "nullable": true,
+ "description": "部门"
+ },
+ "reason": {
+ "type": "string",
+ "nullable": true,
+ "description": "申请原因"
+ },
+ "status": {
+ "type": "string",
+ "enum": [
+ "PENDING",
+ "APPROVED",
+ "REJECTED",
+ "CANCELLED",
+ "COMPLETED"
+ ],
+ "description": "状态"
+ },
+ "approverId": {
+ "type": "string",
+ "nullable": true,
+ "description": "审批人ID"
+ },
+ "approvedAt": {
+ "type": "string",
+ "nullable": true,
+ "description": "审批时间"
+ },
+ "neededAt": {
+ "type": "string",
+ "nullable": true,
+ "description": "需要时间"
+ },
+ "remark": {
+ "type": "string",
+ "nullable": true,
+ "description": "备注"
+ },
+ "createdAt": {
+ "type": "string",
+ "description": "创建时间"
+ },
+ "updatedAt": {
+ "type": "string",
+ "description": "更新时间"
+ },
+ "items": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "example": "打印纸",
+ "description": "物料名称"
+ },
+ "spec": {
+ "type": "string",
+ "example": "A4",
+ "description": "规格"
+ },
+ "quantity": {
+ "type": "integer",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 10,
+ "description": "数量"
+ },
+ "unit": {
+ "type": "string",
+ "example": "箱",
+ "description": "单位"
+ },
+ "estimatedUnitCost": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 25.5,
+ "description": "预估单价"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ },
+ "catalogId": {
+ "type": "string",
+ "description": "关联的目录ID"
+ },
+ "id": {
+ "type": "string",
+ "description": "物料明细ID"
+ },
+ "requestId": {
+ "type": "string",
+ "description": "关联的请求ID"
+ },
+ "createdAt": {
+ "type": "string",
+ "description": "创建时间"
+ },
+ "updatedAt": {
+ "type": "string",
+ "description": "更新时间"
+ }
+ },
+ "required": [
+ "name",
+ "quantity",
+ "id",
+ "requestId",
+ "createdAt",
+ "updatedAt"
+ ]
+ },
+ "description": "物料明细列表"
+ }
+ },
+ "required": [
+ "id",
+ "applicantName",
+ "applicantPhone",
+ "department",
+ "reason",
+ "status",
+ "approverId",
+ "approvedAt",
+ "neededAt",
+ "remark",
+ "createdAt",
+ "updatedAt",
+ "items"
+ ]
+ }
+ },
+ "required": [
+ "data"
+ ]
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "验证错误",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "string",
+ "description": "错误信息"
+ },
+ "details": {
+ "nullable": true,
+ "description": "详细错误信息"
+ }
+ },
+ "required": [
+ "error"
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "get": {
+ "tags": [
+ "Consumable Requests"
+ ],
+ "summary": "查询耗材临时申请列表",
+ "parameters": [
+ {
+ "schema": {
+ "type": "string",
+ "description": "页码"
+ },
+ "required": false,
+ "description": "页码",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "schema": {
+ "type": "string",
+ "description": "每页数量"
+ },
+ "required": false,
+ "description": "每页数量",
+ "name": "pageSize",
+ "in": "query"
+ },
+ {
+ "schema": {
+ "type": "string",
+ "description": "状态筛选"
+ },
+ "required": false,
+ "description": "状态筛选",
+ "name": "status",
+ "in": "query"
+ },
+ {
+ "schema": {
+ "type": "string",
+ "description": "申请人电话筛选"
+ },
+ "required": false,
+ "description": "申请人电话筛选",
+ "name": "applicantPhone",
+ "in": "query"
+ },
+ {
+ "schema": {
+ "type": "string",
+ "description": "开始时间"
+ },
+ "required": false,
+ "description": "开始时间",
+ "name": "from",
+ "in": "query"
+ },
+ {
+ "schema": {
+ "type": "string",
+ "description": "结束时间"
+ },
+ "required": false,
+ "description": "结束时间",
+ "name": "to",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "查询成功",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "请求ID"
+ },
+ "applicantName": {
+ "type": "string",
+ "nullable": true,
+ "description": "申请人姓名"
+ },
+ "applicantPhone": {
+ "type": "string",
+ "description": "申请人电话"
+ },
+ "department": {
+ "type": "string",
+ "nullable": true,
+ "description": "部门"
+ },
+ "reason": {
+ "type": "string",
+ "nullable": true,
+ "description": "申请原因"
+ },
+ "status": {
+ "type": "string",
+ "enum": [
+ "PENDING",
+ "APPROVED",
+ "REJECTED",
+ "CANCELLED",
+ "COMPLETED"
+ ],
+ "description": "状态"
+ },
+ "approverId": {
+ "type": "string",
+ "nullable": true,
+ "description": "审批人ID"
+ },
+ "approvedAt": {
+ "type": "string",
+ "nullable": true,
+ "description": "审批时间"
+ },
+ "neededAt": {
+ "type": "string",
+ "nullable": true,
+ "description": "需要时间"
+ },
+ "remark": {
+ "type": "string",
+ "nullable": true,
+ "description": "备注"
+ },
+ "createdAt": {
+ "type": "string",
+ "description": "创建时间"
+ },
+ "updatedAt": {
+ "type": "string",
+ "description": "更新时间"
+ },
+ "items": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "example": "打印纸",
+ "description": "物料名称"
+ },
+ "spec": {
+ "type": "string",
+ "example": "A4",
+ "description": "规格"
+ },
+ "quantity": {
+ "type": "integer",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 10,
+ "description": "数量"
+ },
+ "unit": {
+ "type": "string",
+ "example": "箱",
+ "description": "单位"
+ },
+ "estimatedUnitCost": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 25.5,
+ "description": "预估单价"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ },
+ "catalogId": {
+ "type": "string",
+ "description": "关联的目录ID"
+ },
+ "id": {
+ "type": "string",
+ "description": "物料明细ID"
+ },
+ "requestId": {
+ "type": "string",
+ "description": "关联的请求ID"
+ },
+ "createdAt": {
+ "type": "string",
+ "description": "创建时间"
+ },
+ "updatedAt": {
+ "type": "string",
+ "description": "更新时间"
+ }
+ },
+ "required": [
+ "name",
+ "quantity",
+ "id",
+ "requestId",
+ "createdAt",
+ "updatedAt"
+ ]
+ },
+ "description": "物料明细列表"
+ }
+ },
+ "required": [
+ "id",
+ "applicantName",
+ "applicantPhone",
+ "department",
+ "reason",
+ "status",
+ "approverId",
+ "approvedAt",
+ "neededAt",
+ "remark",
+ "createdAt",
+ "updatedAt",
+ "items"
+ ]
+ }
+ },
+ "meta": {
+ "type": "object",
+ "properties": {
+ "total": {
+ "type": "integer",
+ "description": "总数"
+ },
+ "page": {
+ "type": "integer",
+ "description": "当前页码"
+ },
+ "pageSize": {
+ "type": "integer",
+ "description": "每页数量"
+ }
+ },
+ "required": [
+ "total",
+ "page",
+ "pageSize"
+ ]
+ }
+ },
+ "required": [
+ "data",
+ "meta"
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/api/consumable-temp-requests/{id}": {
+ "get": {
+ "tags": [
+ "Consumable Requests"
+ ],
+ "summary": "获取耗材临时申请详情",
+ "parameters": [
+ {
+ "schema": {
+ "type": "string",
+ "description": "请求ID"
+ },
+ "required": true,
+ "description": "请求ID",
+ "name": "id",
+ "in": "path"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "查询成功",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "请求ID"
+ },
+ "applicantName": {
+ "type": "string",
+ "nullable": true,
+ "description": "申请人姓名"
+ },
+ "applicantPhone": {
+ "type": "string",
+ "description": "申请人电话"
+ },
+ "department": {
+ "type": "string",
+ "nullable": true,
+ "description": "部门"
+ },
+ "reason": {
+ "type": "string",
+ "nullable": true,
+ "description": "申请原因"
+ },
+ "status": {
+ "type": "string",
+ "enum": [
+ "PENDING",
+ "APPROVED",
+ "REJECTED",
+ "CANCELLED",
+ "COMPLETED"
+ ],
+ "description": "状态"
+ },
+ "approverId": {
+ "type": "string",
+ "nullable": true,
+ "description": "审批人ID"
+ },
+ "approvedAt": {
+ "type": "string",
+ "nullable": true,
+ "description": "审批时间"
+ },
+ "neededAt": {
+ "type": "string",
+ "nullable": true,
+ "description": "需要时间"
+ },
+ "remark": {
+ "type": "string",
+ "nullable": true,
+ "description": "备注"
+ },
+ "createdAt": {
+ "type": "string",
+ "description": "创建时间"
+ },
+ "updatedAt": {
+ "type": "string",
+ "description": "更新时间"
+ },
+ "items": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "example": "打印纸",
+ "description": "物料名称"
+ },
+ "spec": {
+ "type": "string",
+ "example": "A4",
+ "description": "规格"
+ },
+ "quantity": {
+ "type": "integer",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 10,
+ "description": "数量"
+ },
+ "unit": {
+ "type": "string",
+ "example": "箱",
+ "description": "单位"
+ },
+ "estimatedUnitCost": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 25.5,
+ "description": "预估单价"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ },
+ "catalogId": {
+ "type": "string",
+ "description": "关联的目录ID"
+ },
+ "id": {
+ "type": "string",
+ "description": "物料明细ID"
+ },
+ "requestId": {
+ "type": "string",
+ "description": "关联的请求ID"
+ },
+ "createdAt": {
+ "type": "string",
+ "description": "创建时间"
+ },
+ "updatedAt": {
+ "type": "string",
+ "description": "更新时间"
+ }
+ },
+ "required": [
+ "name",
+ "quantity",
+ "id",
+ "requestId",
+ "createdAt",
+ "updatedAt"
+ ]
+ },
+ "description": "物料明细列表"
+ }
+ },
+ "required": [
+ "id",
+ "applicantName",
+ "applicantPhone",
+ "department",
+ "reason",
+ "status",
+ "approverId",
+ "approvedAt",
+ "neededAt",
+ "remark",
+ "createdAt",
+ "updatedAt",
+ "items"
+ ]
+ }
+ },
+ "required": [
+ "data"
+ ]
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "未找到",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "string",
+ "description": "错误信息"
+ },
+ "details": {
+ "nullable": true,
+ "description": "详细错误信息"
+ }
+ },
+ "required": [
+ "error"
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "put": {
+ "tags": [
+ "Consumable Requests"
+ ],
+ "summary": "更新耗材临时申请",
+ "parameters": [
+ {
+ "schema": {
+ "type": "string",
+ "description": "请求ID"
+ },
+ "required": true,
+ "description": "请求ID",
+ "name": "id",
+ "in": "path"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "applicantName": {
+ "type": "string",
+ "example": "张三",
+ "description": "申请人姓名"
+ },
+ "applicantPhone": {
+ "type": "string",
+ "minLength": 3,
+ "example": "13800138000",
+ "description": "申请人电话"
+ },
+ "department": {
+ "type": "string",
+ "example": "技术部",
+ "description": "部门"
+ },
+ "reason": {
+ "type": "string",
+ "example": "日常办公",
+ "description": "申请原因"
+ },
+ "neededAt": {
+ "type": "string",
+ "nullable": true,
+ "format": "date",
+ "example": "2025-10-10T00:00:00Z",
+ "description": "需要时间"
+ },
+ "items": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "example": "打印纸",
+ "description": "物料名称"
+ },
+ "spec": {
+ "type": "string",
+ "example": "A4",
+ "description": "规格"
+ },
+ "quantity": {
+ "type": "integer",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 10,
+ "description": "数量"
+ },
+ "unit": {
+ "type": "string",
+ "example": "箱",
+ "description": "单位"
+ },
+ "estimatedUnitCost": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 25.5,
+ "description": "预估单价"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ },
+ "catalogId": {
+ "type": "string",
+ "description": "关联的目录ID"
+ },
+ "id": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "name",
+ "quantity"
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "更新成功",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "请求ID"
+ },
+ "applicantName": {
+ "type": "string",
+ "nullable": true,
+ "description": "申请人姓名"
+ },
+ "applicantPhone": {
+ "type": "string",
+ "description": "申请人电话"
+ },
+ "department": {
+ "type": "string",
+ "nullable": true,
+ "description": "部门"
+ },
+ "reason": {
+ "type": "string",
+ "nullable": true,
+ "description": "申请原因"
+ },
+ "status": {
+ "type": "string",
+ "enum": [
+ "PENDING",
+ "APPROVED",
+ "REJECTED",
+ "CANCELLED",
+ "COMPLETED"
+ ],
+ "description": "状态"
+ },
+ "approverId": {
+ "type": "string",
+ "nullable": true,
+ "description": "审批人ID"
+ },
+ "approvedAt": {
+ "type": "string",
+ "nullable": true,
+ "description": "审批时间"
+ },
+ "neededAt": {
+ "type": "string",
+ "nullable": true,
+ "description": "需要时间"
+ },
+ "remark": {
+ "type": "string",
+ "nullable": true,
+ "description": "备注"
+ },
+ "createdAt": {
+ "type": "string",
+ "description": "创建时间"
+ },
+ "updatedAt": {
+ "type": "string",
+ "description": "更新时间"
+ },
+ "items": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "example": "打印纸",
+ "description": "物料名称"
+ },
+ "spec": {
+ "type": "string",
+ "example": "A4",
+ "description": "规格"
+ },
+ "quantity": {
+ "type": "integer",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 10,
+ "description": "数量"
+ },
+ "unit": {
+ "type": "string",
+ "example": "箱",
+ "description": "单位"
+ },
+ "estimatedUnitCost": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 25.5,
+ "description": "预估单价"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ },
+ "catalogId": {
+ "type": "string",
+ "description": "关联的目录ID"
+ },
+ "id": {
+ "type": "string",
+ "description": "物料明细ID"
+ },
+ "requestId": {
+ "type": "string",
+ "description": "关联的请求ID"
+ },
+ "createdAt": {
+ "type": "string",
+ "description": "创建时间"
+ },
+ "updatedAt": {
+ "type": "string",
+ "description": "更新时间"
+ }
+ },
+ "required": [
+ "name",
+ "quantity",
+ "id",
+ "requestId",
+ "createdAt",
+ "updatedAt"
+ ]
+ },
+ "description": "物料明细列表"
+ }
+ },
+ "required": [
+ "id",
+ "applicantName",
+ "applicantPhone",
+ "department",
+ "reason",
+ "status",
+ "approverId",
+ "approvedAt",
+ "neededAt",
+ "remark",
+ "createdAt",
+ "updatedAt",
+ "items"
+ ]
+ }
+ },
+ "required": [
+ "data"
+ ]
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "未找到",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "string",
+ "description": "错误信息"
+ },
+ "details": {
+ "nullable": true,
+ "description": "详细错误信息"
+ }
+ },
+ "required": [
+ "error"
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "delete": {
+ "tags": [
+ "Consumable Requests"
+ ],
+ "summary": "删除耗材临时申请",
+ "parameters": [
+ {
+ "schema": {
+ "type": "string",
+ "description": "请求ID"
+ },
+ "required": true,
+ "description": "请求ID",
+ "name": "id",
+ "in": "path"
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "删除成功"
+ }
+ }
+ }
+ },
+ "/api/consumable-temp-requests/{id}/status": {
+ "patch": {
+ "tags": [
+ "Consumable Requests"
+ ],
+ "summary": "更新耗材临时申请状态",
+ "parameters": [
+ {
+ "schema": {
+ "type": "string",
+ "description": "请求ID"
+ },
+ "required": true,
+ "description": "请求ID",
+ "name": "id",
+ "in": "path"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "string",
+ "enum": [
+ "PENDING",
+ "APPROVED",
+ "REJECTED",
+ "CANCELLED",
+ "COMPLETED"
+ ],
+ "description": "状态",
+ "example": "APPROVED"
+ },
+ "approverId": {
+ "type": "string",
+ "description": "审批人ID"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ }
+ },
+ "required": [
+ "status"
+ ]
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "更新成功",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "请求ID"
+ },
+ "applicantName": {
+ "type": "string",
+ "nullable": true,
+ "description": "申请人姓名"
+ },
+ "applicantPhone": {
+ "type": "string",
+ "description": "申请人电话"
+ },
+ "department": {
+ "type": "string",
+ "nullable": true,
+ "description": "部门"
+ },
+ "reason": {
+ "type": "string",
+ "nullable": true,
+ "description": "申请原因"
+ },
+ "status": {
+ "type": "string",
+ "enum": [
+ "PENDING",
+ "APPROVED",
+ "REJECTED",
+ "CANCELLED",
+ "COMPLETED"
+ ],
+ "description": "状态"
+ },
+ "approverId": {
+ "type": "string",
+ "nullable": true,
+ "description": "审批人ID"
+ },
+ "approvedAt": {
+ "type": "string",
+ "nullable": true,
+ "description": "审批时间"
+ },
+ "neededAt": {
+ "type": "string",
+ "nullable": true,
+ "description": "需要时间"
+ },
+ "remark": {
+ "type": "string",
+ "nullable": true,
+ "description": "备注"
+ },
+ "createdAt": {
+ "type": "string",
+ "description": "创建时间"
+ },
+ "updatedAt": {
+ "type": "string",
+ "description": "更新时间"
+ },
+ "items": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "example": "打印纸",
+ "description": "物料名称"
+ },
+ "spec": {
+ "type": "string",
+ "example": "A4",
+ "description": "规格"
+ },
+ "quantity": {
+ "type": "integer",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 10,
+ "description": "数量"
+ },
+ "unit": {
+ "type": "string",
+ "example": "箱",
+ "description": "单位"
+ },
+ "estimatedUnitCost": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 25.5,
+ "description": "预估单价"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ },
+ "catalogId": {
+ "type": "string",
+ "description": "关联的目录ID"
+ },
+ "id": {
+ "type": "string",
+ "description": "物料明细ID"
+ },
+ "requestId": {
+ "type": "string",
+ "description": "关联的请求ID"
+ },
+ "createdAt": {
+ "type": "string",
+ "description": "创建时间"
+ },
+ "updatedAt": {
+ "type": "string",
+ "description": "更新时间"
+ }
+ },
+ "required": [
+ "name",
+ "quantity",
+ "id",
+ "requestId",
+ "createdAt",
+ "updatedAt"
+ ]
+ },
+ "description": "物料明细列表"
+ }
+ },
+ "required": [
+ "id",
+ "applicantName",
+ "applicantPhone",
+ "department",
+ "reason",
+ "status",
+ "approverId",
+ "approvedAt",
+ "neededAt",
+ "remark",
+ "createdAt",
+ "updatedAt",
+ "items"
+ ]
+ }
+ },
+ "required": [
+ "data"
+ ]
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "未找到",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "string",
+ "description": "错误信息"
+ },
+ "details": {
+ "nullable": true,
+ "description": "详细错误信息"
+ }
+ },
+ "required": [
+ "error"
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/api/consumable-temp-requests/{id}/items": {
+ "post": {
+ "tags": [
+ "Consumable Request Items"
+ ],
+ "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": "A4",
+ "description": "规格"
+ },
+ "quantity": {
+ "type": "integer",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 10,
+ "description": "数量"
+ },
+ "unit": {
+ "type": "string",
+ "example": "箱",
+ "description": "单位"
+ },
+ "estimatedUnitCost": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 25.5,
+ "description": "预估单价"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ },
+ "catalogId": {
+ "type": "string",
+ "description": "关联的目录ID"
+ }
+ },
+ "required": [
+ "name",
+ "quantity"
+ ]
+ }
+ }
+ }
+ },
+ "responses": {
+ "201": {
+ "description": "创建成功",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "example": "打印纸",
+ "description": "物料名称"
+ },
+ "spec": {
+ "type": "string",
+ "example": "A4",
+ "description": "规格"
+ },
+ "quantity": {
+ "type": "integer",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 10,
+ "description": "数量"
+ },
+ "unit": {
+ "type": "string",
+ "example": "箱",
+ "description": "单位"
+ },
+ "estimatedUnitCost": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 25.5,
+ "description": "预估单价"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ },
+ "catalogId": {
+ "type": "string",
+ "description": "关联的目录ID"
+ },
+ "id": {
+ "type": "string",
+ "description": "物料明细ID"
+ },
+ "requestId": {
+ "type": "string",
+ "description": "关联的请求ID"
+ },
+ "createdAt": {
+ "type": "string",
+ "description": "创建时间"
+ },
+ "updatedAt": {
+ "type": "string",
+ "description": "更新时间"
+ }
+ },
+ "required": [
+ "name",
+ "quantity",
+ "id",
+ "requestId",
+ "createdAt",
+ "updatedAt"
+ ]
+ }
+ },
+ "required": [
+ "data"
+ ]
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "请求未找到",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "string",
+ "description": "错误信息"
+ },
+ "details": {
+ "nullable": true,
+ "description": "详细错误信息"
+ }
+ },
+ "required": [
+ "error"
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/api/consumable-temp-items/{itemId}": {
+ "put": {
+ "tags": [
+ "Consumable Request Items"
+ ],
+ "summary": "更新物料明细",
+ "parameters": [
+ {
+ "schema": {
+ "type": "string",
+ "description": "物料明细ID"
+ },
+ "required": true,
+ "description": "物料明细ID",
+ "name": "itemId",
+ "in": "path"
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "example": "打印纸",
+ "description": "物料名称"
+ },
+ "spec": {
+ "type": "string",
+ "example": "A4",
+ "description": "规格"
+ },
+ "quantity": {
+ "type": "integer",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 10,
+ "description": "数量"
+ },
+ "unit": {
+ "type": "string",
+ "example": "箱",
+ "description": "单位"
+ },
+ "estimatedUnitCost": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 25.5,
+ "description": "预估单价"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ },
+ "catalogId": {
+ "type": "string",
+ "description": "关联的目录ID"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "更新成功",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "example": "打印纸",
+ "description": "物料名称"
+ },
+ "spec": {
+ "type": "string",
+ "example": "A4",
+ "description": "规格"
+ },
+ "quantity": {
+ "type": "integer",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 10,
+ "description": "数量"
+ },
+ "unit": {
+ "type": "string",
+ "example": "箱",
+ "description": "单位"
+ },
+ "estimatedUnitCost": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true,
+ "example": 25.5,
+ "description": "预估单价"
+ },
+ "remark": {
+ "type": "string",
+ "description": "备注"
+ },
+ "catalogId": {
+ "type": "string",
+ "description": "关联的目录ID"
+ },
+ "id": {
+ "type": "string",
+ "description": "物料明细ID"
+ },
+ "requestId": {
+ "type": "string",
+ "description": "关联的请求ID"
+ },
+ "createdAt": {
+ "type": "string",
+ "description": "创建时间"
+ },
+ "updatedAt": {
+ "type": "string",
+ "description": "更新时间"
+ }
+ },
+ "required": [
+ "name",
+ "quantity",
+ "id",
+ "requestId",
+ "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 Request Items"
+ ],
+ "summary": "删除物料明细",
+ "parameters": [
+ {
+ "schema": {
+ "type": "string",
+ "description": "物料明细ID"
+ },
+ "required": true,
+ "description": "物料明细ID",
+ "name": "itemId",
+ "in": "path"
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "删除成功"
+ }
+ }
+ }
+ },
+ "/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"
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "get": {
+ "tags": [
+ "Consumable Catalog"
+ ],
+ "summary": "查询耗材目录列表",
+ "parameters": [
+ {
+ "schema": {
+ "type": "string",
+ "description": "页码"
+ },
+ "required": false,
+ "description": "页码",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "schema": {
+ "type": "string",
+ "description": "每页数量"
+ },
+ "required": false,
+ "description": "每页数量",
+ "name": "pageSize",
+ "in": "query"
+ },
+ {
+ "schema": {
+ "type": "string",
+ "description": "是否激活"
+ },
+ "required": false,
+ "description": "是否激活",
+ "name": "isActive",
+ "in": "query"
+ },
+ {
+ "schema": {
+ "type": "string",
+ "description": "搜索关键词"
+ },
+ "required": false,
+ "description": "搜索关键词",
+ "name": "q",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "查询成功",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "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"
+ ]
+ }
+ },
+ "meta": {
+ "type": "object",
+ "properties": {
+ "total": {
+ "type": "integer",
+ "description": "总数"
+ },
+ "page": {
+ "type": "integer",
+ "description": "当前页码"
+ },
+ "pageSize": {
+ "type": "integer",
+ "description": "每页数量"
+ }
+ },
+ "required": [
+ "total",
+ "page",
+ "pageSize"
+ ]
+ }
+ },
+ "required": [
+ "data",
+ "meta"
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "/api/consumable-temp-catalog/{id}": {
+ "get": {
+ "tags": [
+ "Consumable Catalog"
+ ],
+ "summary": "获取耗材目录详情",
+ "parameters": [
+ {
+ "schema": {
+ "type": "string",
+ "description": "目录ID"
+ },
+ "required": true,
+ "description": "目录ID",
+ "name": "id",
+ "in": "path"
+ }
+ ],
+ "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"
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "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": "停用成功"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/pages/api/consumable-temp.ts b/src/pages/api/consumable-temp.ts
new file mode 100644
index 0000000..e196184
--- /dev/null
+++ b/src/pages/api/consumable-temp.ts
@@ -0,0 +1,188 @@
+import { formatTime, formatDate, formatDateTime, getHeaders } from './index';
+
+const BASE_URL = 'http://localhost:3000' // 替换为你的实际后端地址
+// 请求封装
+const request = (url: string, options: any = {}) => {
+ const token = uni.getStorageSync('token')
+ return uni.request({
+ url: `${BASE_URL}${url}`,
+ method: options.method || 'GET',
+ data: options.data,
+ header: {
+ 'Content-Type': 'application/json',
+ 'Authorization': token ? `Bearer ${token}` : '',
+ ...options.header
+ }
+ })
+}
+
+// 类型定义
+export interface RequestItem {
+ id?: string
+ name: string
+ spec?: string
+ quantity: number
+ unit?: string
+ estimatedUnitCost?: number
+ remark?: string
+ catalogId?: string
+ requestId?: string
+ createdAt?: string
+ updatedAt?: string
+}
+
+export interface ConsumableRequest {
+ id?: string
+ applicantName?: string
+ applicantPhone: string
+ department?: string
+ reason?: string
+ status?: 'PENDING' | 'APPROVED' | 'REJECTED' | 'CANCELLED' | 'COMPLETED'
+ approverId?: string
+ approvedAt?: string
+ neededAt?: string
+ remark?: string
+ createdAt?: string
+ updatedAt?: string
+ items: RequestItem[]
+}
+
+export interface CatalogItem {
+ id?: string
+ name: string
+ spec?: string
+ unit?: string
+ isActive?: boolean
+ createdAt?: string
+ updatedAt?: string
+}
+
+export interface ListQuery {
+ page?: number
+ pageSize?: number
+ status?: string
+ applicantPhone?: string
+ from?: string
+ to?: string
+}
+
+export interface CatalogQuery {
+ page?: number
+ pageSize?: number
+ isActive?: boolean
+ q?: string
+}
+
+// API 方法
+export default {
+ // 创建临时申请
+ createRequest(data: Partial) {
+ return request('/api/consumable-temp-requests', {
+ method: 'POST',
+ data
+ })
+ },
+
+ // 查询申请列表
+ getRequestList(params?: ListQuery) {
+ return request('/api/consumable-temp-requests', {
+ method: 'GET',
+ data: params
+ })
+ },
+
+ // 获取申请详情
+ getRequestDetail(id: string) {
+ return request(`/api/consumable-temp-requests/${id}`, {
+ method: 'GET'
+ })
+ },
+
+ // 更新申请
+ updateRequest(id: string, data: Partial) {
+ return request(`/api/consumable-temp-requests/${id}`, {
+ method: 'PUT',
+ data
+ })
+ },
+
+ // 删除申请
+ deleteRequest(id: string) {
+ return request(`/api/consumable-temp-requests/${id}`, {
+ method: 'DELETE'
+ })
+ },
+
+ // 更新申请状态
+ updateRequestStatus(id: string, data: {
+ status: string
+ approverId?: string
+ remark?: string
+ }) {
+ return request(`/api/consumable-temp-requests/${id}/status`, {
+ method: 'PATCH',
+ data
+ })
+ },
+
+ // 添加物料明细
+ addRequestItem(requestId: string, data: Partial) {
+ return request(`/api/consumable-temp-requests/${requestId}/items`, {
+ method: 'POST',
+ data
+ })
+ },
+
+ // 更新物料明细
+ updateRequestItem(itemId: string, data: Partial) {
+ return request(`/api/consumable-temp-items/${itemId}`, {
+ method: 'PUT',
+ data
+ })
+ },
+
+ // 删除物料明细
+ deleteRequestItem(itemId: string) {
+ return request(`/api/consumable-temp-items/${itemId}`, {
+ method: 'DELETE'
+ })
+ },
+
+ // 创建耗材目录
+ createCatalog(data: Partial) {
+ return request('/api/consumable-temp-catalog', {
+ method: 'POST',
+ data
+ })
+ },
+
+ // 查询目录列表
+ getCatalogList(params?: CatalogQuery) {
+ return request('/api/consumable-temp-catalog', {
+ method: 'GET',
+ data: params
+ })
+ },
+
+ // 获取目录详情
+ getCatalogDetail(id: string) {
+ return request(`/api/consumable-temp-catalog/${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/fixedAssets.js b/src/pages/api/fixedAssets.js
index 46645eb..7a607dc 100644
--- a/src/pages/api/fixedAssets.js
+++ b/src/pages/api/fixedAssets.js
@@ -1,8 +1,4 @@
-const BASE_URL = 'http://110.42.33.196:8089';//定义后端基础接口地址
-import config from '../../config.js'; // 引入配置文件
-
-
-
+import { formatTime, formatDate, formatDateTime, BASE_URL, getHeaders } from './index.ts'; // 引入时间格式化函数和BASE_URL
// 根据手机号搜索用户列表
export function searchUserByMobile(mobile) {
@@ -16,7 +12,7 @@ export function searchUserByMobile(mobile) {
},
success: (res) => {
console.log(res);
-
+
if (res.statusCode === 200) {
resolve(res.data);
} else {
@@ -31,63 +27,6 @@ export function searchUserByMobile(mobile) {
}
-//——————————————————————————————————————————————————————时间————————————————————————————————————————————————————
-// 数字补零工具函数(辅助日期格式化)
-const formatNumber = n => {
- n = n.toString()// 1. 将数字转为字符串(如 5 → "5",12 → "12")
- return n[1] ? n : '0' + n// 2. 补零逻辑:若字符串长度<2(如 "5"),则在前面加"0" → "05";否则直接返回(如 "12")
-}
-
-//时间格式化函数(仅返回时分秒)
-const formatTime = date => {
- date = new Date(date);// 1. 将输入的日期参数(可能是时间戳/字符串)转为标准 Date 对象
- const hour = date.getHours()// 2. 获取小时(0-23
- const minute = date.getMinutes()// 3. 获取分钟(0-59)
- const second = date.getSeconds()// 4. 获取秒(0-59)
- // 5. 拼接为 "时:分:秒" 格式(调用 formatNumber 补零),如 "09:05:03
- return `${formatNumber(hour)}:${formatNumber(minute)}:${formatNumber(second)}`
-}
-
-
-
-//日期格式化函数(仅返回年月日)
-const formatDate = date => {
- date = new Date(date);// 1. 转为标准 Date 对象
- const year = date.getFullYear()// 2. 获取完整年份(如 2024)
- const month = date.getMonth() + 1// 3. 获取月份(注意:Date 中月份是 0-11,需+1 才是实际月份,如 2→3月
- const day = date.getDate()// 4. 获取日期(1-31)
- // 5. 拼接为 "年-月-日" 格式(补零),如 "2024-03-15"
- return `${year}-${formatNumber(month)}-${formatNumber(day)}`
-}
-
-//完整日期时间格式化函数(年月日 + 时分秒)
-const formatDateTime = date => {
- return `${formatDate(date)} ${formatTime(date)}`
-}
-//——————————————————————————————————————————————————————————————————————————————————————————————————————————————————
-
-
-//用户信息初始化与判断
-let staff = uni.getStorageSync('staff'); // 1. 从 UniApp 本地缓存中读取 "staff"(用户信息,如ID、医院ID、手机号等)
-let staffisnull = (staff == null || staff == undefined || staff == '');// 2. 判断用户信息是否为空(null/undefined/空字符串)
-
-
-//统一请求头配置函数(核心!!!!!!!!!!!!!!!!!!!!所有接口共用)
-export function getHeaders() {
- const staff = uni.getStorageSync('staff') || null// 1. 再次读取用户信息(避免缓存过期,确保最新)
- // console.log("用户信息:",staff)// 2. 控制台打印用户信息,用于开发调试
- const staffisnull = !staff // 3. 简化判断:用户信息为空则为 true,否则为 false
-// 4. 返回请求头对象(接口请求时会携带这些信息,供后端验证)
- return {
- 'content-type': 'application/json',// ① 声明请求体格式为 JSON(后端需按 JSON 解析数据)
- //'Authorization': staffisnull ? null : `Bearer ${uni.getStorageSync('token')}`,
- 'hosp-ID': staffisnull ? config.defaultHospId : staff.hosp_id,// ③ 医院ID:用户未登录用配置文件的默认值,登录后用用户所属医院ID
- 'user-ID': staffisnull ? null : staff.id,// ④ 用户ID:用户未登录为 null,登录后用用户ID(后端用于识别请求用户)
- 'datetime': formatDateTime(new Date()),// ⑤ 请求时间:当前完整日期时间(后端可用于校验请求时效性)
- 'createby': staffisnull ? null : staff.id// ⑥ 创建人ID:与 user-ID 类似,用于后端记录操作人
- }////核心作用:统一所有接口的请求头格式,避免每个接口重复写头信息,同时支持 “登录 / 未登录” 状态的动态适配。
-}
-
//————————————————————————————————————————————————————固定资产相关————————————————————————————————————————————————————————
//分页请求固定资产数据
//作用:前端加载固定资产列表时调用(如 “资产列表页” 分页加载数据)。
@@ -104,11 +43,11 @@ export function fetchFixedAssets(pageNum, pageSize) {
url: `${BASE_URL}/api/assetInformation/page?pageNum=${pageNum}&pageSize=${pageSize}`,// 接口路径:拼接基础地址+分页参数(pageNum=页码,pageSize=每页条数)
method: 'POST',// 请求方法:POST
data: {// 请求体:空查询条件(后端可能支持按条件筛选,此处默认无筛选)
- query:{},
+ query: {},
},
- header:getHeaders(),// 请求头:调用上面的 getHeaders() 获取统一头信息
-
+ header: getHeaders(),// 请求头:调用上面的 getHeaders() 获取统一头信息
+
success: (res) => { // 请求成功回调(后端有响应,无论业务成功与否)
if (res.statusCode === 200) {// 若 HTTP 状态码为 200(表示网络请求成功)
resolve(res.data); // 根据你的接口返回结构调整 // 将后端返回的业务数据传给前端(前端用 .then() 接收)
@@ -133,11 +72,11 @@ export function searchFixedAssets(name) {
url: `${BASE_URL}/api/assetInformation/list`,// 接口路径:资产搜索接口
method: 'POST',
data: {
- assetName:name // 请求体:传递搜索关键词(assetName=资产名称)
+ assetName: name // 请求体:传递搜索关键词(assetName=资产名称)
},
- header:getHeaders(),
-
+ header: getHeaders(),
+
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data); // 根据你的接口返回结构调整
@@ -159,12 +98,12 @@ export function fetchAssetInfoById(id) {
uni.request({
url: `${BASE_URL}/api/assetInformation/list`, // 接口路径:获取单条资产信息
method: 'POST',
- header:getHeaders(),
- data:{
-
- "assetSn":id // 请求体:传递资产编号(assetSn=资产唯一编号)
-
- },
+ header: getHeaders(),
+ data: {
+
+ "assetSn": id // 请求体:传递资产编号(assetSn=资产唯一编号)
+
+ },
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data); // 根据你的接口返回结构调整
@@ -184,7 +123,7 @@ export function fetchMaintenanceInfoById(id) {
uni.request({
url: `${BASE_URL}/api/asset/maintenance/getByAssetId/${id}`, // 接口路径:拼接资产ID(RESTful 风格)
method: 'GET', // 请求方法:GET(此处用 GET 传递路径参数)
- header:getHeaders(),
+ header: getHeaders(),
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data); // 根据你的接口返回结构调整
@@ -208,17 +147,17 @@ export function borrowAssetById(addDTO) {
method: 'POST',
header: getHeaders(),
data: { // 请求体:传递借用所需的所有参数(从前端表单收集的信息)
- assetId: addDTO.assetId, // 资产ID
- assetName: addDTO.assetName, // 资产名称
- borrowDate: addDTO.borrowDate,// 借用日期(需前端传递格式化后的日期)
- borrowerId: addDTO.borrowerId,// 借用人ID
- borrowerMobile: addDTO.borrowerMobile, // 借用人手机号
- lenderId: addDTO.lenderId,// 出借人ID
- lenderMobile: addDTO.lenderMobile,// 出借人手机号
- note: addDTO.note,// 备注(可选)
- registrantDate: addDTO.registrantDate,// 登记日期
- registrantId: addDTO.registrantId,// 登记人ID
- returnDate: addDTO.returnDate// 预计归还日期
+ assetId: addDTO.assetId, // 资产ID
+ assetName: addDTO.assetName, // 资产名称
+ borrowDate: addDTO.borrowDate,// 借用日期(需前端传递格式化后的日期)
+ borrowerId: addDTO.borrowerId,// 借用人ID
+ borrowerMobile: addDTO.borrowerMobile, // 借用人手机号
+ lenderId: addDTO.lenderId,// 出借人ID
+ lenderMobile: addDTO.lenderMobile,// 出借人手机号
+ note: addDTO.note,// 备注(可选)
+ registrantDate: addDTO.registrantDate,// 登记日期
+ registrantId: addDTO.registrantId,// 登记人ID
+ returnDate: addDTO.returnDate// 预计归还日期
},
success: (res) => {
if (res.statusCode === 200) {
@@ -244,7 +183,7 @@ export function borrowInfo(borrowerId) {
method: 'POST',
header: getHeaders(),
data: {
- borrowerId:borrowerId // 请求体:传递借用人ID(查询该用户的所有借用记录)
+ borrowerId: borrowerId // 请求体:传递借用人ID(查询该用户的所有借用记录)
},
success: (res) => {
if (res.statusCode === 200) {
@@ -268,7 +207,7 @@ export function returnAsset(id) {
uni.request({
url: `${BASE_URL}/api/asset/borrow/returnAsset?assetId=${id}`, // 接口路径:拼接资产ID(URL参数)
method: 'PUT', // 请求方法:PUT(通常用于“更新资源状态”,此处更新资产为“已归还”)
- header:getHeaders(),
+ header: getHeaders(),
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data); // 根据你的接口返回结构调整
@@ -285,124 +224,18 @@ export function returnAsset(id) {
//————————————————————————————————————————————————业务接口函数(易耗品相关)——————————————————————————————————————————
//易耗品领用
-//作用:前端提交 “易耗品领用表单” 时调用(完成领用申请)。
-export function getConsumption(addDTO) {
- return new Promise((resolve, reject) => {
- uni.request({
- url: `${BASE_URL}/api/consumable-distribution-item/add`, //接口路径:易耗品领用提交
- method: 'POST',
- header:getHeaders(),
- data:{ // 请求体:易耗品领用所需参数(数量、组别ID、备注等)
- actualQuantity:addDTO.actualQuantity, // 实际领用数量
- groupId:addDTO.groupId,// 所属组别ID
- notes:addDTO.notes,// 备注
- planId:addDTO.planId,// 发放计划ID
- recipientMobile:addDTO.recipientMobile,// 领取人手机号
- skuId:addDTO.skuId// 易耗品SKU编号(唯一标识)
- },
- success: (res) => {
- if (res.statusCode === 200) {
- resolve(res.data); // 根据你的接口返回结构调整
- } else {
- reject(res);
- }
- },
- fail: (err) => {
- reject(err);
- }
- });
- });
-}
-//根据条码查询sku Id
-export function getConsumptionSkuId(barcode) {
- return new Promise((resolve, reject) => {
- uni.request({
- url: `${BASE_URL}/api/consumable/sku/list`,// 接口路径:条码查询SKU
- method: 'POST',
- header:getHeaders(),
- data:{
- barcode:barcode // 请求体:传递易耗品条码(通过条码获取对应的SKU ID)
- },
- success: (res) => {
- if (res.statusCode === 200) {
- resolve(res.data); // 根据你的接口返回结构调整
- } else {
- reject(res);
- }
- },
- fail: (err) => {
- reject(err);
- }
- });
- });
-}
-
-//查询商品库存
-export function getConsumptionQuantity(goodsInfo) {
- return new Promise((resolve, reject) => {
- uni.request({
- url: `${BASE_URL}/api/consumable-inventory/findByCondition`, // 接口路径:库存查询
- method: 'POST',
- header:getHeaders(),
- data:{ // 请求体:库存查询条件(SKU ID、仓库ID、位置ID)
- skuId:goodsInfo.skuId,
- locationId:goodsInfo.locationId,
- warehouseId:goodsInfo.warehouseId
-
- },
- success: (res) => {
- if (res.statusCode === 200) {
- resolve(res.data); // 根据你的接口返回结构调整
- } else {
- reject(res);
- }
- },
- fail: (err) => {
- reject(err);
- }
- });
- });
-}
-
-//——————————————————————————————————————————易耗品领用计划??????????????????????????????
-//获取组别信息
-export function getGroupsInfo(mobile) { //参数 mobile 表示“组长手机号”
- return new Promise((resolve, reject) => { // 返回 Promise 对象,支持异步调用(用 async/await 或 .then() 处理结果)
- // 调用 UniApp 的网络请求 API
- uni.request({
- // 请求地址:拼接基础地址 + 易耗品组别查询接口
- // 接口作用:根据条件查询易耗品组别(此处条件是组长手机号)
- url: `${BASE_URL}/api/consumable-groups/findByCondition`,
- method: 'POST',
- header:getHeaders(), // 请求头:使用统一的 getHeaders() 配置(携带用户、医院等信息)
- data:{ // 请求体:传递查询条件
- groupHeadMobile:mobile // 按“组长手机号”查询对应的组别(如组长管理的易耗品分组)
- },
- success: (res) => {
- if (res.statusCode === 200) {
- resolve(res.data); // 根据你的接口返回结构调整
- } else {
- reject(res);
- }
- },
- fail: (err) => {
- reject(err);
- }
- });
- });
-}
//获取发放计划信息
-export function getPlanInfo(id,pageNum, pageSize) {
+export function getPlanInfo(id, pageNum, pageSize) {
return new Promise((resolve, reject) => {
uni.request({
- // 请求地址:拼接基础地址 + 发放计划接口 + 分页参数(pageNum/pageSize)
+ // 请求地址:拼接基础地址 + 发放计划接口 + 分页参数(pageNum/pageSize)
url: `${BASE_URL}/api/consumable-distribution-plan/findByCondition?pageNum=${pageNum}&pageSize=${pageSize}`,
method: 'POST',
- header:getHeaders(),
- data:{
- hospId:id // 按“医院ID”查询该医院的易耗品发放计划(如“2024年Q1耗材发放计划”)
- },
+ header: getHeaders(),
+ data: {
+ hospId: id // 按“医院ID”查询该医院的易耗品发放计划(如“2024年Q1耗材发放计划”)
+ },
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data); // 根据你的接口返回结构调整
@@ -420,13 +253,13 @@ export function getPlanInfo(id,pageNum, pageSize) {
export function getConsumptionDetail(id) {
return new Promise((resolve, reject) => {
uni.request({
- // 请求地址:拼接基础地址 + 领用详情接口 + 领用记录ID(RESTful风格)
+ // 请求地址:拼接基础地址 + 领用详情接口 + 领用记录ID(RESTful风格)
url: `${BASE_URL}/api/consumable-distribution-item/app_getDistributeItem/${id}`,
method: 'GET', // 请求方法:GET(查询详情常用GET)
- header:getHeaders(),
- data:{
- // GET请求无需请求体,参数通过URL路径传递
- },
+ header: getHeaders(),
+ data: {
+ // GET请求无需请求体,参数通过URL路径传递
+ },
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data); // 根据你的接口返回结构调整
@@ -446,10 +279,10 @@ export function consumptonConfirm(id) {
uni.request({
url: `${BASE_URL}/api/consumable-distribution-item/app_getDistributeItem/${id}`,
method: 'POST', // 请求方法:POST(用于更新状态,确认领用
- header:getHeaders(),
- data:{
-
- },
+ header: getHeaders(),
+ data: {
+
+ },
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data); // 根据你的接口返回结构调整
@@ -467,50 +300,18 @@ export function consumptonConfirm(id) {
//————————————————————————————————————————————————资产盘点————————————————————————————————————————————————————————————
-//新增固定资产盘点
-export function addInventory(addDTO) {
- return new Promise((resolve, reject) => {
- uni.request({
- url: `${BASE_URL}/api/asset/inventory/add`, // 接口路径:固定资产盘点记录提交接口
- method: 'POST', // 请求方法:POST(新增数据用POST)
- data: { // 请求体:盘点记录所需的核心参数(从前端盘点表单收集)
- assetId:addDTO.assetId, // 被盘点的固定资产ID
- assetName:addDTO.assetName, // 固定资产名称(冗余字段,便于后端校验)
- inventoryDate:addDTO.inventoryDate, // 盘点日期(格式化后的日期时间)
- inventoryManId:addDTO.inventoryManId, // 盘点人ID(当前操作用户ID)
- inventoryManMobile:addDTO.inventoryManMobile, // 盘点人手机号(用于身份校验)
- inventoryPic:addDTO.inventoryPic, // 盘点照片(可选,如资产实物照片,通常是Base64或图片URL)
- inventoryPlanId:addDTO.inventoryPlanId, // 所属盘点计划ID(关联到具体的盘点任务)
- inventoryResult:addDTO.inventoryResult, // 盘点结果(如“正常”“缺失”“损坏”等枚举值)
- note:addDTO.note // 盘点备注(可选,记录特殊情况,如“资产外观有划痕”)
- },
- header:getHeaders(), // 统一请求头(携带用户、医院等信息)
-
- success: (res) => {
- if (res.statusCode === 200) {
- resolve(res.data); // 成功时返回后端的盘点记录ID或成功信息
- } else {
- reject(res);
- }
- },
- fail: (err) => {
- reject(err);
- }
- });
- });
-}
//获取固定资产盘点计划信息
export function getInventoryPlan(pageNum, pageSize) {
return new Promise((resolve, reject) => {
uni.request({
- // 接口路径:固定资产盘点计划分页接口,拼接页码(pageNum)和每页条数(pageSize)
+ // 接口路径:固定资产盘点计划分页接口,拼接页码(pageNum)和每页条数(pageSize)
url: `${BASE_URL}/api/asset/inventoryPlan/page?pageNum=${pageNum}&pageSize=${pageSize}`,
method: 'POST',
- header:getHeaders(),
- data:{
- // 请求体:空(后端可能默认返回当前用户有权限的盘点计划,无需额外筛选条件)
- },
+ header: getHeaders(),
+ data: {
+ // 请求体:空(后端可能默认返回当前用户有权限的盘点计划,无需额外筛选条件)
+ },
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data); // 根据你的接口返回结构调整
@@ -529,14 +330,14 @@ export function getInventoryPlan(pageNum, pageSize) {
export function getInventoryDetailEnd(id) {
return new Promise((resolve, reject) => {
uni.request({
-
+
url: `${BASE_URL}/api/asset/inventory/app_getInventoryPlan/${id}`,
- // 接口路径:拼接盘点计划ID,专门获取“进行中”计划的详情(与已结束计划接口区分开)
+ // 接口路径:拼接盘点计划ID,专门获取“进行中”计划的详情(与已结束计划接口区分开)
method: 'GET',
- header:getHeaders(),
- data:{
-
- },
+ header: getHeaders(),
+ data: {
+
+ },
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data); // 返回进行中计划的详情(如待盘点资产列表、已盘点进度)
@@ -555,13 +356,13 @@ export function getInventoryDetailEnd(id) {
export function getInventoryDetailIng(id) {
return new Promise((resolve, reject) => {
uni.request({
- // 接口路径:拼接盘点计划ID,专门获取“进行中”计划的详情(与已结束计划接口区分开)
+ // 接口路径:拼接盘点计划ID,专门获取“进行中”计划的详情(与已结束计划接口区分开)
url: `${BASE_URL}/api/asset/inventory/app_getInventoryPlan2/${id}`,
method: 'GET',
- header:getHeaders(),
- data:{
-
- },
+ header: getHeaders(),
+ data: {
+
+ },
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data); // 根据你的接口返回结构调整
@@ -582,16 +383,16 @@ export function inventory(addDTO) {
uni.request({
url: `${BASE_URL}/api/asset/inventory/add`, // 与“addInventory”接口路径相同,可能是后端兼容的简化版
method: 'POST',
- header:getHeaders(),
- data:{ // 请求体:简化后的参数(去掉了assetName、note等非必填项,inventoryDate注释后可能由后端自动填充)
- assetId:addDTO.assetId, // 被盘点资产ID(必填)
- inventoryManId:addDTO.inventoryManId, // 盘点人ID(必填)
- inventoryManMobile:addDTO.inventoryManMobile, // 盘点人手机号(必填)
- inventoryPic:addDTO.inventoryPic, // 盘点照片(可选)
- inventoryPlanId:addDTO.inventoryPlanId, // 所属计划ID(必填)
- inventoryResult:addDTO.inventoryResult, // 盘点结果(必填)
- //inventoryDate:addDTO.inventoryDate // 注释后,后端可能自动用当前时间作为盘点日期
- },
+ header: getHeaders(),
+ data: { // 请求体:简化后的参数(去掉了assetName、note等非必填项,inventoryDate注释后可能由后端自动填充)
+ assetId: addDTO.assetId, // 被盘点资产ID(必填)
+ inventoryManId: addDTO.inventoryManId, // 盘点人ID(必填)
+ inventoryManMobile: addDTO.inventoryManMobile, // 盘点人手机号(必填)
+ inventoryPic: addDTO.inventoryPic, // 盘点照片(可选)
+ inventoryPlanId: addDTO.inventoryPlanId, // 所属计划ID(必填)
+ inventoryResult: addDTO.inventoryResult, // 盘点结果(必填)
+ //inventoryDate:addDTO.inventoryDate // 注释后,后端可能自动用当前时间作为盘点日期
+ },
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data); // 根据你的接口返回结构调整
@@ -612,13 +413,13 @@ export function inventory(addDTO) {
export function getConsumpationPlan(pageNum, pageSize) {
return new Promise((resolve, reject) => {
uni.request({
- // 接口路径:易耗品盘点计划分页接口,名称区分于固定资产计划
+ // 接口路径:易耗品盘点计划分页接口,名称区分于固定资产计划
url: `${BASE_URL}/api/consumable-check-plan/findByConditionWithPage?pageNum=${pageNum}&pageSize=${pageSize}`,
method: 'POST',
- header:getHeaders(),
- data:{
- // 空请求体(后端默认返回当前用户的易耗品盘点计划)
- },
+ header: getHeaders(),
+ data: {
+ // 空请求体(后端默认返回当前用户的易耗品盘点计划)
+ },
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data); // 返回易耗品盘点计划的分页数据
@@ -636,13 +437,16 @@ export function getConsumpationPlan(pageNum, pageSize) {
export function getConsumpationInventoryDetailEnd(id) {
return new Promise((resolve, reject) => {
uni.request({
- // 接口路径:拼接易耗品盘点计划ID,专门获取“已结束”计划的详情
+ // 接口路径:拼接易耗品盘点计划ID,专门获取“已结束”计划的详情
url: `${BASE_URL}/api/consumable-check-item/app_getInventoryPlan/${id}`,
method: 'GET',
- header:getHeaders(),
- data:{
-
- },
+ header: {
+
+ ...getHeaders()
+ },
+ data: {
+
+ },
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data); // 返回已结束计划的详情(如易耗品盘点总数、盈亏统计)
@@ -661,13 +465,13 @@ export function getConsumpationInventoryDetailEnd(id) {
export function getConsumpationInventoryDetailIng(id) {
return new Promise((resolve, reject) => {
uni.request({
- // 接口路径:拼接易耗品盘点计划ID,专门获取“进行中”计划的详情
+ // 接口路径:拼接易耗品盘点计划ID,专门获取“进行中”计划的详情
url: `${BASE_URL}/api/consumable-check-item/app_getInventoryPlan2/${id}`,
method: 'GET',
- header:getHeaders(),
- data:{
-
- },
+ header: getHeaders(),
+ data: {
+
+ },
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data); // 返回进行中计划的详情(如待盘点易耗品列表、已盘点进度)
@@ -689,14 +493,14 @@ export function addComInventory(addDTO) {
uni.request({
url: `${BASE_URL}/api/consumable-check-item/add`, // 接口路径:易耗品盘点记录提交接口
method: 'POST',
- header:getHeaders(),
- data:{ // 请求体:易耗品盘点的核心参数(与固定资产盘点参数差异在于“数量”字段)
- checkPlanId:addDTO.checkPlanId, // 所属易耗品盘点计划ID
- checkResult:addDTO.checkResult, // 盘点结果(如“账实相符”“盘盈”“盘亏”)
- inventoryId:addDTO.inventoryId, // 库存ID(关联到具体的易耗品库存记录)
- quantity:addDTO.quantity // 实际盘点数量(易耗品需统计数量,固定资产通常是“有无”)
-
- },
+ header: getHeaders(),
+ data: { // 请求体:易耗品盘点的核心参数(与固定资产盘点参数差异在于“数量”字段)
+ checkPlanId: addDTO.checkPlanId, // 所属易耗品盘点计划ID
+ checkResult: addDTO.checkResult, // 盘点结果(如“账实相符”“盘盈”“盘亏”)
+ inventoryId: addDTO.inventoryId, // 库存ID(关联到具体的易耗品库存记录)
+ quantity: addDTO.quantity // 实际盘点数量(易耗品需统计数量,固定资产通常是“有无”)
+
+ },
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data); // 根据你的接口返回结构调整
diff --git a/src/pages/api/index.ts b/src/pages/api/index.ts
new file mode 100644
index 0000000..5f711d9
--- /dev/null
+++ b/src/pages/api/index.ts
@@ -0,0 +1,49 @@
+const BASE_URL = 'http://110.42.33.196:8089';//定义后端基础接口地址
+import config from '../../config'; // 引入配置文件
+
+const formatNumber = (n: number | string): string => {
+ n = n.toString();// 1. 将数字转为字符串(如 5 → "5",12 → "12")
+ return n[1] ? n : '0' + n;// 2. 补零逻辑:若字符串长度<2(如 "5"),则在前面加"0" → "05";否则直接返回(如 "12")
+}
+
+const formatTime = (date: Date | string | number) => {
+ date = new Date(date);// 1. 将输入的日期参数(可能是时间戳/字符串)转为标准 Date 对象
+ const hour: number = date.getHours();// 2. 获取小时(0-23)
+ const minute: number = date.getMinutes();// 3. 获取分钟(0-59)
+ const second: number = date.getSeconds();// 4. 获取秒(0-59)
+ // 5. 拼接为 "时:分:秒" 格式(调用 formatNumber 补零),如 "09:05:03"
+ return `${formatNumber(hour)}:${formatNumber(minute)}:${formatNumber(second)}`;
+}
+
+//日期格式化函数(仅返回年月日)
+const formatDate = (date: Date | string | number) => {
+ date = new Date(date);// 1. 转为标准 Date 对象
+ const year = date.getFullYear()// 2. 获取完整年份(如 2024)
+ const month = date.getMonth() + 1// 3. 获取月份(注意:Date 中月份是 0-11,需+1 才是实际月份,如 2→3月
+ const day = date.getDate()// 4. 获取日期(1-31)
+ // 5. 拼接为 "年-月-日" 格式(补零),如 "2024-03-15"
+ return `${year}-${formatNumber(month)}-${formatNumber(day)}`
+}
+
+//完整日期时间格式化函数(年月日 + 时分秒)
+const formatDateTime = (date: Date | string | number) => {
+ return `${formatDate(date)} ${formatTime(date)}`
+}
+
+//统一请求头配置函数(核心!!!!!!!!!!!!!!!!!!!!所有接口共用)
+ function getHeaders() {
+ const staff = uni.getStorageSync('staff') || null// 1. 再次读取用户信息(避免缓存过期,确保最新)
+ // console.log("用户信息:",staff)// 2. 控制台打印用户信息,用于开发调试
+ const staffisnull = !staff // 3. 简化判断:用户信息为空则为 true,否则为 false
+ // 4. 返回请求头对象(接口请求时会携带这些信息,供后端验证)
+ return {
+ 'content-type': 'application/json',// ① 声明请求体格式为 JSON(后端需按 JSON 解析数据)
+ //'Authorization': staffisnull ? null : `Bearer ${uni.getStorageSync('token')}`,
+ 'hosp-ID': staffisnull ? config.defaultHospId : staff.hosp_id,// ③ 医院ID:用户未登录用配置文件的默认值,登录后用用户所属医院ID
+ 'user-ID': staffisnull ? null : staff.id,// ④ 用户ID:用户未登录为 null,登录后用用户ID(后端用于识别请求用户)
+ 'datetime': formatDateTime(new Date()),// ⑤ 请求时间:当前完整日期时间(后端可用于校验请求时效性)
+ 'createby': staffisnull ? null : staff.id// ⑥ 创建人ID:与 user-ID 类似,用于后端记录操作人
+ }////核心作用:统一所有接口的请求头格式,避免每个接口重复写头信息,同时支持 “登录 / 未登录” 状态的动态适配。
+}
+
+export { formatTime, formatDate, formatDateTime, BASE_URL, getHeaders };// 导出时间格式化函数、BASE_URL 和 getHeaders 供其他模块使用
\ No newline at end of file
diff --git a/src/pages/api/inventory.js b/src/pages/api/inventory.js
index dd97edb..d4f8edd 100644
--- a/src/pages/api/inventory.js
+++ b/src/pages/api/inventory.js
@@ -1,46 +1,4 @@
-const BASE_URL = 'http://110.42.33.196:8089';
-const config = require('config.js');
-const formatTime = date => {
- date = new Date(date);
- const hour = date.getHours()
- const minute = date.getMinutes()
- const second = date.getSeconds()
-
- return `${formatNumber(hour)}:${formatNumber(minute)}:${formatNumber(second)}`
-}
-
-const formatNumber = n => {
- n = n.toString()
- return n[1] ? n : '0' + n
-}
-
-const formatDate = date => {
- date = new Date(date);
- const year = date.getFullYear()
- const month = date.getMonth() + 1
- const day = date.getDate()
-
- return `${year}-${formatNumber(month)}-${formatNumber(day)}`
-}
-
-const formatDateTime = date => {
- return `${formatDate(date)} ${formatTime(date)}`
-}
-let staff = uni.getStorageSync('staff');
-let staffisnull = (staff == null || staff == undefined || staff == '');
-export function getHeaders() {
- const staff = uni.getStorageSync('staff') || null
- const staffisnull = !staff
-
- return {
- 'content-type': 'application/json',
- 'Authorization': staffisnull ? null : `Bearer ${uni.getStorageSync('token')}`,
- 'hosp-ID': staffisnull ? config.defaultHospId : staff.hosp_id,
- 'user-ID': staffisnull ? null : staff.id,
- 'datetime': formatDateTime(new Date()),
- 'createby': staffisnull ? null : staff.id
- }
-}
+import { formatTime, formatDate, formatDateTime, BASE_URL ,getHeaders} from './index.js'; // 引入时间格式化函数和BASE_URL
//分页请求固定资产盘点信息
export function fetchAssetInventory(pageNum, pageSize) {
@@ -49,11 +7,11 @@ export function fetchAssetInventory(pageNum, pageSize) {
url: `${BASE_URL}/api/asset/inventory/page?pageNum=${pageNum}&pageSize=${pageSize}`,
method: 'POST',
data: {
- query:{},
+ query: {},
},
- header:getHeaders(),
-
+ header: getHeaders(),
+
success: (res) => {
if (res.statusCode === 200) {
resolve(res.data); // 根据你的接口返回结构调整
diff --git a/src/pages/api/user.ts b/src/pages/api/user.ts
new file mode 100644
index 0000000..9cf025b
--- /dev/null
+++ b/src/pages/api/user.ts
@@ -0,0 +1,54 @@
+import { formatTime, formatDate, formatDateTime, BASE_URL, getHeaders } from './index.js'; // 引入时间格式化函数和BASE_URL
+
+//@ts-ignore
+import md5 from '@/utils/md5.js'
+
+export function login(username: string, password: string): Promise<{
+ code: number;
+ msg: string;
+ data: {
+ token: string;
+ userLoginRequestVO: {
+ id: number;
+ user_name: string;
+ user_login_name: string;
+ user_type: string;
+ user_pic_path: string | null;
+ role_id: number | null;
+ role_name: string | null;
+ hosp_id: number | null;
+ hospName: string | null;
+ hospPic: string | null;
+ hospCenterX: number | null;
+ hospCenterY: number | null;
+ role: string[] | null;
+ assetsRole: number | null;
+ roles: string[] | null;
+ }
+ }
+}> {
+ return new Promise((resolve, reject) => {
+ uni.request({
+ url: `${BASE_URL}/myUser/login2`,
+ method: 'POST',// 请求方法:POST
+ data: {
+ mobile: username,
+ password: md5.hexMD5(username + password),
+ role: '007'
+ },
+
+ header: getHeaders(),
+
+ success: (res) => {
+ if (res.statusCode === 200) {
+ resolve(res.data as any);
+ } else {
+ reject(res);
+ }
+ },
+ fail: (err) => {
+ reject(err);
+ }
+ });
+ });
+}
\ No newline at end of file
diff --git a/src/pages/consumables/temp-approve-detail.vue b/src/pages/consumables/temp-approve-detail.vue
new file mode 100644
index 0000000..726aa2a
--- /dev/null
+++ b/src/pages/consumables/temp-approve-detail.vue
@@ -0,0 +1,851 @@
+
+
+
+
+
+
+
+
+ {{ ['REJECTED', 'CANCELLED'].includes(detail.status || '') ? '✕' : '✓' }}
+
+ 待审批
+
+
+
+
+ ✓
+
+ 待发放
+
+
+
+
+ ✓
+
+ 已完成
+
+
+
+
+
+
+
+ {{ getStatusText(detail.status) }}
+
+ {{ formatTime(detail.createdAt) }}
+
+
+
+
+ 申请人信息
+
+
+ {{ getAvatarText(detail.applicantName) }}
+
+
+ {{ detail.applicantName || '未填写' }}
+ {{ detail.applicantPhone }}
+ {{ detail.department }}
+
+
+
+
+
+
+ 申请信息
+
+
+ 申请原因:
+ {{ detail.reason || '-' }}
+
+
+ 需要时间:
+ {{ detail.neededAt || '-' }}
+
+
+ 审批人ID:
+ {{ detail.approverId }}
+
+
+ 审批时间:
+ {{ formatTime(detail.approvedAt) }}
+
+
+ 审批意见:
+
+
+
+
+
+
+
+ 物料明细({{ detail.items?.length || 0 }}项)
+
+
+
+
+ 规格
+ {{ item.spec }}
+
+
+ 数量
+ {{ item.quantity }} {{ item.unit || '' }}
+
+
+ 预估单价
+ ¥{{ item.estimatedUnitCost }}
+
+
+ 小计
+ ¥{{ (item.estimatedUnitCost * item.quantity).toFixed(2) }}
+
+
+
+
+
+
+
+
+
+ 预估总金额
+ ¥{{ totalCost.toFixed(2) }}
+
+
+
+
+
+ 加载中...
+
+
+
+
+
+
+
+
+
+
+
+
+ 审批意见
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/consumables/temp-approve.vue b/src/pages/consumables/temp-approve.vue
new file mode 100644
index 0000000..d6525bd
--- /dev/null
+++ b/src/pages/consumables/temp-approve.vue
@@ -0,0 +1,798 @@
+
+
+
+
+
+
+
+
+ 显示已完成
+
+
+
+
+
+
+
+
+ 暂无审批记录
+
+
+
+
+
+
+
+ {{ ['REJECTED', 'CANCELLED'].includes(item.status || '') ? '✕' : '✓' }}
+
+ 待审批
+
+
+
+
+ ✓
+
+ 待发放
+
+
+
+
+ ✓
+
+ 已完成
+
+
+
+
+
+
+
+
+ {{ getAvatarText(item.applicantName) }}
+
+
+ {{ item.applicantName || '未填写' }}
+ {{ item.applicantPhone }}
+
+
+
+
+
+ 部门
+ {{ item.department || '-' }}
+
+
+ 物料数量
+ {{ item.items?.length || 0 }} 项
+
+
+
+
+ 申请原因:
+ {{ item.reason || '-' }}
+
+
+
+
+
+
+
+
+
+ 加载中...
+
+
+
+ 没有更多了
+
+
+
+
+
+
+
+
+
+ 审批意见
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/consumables/temp-catalog.vue b/src/pages/consumables/temp-catalog.vue
new file mode 100644
index 0000000..c849150
--- /dev/null
+++ b/src/pages/consumables/temp-catalog.vue
@@ -0,0 +1,588 @@
+
+
+
+
+
+
+
+
+ 🔍
+
+
+
+
+
+
+
+
+ 暂无耗材种类
+
+
+
+
+
+ {{ item.name }}
+
+ 规格: {{ item.spec }}
+ 单位: {{ item.unit }}
+
+
+
+ {{ item.isActive ? '启用' : '停用' }}
+
+
+
+
+
+
+ 加载中...
+
+
+
+ 没有更多了
+
+
+
+
+
+
+
+
+
+ 物料名称
+
+
+
+ 规格
+
+
+
+ 单位
+
+
+
+ 状态
+
+
+ {{ formData.isActive ? '启用' : '停用' }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/consumables/temp-request-create.vue b/src/pages/consumables/temp-request-create.vue
new file mode 100644
index 0000000..082c8a2
--- /dev/null
+++ b/src/pages/consumables/temp-request-create.vue
@@ -0,0 +1,613 @@
+
+
+
+
+
+
+ 基本信息
+
+
+
+ 申请人姓名
+
+
+
+ 联系电话
+
+
+
+ 部门
+
+
+
+ 申请原因
+
+
+
+ 需要时间
+
+
+ {{ formData.neededAt || '请选择需要时间' }}
+
+
+
+
+
+
+
+
+
+ 物料明细
+
+
+
+
+ 暂无物料,请点击上方按钮添加
+
+
+
+
+
+
+ 物料名称
+
+
+
+
+
+
+
+ 规格
+
+
+
+
+
+ 数量
+
+
+
+ 单位
+
+
+
+
+
+ 预估单价
+
+
+
+
+ 备注
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ catalog.name }}
+
+ {{ catalog.spec }}
+ {{ catalog.unit }}
+
+
+
+ 暂无数据
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/consumables/temp-request-detail.vue b/src/pages/consumables/temp-request-detail.vue
new file mode 100644
index 0000000..8137689
--- /dev/null
+++ b/src/pages/consumables/temp-request-detail.vue
@@ -0,0 +1,456 @@
+
+
+
+
+
+
+ {{ getStatusText(detail.status) }}
+
+ {{ formatTime(detail.createdAt) }}
+
+
+
+
+ 基本信息
+
+
+ 申请人:
+ {{ detail.applicantName || '-' }}
+
+
+ 联系电话:
+ {{ detail.applicantPhone }}
+
+
+ 部门:
+ {{ detail.department || '-' }}
+
+
+ 申请原因:
+ {{ detail.reason || '-' }}
+
+
+ 需要时间:
+ {{ detail.neededAt || '-' }}
+
+
+ 审批人ID:
+ {{ detail.approverId }}
+
+
+ 审批时间:
+ {{ formatTime(detail.approvedAt) }}
+
+
+ 备注:
+ {{ detail.remark }}
+
+
+
+
+
+
+ 物料明细({{ detail.items?.length || 0 }}项)
+
+
+
+ {{ item.name }}
+
+
+ 规格:
+ {{ item.spec }}
+
+
+ 数量:
+ {{ item.quantity }} {{ item.unit || '' }}
+
+
+ 预估单价:
+ ¥{{ item.estimatedUnitCost }}
+
+
+ 小计:
+ ¥{{ (item.estimatedUnitCost * item.quantity).toFixed(2) }}
+
+
+ 备注:
+ {{ item.remark }}
+
+
+
+
+
+
+
+
+
+ 预估总金额
+ ¥{{ totalCost.toFixed(2) }}
+
+
+
+
+
+ 加载中...
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/consumables/temp-request.vue b/src/pages/consumables/temp-request.vue
new file mode 100644
index 0000000..7f8c552
--- /dev/null
+++ b/src/pages/consumables/temp-request.vue
@@ -0,0 +1,438 @@
+
+
+
+
+
+
+
+
+
+ {{ currentStatus?.label || '全部状态' }}
+ ▼
+
+
+
+
+
+
+
+
+ 暂无申请记录
+
+
+
+
+
+
+
+ 申请人:
+ {{ item.applicantName || '-' }}
+
+
+ 电话:
+ {{ item.applicantPhone }}
+
+
+ 部门:
+ {{ item.department || '-' }}
+
+
+ 申请原因:
+ {{ item.reason || '-' }}
+
+
+ 物料数量:
+ {{ item.items?.length || 0 }} 项
+
+
+
+
+
+
+
+ 加载中...
+
+
+
+ 没有更多了
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index 36d4e3a..a7f80ed 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -74,11 +74,11 @@
diff --git a/src/pages/mine/index.vue b/src/pages/mine/index.vue
index da2189d..e7c8b28 100644
--- a/src/pages/mine/index.vue
+++ b/src/pages/mine/index.vue
@@ -10,7 +10,12 @@
{{ staff?.user_name || staff?.name || '已登录' }}
类型:{{ userTypeText }}
- 角色:{{ staff?.role_name || '-' }}
+
+ 角色:{{ [
+ assetRole & AssetRole.CONSUMABLES_MANAGER ? '易耗品发放负责人' : undefined,
+ assetRole & AssetRole.DEVICE_MANAGER ? '设备管理人员' : undefined,
+ assetRole & AssetRole.TEAM_LEAD ? '小组负责人' : undefined
+ ].filter(Boolean).join('、') || '普通用户'}}
工号:{{ staff?.job_no }}
@@ -19,12 +24,12 @@
-
+
-
+
-
+
-
+
-
+