diff --git a/module/project/css/batchedit.css b/module/project/css/batchedit.css index d44eca5c0f..583cc42539 100644 --- a/module/project/css/batchedit.css +++ b/module/project/css/batchedit.css @@ -4,3 +4,4 @@ .c-name {width: 180px;} .c-code {width: 160px;} .c-acl {width: 125px;} +#dateTip {padding: 0 7px;} diff --git a/module/project/js/common.js b/module/project/js/common.js index a64000db6a..c6d85cccc9 100644 --- a/module/project/js/common.js +++ b/module/project/js/common.js @@ -95,7 +95,7 @@ function computeWorkDays(currentID) { computeEndDate(); } - outOfDateTip(); + outOfDateTip(isBactchEdit ? index : 0); } /** @@ -358,23 +358,26 @@ function budgetOverrunTips() /** *The date is out of the range of the parent project set, and a prompt is given. * + * @param int $currentID * @access public * @return void */ -function outOfDateTip() +function outOfDateTip(currentID = 0) { - var end = $('#end').val(); - var begin = $('#begin').val(); - if($('#dateTip').length > 0) $('#dateTip').remove(); + 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(currentID) $('#dateTip\\[' + currentID + '\\]').remove(); if(end == longTime) end = LONG_TIME; if(end.length > 0 && begin.length > 0) { - var selectedProgramID = $('#parent').val(); + var selectedProgramID = currentID ? $("select[name='parents\[" + currentID + "\]']").val() : $('#parent').val(); if(selectedProgramID == 0) return; if(typeof(projectID) == 'undefined') projectID = 0; + projectID = currentID ? $('#projectIdList\\['+ currentID + '\\]').val() : projectID; $.get(createLink('project', 'ajaxGetObjectInfo', 'objectType=project&objectID=' + projectID + '&selectedProgramID=' + selectedProgramID), function(data) { var data = JSON.parse(data); @@ -383,23 +386,34 @@ function outOfDateTip() var projectEnd = new Date(end); var projectBegin = new Date(begin); + var beginLetterParentTip = beginLetterParent + data.selectedProgramBegin; + var endGreaterParentTip = endGreaterParent + data.selectedProgramEnd; + var dateExceedParentTip = dateExceedParent + data.selectedProgramBegin + "~" + data.selectedProgramEnd; + if(projectBegin >= parentBegin && projectEnd <= parentEnd) return; var dateTip = ""; if(projectBegin < parentBegin && projectEnd <= parentEnd && projectEnd >= parentBegin) { - dateTip = "" + beginLetterParent + data.selectedProgramBegin + ""; + dateTip = currentID ? beginLetterParentTip + "'>" + beginLetterParentTip : beginLetterParentTip; } else if(projectEnd > parentEnd && projectBegin >= parentBegin && projectBegin <= parentEnd) { - dateTip = "" + endGreaterParent + data.selectedProgramEnd + ""; + dateTip = currentID ? endGreaterParentTip + "'>" + endGreaterParentTip : endGreaterParentTip; } else { - dateTip = "" + dateExceedParent + data.selectedProgramBegin + "~" + data.selectedProgramEnd + ""; + dateTip = currentID ? dateExceedParentTip + "'>" + dateExceedParentTip : dateExceedParentTip; } - $('#dateBox').after(dateTip); + if(currentID) + { + $("#projects\\[" + currentID + "\\]").after("