From 09f98ab6b6ac0779f12bd003443e1e6065cad256 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期二, 12 五月 2026 14:33:31 +0800
Subject: [PATCH] fix: 支持按照工单进行输入报工信息报工。也可以扫码报工
---
src/pages/works.vue | 87 +------------------------------------------
1 files changed, 3 insertions(+), 84 deletions(-)
diff --git a/src/pages/works.vue b/src/pages/works.vue
index 121a6e9..8d36ad9 100644
--- a/src/pages/works.vue
+++ b/src/pages/works.vue
@@ -306,7 +306,6 @@
<script setup>
import { ref, onMounted, nextTick, reactive, computed } from "vue";
import { userLoginFacotryList } from "@/api/login";
- import { getProductWorkOrderById } from "@/api/productionManagement/productionReporting";
import DownloadProgressMask from "@/components/DownloadProgressMask.vue";
import modal from "@/plugins/modal";
import useUserStore from "@/store/modules/user";
@@ -868,7 +867,9 @@
});
break;
case "鐢熶骇鎶ュ伐":
- getcode();
+ uni.navigateTo({
+ url: "/pages/productionManagement/productionReport/workOrderList",
+ });
break;
case "鎶ュ伐鍙拌处":
uni.navigateTo({
@@ -1076,88 +1077,6 @@
factoryList.value = [];
});
}
- const getcode = async () => {
- uni.scanCode({
- success: async res => {
- // 瑙f瀽浜岀淮鐮佸唴瀹�
- const scanResult = res.result;
- let orderRow = "";
-
- // 鍒ゆ柇鎵弿缁撴灉鏄惁涓虹函鏁板瓧锛坕d锛�
- const isNumericId = /^\d+$/.test(scanResult.trim());
-
- if (isNumericId) {
- // 濡傛灉鏄函鏁板瓧锛屾牴鎹� id 鑾峰彇宸ュ崟鏁版嵁
- const workOrderId = scanResult.trim();
- modal.loading("姝e湪鑾峰彇宸ュ崟淇℃伅...");
- try {
- const workRes = await getProductWorkOrderById({ id: workOrderId });
- modal.closeLoading();
-
- console.log("宸ュ崟鏌ヨ缁撴灉:", workRes);
-
- if (workRes.code === 200 && workRes.data) {
- // 鏂版帴鍙h繑鍥炵殑鏄崟涓璞★紝涓嶆槸鏁扮粍
- const workData = workRes.data;
- console.log("宸ュ崟鏁版嵁:", workData);
-
- if (workData.endOrder === true) {
- modal.msgError("璇ヨ鍗曞凡缁撴潫锛屾棤娉曟姤宸�");
- return;
- }
-
- orderRow = JSON.stringify(workData);
-
- console.log("鏋勯�犵殑orderRow:", orderRow);
- } else {
- modal.msgError("鏈壘鍒板搴旂殑宸ュ崟淇℃伅");
- return;
- }
- } catch (error) {
- modal.closeLoading();
- console.error("鑾峰彇宸ュ崟淇℃伅澶辫触:", error);
- modal.msgError("鑾峰彇宸ュ崟淇℃伅澶辫触: " + (error.message || "鏈煡閿欒"));
- return;
- }
- } else {
- // 濡傛灉涓嶆槸绾暟瀛楋紝灏濊瘯浠庢壂鐮佺粨鏋滀腑鎻愬彇orderRow鍙傛暟
- try {
- // 澶勭悊娣峰悎鏍煎紡: http://...?orderRow={...}
- const orderRowStart = scanResult.indexOf("orderRow={");
- if (orderRowStart !== -1) {
- // 鎻愬彇浠巓rderRow={寮�濮嬬殑JSON鍐呭
- const jsonPart = scanResult.substring(orderRowStart + 9); // 9鏄�"orderRow=".length
- orderRow = jsonPart;
- } else {
- // 濡傛灉鐩存帴鏄疛SON瀛楃涓诧紝灏濊瘯瑙f瀽
- orderRow = scanResult;
- }
- } catch (e) {
- console.error(e, "瑙f瀽澶辫触====????=====");
- orderRow = "";
- }
-
- // 楠岃瘉鏄惁涓烘湁鏁堢殑JSON
- try {
- JSON.parse(orderRow);
- } catch (error) {
- modal.msgError("璁㈠崟瑙f瀽澶辫触锛岃妫�鏌ヤ簩缁寸爜鏍煎紡");
- return;
- }
- }
- // 鎵爜鎴愬姛鍚庤烦杞埌鐢熶骇鎶ュ伐椤甸潰锛屽苟浼犻�抩rderRow鍙傛暟
- uni.navigateTo({
- url: `/pages/productionManagement/productionReport/index?orderRow=${orderRow}`,
- });
- },
- fail: err => {
- uni.showToast({
- title: "鎵爜澶辫触",
- icon: "none",
- });
- },
- });
- };
const changeFactory = async arr => {
show.value = false;
const factoryId = factoryListTem.value[arr.indexs[0]].deptId;
--
Gitblit v1.9.3