From 3cc99776630a5c81f945c23783d3019e708f1963 Mon Sep 17 00:00:00 2001 From: zhouxudong Date: Tue, 9 Aug 2022 05:49:27 +0000 Subject: [PATCH] * Finisha task. --- module/program/control.php | 14 +++++--------- module/program/js/common.js | 4 ++-- module/project/control.php | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/module/program/control.php b/module/program/control.php index e95fabe789..f54144784f 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -705,7 +705,7 @@ class program extends control } /** - * ajax get childish information. + * Ajax: Get childish information. * * @param int $programID * @access public @@ -713,15 +713,11 @@ class program extends control */ public function ajaxGetChildInfo($programID) { - $children = $this->program->getChildren($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'); - if($children > 0) - { - $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(); - $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(); - } - - $data = array('minChildBegin' => $minChildBegin->minBegin, 'maxChildEnd' => $maxChildEnd->maxEnd); + $data = array('minChildBegin' => $minChildBegin, 'maxChildEnd' => $maxChildEnd); echo json_encode($data); } diff --git a/module/program/js/common.js b/module/program/js/common.js index e3aa808603..b5216d8b8e 100644 --- a/module/program/js/common.js +++ b/module/program/js/common.js @@ -339,6 +339,7 @@ function compareChildDate() $.get(createLink('program', 'ajaxGetChildInfo', 'programID=' + programID), function(data) { + var dateTip = ''; var childInfo = JSON.parse(data); var childBegin = new Date(childInfo.minChildBegin); var childEnd = new Date(childInfo.maxChildEnd); @@ -379,7 +380,6 @@ function outOfDateTip() if(typeof(programID) == 'undefined') programID = 0; $.get(createLink('project', 'ajaxGetParentInfo', 'objectType=program&objectID=' + programID + "&selectedProgramID=" + selectedProgramID), function(data) { - console.log('789'); var data = JSON.parse(data); var parentEnd = new Date(data.selectedProgramEnd); var parentBegin = new Date(data.selectedProgramBegin); @@ -387,7 +387,7 @@ function outOfDateTip() var dateTip = ""; if(programBegin < parentBegin && programEnd <= parentEnd) dateTip = "" + beginLetterParent + data.selectedProgramBegin + ""; if(programBegin >= parentBegin && programEnd > parentEnd) dateTip = "" + endGreaterParent + data.selectedProgramEnd + ""; - if((programBegin < parentBegin && programEnd > parentEnd) || (projectEnd <= parentBegin && projectBegin <= parentBeg in) || (projectBegin >= parentEnd && projectEnd >= parentEnd)) dateTip = "" + dateExceedParent + data.selectedProgramBegin + "~" + data.selectedProgramEnd + ""; + if((programBegin < parentBegin && programEnd > parentEnd) || (programEnd <= parentBegin && programBegin <= parentBegin) || (programBegin >= parentEnd && programEnd >= parentEnd)) dateTip = "" + dateExceedParent + data.selectedProgramBegin + "~" + data.selectedProgramEnd + ""; if($('#dateTip').length > 0) $('#dateTip').remove(); $('#dateBox').after(dateTip); diff --git a/module/project/control.php b/module/project/control.php index 21ce3b2210..d9d1764d58 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -220,7 +220,7 @@ class project extends control } /** - * Ajax get selected program's information. + * Ajax: Get selected program's information. * * @param str $objectType * @param int $objectID