From 2a92b8a223d4875737b8062d177505263abcb6a3 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 21 五月 2026 17:31:50 +0800
Subject: [PATCH] fix: 投入数量编辑不成功,现在投入数量记录参数不能被删除
---
src/views/productionManagement/workOrder/components/ProductionRecordForm.vue | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/src/views/productionManagement/workOrder/components/ProductionRecordForm.vue b/src/views/productionManagement/workOrder/components/ProductionRecordForm.vue
index 9ab62b0..10bfc44 100644
--- a/src/views/productionManagement/workOrder/components/ProductionRecordForm.vue
+++ b/src/views/productionManagement/workOrder/components/ProductionRecordForm.vue
@@ -93,13 +93,19 @@
weightItem.value = Number(((qty * coeff) / 1000).toFixed(4));
};
-/** 闈炴垚鍨嬶細鎶曞叆閲嶉噺鍙栧伐鍗� bomInputQty */
-const syncBomInputWeight = () => {
+/** 闈炴垚鍨嬶細鎶曞叆閲嶉噺鍙栧伐鍗� bomInputQty锛堜粎鍥炴樉锛屼笉瑕嗙洊鐢ㄦ埛宸茬紪杈戠殑鍊硷級 */
+const syncBomInputWeight = (force = false) => {
if (props.isFormingProcess) return;
const weightItem = formData.list.find(isInputWeightItem);
if (!weightItem) return;
const bom = props.bomInputQty;
if (bom === null || bom === undefined || Number.isNaN(Number(bom))) {
+ return;
+ }
+ const current = weightItem.value;
+ const isEmpty =
+ current === null || current === undefined || current === "";
+ if (!force && !isEmpty) {
return;
}
weightItem.value = Number(bom);
@@ -113,15 +119,22 @@
}
};
+const cloneParamList = (list) =>
+ JSON.parse(JSON.stringify(list || []));
+
const initData = () => {
- formData.list = props.list || [];
+ formData.list = cloneParamList(props.list);
formData.list.forEach(item => {
if (item.value === undefined) {
item.value = null;
}
});
loadDeviceName();
- syncInputWeight();
+ if (props.isFormingProcess) {
+ syncFormingInputWeight();
+ } else {
+ syncBomInputWeight(true);
+ }
};
const submitData = async () => {
@@ -139,7 +152,7 @@
() => {
initData();
},
- {immediate: true, deep: true}
+ {immediate: true}
);
watch(
--
Gitblit v1.9.3