* Code for task#41776.

This commit is contained in:
xieqiyu
2021-08-25 19:55:28 +08:00
parent 488823ddbc
commit 5b8e78cd18
5 changed files with 198 additions and 0 deletions
+7
View File
@@ -300,6 +300,13 @@ class project extends control
*/
public function kanban()
{
extract($this->project->getStats4Kanban());
$this->view->title = $this->lang->project->kanban;
$this->view->kanbanGroup = $kanbanGroup;
$this->view->latestExecutions = $latestExecutions;
$this->view->programPairs = $this->loadModel('program')->getPairs(true);
$this->display();
}
+17
View File
@@ -0,0 +1,17 @@
.main-table .table {cursor: default;}
.main-table .table td {background: #efefef;}
.board-item {border: 1px solid #EBEBEB; padding: 5px 10px; cursor: default; border-radius: 2px; background-color: #fff;}
.board-item:hover {border-color: #ccc;}
.board-item + .board-item {margin-top: 10px;}
.board-project {padding: 5px;}
.board-doing-project, .board-doing-execution {padding: 5px;}
.board-doing-project .table-row .table-col:last-child, .c-progress {width: 30px;}
.board-doing-execution .table-row .table-col:last-child, .c-progress {width: 30px;}
.table-row .table-col:first-child {overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
table th, td {border: 2px solid #fff !important;}
#kanban {padding-bottom: 10px}
+11
View File
@@ -131,6 +131,17 @@ $lang->project->moreProject = '更多项目';
$lang->project->days = '可用工作日';
$lang->project->etc = "等";
$lang->project->kanban = new stdclass();
$lang->project->kanban->typeList['my'] = '我负责的项目';
$lang->project->kanban->typeList['other'] = '其他项目';
$lang->project->kanban->waitProjects = '未开始的项目';
$lang->project->kanban->doingProjects = '进行中的项目';
$lang->project->kanban->doingExecutions = '进行中的执行';
$lang->project->kanban->closedProjects = '已关闭的项目';
$lang->project->kanban->laneColorList = array('#32C5FF', '#006AF1', '#9D28B2', '#FF8F26', '#FFC20E', '#00A78E', '#7FBB00', '#424BAC', '#C0E9FF', '#EC2761');
$lang->project->productNotEmpty = '请关联产品或创建产品。';
$lang->project->existProductName = '产品名称已存在。';
$lang->project->changeProgram = '%s > 修改项目集';
+44
View File
@@ -1794,6 +1794,50 @@ class projectModel extends model
return array_merge($parents, $orphan);
}
/**
* Get stats for project kanban.
*
* @access public
* @return void
*/
public function getStats4Kanban()
{
$this->loadModel('program');
$projects = $this->program->getProjectStats(0, 'all');
$executions = $this->getStats(0, 'doing');
$doingExecutions = array();
$latestExecutions = array();
foreach($executions as $execution) $doingExecutions[$execution->project][$execution->id] = $execution;
foreach($doingExecutions as $projectID => $executions)
{
krsort($doingExecutions[$projectID]);
$latestExecutions[$projectID] = current($doingExecutions[$projectID]);
}
$myProjects = array();
$otherProjects = array();
foreach($projects as $project)
{
if(strpos('wait,doing,closed', $project->status) === false) continue;
$projectPath = explode(',', trim($project->path, ','));
$topProgram = !empty($project->parent) ? $projectPath[0] : $project->parent;
if($project->PM == $this->app->user->account)
{
$myProjects[$topProgram][$project->status][$project->id] = $project;
}
else
{
$otherProjects[$topProgram][$project->status][$project->id] = $project;
}
}
return array('kanbanGroup' => array('my' => $myProjects, 'other' => $otherProjects), 'latestExecutions' => $latestExecutions);
}
/**
* Set menu of project module.
*
+119
View File
@@ -0,0 +1,119 @@
<?php
/**
* The project kanban view file of project module of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @author Qiyu Xie
* @package project
* @version $Id: kanban.html.php $
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php $colorIndex = 0;?>
<?php if(empty($kanbanGroup)):?>
<div class="table-empty-tip">
<p><span class="text-muted"><?php echo $lang->project->empty;?></span></p>
</div>
<?php else:?>
<?php foreach($kanbanGroup as $type => $projectGroup):?>
<?php if(!empty($projectGroup)):?>
<div id="kanban" class="main-table fade auto-fade-in" data-ride="table" data-checkable="false" data-group="true">
<div class="cell">
<div class='detail'>
<div class='detail-title'><?php echo $lang->project->kanban->typeList[$type];?></div>
<div class='detail-content'>
<table class='table no-margin' style='background-color: #efefef;'>
<thead class='text-center'>
<tr>
<th rowspan='2' class='w-20px'></th>
<th rowspan='2'><?php echo $lang->project->kanban->waitProjects;?></th>
<th colspan='2'><?php echo $lang->project->statusList['doing'];?></th>
<th rowspan='2'><?php echo $lang->project->kanban->closedProjects;?></th>
</tr>
<tr>
<th><?php echo $lang->project->kanban->doingProjects;?></th>
<th><?php echo $lang->project->kanban->doingExecutions;?></th>
</tr>
</thead>
<tbody>
<?php foreach($projectGroup as $programID => $statusList):?>
<tr>
<td style='background: <?php echo $lang->project->kanban->laneColorList[$colorIndex];?>; color: #fff; padding-left: 2px;'><?php echo zget($programPairs, $programID);?></td>
<?php foreach(array('wait','doing','closed') as $status):?>
<?php if($status == 'doing'):?>
<td colspan='2'>
<div class='board-doing'>
<?php if(isset($statusList[$status])):?>
<?php foreach($statusList[$status] as $project):?>
<div class='table-row'>
<div class='table-col board-doing-project'>
<div class='board-item' <?php echo "style='border-left: 3px solid " . (isset($project->delay) ? 'red' : "#0BD986") . "'";?>>
<div class='table-row'>
<div class='table-col'>
<span><?php echo $project->name;?></span>
</div>
<div class='table-col'>
<div class="c-progress">
<div class='progress-pie' data-doughnut-size='90' data-color='#3CB371' data-value='<?php echo round($project->hours->progress);?>' data-width='24' data-height='24' data-back-color='#e8edf3'>
<div class='progress-info'><?php echo round($project->hours->progress);?></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class='table-col board-doing-execution'>
<?php if(isset($latestExecutions[$project->id])):?>
<?php $execution = $latestExecutions[$project->id];?>
<div class='board-item' <?php echo "style='border-left: 3px solid " . (isset($execution->delay) ? 'red' : "#0BD986") . "'";?>>
<div class='table-row'>
<div class='table-col'>
<span><?php echo $execution->name;?></span>
</div>
<div class='table-col'>
<div class="c-progress">
<div class='progress-pie' data-doughnut-size='90' data-color='#3CB371' data-value='<?php echo round($execution->hours->progress);?>' data-width='24' data-height='24' data-back-color='#e8edf3'>
<div class='progress-info'><?php echo round($execution->hours->progress);?></div>
</div>
</div>
</div>
</div>
</div>
<?php endif;?>
</div>
</div>
<?php endforeach;?>
<?php endif;?>
</div>
</td>
<?php else:?>
<td>
<div class='board-project'>
<?php if(isset($statusList[$status])):?>
<?php foreach($statusList[$status] as $project):?>
<div class='board-item' <?php echo "style='border-left: 3px solid " . $lang->execution->statusColorList[$status] . "'";?>>
<span><?php echo $project->name;?></span>
</div>
<?php endforeach;?>
<?php endif;?>
</div>
</td>
<?php endif;?>
<?php endforeach;?>
</tr>
<?php $colorIndex ++;?>
<?php if($colorIndex > 9) $colorIndex = 0;?>
<?php endforeach;?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php endif;?>
<?php endforeach;?>
<?php endif;?>
<?php include '../../common/view/footer.html.php';?>