config.router.js 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. 'use strict';
  2. /**
  3. * Config for the router
  4. */
  5. app.config(['$httpProvider', '$stateProvider', '$urlRouterProvider', '$controllerProvider', '$compileProvider', '$filterProvider', '$provide', '$ocLazyLoadProvider', 'JS_REQUIRES',
  6. function($httpProvider, $stateProvider, $urlRouterProvider, $controllerProvider, $compileProvider, $filterProvider, $provide, $ocLazyLoadProvider, jsRequires) {
  7. app.controller = $controllerProvider.register;
  8. app.directive = $compileProvider.directive;
  9. app.filter = $filterProvider.register;
  10. app.factory = $provide.factory;
  11. app.service = $provide.service;
  12. app.constant = $provide.constant;
  13. app.value = $provide.value;
  14. $ocLazyLoadProvider.config({
  15. debug: false,
  16. events: true,
  17. modules: jsRequires.modules
  18. });
  19. // setup an abstract state for the tabs directive
  20. $stateProvider.state('tab', {
  21. url: '/tab',
  22. abstract: true,
  23. resolve: loadSequence('mainCtrl'),
  24. templateUrl: 'assets/views/weChat/tabs.html',
  25. controller: 'mainCtrl'
  26. })
  27. .state('tab.index', {
  28. url: '/index',
  29. resolve: loadSequence('indexCtrl'),
  30. templateUrl: 'assets/views/weChat/tab-index.html',
  31. controller: 'indexCtrl'
  32. // views: {
  33. // 'tab-index': {
  34. // templateUrl: 'assets/views/weChat/tab-index.html',
  35. // controller: 'loginCtrl'
  36. // }
  37. // }
  38. })
  39. .state('tab.login', {
  40. url: '/login',
  41. resolve: loadSequence('loginCtrl'),
  42. templateUrl: 'assets/views/weChat/tab-login.html',
  43. controller: 'loginCtrl'
  44. })
  45. //
  46. .state('tab.chats', {
  47. url: '/chats',
  48. resolve: loadSequence('customformCtrl'),
  49. views: {
  50. 'tab-chats': {
  51. templateUrl: 'assets/views/weChat/customForm/customFormIndex.html',
  52. controller: 'CustomformCtrl'
  53. }
  54. }
  55. // resolve: loadSequence('aa'),
  56. // views: {
  57. // 'tab-chats': {
  58. // templateUrl: 'ionic/templates/tab-chats.html',
  59. // controller: 'aa'
  60. // }
  61. // }
  62. })
  63. //我的事件
  64. // .state('tab.myIncident', {
  65. // url: '/myIncident',
  66. // resolve: loadSequence('myIncidentCtrl'),
  67. // views: {
  68. // 'tab-myIncident': {
  69. // templateUrl: 'assets/views/weChat/myIncident/myIncident.html',
  70. // controller: 'myIncidentCtrl'
  71. // }
  72. // }
  73. // })
  74. //请求人列表
  75. .state('tab.myIncident', {
  76. url: '/myIncident',
  77. resolve: loadSequence('myIncidentCtrl'),
  78. templateUrl: 'assets/views/weChat/myIncident/myIncident.html',
  79. controller: 'myIncidentCtrl'
  80. })
  81. //请求人表单创建
  82. .state('tab.customFormIndex', {
  83. url: '/customFormIndex/{formKey}',
  84. templateUrl: "assets/views/weChat/customForm/customFormIndex.html",
  85. resolve: loadSequence('customFormIndexCtrl', 'ui.select', 'angularFileUpload'),
  86. pdKey: 'weChatApplyStart',
  87. // formKey: 'requestMobileEditor',
  88. controller: 'customFormIndexCtrl'
  89. })
  90. //请求人表单查看
  91. .state('tab.customFormDetail', {
  92. url: '/customFormDetail/{formKey}/{pdKey}/{dataId}/{taskId}/{processInstanceId}',
  93. resolve: loadSequence('customFormIndexCtrl', 'customFormDetailCtrl'),
  94. templateUrl: 'assets/views/weChat/customForm/customFormDetail.html',
  95. controller: 'customFormDetailCtrl'
  96. })
  97. //请求人满意的评价
  98. .state('tab.requesterDegree', {
  99. url: '/customFormIndex/{formKey}/{incidentid}',
  100. templateUrl: "assets/views/weChat/customForm/customFormIndex.html",
  101. resolve: loadSequence('customFormIndexCtrl', 'ui.select', 'angularFileUpload'),
  102. pdKey: 'weChatApplySave',
  103. // formKey: 'requestMobileEditor',
  104. controller: 'customFormIndexCtrl'
  105. })
  106. //处理人列表
  107. .state('tab.incidentHandler', {
  108. url: '/incidentHandler',
  109. resolve: loadSequence('incidentHandlerCtrl'),
  110. templateUrl: 'assets/views/weChat/myIncident/incidentHandler.html',
  111. controller: 'incidentHandlerCtrl'
  112. })
  113. //处理人表单查看
  114. .state('tab.incidentHandlerCustomFormDetail', {
  115. url: '/incidentHandlerCustomFormDetail/{formKey}/{pdKey}/{dataId}/{taskId}/{processInstanceId}',
  116. templateUrl: "assets/views/weChat/customForm/customFormDetail.html",
  117. resolve: loadSequence('customFormIndexCtrl', 'customFormDetailCtrl'),
  118. pdKey: 'bpm_incident',
  119. controller: 'customFormDetailCtrl'
  120. })
  121. //处理人表单操作
  122. .state('tab.incidentHandlerCustomFormIndex', {
  123. // url: '/incidentHandlerCustomFormIndex',
  124. // templateUrl: "assets/views/weChat/customForm/customFormIndex.html",
  125. // resolve: loadSequence('customFormIndexCtrl'),
  126. // pdKey: 'bpm_incident',
  127. resolve: loadSequence('customFormIndexCtrl', 'multi.select.tree', 'ui.select', 'angularFileUpload'),
  128. url: '/incidentHandlerCustomFormIndex/{taskId}/{processInstanceId}',
  129. templateUrl: "assets/views/weChat/customForm/customFormIndex.html",
  130. pdKey: 'bpm_incident',
  131. controller: 'customFormIndexCtrl'
  132. })
  133. //知识库
  134. .state('tab.myKnowledge', {
  135. url: '/myKnowledge',
  136. resolve: loadSequence('myKnowledgeCtrl'),
  137. templateUrl: 'assets/views/weChat/myKnowledge/myKnowledge.html',
  138. controller: 'myKnowledgeCtrl'
  139. })
  140. //知识库查看
  141. .state('tab.myKnowledgeDetail', {
  142. url: '/myKnowledgeDetail/{item}',
  143. resolve: loadSequence('myKnowledgeDetailCtrl'),
  144. templateUrl: 'assets/views/weChat/myKnowledge/myKnowledgeDetail.html',
  145. controller: 'myKnowledgeDetailCtrl'
  146. })
  147. //公告列表
  148. .state('tab.myNotice', {
  149. url: '/myNotice',
  150. resolve: loadSequence('myNoticeCtrl'),
  151. templateUrl: 'assets/views/weChat/myNotice/myNotice.html',
  152. controller: 'myNoticeCtrl'
  153. })
  154. //验证错误页面
  155. .state('err', {
  156. url: '/err',
  157. resolve: loadSequence('errorCtrl'),
  158. templateUrl: 'assets/views/weChat/err.html',
  159. controller: 'errorCtrl'
  160. })
  161. //测试
  162. .state('tab.aa', {
  163. url: '/aa',
  164. template: 'aa123',
  165. })
  166. $urlRouterProvider.otherwise('/tab/login');
  167. // Generates a resolve object previously configured in constant.JS_REQUIRES (config.constant.js)
  168. function loadSequence() {
  169. var _args = arguments;
  170. return {
  171. deps: ['$ocLazyLoad', '$q',
  172. function($ocLL, $q) {
  173. var promise = $q.when(1);
  174. for (var i = 0, len = _args.length; i < len; i++) {
  175. promise = promiseThen(_args[i]);
  176. }
  177. return promise;
  178. function promiseThen(_arg) {
  179. if (typeof _arg == 'function')
  180. return promise.then(_arg);
  181. else
  182. return promise.then(function() {
  183. var nowLoad = requiredData(_arg);
  184. if (!nowLoad)
  185. return $.error('Route resolve: Bad resource name [' + _arg + ']');
  186. return $ocLL.load(nowLoad);
  187. });
  188. }
  189. function requiredData(name) {
  190. if (jsRequires.modules)
  191. for (var m in jsRequires.modules)
  192. if (jsRequires.modules[m].name && jsRequires.modules[m].name === name)
  193. return jsRequires.modules[m];
  194. return jsRequires.scripts && jsRequires.scripts[name];
  195. }
  196. }
  197. ]
  198. };
  199. }
  200. }
  201. ]);