view.html.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <?php
  2. /**
  3. * The view file of demand module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2024 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  6. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Yuting Wang <wangyuting@easycorp.ltd>
  8. * @package demand
  9. * @link https://www.zentao.net
  10. */
  11. namespace zin;
  12. jsVar('storyGrades', $storyGrades);
  13. jsVar('roadmapPlans', $roadmapPlans);
  14. jsVar('roadmapCommon', $lang->roadmap->common);
  15. jsVar('planCommon', $lang->productplan->shortCommon);
  16. /* 左侧描述区块。 */
  17. $sections[] = setting()
  18. ->title($lang->demand->spec)
  19. ->control('html')
  20. ->content($demand->spec);
  21. /* 左侧验收标准区块。 */
  22. $sections[] = setting()
  23. ->title($lang->demand->verify)
  24. ->control('html')
  25. ->content($demand->verify);
  26. /* 左侧附件区块。 */
  27. if($demand->files)
  28. {
  29. $sections[] = array
  30. (
  31. 'control' => 'fileList',
  32. 'files' => $demand->files,
  33. 'object' => $demand,
  34. 'padding' => false,
  35. 'showDelete' => false
  36. );
  37. }
  38. /* 左侧子需求列表。 */
  39. if(!empty($demand->children))
  40. {
  41. $cols = array();
  42. $cols['id'] = $config->demand->dtable->fieldList['id'];
  43. $cols['title'] = $config->demand->dtable->fieldList['title'];
  44. $cols['pri'] = $config->demand->dtable->fieldList['pri'];
  45. $cols['assignedTo'] = $config->demand->dtable->fieldList['assignedTo'];
  46. $cols['status'] = $config->demand->dtable->fieldList['status'];
  47. $cols['stage'] = $config->demand->dtable->fieldList['stage'];
  48. $cols['actions'] = $config->demand->dtable->fieldList['actions'];
  49. foreach($cols as $key => $col) $cols[$key]['sortType'] = false;
  50. $cols['title']['data-toggle'] = 'modal';
  51. $cols['title']['data-size'] = 'lg';
  52. $children = initTableData($demand->children, $cols, $this->demand);
  53. $sections[] = array
  54. (
  55. 'title' => $lang->demand->children,
  56. 'control' => 'dtable',
  57. 'cols' => $cols,
  58. 'userMap' => $users,
  59. 'data' => $children,
  60. 'fixedLeftWidth' => '0.4',
  61. 'nested' => false
  62. );
  63. }
  64. /* 左侧分发需求列表。 */
  65. if(!empty($demand->stories))
  66. {
  67. $this->loadModel('story');
  68. $config->story->dtable->fieldList['title']['title'] = $lang->demand->title;
  69. $cols = array();
  70. $cols['id'] = array('name' => 'id', 'title' => $lang->idAB, 'type' => 'id');
  71. $cols['title'] = $config->story->dtable->fieldList['title'];
  72. $cols['product'] = $config->story->dtable->fieldList['product'];
  73. $cols['roadmap'] = array('name' => 'roadmapOrPlan', 'title' => $lang->demand->roadmapOrPlanAB, 'type' => 'text');
  74. $cols['status'] = $config->story->dtable->fieldList['status'];
  75. $cols['stage'] = $config->story->dtable->fieldList['stage'];
  76. $cols['actions'] = array('title' => $lang->actions, 'type' => 'actions', 'list' => array('retract' => array('icon' => 'back', 'hint' => $lang->demand->retract, 'url' => array('module' => 'demand', 'method' => 'retract', 'params' => 'storyID={id}'), 'data-toggle' => 'modal', 'data-size' => 'lg')), 'menu' => array('retract'));
  77. unset($cols['title']['nestedToggle']);
  78. $cols['title']['data-toggle'] = 'modal';
  79. $cols['title']['data-size'] = 'lg';
  80. $cols['product']['map'] = $products;
  81. $cols['stage']['title'] = $lang->demand->storyStage;
  82. $cols['stage']['width'] = '125';
  83. $cols['stage']['statusMap'] += $lang->story->stageList;
  84. foreach(array_keys($cols) as $fieldName) $cols[$fieldName]['sortType'] = false;
  85. $stories = initTableData($demand->stories, $cols, $this->story);
  86. $sections[] = array
  87. (
  88. 'title' => $lang->demand->distributedStory,
  89. 'control' => 'dtable',
  90. 'cols' => $cols,
  91. 'userMap' => $users,
  92. 'data' => $stories,
  93. 'fixedLeftWidth' => '0.4',
  94. 'extensible' => false,
  95. 'onRenderCell' => jsRaw('window.renderCell')
  96. );
  97. }
  98. /* 右侧基本信息区块。 */
  99. $tabs[] = setting()
  100. ->group('basic')
  101. ->title($lang->demand->basicInfo)
  102. ->control('demandBasicInfo');
  103. /* 右侧需求一生区块。 */
  104. $tabs[] = setting()
  105. ->group('basic')
  106. ->title($lang->demand->lifeTime)
  107. ->control('demandLifeInfo');
  108. /* 关联对象。*/
  109. $tabs[] = setting()
  110. ->group('related')
  111. ->title($lang->custom->relateObject)
  112. ->control('relatedObjectList')
  113. ->objectID($demand->id)
  114. ->objectType('demand')
  115. ->browseType('byObject');
  116. if($demand->status == 'changing') $config->demand->actionList['recall']['text'] = $lang->demand->recallChange;
  117. /* 操作按钮。 */
  118. $operateList = $this->loadModel('common')->buildOperateMenu($demand);
  119. $actions = $operateList['mainActions'];
  120. if(!empty($operateList['suffixActions'])) $actions = array_merge($actions, array(array('type' => 'divider')), $operateList['suffixActions']);
  121. /* 版本列表。Version list. */
  122. $versions = array();
  123. for($i = $demand->version; $i >= 1; $i--)
  124. {
  125. $versionItem = setting()->text("#{$i}")->url(inlink('view', "demandID={$demand->id}&version={$i}"))->selected($version == $i);
  126. if(isInModal()) $versionItem->set(array('data-load' => 'modal', 'data-target' => '.modal.show'));
  127. $versions[] = $versionItem;
  128. }
  129. $versionBtn = count($versions) > 1 ? to::title(dropdown
  130. (
  131. btn(set::type('ghost'), setClass('text-link font-normal text-base'), "#{$version}"),
  132. set::items($versions)
  133. )) : null;
  134. detail
  135. (
  136. set::urlFormatter(array('{id}' => $demand->id, '{pool}' => $demand->pool)),
  137. set::sections($sections),
  138. set::tabs($tabs),
  139. set::actions(array_values($actions)),
  140. $versionBtn
  141. );