From faf66f2d63f5f36a821682cfe1e69a545d13b205 Mon Sep 17 00:00:00 2001 From: zhouxudong Date: Fri, 19 Aug 2022 07:51:38 +0000 Subject: [PATCH 1/6] * Optimization task #64888. --- module/program/js/common.js | 27 +++++++++++++++------------ module/project/js/common.js | 17 +++++++++-------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/module/program/js/common.js b/module/program/js/common.js index 17b3a4acf1..46541b6234 100644 --- a/module/program/js/common.js +++ b/module/program/js/common.js @@ -283,7 +283,7 @@ $(function() if($(this).prop('checked')) { $('#budget').val('').attr('disabled', 'disabled'); - if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove(); + if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').parent().parent().remove(); } else { @@ -362,14 +362,15 @@ function compareChildDate() var dateTip = ''; if(programBegin > childBegin) { - dateTip = "

" + beginGreateChild + childInfo.minChildBegin + "

" + ignore + "

"; + dateTip = "

" + beginGreateChild + childInfo.minChildBegin + "

" + ignore + "

"; } else if(programEnd < childEnd) { - dateTip = "

" + endLetterChild + childInfo.maxChildEnd + "

" + ignore + "

"; + dateTip = "

" + endLetterChild + childInfo.maxChildEnd + "

" + ignore + "

"; } - $('#dateBox').after(dateTip); + $('#dateBox').parent().parent().after(dateTip); + $('#dateTip').parent().css('line-height', '0'); }); } } @@ -386,7 +387,7 @@ function outOfDateTip() var end = $('#end').val(); var begin = $('#begin').val(); - if($('#dateTip').length > 0) $('#dateTip').remove(); + if($('#dateTip').length > 0) $('#dateTip').parent().parent().remove(); if(end == longTime) end = LONG_TIME; if(end.length > 0 && begin.length > 0) @@ -417,14 +418,15 @@ function outOfDateTip() if(programBegin < parentBegin) { - dateTip = "

" + beginLetterParent + data.selectedProgramBegin + "

" + ignore + "

"; + dateTip = "

" + beginLetterParent + data.selectedProgramBegin + "

" + ignore + "

"; } else if(programEnd > parentEnd) { - dateTip = "

" + endGreaterParent + data.selectedProgramEnd + "

" + ignore + "

"; + dateTip = "

" + endGreaterParent + data.selectedProgramEnd + "

" + ignore + "

"; } - $('#dateBox').after(dateTip); + $('#dateBox').parent().parent().after(dateTip); + $('#dateTip').parent().css('line-height', '0'); }); } } @@ -443,7 +445,7 @@ function budgetOverrunTips() var budget = $('#budget').val(); if(selectedProgramID == 0) { - if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove(); + if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').parent().parent().remove(); return false; } @@ -453,9 +455,10 @@ function budgetOverrunTips() var data = JSON.parse(data); var tip = ""; - if(budget !=0 && budget !== null && budget > data.availableBudget) var tip = "

" + budgetOverrun + currencySymbol[data.budgetUnit] + data.availableBudget + "

" + ignore + "

" - if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove(); - $('#budgetBox').after(tip); + if(budget !=0 && budget !== null && budget > data.availableBudget) var tip = "

" + budgetOverrun + currencySymbol[data.budgetUnit] + data.availableBudget + "

" + ignore + "

" + if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').parent().parent().remove(); + $('#budgetBox').parent().parent().after(tip); + $('#beyondBudgetTip').parent().css('line-height', '0'); }); } diff --git a/module/project/js/common.js b/module/project/js/common.js index 7ce2365ef8..58b6b3252f 100644 --- a/module/project/js/common.js +++ b/module/project/js/common.js @@ -295,7 +295,7 @@ $(function() if($(this).prop('checked')) { $('#budget').val('').attr('disabled', 'disabled'); - if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove(); + if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').parent().parent().remove(); } else { @@ -340,7 +340,7 @@ function budgetOverrunTips() if(selectedProgramID == 0) { - if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove(); + if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').parent().parent().remove(); return false; } @@ -351,9 +351,10 @@ function budgetOverrunTips() if(typeof(data.availableBudget) == 'undefined') return; var tip = ""; - if(budget != 0 && budget !== null && budget > data.availableBudget) tip = "

