From 87fce896046ec8e804810f75a90a62a5986e67ed Mon Sep 17 00:00:00 2001
From: ZN <zhang_12370@163.com>
Date: 星期二, 31 三月 2026 15:18:26 +0800
Subject: [PATCH] fix: 修正端口号、消息页签索引及生产报告表单字段
---
src/pages/productionManagement/productionReport/index.vue | 81 ++++++++++++++++++++++++++--------------
1 files changed, 53 insertions(+), 28 deletions(-)
diff --git a/src/pages/productionManagement/productionReport/index.vue b/src/pages/productionManagement/productionReport/index.vue
index c528611..ab3baf4 100644
--- a/src/pages/productionManagement/productionReport/index.vue
+++ b/src/pages/productionManagement/productionReport/index.vue
@@ -24,19 +24,23 @@
<u-input v-model="form.quantity"
placeholder="璇疯緭鍏�"
type="number" />
- <!-- <u-number-box v-model="form.quantity"
- step="0.1"
- bgColor="#fff"
- decimal-length="1"
- :min="0"></u-number-box> -->
</u-form-item>
- <u-form-item label="鐝粍淇℃伅"
- prop="schedulingUserId"
+ <u-form-item label="鎶ュ簾鏁伴噺"
+ prop="scrapQty">
+ <u-input v-model="form.scrapQty"
+ placeholder="璇疯緭鍏�"
+ type="number" />
+ </u-form-item>
+ <!-- 鐝粍淇℃伅鍜屽鏍镐汉 -->
+ <u-form-item v-for="(item, key) in pickerFields"
+ :key="key"
+ :label="item.label"
+ :prop="key + '.name'"
required>
- <u-input v-model="form.userName"
- placeholder="璇烽�夋嫨鐢熶骇浜�"
+ <u-input v-model="form[key].name"
+ :placeholder="form[key].name ? '宸查�夋嫨: ' + form[key].name : '璇烽�夋嫨' + item.label"
readonly
- @click="openProducerPicker"
+ @click="openProducerPicker(key)"
suffix-icon="arrow-down" />
</u-form-item>
</view>
@@ -75,22 +79,29 @@
const formRef = ref();
// 琛ㄥ崟鏁版嵁
- let form = ref({
+ const form = ref({
planQuantity: "",
quantity: "",
- userName: "",
+ scrapQty: "",
workOrderId: "",
productProcessRouteItemId: "",
- userId: "",
- schedulingUserId: "",
+ userId: { value: "", name: "" }, // 鐝粍淇℃伅
+ auditUserId: { value: "", name: "" }, // 瀹℃牳浜�
});
+
+ // 杩欓噷鐨勫瓧娈甸厤缃敤浜庢ā鐗堝惊鐜�
+ const pickerFields = {
+ userId: { label: "鐝粍淇℃伅" },
+ auditUserId: { label: "瀹℃牳浜�" },
+ };
// 鐢熶骇浜洪�夋嫨鍣ㄧ姸鎬�
const showProducerPicker = ref(false);
const producerList = ref([]);
+ const currentField = ref(""); // 褰撳墠閫夋嫨鐨勫瓧娈�
// 鎵撳紑鐢熶骇浜洪�夋嫨鍣�
- const openProducerPicker = async () => {
+ const openProducerPicker = async (field) => {
if (producerList.value.length === 0) {
// 濡傛灉鍒楄〃涓虹┖锛屽厛鍔犺浇鐢ㄦ埛鍒楄〃
try {
@@ -98,7 +109,7 @@
const users = res.data || [];
// 杞崲涓� action-sheet 闇�瑕佺殑鏍煎紡
producerList.value = users.map(user => ({
- name: user.nickName || user.userName,
+ name: user.nickName || "",
value: user.userId,
}));
} catch (error) {
@@ -108,13 +119,15 @@
}
}
showProducerPicker.value = true;
+ currentField.value = field; // 淇濆瓨褰撳墠瀛楁
};
// 鐢熶骇浜洪�夋嫨纭
const onProducerConfirm = e => {
- form.value.schedulingUserId = e.value;
- form.value.userName = e.name;
- form.value.userId = e.value; // 鍚屾椂鏇存柊 userId
+ if (currentField.value && form.value[currentField.value]) {
+ form.value[currentField.value].value = e.value;
+ form.value[currentField.value].name = e.name ;
+ }
showProducerPicker.value = false;
};
@@ -134,14 +147,26 @@
showToast("璇疯緭鍏ユ湰娆$敓浜ф暟閲�");
return;
}
- if (!form.value.schedulingUserId) {
+ if (!form.value.userId.value) {
submitting.value = false;
- showToast("璇烽�夋嫨鐢熶骇浜�");
+ showToast("璇烽�夋嫨鐝粍淇℃伅");
+ return;
+ }
+ if (!form.value.auditUserId.value) {
+ submitting.value = false;
+ showToast("璇烽�夋嫨瀹℃牳浜�");
return;
}
// 杞崲涓烘暟瀛楄繘琛屾瘮杈�
- const quantity = Number(form.value.quantity);
+ const quantity = Number(form.value.quantity) || 0;
+ const scrapQty = Number(form.value.scrapQty) || 0;
const planQuantity = Number(form.value.planQuantity);
+ // 楠岃瘉鐢熶骇鏁伴噺鍜屾姤搴熸暟閲忕殑鍜屼笉鑳借秴杩囧緟鐢熶骇鏁伴噺
+ if (quantity + scrapQty > planQuantity) {
+ submitting.value = false;
+ showToast("鐢熶骇鏁伴噺鍜屾姤搴熸暟閲忕殑鍜屼笉鑳借秴杩囧緟鐢熶骇鏁伴噺");
+ return;
+ }
if (quantity > planQuantity) {
submitting.value = false;
showToast("鏈鐢熶骇鏁伴噺涓嶈兘澶т簬寰呯敓浜ф暟閲�");
@@ -151,7 +176,11 @@
const submitData = {
...form.value,
quantity: Number(form.value.quantity),
+ scrapQty: Number(form.value.scrapQty) || 0,
planQuantity: Number(form.value.planQuantity) || 0,
+ userId: form.value.userId.value,
+ auditUserId: form.value.auditUserId.value,
+ schedulingUserId: form.value.userId.value, // 鍏煎鏃у瓧娈�
};
console.log(submitData, "submitData");
@@ -171,20 +200,16 @@
// 椤甸潰鍔犺浇鏃跺垵濮嬪寲鏁版嵁
onLoad(options => {
- console.log(options, "options");
try {
const orderRow = JSON.parse(options.orderRow);
- console.log("鏋勯�犵殑orderRow:", orderRow);
- console.log(orderRow, "orderRow======########");
// 纭繚 planQuantity 杞崲涓哄瓧绗︿覆锛屼互渚垮湪 u-input 涓纭樉绀�
form.value.planQuantity = orderRow.planQuantity != null ? String(orderRow.planQuantity) : "";
form.value.productProcessRouteItemId = orderRow.productProcessRouteItemId || "";
form.value.workOrderId = orderRow.id || "";
getInfo().then(res => {
// 榛樿浣跨敤褰撳墠鐧诲綍鐢ㄦ埛锛屼絾鍏佽鐢ㄦ埛淇敼
- form.value.userId = res.user.userId;
- form.value.userName = res.user.userName;
- form.value.schedulingUserId = res.user.userId;
+ form.value.userId.value = res.user.userId;
+ form.value.userId.name = res.user.nickName;
});
// 浣跨敤 nextTick 纭繚 DOM 鏇存柊
nextTick(() => {
--
Gitblit v1.9.3