From bd35243cbde6e1ef4de142d9b0a7d40e41789d66 Mon Sep 17 00:00:00 2001 From: dj <1042039504@qq.com> Date: Fri, 13 Jun 2025 14:23:37 +0800 Subject: [PATCH] =?UTF-8?q?test=20:=20=E6=B5=8B=E8=AF=95ci/cd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../expense-management/share-detail/add.vue | 62 ++++++++++++++++--- 1 file changed, 52 insertions(+), 10 deletions(-) diff --git a/src/views/expense-management/share-detail/add.vue b/src/views/expense-management/share-detail/add.vue index 3253efb..56bb378 100644 --- a/src/views/expense-management/share-detail/add.vue +++ b/src/views/expense-management/share-detail/add.vue @@ -2,12 +2,12 @@
- - - - - - + + + + + + - 添加一行 + 添加一行 @@ -386,7 +386,47 @@ const handleSubmit = (instance) => { apportionmentMonth: formData.value.apportionmentMonth, usrAllocations: formData.value.tableData, } - console.log('params', params, formData.value.tableData) + console.log('params', params.usrAllocations, formData.value.tableData) + const resultMap = params.usrAllocations.reduce((acc, item) => { + if (!acc[item.researchPersonnelId]) { + acc[item.researchPersonnelId] = []; + } + acc[item.researchPersonnelId].push(item); + return acc; + }, {}); + const exceedList = []; + + Object.entries(resultMap).forEach(([id, items]) => { + const totalDuration = items.reduce((sum, item) => sum + (item.researchDuration || 0), 0); + const preciseTotalDuration = parseFloat(totalDuration.toFixed(2)); + + if (preciseTotalDuration > 21.75) { + // 收集超出的研发人员ID及总工时 + exceedList.push({ id, totalDuration: preciseTotalDuration }); + } + }); +// 从 resultMap 中获取 researchPersonnel + const exceedResearchPersonnel = exceedList.map(item => { + const id = item.id; + const personnelItems = resultMap[id]; + // 获取第一个对象中的 researchPersonnel(假设所有对象的 researchPersonnel 相同) + const researchPersonnel = personnelItems[0].researchPersonnel; + return { id, researchPersonnel, totalDuration: item.totalDuration }; + }); + + console.log('超过21.75的研发人员:', exceedResearchPersonnel); + + if (exceedResearchPersonnel.length > 0) { + console.log('以下研发人员的总研发工时超过21.75天:', exceedResearchPersonnel); + + ElNotification({ + title: '提示', + message: `以下研发人员的总研发工时超过21.75天:${exceedResearchPersonnel.map(e => e.researchPersonnel).join(',')}`, + type: 'warning' + }); + } +// 调用函数 + console.log('是大V',resultMap) const {code, msg} = await addShare(params) ElNotification({ title: '提示', @@ -536,9 +576,11 @@ onMounted(() => { } } } -:deep(.el-date-editor--month){ - width: 100%!important; + +:deep(.el-date-editor--month) { + width: 100% !important; } + :deep(.el-input-number) { width: 100%;