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 | 70 ++++++++++++++++++----------------
1 files changed, 37 insertions(+), 33 deletions(-)
diff --git a/src/pages/productionManagement/productionReport/index.vue b/src/pages/productionManagement/productionReport/index.vue
index dcd0fd7..ab3baf4 100644
--- a/src/pages/productionManagement/productionReport/index.vue
+++ b/src/pages/productionManagement/productionReport/index.vue
@@ -31,13 +31,16 @@
placeholder="璇疯緭鍏�"
type="number" />
</u-form-item>
- <u-form-item label="鐝粍淇℃伅"
- prop="schedulingUserId"
+ <!-- 鐝粍淇℃伅鍜屽鏍镐汉 -->
+ <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>
@@ -76,23 +79,29 @@
const formRef = ref();
// 琛ㄥ崟鏁版嵁
- let form = ref({
+ const form = ref({
planQuantity: "",
quantity: "",
scrapQty: "",
- userName: "",
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 {
@@ -100,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) {
@@ -110,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;
};
@@ -136,9 +147,14 @@
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;
}
// 杞崲涓烘暟瀛楄繘琛屾瘮杈�
@@ -162,6 +178,9 @@
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");
@@ -181,31 +200,16 @@
// 椤甸潰鍔犺浇鏃跺垵濮嬪寲鏁版嵁
onLoad(options => {
- console.log(options, "options");
- // 濡傛灉娌℃湁 orderRow 鍙傛暟锛岃鏄庢槸浠庨椤电洿鎺ヨ烦杞紝闇�瑕佺敤鎴锋墜鍔ㄩ�夋嫨璁㈠崟
- if (!options.orderRow) {
- console.log("浠庨椤佃烦杞紝鏃犺鍗曟暟鎹�");
- getInfo().then(res => {
- // 榛樿浣跨敤褰撳墠鐧诲綍鐢ㄦ埛
- form.value.userId = res.user.userId;
- form.value.userName = res.user.userName;
- form.value.schedulingUserId = res.user.userId;
- });
- return;
- }
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