* Finish task #73291.

This commit is contained in:
tianshujie
2022-11-08 14:33:53 +08:00
parent e593c657d4
commit 51a786f73d
6 changed files with 91 additions and 97 deletions
+21 -14
View File
@@ -55,36 +55,43 @@ $config->program->search['params']['closedDate'] = array('operator' => '=',
global $lang;
$config->program->dtable = new stdclass();
$config->program->dtable->fieldList['name']['name'] = 'name';
$config->program->dtable->fieldList['name']['title'] = $lang->nameAB;
$config->program->dtable->fieldList['name']['type'] = 'html';
$config->program->dtable->fieldList['name']['flex'] = 1;
$config->program->dtable->fieldList['name']['name'] = 'name';
$config->program->dtable->fieldList['name']['title'] = $lang->nameAB;
$config->program->dtable->fieldList['name']['type'] = 'link';
$config->program->dtable->fieldList['name']['flex'] = 1;
$config->program->dtable->fieldList['name']['nestedToggle'] = true;
$config->program->dtable->fieldList['name']['checkbox'] = true;
//$config->program->dtable->fieldList['name']['iconRender'] = 'icon-cards-view text-gray';
$config->program->dtable->fieldList['status']['name'] = 'status';
$config->program->dtable->fieldList['status']['title'] = $lang->program->status;
$config->program->dtable->fieldList['status']['width'] = 65;
$config->program->dtable->fieldList['status']['type'] = 'html';
$config->program->dtable->fieldList['status']['sortType'] = 1;
$config->program->dtable->fieldList['status']['name'] = 'status';
$config->program->dtable->fieldList['status']['title'] = $lang->program->status;
$config->program->dtable->fieldList['status']['width'] = 65;
$config->program->dtable->fieldList['status']['type'] = 'status';
$config->program->dtable->fieldList['status']['sortType'] = 1;
$config->program->dtable->fieldList['status']['statusMap'] = $lang->program->statusList;
$config->program->dtable->fieldList['pm']['name'] = 'pm';
$config->program->dtable->fieldList['pm']['title'] = $lang->program->PM;
$config->program->dtable->fieldList['pm']['width'] = 100;
$config->program->dtable->fieldList['pm']['type'] = 'html';
$config->program->dtable->fieldList['pm']['sortType'] = 1;
$config->program->dtable->fieldList['PM']['name'] = 'PM';
$config->program->dtable->fieldList['PM']['title'] = $lang->program->PM;
$config->program->dtable->fieldList['PM']['width'] = 100;
$config->program->dtable->fieldList['PM']['type'] = 'avatarBtn';
$config->program->dtable->fieldList['PM']['sortType'] = 1;
$config->program->dtable->fieldList['budget']['name'] = 'budget';
$config->program->dtable->fieldList['budget']['title'] = $lang->program->budget;
$config->program->dtable->fieldList['budget']['width'] = 100;
$config->program->dtable->fieldList['budget']['type'] = 'format';
$config->program->dtable->fieldList['budget']['sortType'] = 1;
$config->program->dtable->fieldList['begin']['name'] = 'begin';
$config->program->dtable->fieldList['begin']['title'] = $lang->program->begin;
$config->program->dtable->fieldList['begin']['width'] = 100;
$config->program->dtable->fieldList['begin']['type'] = 'datetime';
$config->program->dtable->fieldList['begin']['sortType'] = 1;
$config->program->dtable->fieldList['end']['name'] = 'end';
$config->program->dtable->fieldList['end']['title'] = $lang->program->end;
$config->program->dtable->fieldList['end']['width'] = 100;
$config->program->dtable->fieldList['end']['type'] = 'datetime';
$config->program->dtable->fieldList['end']['sortType'] = 1;
$config->program->dtable->fieldList['progress']['name'] = 'progress';
+3 -1
View File
@@ -4,10 +4,12 @@ $(function()
{
var editProject = $(this).is(':checked') ? 1 : 0;
$.cookie('editProject', editProject, {expires:config.cookieLife, path:config.webRoot});
showEditCheckbox(editProject);
dtableWithZentao.render({checkable: editProject});
});
if($.cookie('editProject') == 1) $('input#editProject1').prop('checked', 'true');
dtableWithZentao.render({checkable: $('input#editProject1').is(':checked')});
if($('input#editProject1').prop('checked'))
{
setTimeout(function()
+21 -62
View File
@@ -1595,75 +1595,34 @@ class programModel extends model
}
/**
* Build datatable cell.
* Build row data.
*
* @param array $field
* @param object $program
* @param array $users
* @param array $userIdPairs
* @param string $program
* @param array $PMList
* @param array $progressList
* @access public
* @return string
* @return object
*/
public function buildCell($field, $program, $users, $usersAvatar, $userIdPairs, $PMList, $progressList)
public function buildRowData($program, $PMList, $progressList)
{
$id = $field['name'];
$html = '';
switch($id)
{
case 'name':
if($program->type == 'program') $icon = ' icon-program';
if($program->type == 'project') $icon = ' icon-common icon-' . $program->model;
$class = $program->type == 'program' ? ' table-nest-toggle' : '';
$html = "<span class='table-nest-icon icon $class $icon'></span>";
$row = new stdclass();
if($program->type == 'program')
{
$html .= "<span class='icon icon-cards-view' style='color: #888fa1;'></span>";
$html .= ($this->app->user->admin or strpos(",{$this->app->user->view->programs},", ",$program->id,") !== false) ? html::a(helper::createLink('program', 'product', "programID=$program->id"), $program->name) : $program->name;
}
else
{
$projectType = $this->lang->project->{$program->model};
$html .= html::a(helper::createLink('project', 'index', "projectID=$program->id", '', '', $program->id), $program->name, '', "class='text-ellipsis text-primary' title='{$program->name} ($projectType)'");
$manager = isset($PMList[$program->PM]) ? $PMList[$program->PM] : '';
$programBudget = $this->project->getBudgetWithUnit($program->budget);
if($program->status != 'done' and $program->status != 'closed' and $program->status != 'suspended')
{
$delay = helper::diffDate(helper::today(), $program->end);
if($delay > 0) $html .= "<span class='label label-danger label-badge'>{$this->lang->project->statusList['delay']}</span>";
}
}
break;
case 'status':
$html = "<span class='status-program status-{$program->status}'>" . zget($this->lang->project->statusList, $program->status, '') . '</span>';
break;
case 'pm':
if(!empty($program->PM))
{
$userName = zget($users, $program->PM);
$html = html::smallAvatar(array('avatar' => $usersAvatar[$program->PM], 'account' => $program->PM, 'name' => $userName), (($program->type == 'program' and $program->grade == 1 )? 'avatar-circle avatar-top avatar-' : 'avatar-circle avatar-') . zget($userIdPairs, $program->PM));
$userID = isset($PMList[$program->PM]) ? $PMList[$program->PM]->id : '';
$html .= html::a(helper::createLink('user', 'profile', "userID=$userID", '', true), $userName, '', "title='{$userName}' data-toggle='modal' data-type='iframe' data-width='600'");
}
break;
case 'budget':
$programBudget = $this->project->getBudgetWithUnit($program->budget);
$html = $program->budget != 0 ? zget($this->lang->project->currencySymbol, $program->budgetUnit) . ' ' . $programBudget : $this->lang->project->future;
break;
case 'begin':
$html = $program->begin;
break;
case 'end':
$html = $program->end == LONG_TIME ? $this->lang->program->longTime : $program->end;
break;
case 'progress':
$html = isset($progressList[$program->id]) ? round($progressList[$program->id]) : 0;
break;
case 'actions':
$html = $this->buildOperateMenu($program, 'browse');
break;
}
return $html;
$row->id = $program->id;
$row->parent = $program->parent ? $program->parent : '';
$row->asParent = $program->type == 'program';
$row->type = $program->type;
$row->name = $program->name;
$row->status = $program->status;
$row->PM = empty($manager) ? '' : $manager->realname;
$row->PMAvatar = empty($manager) ? '' : $manager->avatar;
$row->budget = $program->budget != 0 ? zget($this->lang->project->currencySymbol, $program->budgetUnit) . ' ' . $programBudget : $this->lang->project->future;
$row->begin = $program->begin;
$row->end = $program->end == LONG_TIME ? $this->lang->program->longTime : $program->end;
$row->progress = isset($progressList[$program->id]) ? round($progressList[$program->id]) : 0;
return $row;
}
}
+1 -10
View File
@@ -42,16 +42,7 @@ $rows = array();
$this->loadModel('project');
foreach($programs as $program)
{
$row = new stdclass();
foreach($this->config->program->dtable->fieldList as $field)
{
$fieldName = $field['name'];
$row->$fieldName = $this->program->buildCell($field, $program, $users, $usersAvatar, $userIdPairs, $PMList, $progressList);
}
$row->id = $program->id;
$row->parent = $program->parent;
$rows[] = $row;
$rows[] = $this->program->buildRowData($program, $PMList, $progressList);
}
$table->search($status, $moduleName);