From 8cc901ed214f3885b34a07d0520fbcfd50063439 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 19 十一月 2025 14:30:39 +0800
Subject: [PATCH] fix: 完成绞线自检,生产确认等功能新增
---
src/pages/production/detail/twistDetail.vue | 53 +++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 45 insertions(+), 8 deletions(-)
diff --git a/src/pages/production/detail/twistDetail.vue b/src/pages/production/detail/twistDetail.vue
index fede20a..b63840d 100644
--- a/src/pages/production/detail/twistDetail.vue
+++ b/src/pages/production/detail/twistDetail.vue
@@ -13,12 +13,7 @@
/>
<view class="mx-3">
<wd-grid class="rounded-lg" clickable>
- <wd-grid-item
- icon="computer"
- link-type="navigateTo"
- :url="`/pages/production/twist/report/index?id=${paramsId}`"
- text="鎶ュ伐"
- />
+ <wd-grid-item icon="computer" @click="handleReportClick" text="鎶ュ伐" />
<!-- <wd-grid-item
icon="chart"
text="鑷"
@@ -46,6 +41,8 @@
import { onLoad } from "@dcloudio/uni-app";
import ProductCard from "@/components/product_card/index.vue";
import TwistApi from "@/api/product/twist";
+import { getPrepareId, setPrepareId } from "@/utils/cache";
+import HomeApi from "@/api/home";
const paramsId = ref();
const cardData = reactive({
@@ -69,9 +66,49 @@
cardData.unAmount = data.unLength;
};
-onLoad((options: any) => {
+// 鑾峰彇骞剁紦瀛樼敓浜у噯澶嘔D
+const initPrepareId = async () => {
+ try {
+ const { data } = await HomeApi.getIndex();
+ if (data && data.prepareId) {
+ setPrepareId(data.prepareId);
+ }
+ } catch (error) {
+ console.error("鑾峰彇鐢熶骇鍑嗗ID澶辫触:", error);
+ }
+};
+
+// 澶勭悊鎶ュ伐鐐瑰嚮
+const handleReportClick = () => {
+ const prepareId = getPrepareId();
+ console.log("缁炵嚎琛ㄦ牸鎶ュ伐妫�鏌� - prepareId鍊�:", prepareId);
+
+ // 濡傛灉prepareId涓虹┖鎴栨湭瀹氫箟锛岃鏄庣敓浜у噯澶囨湭瀹屾垚
+ if (!prepareId) {
+ console.log("缁炵嚎琛ㄦ牸鎶ュ伐闃绘 - 鐢熶骇鍑嗗鏈畬鎴�");
+ uni.showModal({
+ title: "鎻愮ず",
+ content: "璇峰湪鐢佃剳绔畬鎴愮敓浜у噯澶囩‘璁わ紝鍐嶈繘琛屾姤宸ユ搷浣�",
+ showCancel: false,
+ confirmText: "纭畾",
+ success: () => {
+ // 鐢ㄦ埛鐐瑰嚮纭畾鍚庯紝涓嶅仛浠讳綍鎿嶄綔
+ },
+ });
+ return;
+ }
+
+ // 濡傛灉鏈� prepareId锛屾甯歌烦杞�
+ uni.navigateTo({
+ url: `/pages/production/twist/report/index?id=${paramsId.value}`,
+ });
+};
+
+onLoad(async (options: any) => {
paramsId.value = options.id;
- getDetailData(options.id);
+ await getDetailData(options.id);
+ // 鑾峰彇骞剁紦瀛樼敓浜у噯澶嘔D
+ await initPrepareId();
});
</script>
--
Gitblit v1.9.3