From 20dbdee5a002544f6a4e12b5e39e338052418782 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期五, 26 十二月 2025 10:36:27 +0800
Subject: [PATCH] fix: 完成成品单丝报工逻辑
---
src/pages/production/wire/report/wire.vue | 13 ++++
src/pages/production/list/index.vue | 4 +
src/pages/production/detail/wireDetail.vue | 16 +++++
src/manifest.json | 2
src/pages/production/wire/report/reportManage.vue | 85 ++++++++++++++++++++++++----
src/components/product_card/index.vue | 20 ++++++
6 files changed, 125 insertions(+), 15 deletions(-)
diff --git a/src/components/product_card/index.vue b/src/components/product_card/index.vue
index 92b2413..08ae612 100644
--- a/src/components/product_card/index.vue
+++ b/src/components/product_card/index.vue
@@ -3,6 +3,13 @@
<template #title>
<view class="flex justify-between w-full">
<text class="font-medium text-[#252525]">璁惧缂栧彿: {{ data[map.deviceModel] }}</text>
+ <wd-tag
+ :color="data[map.isMonofil] == 1 ? '#0D867F' : '#e6a23c'"
+ :bg-color="data[map.isMonofil] == 1 ? '#E7F4EC' : '#fdf6ec'"
+ >
+ <text class="text-xs">{{ data[map.isMonofil] == 1 ? "鎴愬搧" : "鍗婃垚鍝�" }}</text>
+ </wd-tag>
+ <!-- #fdf6ec #e6a23c-->
<wd-tag color="#0D867F" bg-color="#E7F4EC">
<text class="text-xs">{{ data[map.model] }}</text>
</wd-tag>
@@ -60,6 +67,19 @@
</view>
</wd-col>
</wd-row>
+ <wd-row class="my-2" v-if="data.type === '鎷変笣' && data.contractNo && data[map.isMonofil] == 1">
+ <wd-col :span="24">
+ <view class="flex">
+ <view class="icon_box">
+ <wd-icon name="folder" color="#0D867F"></wd-icon>
+ </view>
+ <text class="text-[#646874] mx-2">
+ 閲嶉噺:
+ <text class="text-[#252525]">{{ data.totalWeight }} kg</text>
+ </text>
+ </view>
+ </wd-col>
+ </wd-row>
<wd-row class="my-2">
<wd-col :span="12">
<view class="flex">
diff --git a/src/manifest.json b/src/manifest.json
index 5546cac..6b86464 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -2,7 +2,7 @@
"name" : "绾跨紗涓婃姤",
"appid" : "__UNI__F64E0A4",
"description" : "",
- "versionName" : "1.0.26",
+ "versionName" : "1.0.27",
"versionCode" : "100",
"transformPx" : false,
/* 5+App鐗规湁鐩稿叧 */
diff --git a/src/pages/production/detail/wireDetail.vue b/src/pages/production/detail/wireDetail.vue
index 5303962..df36fcd 100644
--- a/src/pages/production/detail/wireDetail.vue
+++ b/src/pages/production/detail/wireDetail.vue
@@ -11,6 +11,8 @@
unAmount: 'unAmount',
poleModel: 'poleModel',
contractNo: 'contractNo',
+ isMonofil: 'isMonofil',
+ totalWeight: 'totalWeight',
}"
/>
<view class="mx-3">
@@ -57,6 +59,9 @@
oneLength: undefined,
poleModel: undefined,
contractNo: undefined,
+ isMonofil: undefined,
+ totalWeight: undefined,
+ meterWeight: undefined,
type: "鎷変笣",
});
const detailData = ref<any>({});
@@ -75,6 +80,9 @@
cardData.oneLength = data.oneLength;
cardData.poleModel = data.poleModel;
cardData.contractNo = data.contractNo;
+ cardData.isMonofil = data.isMonofil;
+ cardData.totalWeight = data.totalWeight;
+ cardData.meterWeight = data.meterWeight;
cardData.type = data.type || "鎷変笣";
};
@@ -127,8 +135,14 @@
}
// 濡傛灉鏈� prepareId锛屾甯歌烦杞�
+ const isMonofil =
+ cardData.isMonofil !== undefined && cardData.isMonofil !== null ? cardData.isMonofil : "";
+ const meterWeight =
+ cardData.meterWeight !== undefined && cardData.meterWeight !== null ? cardData.meterWeight : "";
+ const totalWeight =
+ cardData.totalWeight !== undefined && cardData.totalWeight !== null ? cardData.totalWeight : "";
uni.navigateTo({
- url: `/pages/production/wire/report/wire?id=${paramsId.value}&model=${cardData.model}&oneLength=${cardData.oneLength}`,
+ url: `/pages/production/wire/report/wire?id=${paramsId.value}&model=${cardData.model}&oneLength=${cardData.oneLength}&isMonofil=${isMonofil}&meterWeight=${meterWeight}&totalWeight=${totalWeight}`,
});
};
diff --git a/src/pages/production/list/index.vue b/src/pages/production/list/index.vue
index bd6f0e4..c24f894 100644
--- a/src/pages/production/list/index.vue
+++ b/src/pages/production/list/index.vue
@@ -43,6 +43,8 @@
unit: "unit",
poleModel: "poleModel",
contractNo: "contractNo",
+ isMonofil: "isMonofil",
+ totalWeight: "totalWeight",
});
const props = defineProps({
api: {
@@ -103,6 +105,8 @@
map.unAmount = "unAmount";
map.poleModel = "poleModel";
map.contractNo = "contractNo";
+ map.isMonofil = "isMonofil";
+ map.totalWeight = "totalWeight";
}
if (data.data.total == 0) {
pagingRef.value.complete(true);
diff --git a/src/pages/production/wire/report/reportManage.vue b/src/pages/production/wire/report/reportManage.vue
index c7e13b1..7df3b0f 100644
--- a/src/pages/production/wire/report/reportManage.vue
+++ b/src/pages/production/wire/report/reportManage.vue
@@ -272,6 +272,9 @@
const oneLength = ref();
const allChildDataList = ref<any[]>([]);
const wireDetail = ref<any>(null);
+const isMonofil = ref();
+const meterWeight = ref();
+const totalWeight = ref();
// 鏂板寮规鐩稿叧
const addDialogVisible = ref(false);
@@ -344,20 +347,33 @@
const handleAdd = () => {
const lastChild = childList.value[childList.value.length - 1];
- // 浠庤鎯呮暟鎹腑鑾峰彇绫抽噸
- const meterWeight =
+ // 浠庤鎯呮暟鎹腑鑾峰彇绫抽噸锛屼紭鍏堜娇鐢ㄤ紶鍏ョ殑鍙傛暟
+ const meterWeightValue =
+ Number(meterWeight.value) ||
Number(wireDetail.value?.meterWeight) ||
Number(wireDetail.value?.weight) ||
Number(wireDetail.value?.theoryWeight) ||
0;
+ // 濡傛灉鏄垚鍝佸崟涓濓紝鏍规嵁鍏紡鑷姩璁$畻鐩橀暱锛�(totalWeight/meterWeight)*1000
+ let calculatedLength = "";
+ if (
+ isMonofil.value &&
+ (isMonofil.value === 1 || isMonofil.value === "1" || isMonofil.value === true)
+ ) {
+ const totalWeightValue = Number(totalWeight.value) || 0;
+ if (totalWeightValue > 0 && meterWeightValue > 0) {
+ calculatedLength = ((totalWeightValue / meterWeightValue) * 1000).toFixed(2);
+ }
+ }
+
// 鍒濆鍖栨柊鏁版嵁锛屽鏋滄湁鏈�鍚庝竴鏉℃暟鎹紝浣跨敤鍏跺�间綔涓洪粯璁ゅ��
newChildData.value = {
dishModel: lastChild?.dishModel || "",
- actuallyLength: lastChild?.actuallyLength || "",
+ actuallyLength: calculatedLength || lastChild?.actuallyLength || "",
actuallyWeight: lastChild?.actuallyWeight || "",
isJoint: lastChild?.isJoint || 0,
- meterWeight: meterWeight,
+ meterWeight: meterWeightValue,
};
addDialogVisible.value = true;
@@ -530,28 +546,68 @@
}
};
-// 鑷姩璁$畻瀹為檯閲嶉噺
+// 鑷姩璁$畻瀹為檯閲嶉噺锛堟牴鎹暱搴︼級
const handleCalculateWeight = (row: any) => {
// 浠� newChildData 瀵硅薄涓幏鍙栫背閲�
- const meterWeight = Number(row.meterWeight) || 0;
+ const meterWeightValue = Number(row.meterWeight) || 0;
const actuallyLength = Number(row.actuallyLength);
- if (meterWeight > 0 && actuallyLength > 0) {
- const calculatedWeight = (meterWeight * actuallyLength) / 1000;
+ if (meterWeightValue > 0 && actuallyLength > 0) {
+ const calculatedWeight = (meterWeightValue * actuallyLength) / 1000;
row.actuallyWeight = Number(calculatedWeight.toFixed(3));
}
- console.log("row", meterWeight, actuallyLength);
+ console.log("row", meterWeightValue, actuallyLength);
};
-// 鐩戝惉瀹為檯闀垮害鍙樺寲锛岃嚜鍔ㄨ绠楅噸閲�
+// 鑷姩璁$畻瀹為檯闀垮害锛堟牴鎹噸閲忥紝浠呮垚鍝佸崟涓濓級
+const handleCalculateLength = (row: any) => {
+ // 濡傛灉鏄垚鍝佸崟涓濓紝鏍规嵁閲嶉噺璁$畻闀垮害
+ if (
+ isMonofil.value &&
+ (isMonofil.value === 1 || isMonofil.value === "1" || isMonofil.value === true)
+ ) {
+ const meterWeightValue = Number(meterWeight.value) || Number(row.meterWeight) || 0;
+ const actuallyWeight = Number(row.actuallyWeight);
+
+ if (meterWeightValue > 0 && actuallyWeight > 0) {
+ const calculatedLength = (actuallyWeight / meterWeightValue) * 1000;
+ row.actuallyLength = Number(calculatedLength.toFixed(2));
+ }
+ }
+};
+
+// 鐩戝惉瀹為檯闀垮害鍙樺寲锛岃嚜鍔ㄨ绠楅噸閲忥紙闈炴垚鍝佸崟涓濇椂锛�
watch(
() => newChildData.value.actuallyLength,
(newValue, oldValue) => {
- console.log("瀹為檯闀垮害鍙樺寲:", { newValue, oldValue, newChildData: newChildData.value });
- if (newValue && String(newValue).trim() !== "") {
+ console.log("瀹為檯闀垮害鍙樺寲:", { newValue, oldValue, isMonofil: isMonofil.value });
+ // 濡傛灉涓嶆槸鎴愬搧鍗曚笣锛屾墠鏍规嵁闀垮害璁$畻閲嶉噺
+ if (
+ newValue &&
+ String(newValue).trim() !== "" &&
+ !(
+ isMonofil.value &&
+ (isMonofil.value === 1 || isMonofil.value === "1" || isMonofil.value === true)
+ )
+ ) {
// 浣跨敤 nextTick 纭繚 v-model 宸茬粡鏇存柊
nextTick(() => {
handleCalculateWeight(newChildData.value);
+ });
+ }
+ },
+ { immediate: false, deep: true }
+);
+
+// 鐩戝惉瀹為檯閲嶉噺鍙樺寲锛岃嚜鍔ㄨ绠楅暱搴︼紙浠呮垚鍝佸崟涓濓級
+watch(
+ () => newChildData.value.actuallyWeight,
+ (newValue, oldValue) => {
+ console.log("瀹為檯閲嶉噺鍙樺寲:", { newValue, oldValue, isMonofil: isMonofil.value });
+ if (newValue && String(newValue).trim() !== "") {
+ // 浣跨敤 nextTick 纭繚 v-model 宸茬粡鏇存柊
+ nextTick(() => {
+ handleCalculateLength(newChildData.value);
});
}
},
@@ -571,6 +627,11 @@
supplier: options.supplier,
};
+ // 鎺ユ敹浼犻�掔殑鍙傛暟
+ isMonofil.value = options.isMonofil;
+ meterWeight.value = options.meterWeight;
+ totalWeight.value = options.totalWeight;
+
await getDetailData(options.wireId);
await getData();
});
diff --git a/src/pages/production/wire/report/wire.vue b/src/pages/production/wire/report/wire.vue
index 7814947..15d612a 100644
--- a/src/pages/production/wire/report/wire.vue
+++ b/src/pages/production/wire/report/wire.vue
@@ -221,6 +221,9 @@
const paramsId = ref();
const model = ref();
const oneLength = ref();
+const isMonofil = ref();
+const meterWeight = ref();
+const totalWeight = ref();
// 鐖剁骇鏁版嵁鍒楄〃
const parentDataList = ref<any[]>([]);
@@ -518,8 +521,11 @@
}
// 璺宠浆鍒版姤宸ョ鐞嗛〉闈�
+ const isMonofilParam = isMonofil.value !== undefined && isMonofil.value !== null ? isMonofil.value : "";
+ const meterWeightParam = meterWeight.value !== undefined && meterWeight.value !== null ? meterWeight.value : "";
+ const totalWeightParam = totalWeight.value !== undefined && totalWeight.value !== null ? totalWeight.value : "";
uni.navigateTo({
- url: `/pages/production/wire/report/reportManage?wireId=${paramsId.value}&parentId=${parentRow.id}&poleNumber=${parentRow.poleNumber}&poleModel=${parentRow.poleModel}&polePackageNumber=${parentRow.polePackageNumber}&poleWeight=${parentRow.poleWeight}&supplier=${parentRow.supplier || ""}`,
+ url: `/pages/production/wire/report/reportManage?wireId=${paramsId.value}&parentId=${parentRow.id}&poleNumber=${parentRow.poleNumber}&poleModel=${parentRow.poleModel}&polePackageNumber=${parentRow.polePackageNumber}&poleWeight=${parentRow.poleWeight}&supplier=${parentRow.supplier || ""}&isMonofil=${isMonofilParam}&meterWeight=${meterWeightParam}&totalWeight=${totalWeightParam}`,
});
};
@@ -612,6 +618,11 @@
onLoad(async (options: any) => {
paramsId.value = options.id;
+ model.value = options.model;
+ oneLength.value = options.oneLength;
+ isMonofil.value = options.isMonofil;
+ meterWeight.value = options.meterWeight;
+ totalWeight.value = options.totalWeight;
await getDetailData(options.id);
await loadSupplierDict();
await getData();
--
Gitblit v1.9.3