From 5b62f70d5df5731a571d709f0f9ff312a7cec5dc Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 20 十一月 2025 16:25:59 +0800
Subject: [PATCH] fix: 巡检加上绞合外径可选
---
src/pages/production/detail/wireDetail.vue | 88 ++++++++++++++++++++++++++++++++++++++------
1 files changed, 76 insertions(+), 12 deletions(-)
diff --git a/src/pages/production/detail/wireDetail.vue b/src/pages/production/detail/wireDetail.vue
index 1e67d52..4e77cd2 100644
--- a/src/pages/production/detail/wireDetail.vue
+++ b/src/pages/production/detail/wireDetail.vue
@@ -1,14 +1,21 @@
<template>
<view class="pt-2">
- <ProductCard :data="cardData" />
+ <ProductCard
+ :data="cardData"
+ :map="{
+ deviceModel: 'deviceModel',
+ model: 'model',
+ systemNo: 'systemNo',
+ totalAmount: 'totalAmount',
+ amount: 'amount',
+ unAmount: 'unAmount',
+ poleModel: 'poleModel',
+ contractNo: 'contractNo',
+ }"
+ />
<view class="mx-3">
<wd-grid class="rounded-lg" clickable>
- <wd-grid-item
- icon="computer"
- link-type="navigateTo"
- :url="`/pages/production/wire/report/wire?id=${paramsId}`"
- text="鎶ュ伐"
- />
+ <wd-grid-item icon="computer" @click="handleReportClick" text="鎶ュ伐" />
<!-- <wd-grid-item
icon="chart"
text="鑷"
@@ -18,15 +25,15 @@
<wd-grid-item
icon="tips"
link-type="navigateTo"
- url="/pages/production/wire/backman/index"
+ :url="`/pages/production/wire/backman/index?id=${paramsId}`"
text="鏉傚伐"
/>
- <wd-grid-item
+ <!-- <wd-grid-item
icon="wallet"
link-type="navigateTo"
url="/pages/production/wire/receive/index"
text="鏉愭枡棰嗙敤"
- />
+ /> -->
</wd-grid>
</view>
</view>
@@ -36,14 +43,21 @@
import { onLoad } from "@dcloudio/uni-app";
import ProductCard from "@/components/product_card/index.vue";
import WireApi from "@/api/product/wire";
+import { getPrepareId, setPrepareId, clearPrepareId } from "@/utils/cache";
+import HomeApi from "@/api/home";
const paramsId = ref();
const cardData = reactive({
deviceModel: undefined,
model: undefined,
+ systemNo: undefined,
totalAmount: undefined,
amount: undefined,
unAmount: undefined,
+ oneLength: undefined,
+ poleModel: undefined,
+ contractNo: undefined,
+ type: "鎷変笣",
});
const getDetailData = async (id: string) => {
@@ -52,14 +66,64 @@
});
cardData.deviceModel = data.deviceModel;
cardData.model = data.model;
+ cardData.systemNo = data.systemNo;
cardData.totalAmount = data.totalAmount;
cardData.amount = data.amount;
cardData.unAmount = data.unAmount;
+ cardData.oneLength = data.oneLength;
+ cardData.poleModel = data.poleModel;
+ cardData.contractNo = data.contractNo;
+ cardData.type = data.type || "鎷変笣";
};
-onLoad((options: any) => {
+// 鑾峰彇骞剁紦瀛樼敓浜у噯澶嘔D
+const initPrepareId = async () => {
+ try {
+ const { data } = await HomeApi.getIndex();
+ if (data && data.prepareId) {
+ setPrepareId(data.prepareId);
+ } else {
+ // 濡傛灉娌℃湁 prepareId锛屾竻绌虹紦瀛�
+ clearPrepareId();
+ }
+ } catch (error) {
+ console.error("鑾峰彇鐢熶骇鍑嗗ID澶辫触:", error);
+ // 鑾峰彇澶辫触鏃朵篃娓呯┖缂撳瓨
+ clearPrepareId();
+ }
+};
+
+// 澶勭悊鎶ュ伐鐐瑰嚮
+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/wire/report/wire?id=${paramsId.value}&model=${cardData.model}&oneLength=${cardData.oneLength}`,
+ });
+};
+
+onLoad(async (options: any) => {
paramsId.value = options.id;
- getDetailData(options.id);
+ await getDetailData(options.id);
+ // 鑾峰彇骞剁紦瀛樼敓浜у噯澶嘔D
+ await initPrepareId();
});
</script>
--
Gitblit v1.9.3