" + budgetOverrun + currencySymbol[data.budgetUnit] + data.availableBudget.toFixed(2) + "

" + ignore + "

" - if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').remove(); - $('#budgetBox').after(tip); + if(budget != 0 && budget !== null && budget > data.availableBudget) tip = "

" + budgetOverrun + currencySymbol[data.budgetUnit] + data.availableBudget.toFixed(2) + "

" + ignore + "

" + if($('#beyondBudgetTip').length > 0) $('#beyondBudgetTip').parent().parent().remove(); + $('#budgetBox').parent().parent().after(tip); + $('#beyondBudgetTip').parent().css('line-height', '0'); var placeholder = ''; if(selectedProgramID) placeholder = parentBudget + currencySymbol[data.budgetUnit] + data.availableBudget.toFixed(2); @@ -374,7 +375,7 @@ function outOfDateTip(currentID = 0) if(window.ignoreTips['dateTip']) return; var end = currentID ? $('#ends\\[' + currentID + '\\]').val() : $('#end').val(); var begin = currentID ? $('#begins\\[' + currentID + '\\]').val() : $('#begin').val(); - if($('#dateTip.text-remind').length > 0) $('#dateTip').remove(); + if($('#dateTip.text-remind').length > 0) $('#dateTip').parent().parent().remove(); if(currentID) $('#dateTip\\[' + currentID + '\\]').remove(); if(end == longTime) end = LONG_TIME; @@ -396,7 +397,6 @@ function outOfDateTip(currentID = 0) var beginLetterParentTip = beginLetterParent + data.selectedProgramBegin; var endGreaterParentTip = endGreaterParent + data.selectedProgramEnd; - var dateExceedParentTip = dateExceedParent + data.selectedProgramBegin + "~" + data.selectedProgramEnd; if(projectBegin >= parentBegin && projectEnd <= parentEnd) return; @@ -416,7 +416,8 @@ function outOfDateTip(currentID = 0) } else { - $('#dateBox').after("

" + dateTip + "

" + ignore + "

"); + $('#dateRange').parent().after("

" + dateTip + "

" + ignore + "

"); + $('#dateTip').parent().css('line-height', '0') } }); } From 41862bf81c7f9440d3be83ffbd6999a47f074801 Mon Sep 17 00:00:00 2001 From: zhouxudong Date: Mon, 22 Aug 2022 02:20:05 +0000 Subject: [PATCH 2/6] * Batch edit append ignore. --- module/project/js/common.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/module/project/js/common.js b/module/project/js/common.js index 58b6b3252f..c3bdce25e0 100644 --- a/module/project/js/common.js +++ b/module/project/js/common.js @@ -403,16 +403,16 @@ function outOfDateTip(currentID = 0) var dateTip = ""; if(projectBegin < parentBegin) { - dateTip = currentID ? beginLetterParentTip + "'>" + beginLetterParentTip : beginLetterParentTip; + dateTip = currentID ? beginLetterParentTip + "'>

" + beginLetterParentTip : beginLetterParentTip; } else if(projectEnd > parentEnd) { - dateTip = currentID ? endGreaterParentTip + "'>" + endGreaterParentTip : endGreaterParentTip; + dateTip = currentID ? endGreaterParentTip + "'>

" + endGreaterParentTip : endGreaterParentTip; } if(currentID) { - $("#projects\\[" + currentID + "\\]").after("" + ignore + "

