From ba448d252ae2f7d904b47869b3d7203c4a81ac6d Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 08 一月 2026 11:51:20 +0800
Subject: [PATCH] 增加扫码报工功能测试修改
---
src/pages/index.vue | 19 ++++-----
src/pages/productionManagement/productionReport/index.vue | 34 ++++++----------
src/api/productionManagement/productionReporting.js | 11 +++++
3 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/src/api/productionManagement/productionReporting.js b/src/api/productionManagement/productionReporting.js
index fdec712..710a02f 100644
--- a/src/api/productionManagement/productionReporting.js
+++ b/src/api/productionManagement/productionReporting.js
@@ -32,4 +32,13 @@
method: "post",
data: query,
});
-}
\ No newline at end of file
+}
+// 鏂板浜у搧涓昏〃
+export function addProductMain(data) {
+ return request({
+ url: "/productionProductMain/addProductMain",
+ method: "post",
+ data: data,
+ });
+}
+
diff --git a/src/pages/index.vue b/src/pages/index.vue
index 1ba9c8b..e6ffe05 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -533,19 +533,18 @@
let orderRow = "";
// 灏濊瘯浠庢壂鐮佺粨鏋滀腑鎻愬彇orderRow鍙傛暟
- // 鍋囪浜岀淮鐮佸唴瀹规槸JSON鏍煎紡鎴朥RL鍙傛暟鏍煎紡
try {
- // 妫�鏌ユ槸鍚︽槸JSON鏍煎紡
- const parsedData = JSON.parse(scanResult);
- if (parsedData.orderRow) {
- orderRow = parsedData.orderRow;
- }
+ // 澶勭悊娣峰悎鏍煎紡: http://...?orderRow={...}
+ const orderRowStart = scanResult.indexOf("orderRow={");
+ // 鎻愬彇浠巓rderRow={寮�濮嬬殑JSON鍐呭
+ const jsonPart = scanResult.substring(orderRowStart + 9); // 9鏄�"orderRow=".length
+ // 灏濊瘯鐩存帴浣跨敤杩欎釜JSON閮ㄥ垎
+ orderRow = jsonPart;
} catch (e) {
- // 妫�鏌ユ槸鍚︽槸URL鍙傛暟鏍煎紡锛屽 orderRow=12345
- const params = new URLSearchParams(scanResult);
- orderRow = params.get("orderRow") || "";
+ console.error(e, "瑙f瀽澶辫触====????=====");
+ orderRow = "";
}
-
+ console.log(orderRow, "orderRow======@@@@@@@@");
// 鎵爜鎴愬姛鍚庤烦杞埌鐢熶骇鎶ュ伐椤甸潰锛屽苟浼犻�抩rderRow鍙傛暟
uni.navigateTo({
url: `/pages/productionManagement/productionReport/index?orderRow=${orderRow}`,
diff --git a/src/pages/productionManagement/productionReport/index.vue b/src/pages/productionManagement/productionReport/index.vue
index 4117f82..313635a 100644
--- a/src/pages/productionManagement/productionReport/index.vue
+++ b/src/pages/productionManagement/productionReport/index.vue
@@ -53,6 +53,7 @@
<script setup>
import { ref, onMounted } from "vue";
+ import { onLoad } from "@dcloudio/uni-app";
import FooterButtons from "@/components/FooterButtons.vue";
const showToast = message => {
@@ -61,10 +62,7 @@
icon: "none",
});
};
-
- import { formatDateToYMD } from "@/utils/ruoyi";
- import { userListNoPageByTenantId } from "@/api/system/user";
- import { productionReport } from "@/api/productionManagement/productionReporting";
+ import { addProductMain } from "@/api/productionManagement/productionReporting";
import { getInfo } from "@/api/login";
// 琛ㄥ崟寮曠敤
@@ -105,7 +103,6 @@
const goBack = () => {
uni.navigateBack();
};
- const parsedOrderRow = ref({});
// 鎻愪氦琛ㄥ崟
const submitForm = async () => {
submitting.value = true;
@@ -121,7 +118,7 @@
return;
}
- addProductMain(reportForm).then(res => {
+ addProductMain(form.value).then(res => {
if (res.code === 200) {
showToast("鎶ュ伐鎴愬姛");
submitting.value = false;
@@ -134,22 +131,17 @@
};
// 椤甸潰鍔犺浇鏃跺垵濮嬪寲鏁版嵁
- onMounted(() => {
- // 鑾峰彇浼犻�掕繃鏉ョ殑orderRow鍙傛暟
- const pages = getCurrentPages();
- const currentPage = pages[pages.length - 1];
- const orderRow = currentPage.options.orderRow;
- form.value.remainingQuantity = 1;
- if (orderRow) {
- parsedOrderRow.value = JSON.parse(orderRow);
+ onLoad(options => {
+ console.log(options, "options");
+ const orderRow = JSON.parse(options.orderRow);
+ console.log(orderRow, "orderRow======########");
- form.value.quantity = parsedOrderRow.value.quantity;
- form.value.productProcessRouteItemId =
- parsedOrderRow.value.productProcessRouteItemId;
- form.value.workOrderId = parsedOrderRow.value.id;
- form.value.reportWork = parsedOrderRow.value.reportWork;
- form.value.productMainId = parsedOrderRow.value.productMainId;
- }
+ form.value.remainingQuantity = 1;
+ form.value.quantity = orderRow.quantity;
+ form.value.productProcessRouteItemId = orderRow.productProcessRouteItemId;
+ form.value.workOrderId = orderRow.id;
+ form.value.reportWork = orderRow.reportWork;
+ form.value.productMainId = orderRow.productMainId;
getInfo().then(res => {
form.value.userId = res.user.userId;
form.value.userName = res.user.userName;
--
Gitblit v1.9.3