* Finish task.

This commit is contained in:
zhouxudong
2022-08-09 09:43:34 +00:00
parent 6f8f9b52e9
commit 808d01aa17
6 changed files with 90 additions and 60 deletions
-17
View File
@@ -704,23 +704,6 @@ class program extends control
echo $html;
}
/**
* Ajax: Get childish information.
*
* @param int $programID
* @access public
* @return void
*/
public function ajaxGetChildInfo($programID)
{
$data = array();
$minChildBegin = $this->dao->select('begin as minBegin')->from(TABLE_PROGRAM)->where('id')->ne($programID)->andWhere('deleted')->eq(0)->andWhere('path')->like("%,{$programID},%")->orderBy('begin_asc')->fetch('minBegin');
$maxChildEnd = $this->dao->select('end as maxEnd')->from(TABLE_PROGRAM)->where('id')->ne($programID)->andWhere('deleted')->eq(0)->andWhere('path')->like("%,{$programID},%")->andWhere('end')->ne('0000-00-00')->orderBy('end_desc')->fetch('maxEnd');
$data = array('minChildBegin' => $minChildBegin, 'maxChildEnd' => $maxChildEnd);
echo json_encode($data);
}
/**
* Update program order.
*
+38 -15
View File
@@ -330,7 +330,8 @@ function setBudgetTipsAndAclList(parentID)
*/
function compareChildDate()
{
if(getMethodName == 'create') return;
if(page == 'create') return;
var end = $('#end').val();
var begin = $('#begin').val();
if(end.length > 0 && begin.length > 0)
@@ -338,22 +339,34 @@ function compareChildDate()
var programEnd = new Date(end);
var programBegin = new Date(begin);
$.get(createLink('program', 'ajaxGetChildInfo', 'programID=' + programID), function(data)
$.get(createLink('project', 'ajaxGetObjectInfo', 'objectType=program&objectID=' + programID + '&selectedProgramID=' + selectedProgramID), function(data)
{
var dateTip = '';
var childInfo = JSON.parse(data);
var childBegin = new Date(childInfo.minChildBegin);
var childEnd = new Date(childInfo.maxChildEnd);
if(programBegin > childBegin) dateTip = "<span id='dateTip' class='text-remind'>" + beginGreateChild + childInfo.minChildBegin + "</span>";
if(programEnd < childEnd) dateTip = "<span id='dateTip' class='text-remind'>" + endLetterChild + childInfo.maxChildEnd + "</span>";
if((programEnd < childBegin && programEnd < childEnd) || (programBegin > childBegin && programBegin > childEnd) || (programBegin > childBegin && programEnd < childEnd)) dateTip = "<span id='dateTip' class='text-remind'>" + dateExceedChild + childInfo.minChildBegin + "~" + childInfo.maxChildEnd + "</span>";
if($('#dateTip').length > 0) $('#dateTip').remove();
if(programBegin <= childBegin && programEnd >= childEnd) return;
if(programBegin > childBegin && programEnd >= childEnd)
{
dateTip = "<span id='dateTip' class='text-remind'>" + beginGreateChild + childInfo.minChildBegin + "</span>";
}
else if(programEnd < childEnd && programBegin <= childBegin)
{
dateTip = "<span id='dateTip' class='text-remind'>" + endLetterChild + childInfo.maxChildEnd + "</span>";
}
else
{
dateTip = "<span id='dateTip' class='text-remind'>" + dateExceedChild + childInfo.minChildBegin + "~" + childInfo.maxChildEnd + "</span>";
}
$('#dateBox').after(dateTip);
});
}
}
/**
* The date is out of the range of the parent project set, and a prompt is given.
*
@@ -367,13 +380,11 @@ function outOfDateTip()
if(end.length > 0 && begin.length > 0)
{
var selectedProgramID = $('#parent').val();
var budget = $('#budget').val();
var programEnd = new Date(end);
var programBegin = new Date(begin);
if(selectedProgramID == 0)
{
if($('#dateTip').length > 0) $('#dateTip').remove();
compareChildDate();
return false;
}
@@ -381,20 +392,32 @@ function outOfDateTip()
if(typeof(programID) == 'undefined') programID = 0;
$.get(createLink('project', 'ajaxGetParentInfo', 'objectType=program&objectID=' + programID + "&selectedProgramID=" + selectedProgramID), function(data)
{
var dateTip = '';
var data = JSON.parse(data);
var parentEnd = new Date(data.selectedProgramEnd);
var parentBegin = new Date(data.selectedProgramBegin);
var dateTip = "";
if(programBegin < parentBegin && programEnd <= parentEnd) dateTip = "<span id='dateTip' class='text-remind'>" + beginLetterParent + data.selectedProgramBegin + "</span>";
if(programBegin >= parentBegin && programEnd > parentEnd) dateTip = "<span id='dateTip' class='text-remind'>" + endGreaterParent + data.selectedProgramEnd + "</span>";
if((programBegin < parentBegin && programEnd > parentEnd) || (programEnd <= parentBegin && programBegin <= parentBegin) || (programBegin >= parentEnd && programEnd >= parentEnd)) dateTip = "<span id='dateTip' class='text-remind'>" + dateExceedParent + data.selectedProgramBegin + "~" + data.selectedProgramEnd + "</span>";
if(programBegin >= parentBegin && programEnd <= parentEnd)
{
compareChildDate();
return;
}
if(programBegin < parentBegin && programEnd <= parentEnd)
{
dateTip = "<span id='dateTip' class='text-remind'>" + beginLetterParent + data.selectedProgramBegin + "</span>";
}
else if(programBegin >= parentBegin && programEnd > parentEnd)
{
dateTip = "<span id='dateTip' class='text-remind'>" + endGreaterParent + data.selectedProgramEnd + "</span>";
}
else
{
dateTip = "<span id='dateTip' class='text-remind'>" + dateExceedParent + data.selectedProgramBegin + "~" + data.selectedProgramEnd + "</span>";
}
if($('#dateTip').length > 0) $('#dateTip').remove();
$('#dateBox').after(dateTip);
if(dateTip.length != 0) return;
compareChildDate();
});
}
}
+1 -1
View File
@@ -45,7 +45,7 @@
<?php js::set('beginLetterParent', $lang->program->beginLetterParent);?>
<?php js::set('endGreaterParent', $lang->program->endGreaterParent);?>
<?php js::set('dateExceedParent', $lang->program->dateExceedParent);?>
<?php js::set('getMethodName', $this->app->getMethodName());?>
<?php js::set('page', $this->app->getMethodName());?>
<?php $aclList = $parentProgram ? $lang->program->subAclList : $lang->program->aclList;?>
<?php $requiredFields = $config->program->create->requiredFields;?>
<div id='mainContent' class='main-content'>
+1 -1
View File
@@ -12,7 +12,7 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php js::set('getMethodName', $this->app->getMethodName());?>
<?php js::set('page', $this->app->getMethodName());?>
<?php js::set('weekend', $config->execution->weekend);?>
<?php js::set('longTime', $lang->program->longTime);?>
<?php js::set('currencySymbol', $lang->project->currencySymbol);?>