* Repair plan workload.

This commit is contained in:
leiyong
2020-11-30 11:13:53 +08:00
parent 0c82b08a7f
commit bbd45d46dc
3 changed files with 8 additions and 41 deletions
-1
View File
@@ -167,7 +167,6 @@ class programplan extends control
$this->view->title = $this->lang->programplan->edit;
$this->view->position[] = $this->lang->programplan->edit;
$this->view->parentStage = $this->programplan->getParentStageList($this->session->PRJ, $planID, $plan->product);
$this->view->isParent = $this->programplan->isParent($planID);
$this->view->isCreateTask = $this->programplan->isCreateTask($planID);
$this->view->plan = $plan;
+2 -15
View File
@@ -323,9 +323,10 @@ class programplanModel extends model
$plans = $this->getStage($projectID, $stage->product, 'parent');
$totalPercent = 0;
$stageID = $stage->id;
foreach($plans as $id => $stage)
{
if($id == $stage->id) continue;
if($id == $stageID) continue;
$totalPercent += $stage->percent;
}
@@ -695,7 +696,6 @@ class programplanModel extends model
if($totalPercent > 100) return dao::$errors['percent'][] = $this->lang->programplan->error->percentOver;
}
/* Set planDuration and realDuration. */
$plan->planDuration = $this->getDuration($plan->begin, $plan->end);
$plan->realDuration = $this->getDuration($plan->realBegan, $plan->realEnd);
@@ -909,19 +909,6 @@ class programplanModel extends model
->fetchPairs();
}
/**
* Is parent.
*
* @param int $planID
* @access public
* @return bool
*/
public function isParent($planID)
{
$childrenStage = $this->dao->select('grade')->from(TABLE_PROJECT)->where('parent')->eq($planID)->andWhere('deleted')->eq('0')->fetch();
return empty($childrenStage) ? false : true;
}
/**
* Get parent stage list.
*
+6 -25
View File
@@ -12,7 +12,6 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php js::set('parentID', $plan->parent);?>
<div id="mainContent" class="main-content fade">
<div class="center-block">
<div class="main-header">
@@ -21,14 +20,10 @@
<form class="load-indicator main-form form-ajax" method='post' enctype='multipart/form-data' id='dataform'>
<table class="table table-form">
<tbody>
<?php if($isParent === false):?>
<tr>
<th class="w-100px"><?php echo $lang->programplan->parent;?></th>
<td class="w-p35-f"><?php echo html::select('parent', $parentStage, $plan->parent, "class='form-control chosen '");?></td>
</tr>
<?php else:?>
<?php echo html::hidden('parent', 0);?>
<?php endif;?>
<tr>
<th class='w-100px'><?php echo $lang->programplan->name;?> </th>
<td class='w-p35-f'><?php echo html::input('name', $plan->name, "class='form-control'");?></td>
@@ -43,7 +38,7 @@
</div>
</td>
</tr>
<tr class="<?php if($plan->parent) echo "hidden";?>" id="attributeType">
<tr class="<?php if($plan->grade == 2) echo "hidden";?>" id="attributeType">
<th><?php echo $lang->programplan->attribute;?> </th>
<td><?php echo html::select('attribute', $lang->stage->typeList, $plan->attribute, "class='form-control'");?></td>
</tr>
@@ -94,29 +89,15 @@
$("#parent").change(function()
{
var parent = $(this).children("option:selected").val();
if(parentID > 0)
if(parent == 0)
{
if(parent == 0)
{
$("#attributeType").removeClass('hidden');
}
else
{
$("#attributeType").addClass('hidden');
}
$("#attributeType").removeClass('hidden');
$("#acl").attr('disabled', false);
}
else
{
if(parent == 0)
{
$("#attributeType").removeClass('hidden');
}
else
{
$("#attributeType").addClass('hidden');
}
$("#attributeType").addClass('hidden');
$("#acl").attr('disabled', true);
}
});
</script>