From bacd3972945612cea6eee829602223d2d4c5f50f Mon Sep 17 00:00:00 2001 From: odjbin <1042039504@qq.com> Date: Fri, 13 Jun 2025 06:14:19 +0000 Subject: [PATCH] revert 215f7c6bbf084b0bf6dbee1303a2539a3c21c3ad MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit revert feat(expense-management): 添加研发工时超过21.75天的提示功能 - 在保存分配明细时,增加对研发人员总工时的计算 - 如果总工时超过21.75天,系统将发出警告通知- 优化了控制台日志输出,便于调试和监控 --- .../expense-management/share-detail/add.vue | 42 +------------------ 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/src/views/expense-management/share-detail/add.vue b/src/views/expense-management/share-detail/add.vue index 9e56200..3253efb 100644 --- a/src/views/expense-management/share-detail/add.vue +++ b/src/views/expense-management/share-detail/add.vue @@ -386,47 +386,7 @@ const handleSubmit = (instance) => { apportionmentMonth: formData.value.apportionmentMonth, usrAllocations: 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) + console.log('params', params, formData.value.tableData) const {code, msg} = await addShare(params) ElNotification({ title: '提示',