"); } else { @@ -430,11 +430,11 @@ function outOfDateTip(currentID = 0) * @access public * @return void */ -function ignoreTip(obj) +function ignoreTip(obj,currentID = 0) { var parentID = obj.parentNode.id; - $('#' + parentID).addClass('hidden'); + currentID ? $('#dateTip' + currentID).parent().parent().remove() : $('#' + parentID).parent().parent().remove(); - if(parentID == 'dateTip') window.ignoreTips['dateTip'] = true; + if(parentID == 'dateTip' || parentID == 'dateTip' + currentID) window.ignoreTips['dateTip'] = true; if(parentID == 'beyondBudgetTip') window.ignoreTips['beyondBudgetTip'] = true; } From a4bb6e0c3e8128e956bc99959e1759cdeb5aac65 Mon Sep 17 00:00:00 2001 From: zhouxudong Date: Mon, 22 Aug 2022 04:06:20 +0000 Subject: [PATCH 3/6] * Batch edit append ignore prompt. --- module/project/js/common.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/module/project/js/common.js b/module/project/js/common.js index c3bdce25e0..11c6b4e011 100644 --- a/module/project/js/common.js +++ b/module/project/js/common.js @@ -1,7 +1,8 @@ window.ignoreTips = { - 'beyondBudgetTip' : false, - 'dateTip' : false + 'beyondBudgetTip' : false, + 'dateTip' : false, }; +var batchEditDateTips = new Array(); /** * Access rights are equal to private, and the white list settings are displayed. @@ -366,13 +367,15 @@ function budgetOverrunTips() /** *The date is out of the range of the parent project set, and a prompt is given. * - * @param int $currentID + * @param string $currentID * @access public * @return void */ -function outOfDateTip(currentID = 0) +function outOfDateTip(currentID = '') { if(window.ignoreTips['dateTip']) return; + if(batchEditDateTips.includes(Number(currentID))) return; + var end = currentID ? $('#ends\\[' + currentID + '\\]').val() : $('#end').val(); var begin = currentID ? $('#begins\\[' + currentID + '\\]').val() : $('#begin').val(); if($('#dateTip.text-remind').length > 0) $('#dateTip').parent().parent().remove(); @@ -413,6 +416,7 @@ function outOfDateTip(currentID = 0) if(currentID) { $("#projects\\[" + currentID + "\\]").after("" + ignore + "

"); + $('#dateTip'+ currentID).parent().css('line-height', '0') } else { @@ -427,14 +431,16 @@ function outOfDateTip(currentID = 0) * Make this prompt no longer appear. * * @param string $obj + * @param string $currentID * @access public * @return void */ -function ignoreTip(obj,currentID = 0) +function ignoreTip(obj, currentID) { var parentID = obj.parentNode.id; currentID ? $('#dateTip' + currentID).parent().parent().remove() : $('#' + parentID).parent().parent().remove(); - if(parentID == 'dateTip' || parentID == 'dateTip' + currentID) window.ignoreTips['dateTip'] = true; + if(parentID == 'dateTip') window.ignoreTips['dateTip'] = true; + if(parentID == 'dateTip' + currentID) batchEditDateTips.push(currentID); if(parentID == 'beyondBudgetTip') window.ignoreTips['beyondBudgetTip'] = true; } From a49c03134c9c92cdf786e8f12256dd85e86afd76 Mon Sep 17 00:00:00 2001 From: zhouxudong Date: Mon, 22 Aug 2022 05:04:47 +0000 Subject: [PATCH 4/6] * Batch edit append ignore prompt. --- module/project/js/common.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/project/js/common.js b/module/project/js/common.js index 11c6b4e011..548fa6587c 100644 --- a/module/project/js/common.js +++ b/module/project/js/common.js @@ -1,6 +1,6 @@ window.ignoreTips = { - 'beyondBudgetTip' : false, - 'dateTip' : false, + 'beyondBudgetTip' : false, + 'dateTip' : false, }; var batchEditDateTips = new Array(); From fad466d71107c5d384b7b634ecb55e0430ff4ecc Mon Sep 17 00:00:00 2001 From: zhouxudong Date: Mon, 22 Aug 2022 05:05:49 +0000 Subject: [PATCH 5/6] * Batch edit append ignore prompt. --- module/project/js/common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/project/js/common.js b/module/project/js/common.js index 548fa6587c..9767ec4c42 100644 --- a/module/project/js/common.js +++ b/module/project/js/common.js @@ -1,6 +1,6 @@ window.ignoreTips = { 'beyondBudgetTip' : false, - 'dateTip' : false, + 'dateTip' : false }; var batchEditDateTips = new Array(); From 005533579daadfb42d03950bcf9cd4d556d295f4 Mon Sep 17 00:00:00 2001 From: zhouxudong Date: Mon, 22 Aug 2022 06:02:02 +0000 Subject: [PATCH 6/6] * Update code. --- module/project/js/common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/project/js/common.js b/module/project/js/common.js index 9767ec4c42..a0c7b3c6fc 100644 --- a/module/project/js/common.js +++ b/module/project/js/common.js @@ -371,7 +371,7 @@ function budgetOverrunTips() * @access public * @return void */ -function outOfDateTip(currentID = '') +function outOfDateTip(currentID) { if(window.ignoreTips['dateTip']) return; if(batchEditDateTips.includes(Number(currentID))) return;