5bf8da08f3e7c512de6bc3c9623eb911a7b91a13.svn-base 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. BemsWebApplication.ExecutionSchedule = function (params, viewInfo) {
  2. 'use strict';
  3. var viewModel = null, workOrderPopup = null, rejectExecutionPopup = null,
  4. isDisabledButtons = ko.observable(),
  5. isVisibleButtons = ko.observable(),
  6. isVisibleRejectButtons = ko.observable(), // 2016 06 16 hcLee
  7. isVisibleEditWorkOrderButton = ko.observable();
  8. function handleToolbarButtonVisible() {
  9. return viewModel.dataModel.WorkProgressId() === $Code.WorkProgress.WORK_PLAN;
  10. }
  11. function rejectWork() {
  12. rejectExecutionPopup.show();
  13. }
  14. function orderWork() {
  15. // 오늘 날짜
  16. /*var today = new Date();
  17. // 작업 예정일
  18. var StartWorkDate = viewModel.dataModel.StartWorkDate();
  19. // 오늘 날짜에 7일을 더함
  20. var temp = today.setDate(today.getDate() + 7);
  21. if (temp < StartWorkDate) {
  22. utils.toast.show('오늘(현재)을 기준으로 작업예정일이 7일 이내의 작업만 지시가 가능합니다.', 'error');
  23. return;
  24. }*/
  25. workOrderPopup.show();
  26. }
  27. function editWorkOrder() {
  28. workOrderPopup.show();
  29. }
  30. var options = {
  31. viewOptions: {
  32. },
  33. popupOptions: {
  34. isVisibleButtons: isVisibleButtons,
  35. isVisibleRejectButtons: isVisibleRejectButtons,
  36. isVisibleEditWorkOrderButton: isVisibleEditWorkOrderButton,
  37. getAddedToolbarItemsInPopup: function (e) {
  38. var hasnotPermission = e.hasnotModificationPermission;
  39. return [{
  40. location: 'after',
  41. widget: 'button',
  42. options: {
  43. text: $G('workOrder'),
  44. icon: 'add',
  45. type: 'success',
  46. visible: isVisibleButtons,
  47. disabled: hasnotPermission,
  48. clickAction: orderWork
  49. }
  50. }, {
  51. location: 'after',
  52. widget: 'button',
  53. options: {
  54. text: $G('reject'),
  55. icon: 'remove',
  56. type: 'danger',
  57. visible: isVisibleRejectButtons, // hcLee 2016 06 16
  58. disabled: hasnotPermission,
  59. clickAction: rejectWork
  60. }
  61. }, {
  62. location: 'after',
  63. widget: 'button',
  64. options: {
  65. text: $G('workOrderModification'),
  66. icon: 'edit',
  67. visible: isVisibleEditWorkOrderButton,
  68. disabled: hasnotPermission,
  69. clickAction: editWorkOrder
  70. }
  71. }
  72. ];
  73. }
  74. }
  75. };
  76. viewModel = BWA.CivilComplaint(params, viewInfo, options);
  77. viewModel.popup.isInnerCheckWorkType(true);
  78. rejectExecutionPopup = viewModel.rejectExecutionPopup = BWA.Popup.RejectExecutionPlan.create(viewModel);
  79. workOrderPopup = viewModel.workOrderPopup = BWA.Popup.WorkOrder.create(viewModel);
  80. return viewModel;
  81. };