Merge branch 'sprint/181_tianshujie_kanban' into 'master'

Sprint/181 tianshujie kanban

See merge request easycorp/zentaopms!1178
This commit is contained in:
孙广明
2021-12-29 06:47:25 +00:00
9 changed files with 98 additions and 21 deletions
+16 -7
View File
@@ -531,12 +531,13 @@ class kanbanModel extends model
$this->loadModel('branch');
$this->loadModel('productplan');
$kanbanData = new stdclass();
$lanes = array();
$columns = array();
$branches = array();
$colorIndex = 0;
$laneOrder = 1;
$kanbanData = new stdclass();
$lanes = array();
$columns = array();
$branches = array();
$colorIndex = 0;
$laneOrder = 1;
$cardActions = array('view');
if($product->type == 'normal')
{
@@ -566,6 +567,14 @@ class kanbanModel extends model
{
if(empty($plan) or $plan->parent == -1) continue;
if(!isset($planList[$plan->status])) $planList[$plan->status] = array();
$plan->title = htmlspecialchars_decode($plan->title);
$plan->desc = strip_tags(htmlspecialchars_decode($plan->desc));
$plan->actions = array();
foreach($cardActions as $action)
{
if(common::hasPriv('productplan', $action)) $plan->actions[] = $action;
}
$planList[$plan->status][] = $plan;
}
@@ -751,7 +760,7 @@ class kanbanModel extends model
//->orderBy('`order` asc')
->fetchAll('id');
$actions = array('editCard', 'archiveCard', 'copyCard', 'deleteCard', 'moveCard', 'setCardColor', 'viewCard');
$actions = array('editCard', 'archiveCard', 'deleteCard', 'moveCard', 'setCardColor', 'viewCard');
$cardGroup = array();
foreach($cards as $card)
{
+5 -5
View File
@@ -1001,11 +1001,11 @@ class product extends control
*/
public function ajaxGetPlans($productID, $branch = 0, $planID = 0, $fieldID = '', $needCreate = false, $expired = '', $param = '')
{
$param = strtolower($param);
$plans = $this->loadModel('productplan')->getPairs($productID, $branch, $expired, strpos($param, 'skipparent') !== false);
$field = $fieldID ? "plans[$fieldID]" : 'plan';
$output = '';
$output .= html::select($field, $plans, $planID, "class='form-control chosen'");
$param = strtolower($param);
$plans = $this->loadModel('productplan')->getPairs($productID, $branch, $expired, strpos($param, 'skipparent') !== false);
$field = $fieldID ? "plans[$fieldID]" : 'plan';
$output = '';
$output .= html::select($field, $plans, $planID, "class='form-control chosen'");
if(count($plans) == 1 and $needCreate and $needCreate !== 'false')
{
$output .= "<div class='input-group-btn'>";
+2 -2
View File
@@ -249,12 +249,12 @@ class productplan extends control
$sort = $this->loadModel('common')->appendOrder($orderBy);
$this->session->set('productPlanList', $this->app->getURI(true), 'product');
$viewType = $this->cookie->viewType ? $this->cookie->viewType : 'bylist';
$viewType = $this->cookie->viewType ? $this->cookie->viewType : 'list';
$this->commonAction($productID, $branch);
$product = $this->product->getById($productID);
$productName = empty($product) ? '' : $product->name;
if($viewType == 'bykanban')
if($viewType == 'kanban')
{
$branches = array();
$branchPairs = array();
+60 -2
View File
@@ -51,7 +51,7 @@ $(function()
location.href = link;
});
if(viewType == 'bykanban')
if(viewType == 'kanban')
{
$('#branch_chosen .chosen-single span').prepend('<i class="icon-delay"></i>');
$('#kanban').kanban(
@@ -59,6 +59,8 @@ $(function()
data: kanbanData,
minColWidth: 290,
maxColWidth: 290,
maxColHeight: 460,
minColHeight: 190,
itemRender: renderKanbanItem,
virtualize: true,
droppable:
@@ -165,7 +167,63 @@ function changeCardColType(card, fromColType, toColType, kanbanID)
*/
function renderKanbanItem(item, $item)
{
var $title = $item.children('.title');
var privs = item.actions;
var $titleBox = $item.children('.titleBox');
/* Output header information. */
if(!$titleBox.length) $titleBox = $(
[
'<div class="titleBox">',
'</div>'
].join('')).appendTo($item);
/* Print plan name. */
var $title = $titleBox.children('.title');
if(!$title.length)
{
if(privs.includes('view')) $title = $('<a class="title"></a>').appendTo($titleBox).attr('href', createLink('productplan', 'view', 'cardID=' + item.id));
if(!privs.includes('view')) $title = $('<p class="title"></p>').appendTo($titleBox);
}
$title.text(item.title).attr('title', item.title);
/* Determine whether to print an expired label. */
var today = new Date();
var begin = $.zui.createDate(item.begin);
var end = $.zui.createDate(item.end);
if(end.toLocaleDateString() < today.toLocaleDateString())
{
$expired = $titleBox.children('.expired');
if(!$expired.length)
{
$('<span class="expired label label-danger label-badge">' + productplanLang.expired + '</span>').appendTo($titleBox);
}
}
/* Output plan date information. */
var $dateBox = $item.children('.dateBox');
if(!$dateBox.length) $dateBox = $(
[
'<div class="dateBox">',
'<span class="time label label-outline"></span>',
'</div>'
].join('')).appendTo($item);
var $time = $dateBox.children('.time');
if(item.begin != '2030-01-01' && item.end != '2030-01-01')
{
$time.text($.zui.formatDate(begin, 'MM-dd') + ' ' + productplanLang.to + ' ' + $.zui.formatDate(end, 'MM-dd')).attr('title', $.zui.formatDate(begin, 'yyyy-MM-dd') + productplanLang.to + $.zui.formatDate(end, 'yyyy-MM-dd')).show();
}
else
{
$time.text(productplanLang.future).attr('title', productplanLang.future).show();
}
/* Output plan desc information. */
var $desc = $item.children('.desc');
if(!$desc.length)
{
$("<div class='desc c-name'"+ " title='" + item.desc + "'>" + item.desc + '</div>').appendTo($item);
}
}
/**
+1
View File
@@ -30,6 +30,7 @@ $lang->productplan->batchEdit = 'Batch Edit';
$lang->productplan->project = 'Project';
$lang->productplan->plan = 'Plan';
$lang->productplan->allAB = 'All';
$lang->productplan->to = 'To';
$lang->productplan->batchUnlink = "Batch Unlink";
$lang->productplan->unlinkAB = "Unlink";
+1
View File
@@ -31,6 +31,7 @@ $lang->productplan->batchEdit = '批量编辑';
$lang->productplan->project = '项目';
$lang->productplan->plan = '计划';
$lang->productplan->allAB = '所有';
$lang->productplan->to = '至';
$lang->productplan->batchUnlink = "批量移除";
$lang->productplan->unlinkAB = "移除";
+1 -1
View File
@@ -19,7 +19,7 @@
<?php js::set('projectNotEmpty', $lang->productplan->projectNotEmpty)?>
<?php js::set('viewType', $viewType);?>
<?php
if($viewType == 'bykanban')
if($viewType == 'kanban')
{
include 'browsebykanban.html.php';
}
@@ -18,8 +18,16 @@
#branchBox {width: 120px;}
#branch_chosen .icon-delay {padding-right: 10px; font-size: 15px;}
#kanbanContainer {padding-bottom: 0; margin-bottom: 0;}
.kanban-card {height: 80px !important;}
.kanban-card .titleBox {width: 100%; display: flex;}
.kanban-card .titleBox > span {flex: none;}
.kanban-card .title {white-space: nowrap; overflow: hidden;}
.kanban-card .expired {margin-left: 2px;}
.kanban-card .dateBox {padding-top: 5px;}
.kanban-card .desc {overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #838a9d; padding-top: 5px;}
</style>
<?php js::set('kanbanData', $kanbanData);?>
<?php js::set('productplanLang', $lang->productplan);?>
<div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-left">
<?php if($product->type == 'normal'):?>
@@ -35,8 +43,8 @@
</div>
<div class="btn-toolbar pull-right">
<div class="btn-group panel-actions">
<?php echo html::a('#',"<i class='icon-list'></i> &nbsp;", '', "class='btn btn-icon switchButton' title='{$lang->productplan->list}' data-type='bylist'");?>
<?php echo html::a('#',"<i class='icon-kanban'></i> &nbsp;", '', "class='btn btn-icon text-primary switchButton' title='{$lang->productplan->kanban}' data-type='bykanban'");?>
<?php echo html::a('#',"<i class='icon-list'></i> &nbsp;", '', "class='btn btn-icon switchButton' title='{$lang->productplan->list}' data-type='list'");?>
<?php echo html::a('#',"<i class='icon-kanban'></i> &nbsp;", '', "class='btn btn-icon text-primary switchButton' title='{$lang->productplan->kanban}' data-type='kanban'");?>
</div>
<?php if(common::canModify('product', $product)):?>
<?php common::printLink('productplan', 'create', "productID=$product->id&branch=$branch", "<i class='icon icon-plus'></i> {$lang->productplan->create}", '', "class='btn btn-primary'");?>
@@ -25,8 +25,8 @@
</div>
<div class="btn-toolbar pull-right">
<div class="btn-group panel-actions">
<?php echo html::a('#',"<i class='icon-list'></i> &nbsp;", '', "class='btn btn-icon text-primary switchButton' title='{$lang->productplan->list}' data-type='bylist'");?>
<?php echo html::a('#',"<i class='icon-kanban'></i> &nbsp;", '', "class='btn btn-icon switchButton' title='{$lang->productplan->kanban}' data-type='bykanban'");?>
<?php echo html::a('#',"<i class='icon-list'></i> &nbsp;", '', "class='btn btn-icon text-primary switchButton' title='{$lang->productplan->list}' data-type='list'");?>
<?php echo html::a('#',"<i class='icon-kanban'></i> &nbsp;", '', "class='btn btn-icon switchButton' title='{$lang->productplan->kanban}' data-type='kanban'");?>
</div>
<?php if(common::canModify('product', $product)):?>
<?php common::printLink('productplan', 'create', "productID=$product->id&branch=$branch", "<i class='icon icon-plus'></i> {$lang->productplan->create}", '', "class='btn btn-primary'");?>