aerationJobService.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. "use strict";
  2. angular.module('app.intelligent').service("aerationJobService", function($http, $q,$rootScope, APP_CONFIG) {
  3. //通风作业查询
  4. this.getPageInfo = function(pageNum, pageSize, aerationJob,cfmc) {
  5. var d = $q.defer();
  6. $http({
  7. method : 'GET',
  8. url : APP_CONFIG.qualitycheckUrl + '/intelligents/VentilationOperationController/getList',
  9. params : {
  10. pageNum : pageNum,
  11. pageSize : pageSize,
  12. cfbh : aerationJob==undefined?"":aerationJob.cfbh,
  13. createTime : aerationJob==undefined?"":aerationJob.createTime,
  14. funcType : aerationJob==undefined?"":aerationJob.funcType,
  15. cfmc : cfmc,
  16. orgId : $rootScope.userInfo.orgId
  17. }
  18. }).then(function successCallback(response) {
  19. // 请求成功执行代码
  20. d.resolve(response.data);
  21. }, function errorCallback(response) {
  22. // 请求失败执行代码
  23. d.reject("error");
  24. });
  25. return d.promise;
  26. }
  27. //通风详情查询
  28. this.edit = function(id) {
  29. var d = $q.defer();
  30. $http({
  31. method : 'POST',
  32. url : APP_CONFIG.qualitycheckUrl + '/intelligents/VentilationOperationController/getById',
  33. params : {
  34. id : id
  35. }
  36. }).then(function successCallback(response) {
  37. // 请求成功执行代码
  38. d.resolve(response.data);
  39. }, function errorCallback(response) {
  40. // 请求失败执行代码
  41. d.reject("error");
  42. });
  43. return d.promise;
  44. }
  45. //通风作业保存
  46. this.save = function(aerationJob) {
  47. var d = $q.defer();
  48. $http({
  49. method : 'POST',
  50. url : APP_CONFIG.qualitycheckUrl + '/intelligents/VentilationOperationController/save',
  51. data : {
  52. ventilationOperationJson : angular.toJson(aerationJob)
  53. }
  54. }).then(function successCallback(response) {
  55. // 请求成功执行代码
  56. d.resolve(response.data);
  57. }, function errorCallback(response) {
  58. // 请求失败执行代码
  59. d.reject("error");
  60. });
  61. return d.promise;
  62. }
  63. //删除
  64. this.remove = function(id) {
  65. var d = $q.defer();
  66. $http({
  67. method : 'POST',
  68. url : APP_CONFIG.qualitycheckUrl + '/intelligents/VentilationOperationController/deleteById',
  69. data : {
  70. id : id
  71. }
  72. }).then(function successCallback(response) {
  73. // 请求成功执行代码
  74. d.resolve(response.data);
  75. }, function errorCallback(response) {
  76. // 请求失败执行代码
  77. d.reject("error");
  78. });
  79. return d.promise;
  80. }
  81. });