copyconfirm.html.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?php
  2. namespace zin;
  3. jsVar('copyProjectID', $copyProjectID);
  4. jsVar('projectModel', $project->model);
  5. jsVar('weekend', $config->execution->weekend);
  6. $title = in_array($project->model, array('waterfall', 'waterfallplus')) ? $lang->project->stageInfoConfirm : $lang->project->executionInfoConfirm;
  7. if($project->model == 'kanban') $title = $lang->project->kanbanInfoConfirm;
  8. $previousUrl = $this->createLink('project', !empty($copyProject->isTpl) ? 'createTemplate' : 'create', "project=$project->model&programID=0&copyProjectID=$copyProjectID&extra=copyType=previous,copyFrom={$copyFrom}&pageType=copy");
  9. /* 批量处理执行数据。 */
  10. foreach($executions as $id => $execution)
  11. {
  12. $execution->parentAttr = '';
  13. if(!empty($execution->parent) && isset($executions[$execution->parent]))
  14. {
  15. $executions[$id]->parentAttr = $executions[$execution->parent]->attribute;
  16. }
  17. $execution->method = zget($lang->execution->typeList, $execution->type);
  18. }
  19. $nameText = in_array($project->model, array('scrum', 'agileplus')) ? $lang->execution->name : $lang->stage->name;
  20. if($project->model == 'kanban') $nameText = $lang->project->kanban;
  21. $items['id'] = array('name' => 'id', 'label' => $lang->idAB, 'control' => 'hidden', 'hidden' => true);
  22. $items['parent'] = array('name' => 'parent', 'label' => $lang->execution->parent, 'control' => 'hidden', 'hidden' => true);
  23. $items['method'] = array('name' => 'method', 'label' => $lang->execution->method, 'control' => 'static', 'items' => $lang->execution->typeList, 'width' => '40px');
  24. $items['name'] = array('name' => 'name', 'label' => $nameText, 'control' => 'input', 'required' => true, 'width' => '240px');
  25. $items['PM'] = array('name' => 'PM', 'label' => $lang->project->PM, 'control' => 'picker', 'items' => $users, 'width' => '80px');
  26. $items['begin'] = array('name' => 'begin', 'label' => $lang->execution->begin, 'control' => 'date', 'required' => true, 'width' => '100px', 'hidden' => !empty($copyProject->isTpl));
  27. $items['end'] = array('name' => 'end', 'label' => $lang->execution->end, 'control' => 'date', 'required' => true, 'width' => '100px', 'hidden' => !empty($copyProject->isTpl));
  28. if(in_array($project->model, array('scrum', 'agileplus', 'kanban')))
  29. {
  30. $headerTips = !empty($copyProject->isTpl) ? $lang->project->executionInfoTipsAbbr : $lang->project->executionInfoTips;
  31. if($project->model == 'kanban') $headerTips = str_replace($lang->executionCommon, $lang->kanban->common, $lang->project->executionInfoTips);
  32. if(isset($config->setCode) && $config->setCode == 1)
  33. {
  34. $codeText = $project->model == 'kanban' ? str_replace($lang->executionCommon, $lang->kanban->common, $lang->execution->code) : $lang->execution->code;
  35. $items['code'] = array('name' => 'code', 'label' => $codeText, 'control' => 'input', 'required' => strpos(",{$config->execution->create->requiredFields},", ',code,') !== false, 'width' => '80px');
  36. }
  37. if($project->model != 'kanban') $items['lifetime'] = array('name' => 'lifetime', 'label' => $lang->execution->type, 'control' => 'picker', 'items' => $lang->execution->lifeTimeList, 'width' => '80px');
  38. $items['days'] = array('name' => 'days', 'label' => $lang->execution->days, 'control' => 'input', 'width' => '100px', 'hidden' => !empty($copyProject->isTpl));
  39. if($project->model != 'scrum') unset($items['method']);
  40. formBatchPanel
  41. (
  42. set::title($title),
  43. set::mode('edit'),
  44. on::change('[data-name="begin"]', "computeWorkDays($(e.target).attr('name'))"),
  45. on::change('[data-name="end"]', "computeWorkDays($(e.target).attr('name'))"),
  46. on::change('[data-name^="attribute"]', "changeType"),
  47. set::headingActionsClass('flex-auto justify-between w-11/12'),
  48. to::headingActions(div(setClass('text-sm text-secondary-500'), $headerTips)),
  49. set::submitBtnText($lang->project->completeCopy),
  50. set::actions(array('submit', array('text' => $lang->project->previous, 'class' => 'btn btn-wide', 'url' => $previousUrl))),
  51. set::data(array_values($executions)),
  52. set::onRenderRow(jsRaw('renderRowData')),
  53. set::items(array_values($items))
  54. );
  55. }
  56. else
  57. {
  58. jsVar('notCopyStage', $lang->project->notCopyStage);
  59. jsVar('productPairs', json_encode($oldProductPairs));
  60. jsVar('chosenProductStage', $lang->project->chosenProductStage);
  61. jsVar('isTpl', !empty($copyProject->isTpl));
  62. if(!empty($executionIdList))
  63. {
  64. $data = array();
  65. foreach($executionIdList as $productID => $stageIdList)
  66. {
  67. $index = 0;
  68. foreach($stageIdList as $stageID)
  69. {
  70. $execution = $executions[$stageID];
  71. $execution->productID = $productID;
  72. $execution->isFirst = $index == 0 ? 1 : 0;
  73. $data[] = $execution;
  74. $index++;
  75. }
  76. if(!empty($copyProject->isTpl)) break;
  77. }
  78. $typeList = $project->model == 'ipd' ? $lang->stage->ipdTypeList : $lang->stage->typeList;
  79. $items['percent'] = array('name' => 'percent', 'label' => $lang->programplan->percent, 'control' => 'input', 'width' => '80px', 'hidden' => empty($config->setPercent));
  80. $items['attribute'] = array('name' => 'attribute', 'label' => $lang->programplan->attribute, 'control' => 'picker', 'width' => '80px', 'items' => $typeList, 'hidden' => $project->model == 'ipd');
  81. $items['acl'] = array('name' => 'acl', 'label' => $lang->programplan->acl, 'control' => 'picker', 'width' => '80px', 'items' => $lang->execution->aclList);
  82. $items['milestone'] = array('name' => 'milestone', 'label' => $lang->programplan->milestone, 'control' => 'radioListInline', 'width' => '80px', 'items' => $lang->programplan->milestoneList);
  83. $actions = empty($copyProject->isTpl) && count($executionIdList) > 1 && $productID == key($executionIdList) ? '' : array('submit', array('text' => $lang->project->previous, 'class' => 'btn btn-wide', 'url' => $previousUrl));
  84. formBatchPanel
  85. (
  86. set::id('product' . $productID),
  87. set::title($title),
  88. set::mode('edit'),
  89. on::change('[data-name="begin"]', "computeWorkDays($(e.target).attr('name'))"),
  90. on::change('[data-name="end"]', "computeWorkDays($(e.target).attr('name'))"),
  91. on::change('[name^="attribute"]', "changeAttribute"),
  92. set::submitBtnText($lang->project->completeCopy),
  93. set::onRenderRow(jsRaw('renderRowData')),
  94. set::actions($actions),
  95. set::data($data),
  96. set::items(array_values($items))
  97. );
  98. }
  99. else
  100. {
  101. $actions = array('submit', array('text' => $lang->project->previous, 'class' => 'btn btn-wide', 'url' => $previousUrl));
  102. formBatchPanel
  103. (
  104. set::title($title),
  105. set::mode('edit'),
  106. set::actions($actions)
  107. );
  108. }
  109. }