summaryDetailCtrl.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. "use strict";
  2. /**
  3. * controller for User Profile Example
  4. */
  5. app.controller("summaryDetailCtrl", [
  6. "$rootScope",
  7. "$scope",
  8. "$state",
  9. "$stateParams",
  10. "$timeout",
  11. "$interval",
  12. "$modal",
  13. "SweetAlert",
  14. "i18nService",
  15. "uiGridConstants",
  16. "uiGridGroupingConstants",
  17. "Restangular",
  18. "api_bpm_schedule",
  19. "api_bpm_data",
  20. "api_wechatfile",
  21. "api_configure_data",
  22. "moment",
  23. function (
  24. $rootScope,
  25. $scope,
  26. $state,
  27. $stateParams,
  28. $timeout,
  29. $interval,
  30. $modal,
  31. SweetAlert,
  32. i18nService,
  33. uiGridConstants,
  34. uiGridGroupingConstants,
  35. Restangular,
  36. api_bpm_schedule,
  37. api_bpm_data,
  38. api_wechatfile,
  39. api_configure_data,
  40. moment
  41. ) {
  42. $scope.langs = i18nService.getAllLangs();
  43. $scope.lang = "zh-cn";
  44. i18nService.setCurrentLang($scope.lang);
  45. // 获取信息
  46. $scope.consumableList = [];
  47. $scope.incidentDTO = {};
  48. $scope.workHourManagementList = [];
  49. $scope.totalMaintenancePrice = null;
  50. $scope.totalPriceConsumable = null;
  51. $scope.totalPriceWorkHourManagement = null;
  52. $scope.getInfo = function(){
  53. console.log($stateParams.incidentId);
  54. $rootScope.isMask = true;
  55. api_bpm_data.querySummaryDoc({"incidentId":$stateParams.incidentId}).then(
  56. function (data) {
  57. $rootScope.isMask = false;
  58. $scope.consumableList = data.consumableList || [];
  59. $scope.incidentDTO = data.incidentDTO || {};
  60. $scope.workHourManagementList = data.workHourManagementList || [];
  61. $scope.totalMaintenancePrice = data.totalMaintenancePrice;
  62. $scope.totalPriceConsumable = data.consumablePrice;
  63. $scope.totalPriceWorkHourManagement = data.workHourPrice;
  64. },
  65. function () {
  66. $rootScope.isMask = false;
  67. }
  68. );
  69. }
  70. $scope.getInfo();
  71. //返回列表
  72. $scope.goToList = function(){
  73. $state.go("app.incident.summary");
  74. }
  75. $scope.transferTime = function (time) {
  76. if(time){
  77. return moment(time).format('YYYY-MM-DD HH:mm');
  78. }else{
  79. return '';
  80. }
  81. }
  82. //查看事件
  83. $scope.goToIncident = function(){
  84. $state.go('app.incident.detail', {
  85. formKey: 'incident_back',
  86. pdKey: 'incident',
  87. dataId: $scope.incidentDTO.id,
  88. taskId: $scope.incidentDTO.taskId,
  89. processInstanceId: $scope.incidentDTO.processInstanceId
  90. });
  91. }
  92. // 撤销耗材
  93. $scope.removeHc = function(consumable){
  94. var modalInstance = $modal.open({
  95. templateUrl: "assets/views/delete.html",
  96. controller: function ($scope, $modalInstance) {
  97. $scope.title = "撤销";
  98. $scope.connect = "您确认要撤销此条耗材("+ consumable.consumableName + "【"+ consumable.consumablesNum +"】" +")的使用吗?";
  99. $scope.ok = function () {
  100. $modalInstance.close("start");
  101. };
  102. $scope.cancel = function () {
  103. $modalInstance.dismiss("cancel");
  104. };
  105. },
  106. size: "sm",
  107. });
  108. modalInstance.result.then(
  109. function (result) {
  110. if(result == 'start'){
  111. $rootScope.isMask = true;
  112. api_bpm_data.removeHc({
  113. summaryId: +$stateParams.id,
  114. remove: 'remove',
  115. consumableList: [
  116. {
  117. consumablesId: consumable.consumableId,
  118. consumablesNum: consumable.consumablesNum,
  119. }
  120. ]
  121. }).then(
  122. function (data) {
  123. $rootScope.isMask = false;
  124. $scope.getInfo();
  125. },
  126. function () {
  127. $rootScope.isMask = false;
  128. }
  129. );
  130. }
  131. },
  132. function () {}
  133. );
  134. }
  135. },
  136. ]);