From 6f1db0f92e27c0f72db81448b3ecc81fe6e06da5 Mon Sep 17 00:00:00 2001 From: zx Date: Tue, 14 Apr 2026 08:46:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E5=BA=93=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/request.js | 201 +++++++++++++++-- api/stockOut.js | 46 ++++ api/uniqueCode.js | 8 +- pages.json | 74 +++++-- pages/components/ChooseList.vue | 71 +++--- pages/components/DetailInfo.vue | 10 +- pages/components/MaterialList.vue | 74 ++++--- pages/components/Navigation.vue | 23 +- pages/components/SearchList.vue | 50 +++-- pages/components/WarehousingInfo.vue | 5 +- pages/index/index.vue | 2 +- pages/intelligent/index.vue | 2 +- pages/my/index.vue | 2 +- pages/until.js | 81 +++++-- .../warehousing/StockIn/components/detail.vue | 166 ++++++++------ .../StockIn/components/inbound.vue | 48 ++--- pages/warehousing/StockIn/create.vue | 125 ++++++----- .../components/myTechnicalEvaluation.vue | 170 +++++++++++++++ .../StockOut/components/outAway.vue | 204 ++++++++++++++++++ .../components/technicalEvaluation.vue | 145 +++++++++++++ pages/warehousing/StockOut/create.vue | 105 +++++---- pages/warehousing/StockOut/my.vue | 1 - pages/warehousing/index.vue | 8 +- pages/warehousing/toChooseList.vue | 2 +- .../uniqueCode/issueUniqueCode/index.vue | 71 +++--- .../issueUniqueCode/materialSelection.vue | 95 ++++---- .../uniqueCode/myUniqueCode/detail.vue | 2 +- .../uniqueCode/myUniqueCode/index.vue | 17 +- pages/warehousing/uniqueCode/until.js | 12 +- styles/theme.scss | 4 + 30 files changed, 1366 insertions(+), 458 deletions(-) create mode 100644 api/stockOut.js create mode 100644 pages/warehousing/StockOut/components/myTechnicalEvaluation.vue create mode 100644 pages/warehousing/StockOut/components/outAway.vue create mode 100644 pages/warehousing/StockOut/components/technicalEvaluation.vue diff --git a/api/request.js b/api/request.js index 341a530..ca79cb4 100644 --- a/api/request.js +++ b/api/request.js @@ -1,6 +1,6 @@ //存放主站域名 // const BASE_URL = 'http://192.168.1.5:8082' // w -const BASE_URL = 'http://192.168.1.9:8082' // 正式环境接口 +const BASE_URL = "http://192.168.1.9:8082"; // yx // const BASE_URL = 'http://47.100.212.83:18088' // 正式环境接口 // const BASE_URL = 'http://192.168.1.9:8088' // 测试环境接口 // const BASE_URL = 'http://192.168.1.5:8088' // 测试环境接口 @@ -9,7 +9,12 @@ const BASE_URL_IMG = BASE_URL + "/img/upload"; // 上传图片 let requestRecords = {}; // 重复请求拦截时间(毫秒) const INTERCEPT_DURATION = 2000; -const request = (url, data = {}, method = "GET", ContentType = "application/json") => { +const request = ( + url, + data = {}, + method = "GET", + ContentType = "application/json", +) => { const requestObj = { data, url, @@ -119,29 +124,35 @@ const request = (url, data = {}, method = "GET", ContentType = "application/json // 图片 const Upload = (url, source, formData) => { + console.log("进入上传方法", url, source, formData); + const ContentType = "application/json"; + return new Promise(function (resolve, reject) { - console.log(source) + console.log(source); let header = {}; if (uni.getStorageSync("app_token")) { header = { - // 'Content-Type': ContentType, + "Content-Type": ContentType, authorization: uni.getStorageSync("app_token"), + // Accept: "application/json", + // "Content-Type": "multipart/form-data", }; } - console.log(BASE_URL + url, source, formData, header) - console.log(typeof source === 'string' ? { filePath: source } : { files: source }) + console.log(BASE_URL + url, source, formData, header); + console.log( + typeof source === "string" ? { filePath: source } : { files: source }, + ); uni.uploadFile({ url: BASE_URL + url, - ...(typeof source === 'string' - ? { filePath: source } // 单文件:使用filePath - : { files: source } // 多文件:使用files - ), - name: 'files', + ...(typeof source === "string" + ? { filePath: source } // 单文件:使用filePath + : { files: source }), // 多文件:使用files + name: "files", formData, // name, header, success: function (res) { - console.log(res) + console.log("成功返回res", res); let obj1 = JSON.parse(res.data); uni.hideLoading(); if (obj1.code !== 200) { @@ -156,12 +167,12 @@ const Upload = (url, source, formData) => { icon: "success", duration: 1000, }); - resolve(obj1) + resolve(obj1); } }, fail: function (err) { - console.log(err) - console.log(JSON.stringify(err), "失败999"); + console.log("失败返回err", err); + console.log("失败999", JSON.stringify(err)); uni.hideLoading(); uni.showToast({ title: "加载失败, 请稍后再试!", @@ -229,5 +240,163 @@ const UploadFile = (url, data = {}, source) => { }); }); }; + +/** + * 多文件上传(支持并行/串行) + * @param {Array} files - 要上传的文件数组 + * @param {Boolean} sequential - 是否串行上传(默认 false = 并行) + * @returns {Promise} - 所有文件的上传结果(含成功/失败信息) + */ +const uploadMultipleFiles = async ( + url, + files, + formData, + sequential = false, +) => { + let header = {}; + if (uni.getStorageSync("app_token")) { + header = { + authorization: uni.getStorageSync("app_token"), + }; + } + // 2. 并行上传逻辑 + if (!sequential) { + // 循环生成每个文件的上传 Promise + const uploadPromises = files.map((file, index) => { + return new Promise((resolve) => { + uni.uploadFile({ + url: BASE_URL + url, + filePath: file, + name: "file", + header, + formData, + // 上传成功处理 + success: (res) => { + try { + const result = JSON.parse(res.data); + console.log("成功,", res); + if (result.code === 200 && result.data?.url) { + resolve({ + index, // 保留原文件在数组中的索引(方便对应) + file, // 原始文件信息 + url: result.data.url, // 上传后的 URL + success: true, + error: null, + }); + } else { + // 后端返回失败(如文件格式不允许) + resolve({ + index, + file, + url: null, + success: false, + error: new Error(result.msg || "文件上传失败"), + }); + } + } catch (e) { + resolve({ + index, + file, + url: null, + success: false, + error: new Error("上传结果解析失败:" + e.message), + }); + } + }, + fail: (err) => { + resolve({ + index, + file, + url: null, + success: false, + error: new Error("上传请求失败:" + err.errMsg), + }); + }, + }); + }); + }); + console.log(uploadPromises, "uploadPromises1111"); + + // 等待所有请求完成,返回统一结果 + return Promise.allSettled(uploadPromises).then((results) => { + // 提取实际结果(allSettled 返回的是 {status, value} 结构) + return results.map((res) => res.value); + }); + } // 接上文的 if (!sequential) 之后 + else { + const uploadResults = []; // 存储所有结果 + // 递归函数:上传第 index 个文件 + const uploadNext = (index) => { + // 终止条件:所有文件处理完,返回结果 + if (index >= files.length) { + return Promise.resolve(uploadResults); + } + + const currentFile = files[index]; + return new Promise((resolve) => { + uni.uploadFile({ + url: BASE_URL + url, + filePath: currentFile, + name: "file", + header, + success: (res) => { + try { + const result = JSON.parse(res.data); + if (result.code === 200 && result.data?.url) { + uploadResults.push({ + index, + file: currentFile, + url: result.data.fileUrlList[0].url, + success: true, + error: null, + }); + } else { + uploadResults.push({ + index, + file: currentFile, + url: null, + success: false, + error: new Error(result.msg || "文件上传失败"), + }); + } + // 上传下一个文件(递归) + resolve(uploadNext(index + 1)); + } catch (e) { + uploadResults.push({ + index, + file: currentFile, + url: null, + success: false, + error: new Error("解析失败:" + e.message), + }); + resolve(uploadNext(index + 1)); + } + }, + fail: (err) => { + uploadResults.push({ + index, + file: currentFile, + url: null, + success: false, + error: new Error("请求失败:" + err.errMsg), + }); + resolve(uploadNext(index + 1)); // 即使失败,也继续传下一个(可按需修改) + }, + }); + }); + }; + + // 从第 0 个文件开始上传 + return uploadNext(0); + } +}; + // form表单 -export { BASE_URL, BASE_URL_IMG, request, Upload, UploadFile }; +export { + BASE_URL, + BASE_URL_IMG, + request, + Upload, + UploadFile, + uploadMultipleFiles, +}; diff --git a/api/stockOut.js b/api/stockOut.js new file mode 100644 index 0000000..6ef7a40 --- /dev/null +++ b/api/stockOut.js @@ -0,0 +1,46 @@ +import { request, Upload,uploadMultipleFiles } from "./request"; +const api = "/worn/outboundBill/"; +// 新建:出库单 +const addStockOut = (params) => { + return request(api + "add", params, "POST"); +}; +// 列表 +const stockOutList = (params) => { + return request(api + "list", params, "get"); +}; + +// 详情 +const stockOutDetail = (params) => { + return request("/worn/outboundItem/getByBillNo", params, "post"); +}; +// 编辑 +const stockOutUpdate = (params) => { + return request("/worn/outboundItem/update", params, "post"); +}; +// 出库 +const outBoundFinish = (params) => { + return request("/worn/outboundBill/complete", params, "post"); +}; +// 添加技术鉴定表 +const addWithFiles = (params) => { + return request("/worn/appraisal/addWithFiles", params, "post"); +}; +// 技术鉴定表 +const myList = (params) => { + return request("/worn/appraisal/myList", params, "get"); +}; +// 上传图片 +const uploadTechnicalFile = (files, formData) => { + return uploadMultipleFiles("/worn/technicalFile/upload", files, formData,true); +}; + +export { + addStockOut, + stockOutList, + stockOutDetail, + stockOutUpdate, + outBoundFinish, + addWithFiles, + uploadTechnicalFile, + myList +}; diff --git a/api/uniqueCode.js b/api/uniqueCode.js index dfd8aa4..3a7d498 100644 --- a/api/uniqueCode.js +++ b/api/uniqueCode.js @@ -1,4 +1,5 @@ import { request } from "./request"; +// /unique/code/getMaterialInfo // 列表:物料列表 const getMaterial = (params) => { return request("/worn/material/list", params, 'GET'); @@ -27,6 +28,10 @@ const detailUniqueCode = (params) => { const getMaterialUnique = (params) => { return request(`/unique/code/materialInfo/${params.code}`, params, 'GET'); }; +// 详情:通过唯一码获取物料信息 +const getMaterialByQrCodeInfo = (params) => { + return request('/unique/code/getMaterialInfo', params, 'POST'); +}; export { getMaterial, @@ -35,5 +40,6 @@ export { delUniqueCode, detailUniqueCode, editUniqueCode, - getMaterialUnique + getMaterialUnique, + getMaterialByQrCodeInfo }; diff --git a/pages.json b/pages.json index 7523619..4a5543f 100644 --- a/pages.json +++ b/pages.json @@ -22,11 +22,11 @@ }, { "path": "pages/warehousing/index", - "style": { "navigationBarTitleText": "仓储" } + "style": { "navigationBarTitleText": "仓储", "navigationStyle": "custom" } }, { "path": "pages/intelligent/index", - "style": { "navigationBarTitleText": "智能" } + "style": { "navigationBarTitleText": "智能"} }, { "path": "pages/my/index", @@ -36,7 +36,10 @@ // 仓储 - 唯一码 { "path": "pages/warehousing/uniqueCode/issueUniqueCode/index", - "style": { "navigationBarTitleText": "唯一码发放" } + "style": { + "navigationBarTitleText": "唯一码发放", + "navigationStyle": "custom" + } }, { "path": "pages/warehousing/uniqueCode/issueUniqueCode/materialSelection", @@ -44,7 +47,10 @@ }, { "path": "pages/warehousing/uniqueCode/myUniqueCode/index", - "style": { "navigationBarTitleText": "唯一码" } + "style": { + "navigationBarTitleText": "唯一码", + "navigationStyle": "custom" + } }, { "path": "pages/warehousing/uniqueCode/myUniqueCode/detail", @@ -107,40 +113,82 @@ // ========== 入库单模块 ========== { "path": "pages/warehousing/stockIn/create", - "style": { "navigationBarTitleText": "入库单开单" , "navigationStyle": "custom"} + "style": { + "navigationBarTitleText": "入库单开单", + "navigationStyle": "custom" + } }, { "path": "pages/warehousing/stockIn/my", - "style": { "navigationBarTitleText": "我的入库单", "navigationStyle": "custom" } + "style": { + "navigationBarTitleText": "我的入库单", + "navigationStyle": "custom" + } }, { "path": "pages/warehousing/stockIn/components/detail", "style": { "navigationBarTitleText": "详情", "navigationStyle": "custom" } }, { - "path": "pages/warehousing/stockIn/putaway", - "style": { "navigationBarTitleText": "入库单入库" } + "path": "pages/warehousing/stockIn/putAway", + "style": { + "navigationBarTitleText": "入库单入库", + "navigationStyle": "custom" + } }, { "path": "pages/warehousing/toChooseList", - "style": { "navigationBarTitleText": "请选择" } + "style": { + "navigationBarTitleText": "请选择", + "navigationStyle": "custom" + } }, { "path": "pages/warehousing/stockIn/components/inbound", - "style": { "navigationBarTitleText": "入库" } + "style": { "navigationBarTitleText": "入库", "navigationStyle": "custom" } }, // ========== 出库单模块 ========== { "path": "pages/warehousing/stockOut/create", - "style": { "navigationBarTitleText": "出库单开单" } + "style": { + "navigationBarTitleText": "出库单开单", + "navigationStyle": "custom" + } }, { "path": "pages/warehousing/stockOut/my", - "style": { "navigationBarTitleText": "我的出库单" } + "style": { + "navigationBarTitleText": "我的出库单", + "navigationStyle": "custom" + } }, { "path": "pages/warehousing/stockOut/outbound", - "style": { "navigationBarTitleText": "出库单出库" } + "style": { + "navigationBarTitleText": "出库单出库", + "navigationStyle": "custom" + } + }, + { + "path": "pages/warehousing/stockOut/components/outAway", + "style": { + "navigationBarTitleText": "出库单出库", + "navigationStyle": "custom" + } + }, + { + "path": "pages/warehousing/stockOut/components/technicalEvaluation", + "style": { + "navigationBarTitleText": "技术鉴定表", + "navigationStyle": "custom" + } + }, + { + "path": "pages/warehousing/stockOut/components/myTechnicalEvaluation", + "style": { + "navigationBarTitleText": "我提交的技术鉴定表", + "navigationStyle": "custom" + } } ], "globalStyle": { diff --git a/pages/components/ChooseList.vue b/pages/components/ChooseList.vue index 805fc85..58abc8a 100644 --- a/pages/components/ChooseList.vue +++ b/pages/components/ChooseList.vue @@ -1,6 +1,8 @@ \ No newline at end of file diff --git a/pages/warehousing/StockOut/components/outAway.vue b/pages/warehousing/StockOut/components/outAway.vue new file mode 100644 index 0000000..eccfadc --- /dev/null +++ b/pages/warehousing/StockOut/components/outAway.vue @@ -0,0 +1,204 @@ + + + + + + \ No newline at end of file diff --git a/pages/warehousing/StockOut/components/technicalEvaluation.vue b/pages/warehousing/StockOut/components/technicalEvaluation.vue new file mode 100644 index 0000000..c6b171c --- /dev/null +++ b/pages/warehousing/StockOut/components/technicalEvaluation.vue @@ -0,0 +1,145 @@ + + + \ No newline at end of file diff --git a/pages/warehousing/StockOut/create.vue b/pages/warehousing/StockOut/create.vue index 49d7486..b58008c 100644 --- a/pages/warehousing/StockOut/create.vue +++ b/pages/warehousing/StockOut/create.vue @@ -1,10 +1,12 @@ \ No newline at end of file diff --git a/pages/warehousing/index.vue b/pages/warehousing/index.vue index dfb5821..59d90af 100644 --- a/pages/warehousing/index.vue +++ b/pages/warehousing/index.vue @@ -1,6 +1,8 @@