From 46d5fc2f692b19538f2f7224f04096faececd38b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 26 三月 2026 14:13:36 +0800
Subject: [PATCH] 军泰伟业 1.生产订单新增时展示工序和物料清单并可以修改
---
src/views/productionManagement/productionProcess/Edit.vue | 43 ++++++++++++++++++++++++++++++++++++-------
1 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/src/views/productionManagement/productionProcess/Edit.vue b/src/views/productionManagement/productionProcess/Edit.vue
index 0920e4f..4434fa2 100644
--- a/src/views/productionManagement/productionProcess/Edit.vue
+++ b/src/views/productionManagement/productionProcess/Edit.vue
@@ -109,12 +109,6 @@
// 鐩戝惉 record 鍙樺寲锛屾洿鏂拌〃鍗曟暟鎹�
watch(() => props.record, (newRecord) => {
if (newRecord && isShow.value) {
- const userPowerNames = newRecord.userPower ? newRecord.userPower.split(',') : [];
- const userPowerIds = userPowerNames.map(name => {
- const user = findUserByName(name);
- return user ? user.id : null;
- }).filter(id => id !== null);
-
formState.value = {
id: newRecord.id,
name: newRecord.name || '',
@@ -122,11 +116,46 @@
remark: newRecord.remark || '',
salaryQuota: newRecord.salaryQuota || '',
isQuality: newRecord.isQuality,
- userPower: userPowerIds,
+ userPower: [],
};
+
+ // 绛夊緟 staffList 鍔犺浇瀹屾垚鍚庯紝鍐嶆煡鎵剧敤鎴稩D
+ if (staffList.value.length > 0) {
+ setUserPowerIds(newRecord.userPower);
+ } else {
+ // staffList 杩樻病鍔犺浇锛岀瓑寰呬竴涓嬪啀鏌ユ壘
+ const checkStaffList = () => {
+ if (staffList.value.length > 0) {
+ setUserPowerIds(newRecord.userPower);
+ } else {
+ setTimeout(checkStaffList, 100);
+ }
+ };
+ checkStaffList();
+ }
}
}, { immediate: true, deep: true });
+// 鏍规嵁鐢ㄦ埛鍚嶆煡鎵剧敤鎴稩D
+const setUserPowerIds = (userPowerStr) => {
+ const userPowerNames = userPowerStr ? userPowerStr.split(',') : [];
+ const userPowerIds = [];
+ const findUserIds = (nodes, targetName) => {
+ nodes.forEach(node => {
+ if (node.isUser && node.label === targetName) {
+ userPowerIds.push(node.id);
+ }
+ if (node.children && node.children.length > 0) {
+ findUserIds(node.children, targetName);
+ }
+ });
+ };
+ userPowerNames.forEach(name => {
+ findUserIds(staffList.value, name);
+ });
+ formState.value.userPower = userPowerIds;
+};
+
let { proxy } = getCurrentInstance()
const closeModal = () => {
--
Gitblit v1.9.3