| | |
| | | return ids.includes(uid); |
| | | }; |
| | | |
| | | // 判断当前用户是否在工序报工人中 |
| | | const isCurrentUserInProcessUserIds = (row) => { |
| | | const uid = String(currentUserId.value || ""); |
| | | if (!uid) return false; |
| | | |
| | | const ids = normalizeArray(row?.processUserIds) |
| | | .map(id => String(id)) |
| | | .filter(Boolean); |
| | | |
| | | return ids.includes(uid); |
| | | }; |
| | | |
| | | // 判断当前用户是否可以报工(工单报工人 或 工序报工人) |
| | | const canCurrentUserReport = (row) => { |
| | | return isCurrentUserInUserIds(row) || isCurrentUserInProcessUserIds(row); |
| | | }; |
| | | |
| | | const canOperateByReportWorker = computed(() => { |
| | | return (row) => isCurrentUserReportWorker(row); |
| | | }); |
| | |
| | | clickFun: row => { |
| | | showReportDialog(row); |
| | | }, |
| | | // // 用户当前id |
| | | // 用户当前id在工单报工人或工序报工人中 |
| | | disabled: row => row.completeQuantity >= row.planQuantity || |
| | | !isCurrentUserInUserIds(row) || row.hasUnreportedMachine |
| | | !canCurrentUserReport(row) || row.hasUnreportedMachine |
| | | }, |
| | | { |
| | | name: "生产排产", |
| | |
| | | reportForm.addQty = 0; |
| | | reportForm.userIds = row.userIds || []; |
| | | |
| | | const ids = (row.userIds || "") |
| | | .split(",") |
| | | .map(id => id.trim()) |
| | | // 合并工单报工人和工序报工人,去重 |
| | | const workOrderUserIds = normalizeArray(row.userIds) |
| | | .map(id => String(id).trim()) |
| | | .filter(Boolean); |
| | | const processUserIds = normalizeArray(row.processUserIds) |
| | | .map(id => String(id).trim()) |
| | | .filter(Boolean); |
| | | const allowedUserIds = [...new Set([...workOrderUserIds, ...processUserIds])]; |
| | | |
| | | // 只允许选择工单报工人和工序报工人 |
| | | reportForm.userIdsList = userTeamOptions.value |
| | | // .filter(item => ids.includes(String(item.userId))) |
| | | .filter(item => allowedUserIds.includes(String(item.userId))) |
| | | .map(item => ({ |
| | | userId: item.userId, |
| | | nickName: item.nickName |