workassignsummary.html.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <style>
  2. .priWidth{width:30px !important;}
  3. <?php if($app->getClientLang() == 'zh-cn' || $app->getClientLang() == 'zh-tw'):?>
  4. .dateWidth{width:80px !important; padding: 8px !important;}
  5. .delayWidth{width:80px !important;}
  6. .estWidth{width:65px !important; padding: 8px !important}
  7. .taskConsumedWidth{width:85px !important;}
  8. .taskTotalWidth{width:65px !important; padding: 8px !important;}
  9. .projectConsumedWidth{width:80px !important; padding: 8px !important;}
  10. .userConsumedWidth{width:80px !important; padding: 8px !important;}
  11. <?php else:?>
  12. .dateWidth{width:110px !important; padding: 8px !important;}
  13. .delayWidth{width:80px !important;}
  14. .estWidth{width:80px !important; padding: 8px !important;}
  15. .taskConsumedWidth{width:110px !important;}
  16. .taskTotalWidth{width:80px !important; padding: 8px !important;}
  17. .projectConsumedWidth{width:120px !important; padding: 8px !important;}
  18. .userConsumedWidth{width:110px !important; padding: 8px !important;}
  19. <?php endif;?>
  20. </style>
  21. <div class='flex bg-canvas p-2 gap-3' id='conditions'>
  22. <div class='input-group w-1/4'>
  23. <span class='input-group-addon'><?php echo $lang->pivot->dept;?></span>
  24. <?php echo html::select('dept', $depts, $dept, "class='form-control chosen' onchange='changeParams()'");?>
  25. </div>
  26. <div class='input-group w-1/2'>
  27. <span class='input-group-addon'><?php echo $lang->pivot->taskAssignedDate;?></span>
  28. <div id='beginPicker' zui-create zui-create-datepicker="{defaultValue: '<?php echo $begin;?>', onChange: (e) => changeParams()}" ></div>
  29. <span class='input-group-addon'><?php echo $lang->pivot->to;?></span>
  30. <div id='endPicker' zui-create zui-create-datepicker="{defaultValue: '<?php echo $end;?>', onChange: (e) => changeParams()}"></div>
  31. </div>
  32. </div>
  33. <?php if(empty($userTasks)):?>
  34. <div class="cell bg-canvas">
  35. <div class="dtable-empty-tip">
  36. <p><span class="text-muted"><?php echo $lang->error->noData;?></span></p>
  37. </div>
  38. </div>
  39. <?php else:?>
  40. <?php global $config;?>
  41. <div class='cell'>
  42. <div class='panel rounded ring-0 bg-canvas'>
  43. <div class="panel-heading">
  44. <div class="panel-title"><?php echo $title;?></div>
  45. </div>
  46. <div class='panel-body pt-0'>
  47. <div class='table-responsive' data-ride='table'>
  48. <table class='table table-condensed table-striped table-bordered table-fixed' id="worksummary">
  49. <thead>
  50. <tr class='colhead text-center bg-canvas'>
  51. <th class="w-20 border"><?php echo $lang->task->assignedTo;?></th>
  52. <?php if($config->systemMode == 'ALM'):?>
  53. <th class="border <?php echo common::checkNotCN() ? 'w-28' : 'w-20';?>"><?php echo $lang->task->project;?></th>
  54. <?php endif;?>
  55. <th class="border <?php echo common::checkNotCN() ? 'w-28' : 'w-20';?>"><?php echo $lang->task->execution;?></th>
  56. <th class="border w-14"><?php echo $lang->task->id;?></th>
  57. <th class="border <?php echo common::checkNotCN() ? 'w-28' : 'w-20';?>"><?php echo $lang->task->name;?></th>
  58. <th class="border priWidth"><?php echo $lang->priAB;?></th>
  59. <th class="border dateWidth"><?php echo $lang->task->estStarted;?></th>
  60. <th class="border dateWidth"><?php echo $lang->task->realStarted;?></th>
  61. <th class="border dateWidth"><?php echo $lang->task->deadline;?></th>
  62. <th class="border dateWidth"><?php echo $lang->task->assignedDate;?></th>
  63. <th class="border delayWidth"><?php echo $lang->pivot->delay . '(' . $lang->pivot->day . ')';?></th>
  64. <th class="border estWidth"><?php echo $lang->task->estimate;?></th>
  65. <th class="border <?php echo common::checkNotCN() ? 'w-28' : 'w-24'?>"><?php echo $lang->pivot->taskConsumed;?></th>
  66. <th class="border taskTotalWidth"><?php echo $lang->pivot->taskTotal;?></th>
  67. <th class="border projectConsumedWidth"><?php echo $lang->pivot->executionConsumed;?></th>
  68. <th class="border userConsumedWidth"><?php echo $lang->pivot->userConsumed;?></th>
  69. </tr>
  70. </thead>
  71. <tbody>
  72. <?php $color = false;?>
  73. <?php $i = 0;?>
  74. <?php foreach($userTasks as $user => $projectTaskGroup):?>
  75. <?php if(!isset($users[$user])) continue;?>
  76. <?php
  77. $taskTotal = $totalConsumed = 0;
  78. $executionConsumed = array();
  79. foreach($projectTaskGroup as $executionTasks)
  80. {
  81. foreach($executionTasks as $tasks)
  82. {
  83. $taskTotal += count($tasks);
  84. foreach($tasks as $task)
  85. {
  86. if($task->isParent) continue;
  87. if(!isset($executionConsumed[$task->execution])) $executionConsumed[$task->execution] = 0;
  88. $executionConsumed[$task->execution] += $task->consumed;
  89. $totalConsumed += $task->consumed;
  90. }
  91. }
  92. }
  93. ?>
  94. <tr class="text-center">
  95. <td class="border w-user" rowspan="<?php echo $taskTotal;?>"><?php echo zget($users, $user);?></td>
  96. <?php $j = 0;?>
  97. <?php foreach($projectTaskGroup as $projectID => $executionTasks):?>
  98. <?php
  99. $projectTaskTotal = count($executionTasks, 1) - count($executionTasks);
  100. if($j != 0) echo "<tr class='text-center'>";
  101. $projectName = zget($projects, $projectID, '');
  102. ?>
  103. <?php if($config->systemMode == 'ALM'):?>
  104. <td class='border text-left' rowspan="<?php echo $projectTaskTotal;?>" title='<?php echo $projectName?>'><?php echo $projectName;?></td>
  105. <?php endif;?>
  106. <?php $g = 0;?>
  107. <?php foreach($executionTasks as $executionID => $tasks):?>
  108. <?php
  109. $executionTaskTotal = count($tasks);
  110. if($g != 0) echo "<tr class='text-center'>";
  111. $executionName = zget($executions, $executionID, '');
  112. ?>
  113. <td class='border text-left' rowspan="<?php echo $executionTaskTotal;?>" title='<?php echo $executionName?>'><?php echo $executionName;?></td>
  114. <?php $k = 0;?>
  115. <?php foreach($tasks as $task):?>
  116. <?php if($k != 0) echo "<tr class='text-center'>"?>
  117. <td class='border'><?php echo $task->id;?></td>
  118. <td class="border text-left" title="<?php echo $task->name;?>">
  119. <?php
  120. if($task->parent > 0) echo "[{$lang->task->childrenAB}] ";
  121. if($task->multiple) echo "[{$lang->task->multipleAB}] ";
  122. echo $task->name;
  123. ?>
  124. </td>
  125. <td class="border"><span class='<?php echo 'pri' . $task->pri?>'><?php echo $task->pri;?></span></td>
  126. <td class="border"><?php echo $task->estStarted;?></td>
  127. <td class="border"><?php echo substr($task->realStarted, 0, 10);?></td>
  128. <td class="border"><?php echo $task->deadline;?></td>
  129. <td class="border"><?php echo substr($task->assignedDate, 0, 10);?></td>
  130. <td class="border">
  131. <?php
  132. if(!helper::isZeroDate($task->deadline))
  133. {
  134. $deadline = strtotime($task->deadline);
  135. $targetDate = !helper::isZeroDate($task->finishedDate) ? strtotime(substr($task->finishedDate, 0, 10)) : strtotime(helper::today());
  136. $days = round(($targetDate - $deadline) / 3600 / 24);
  137. if($days > 0) echo $days;
  138. }
  139. ?>
  140. </td>
  141. <td class="border"><?php echo $task->estimate;?></td>
  142. <td class="border"><?php echo $task->consumed;?></td>
  143. <?php if($k == 0):?>
  144. <td class="border" rowspan="<?php echo $executionTaskTotal;?>"><?php echo $executionTaskTotal;?></td>
  145. <td class="border" rowspan="<?php echo $executionTaskTotal;?>"><?php echo zget($executionConsumed, $executionID, '');?></td>
  146. <?php endif;?>
  147. <?php if($j == 0):?>
  148. <td class="border" rowspan="<?php echo $taskTotal;?>"><?php echo $totalConsumed;?></td>
  149. <?php endif;?>
  150. </tr>
  151. <?php $i++; $j++; $k++; $g++;?>
  152. <?php endforeach;?>
  153. <?php endforeach;?>
  154. <?php endforeach;?>
  155. <?php endforeach;?>
  156. </tbody>
  157. </table>
  158. </div>
  159. </div>
  160. <div class='pull-right p-2 no-morph' id='pagerWorkAssignSummary' zui-create zui-create-pager="window.pagerWorkAssignSummaryOptions"></div>
  161. </div>
  162. </div>
  163. <?php endif;?>
  164. <script>
  165. function changeParams()
  166. {
  167. const beginPick = $('#beginPicker').zui();
  168. const endPick = $('#endPicker').zui();
  169. var dept = $('#conditions').find('#dept').val();
  170. var begin = beginPick.$.value;
  171. var end = endPick.$.value;
  172. if(begin.indexOf('-') != -1)
  173. {
  174. var beginarray = begin.split("-");
  175. var begin = '';
  176. for(i=0 ; i < beginarray.length ; i++)
  177. {
  178. begin = begin + beginarray[i];
  179. }
  180. }
  181. if(end.indexOf('-') != -1)
  182. {
  183. var endarray = end.split("-");
  184. var end = '';
  185. for(i=0 ; i < endarray.length ; i++)
  186. {
  187. end = end + endarray[i];
  188. }
  189. }
  190. var params = window.btoa('begin=' + begin + '&end=' + end + '&dept=' + dept);
  191. var link = $.createLink('pivot', 'preview', 'dimension=' + <?php echo $dimensionID?> + '&group=' + <?php echo $groupID;?> + '&method=workassignsummary&params=' + params);
  192. window.location.href = link;
  193. }
  194. function getLink(info)
  195. {
  196. const beginPick = $('#beginPicker').zui();
  197. const endPick = $('#endPicker').zui();
  198. var dept = $('#conditions').find('#dept').val();
  199. var begin = beginPick.$.value;
  200. var end = endPick.$.value;
  201. if(begin.indexOf('-') != -1)
  202. {
  203. var beginarray = begin.split("-");
  204. var begin = '';
  205. for(i=0 ; i < beginarray.length ; i++)
  206. {
  207. begin = begin + beginarray[i];
  208. }
  209. }
  210. if(end.indexOf('-') != -1)
  211. {
  212. var endarray = end.split("-");
  213. var end = '';
  214. for(i=0 ; i < endarray.length ; i++)
  215. {
  216. end = end + endarray[i];
  217. }
  218. }
  219. var params = window.btoa('begin=' + begin + '&end=' + end + '&dept=' + dept + '&recTotal=' + info.recTotal + '&recPerPage=' + info.recPerPage + '&pageID=' + info.page);
  220. return $.createLink('pivot', 'preview', 'dimension=' + <?php echo $dimensionID?> + '&group=' + <?php echo $groupID;?> + '&method=workassignsummary&params=' + params);
  221. }
  222. window.pagerWorkAssignSummaryOptions = {
  223. items: [
  224. {type: 'info', text: '<?php echo str_replace('<strong>{recTotal}</strong>', $pager->recTotal, $lang->pager->totalCount);?>'},
  225. {type: 'size-menu', text: '<?php echo str_replace('<strong>{recPerPage}</strong>', $pager->recPerPage , $lang->pager->pageSize);?>', dropdown: {placement: 'top'}},
  226. {type: 'link', page: 'first', icon: 'icon-first-page', hint: '<?php echo $lang->pager->firstPage;?>'},
  227. {type: 'link', page: 'prev', icon: 'icon-angle-left', hint: '<?php echo $lang->pager->previousPage;?>'},
  228. {type: 'info', text: '<?php echo $pager->pageID;?>/<?php echo $pager->pageTotal;?>'},
  229. {type: 'link', page: 'next', icon: 'icon-angle-right', hint: '<?php echo $lang->pager->nextPage;?>'},
  230. {type: 'link', page: 'last', icon: 'icon-last-page', hint: '<?php echo $lang->pager->lastPage;?>'},
  231. ],
  232. page: <?php echo $pager->pageID;?>,
  233. recTotal: <?php echo $pager->recTotal;?>,
  234. recPerPage: <?php echo $pager->recPerPage;?>,
  235. linkCreator: (info) => {return getLink(info);}
  236. };
  237. </script>