config.router.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  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('login', {
  40. url: '/login',
  41. resolve: loadSequence('loginCtrl'),
  42. templateUrl: 'assets/views/weChat/tab-login.html',
  43. controller: 'loginCtrl',
  44. cache: false,
  45. })
  46. //
  47. .state('tab.chats', {
  48. url: '/chats',
  49. resolve: loadSequence('customformCtrl'),
  50. views: {
  51. 'tab-chats': {
  52. templateUrl: 'assets/views/weChat/customForm/customFormIndex.html',
  53. controller: 'CustomformCtrl'
  54. }
  55. }
  56. // resolve: loadSequence('aa'),
  57. // views: {
  58. // 'tab-chats': {
  59. // templateUrl: 'ionic/templates/tab-chats.html',
  60. // controller: 'aa'
  61. // }
  62. // }
  63. })
  64. //我的事件
  65. // .state('tab.myIncident', {
  66. // url: '/myIncident',
  67. // resolve: loadSequence('myIncidentCtrl'),
  68. // views: {
  69. // 'tab-myIncident': {
  70. // templateUrl: 'assets/views/weChat/myIncident/myIncident.html',
  71. // controller: 'myIncidentCtrl'
  72. // }
  73. // }
  74. // })
  75. //请求人列表
  76. .state('tab.myIncident', {
  77. url: '/myIncident',
  78. resolve: loadSequence('ngAside', 'myIncidentCtrl'),
  79. templateUrl: 'assets/views/weChat/myIncident/myIncident.html',
  80. controller: 'myIncidentCtrl'
  81. })
  82. //请求人详情
  83. .state('tab.myIncidentDetail', {
  84. url: '/myIncidentDetail/{item}',
  85. resolve: loadSequence('moment', 'angularMoment', 'Timeline', 'myIncidentDetailCtrl'),
  86. templateUrl: 'assets/views/weChat/myIncident/myIncidentDetail.html',
  87. controller: 'myIncidentDetailCtrl'
  88. })
  89. //请求人表单创建
  90. .state('tab.customFormIndex', {
  91. url: '/customFormIndex/{formKey}',
  92. templateUrl: "assets/views/weChat/customForm/customFormIndex.html",
  93. resolve: loadSequence( 'jilian', 'directnewscroll', 'ngAside', 'swiper', 'angularFileUpload', 'customFormIndexCtrl'),
  94. pdKey: 'weChatApplyStart',
  95. // formKey: 'requestMobileEditor',
  96. controller: 'customFormIndexCtrl'
  97. })
  98. //请求人表单查看
  99. .state('tab.customFormDetail', {
  100. url: '/customFormDetail/{formKey}/{pdKey}/{dataId}/{taskId}/{processInstanceId}',
  101. resolve: loadSequence('customFormIndexCtrl', 'customFormDetailCtrl'),
  102. templateUrl: 'assets/views/weChat/customForm/customFormDetail.html',
  103. controller: 'customFormDetailCtrl'
  104. })
  105. //请求人满意的评价
  106. .state('tab.requesterDegree', {
  107. url: '/customFormIndex/{formKey}/{incidentid}',
  108. templateUrl: "assets/views/weChat/customForm/customFormIndex.html",
  109. resolve: loadSequence('customFormIndexCtrl', 'ui.select', 'angularFileUpload'),
  110. pdKey: 'weChatApplySave',
  111. // formKey: 'requestMobileEditor',
  112. controller: 'customFormIndexCtrl'
  113. })
  114. //处理人列表
  115. .state('tab.incidentHandler', {
  116. url: '/incidentHandler',
  117. resolve: loadSequence('ngAside', 'incidentHandlerCtrl'),
  118. templateUrl: 'assets/views/weChat/myIncident/incidentHandler.html',
  119. controller: 'incidentHandlerCtrl'
  120. })
  121. //处理人表单查看
  122. .state('tab.incidentHandlerCustomFormDetail', {
  123. url: '/incidentHandlerCustomFormDetail/{formKey}/{pdKey}/{dataId}/{taskId}/{processInstanceId}',
  124. templateUrl: "assets/views/weChat/customForm/customFormDetail.html",
  125. resolve: loadSequence('customFormIndexCtrl', 'moment', 'angularMoment', 'Timeline', 'customFormDetailCtrl'),
  126. pdKey: 'bpm_incident',
  127. controller: 'customFormDetailCtrl'
  128. })
  129. //处理人表单操作
  130. .state('tab.incidentHandlerCustomFormIndex', {
  131. // url: '/incidentHandlerCustomFormIndex',
  132. // templateUrl: "assets/views/weChat/customForm/customFormIndex.html",
  133. // resolve: loadSequence('customFormIndexCtrl'),
  134. // pdKey: 'bpm_incident',
  135. resolve: loadSequence('customFormIndexCtrl', 'multi.select.tree', 'ionicclose', 'uiSwitch', 'groupzhipai', 'knowfenlei', 'renyuan', 'fenlei', 'jilian', 'directnewscroll', 'ngAside', 'swiper', 'angularFileUpload', 'ui.select'),
  136. url: '/incidentHandlerCustomFormIndex/{taskId}/{processInstanceId}',
  137. templateUrl: "assets/views/weChat/customForm/customFormIndex.html",
  138. pdKey: 'bpm_incident',
  139. controller: 'customFormIndexCtrl'
  140. })
  141. //处理人建单
  142. .state('tab.incidentHandlerNew', {
  143. url: '/incidentHandlerNew',
  144. resolve: loadSequence('customFormIndexCtrl', 'multi.select.tree', 'ionicclose', 'renyuan', 'fenlei', 'jilian', 'directnewscroll', 'ngAside', 'swiper', 'angularFileUpload', 'ui.select', 'angularFileUpload'),
  145. templateUrl: "assets/views/weChat/customForm/customFormIndex.html",
  146. pdKey: 'bpm_incident',
  147. controller: 'customFormIndexCtrl'
  148. })
  149. //知识库
  150. .state('tab.myKnowledge', {
  151. url: '/myKnowledge',
  152. resolve: loadSequence('myKnowledgeCtrl'),
  153. templateUrl: 'assets/views/weChat/myKnowledge/myKnowledge.html',
  154. controller: 'myKnowledgeCtrl'
  155. })
  156. //知识库查看
  157. .state('tab.myKnowledgeDetail', {
  158. url: '/myKnowledgeDetail/{item}',
  159. resolve: loadSequence('myKnowledgeDetailCtrl'),
  160. templateUrl: 'assets/views/weChat/myKnowledge/myKnowledgeDetail.html',
  161. controller: 'myKnowledgeDetailCtrl'
  162. })
  163. //知识库评论
  164. // .state('myKnowledge', {
  165. // abstract: true,
  166. // url: '/myKnowledge',
  167. // // resolve: loadSequence('myKnowledgeDetailCtrl'),
  168. // templateUrl: 'assets/views/weChat/myKnowledge/myKnowledgeTab.html',
  169. // // controller: 'myKnowledgeDetailCtrl'
  170. // })
  171. //知识库评论列表
  172. // .state('tab.myKnowledgeList', {
  173. // url: '/myKnowledgeList',
  174. // resolve: loadSequence('myKnowledgeListCtrl'),
  175. // templateUrl: 'assets/views/weChat/myKnowledge/myKnowledgeList.html',
  176. // controller: 'myKnowledgeListCtrl'
  177. // })
  178. //知识库评论列表
  179. .state('tab.myKnowledgeList', {
  180. url: '/myKnowledgeList/{item}',
  181. resolve: loadSequence('myKnowledgeListCtrl'),
  182. templateUrl: 'assets/views/weChat/myKnowledge/myKnowledgeList.html',
  183. controller: 'myKnowledgeListCtrl'
  184. })
  185. //知识库评论提交
  186. .state('tab.myKnowledgeComment', {
  187. url: '/myKnowledgeComment/{item}',
  188. resolve: loadSequence('ionic-ratings', 'myKnowledgeCommentCtrl'),
  189. templateUrl: 'assets/views/weChat/myKnowledge/myKnowledgeComment.html',
  190. controller: 'myKnowledgeCommentCtrl'
  191. })
  192. //知识库评论提交
  193. // .state('myKnowledge.comment', {
  194. // url: '/myKnowledge/comment',
  195. // resolve: loadSequence('customFormIndexCtrl', 'ui.select', 'angularFileUpload'),
  196. // templateUrl: "assets/views/weChat/customForm/customFormIndex.html",
  197. // controller: 'customFormIndexCtrl'
  198. // })
  199. //公告列表
  200. .state('tab.myNotice', {
  201. url: '/myNotice',
  202. resolve: loadSequence('myNoticeCtrl'),
  203. templateUrl: 'assets/views/weChat/myNotice/myNotice.html',
  204. controller: 'myNoticeCtrl'
  205. })
  206. //公告详情
  207. .state('tab.myNoticeDetail', {
  208. url: '/myNoticeDetail/{item}',
  209. resolve: loadSequence('myNoticeDetailCtrl'),
  210. templateUrl: 'assets/views/weChat/myNotice/myNoticeDetail.html',
  211. controller: 'myNoticeDetailCtrl'
  212. })
  213. //巡检列表
  214. .state('tab.inspect', {
  215. url: '/inspect',
  216. resolve: loadSequence('ngAside', 'inspectCtrl'),
  217. templateUrl: 'assets/views/weChat/inspect/inspect.html',
  218. controller: 'inspectCtrl'
  219. })
  220. //巡检编辑
  221. .state('tab.reServiceCustomFormIndex', {
  222. url: '/reServiceCustomFormIndex/{pdKey}/{taskId}/{processInstanceId}/{formUiEdit}',
  223. templateUrl: "assets/views/weChat/customForm/customFormIndex.html",
  224. resolve: loadSequence('customFormIndexCtrl', 'uiSwitch', 'ui.select', 'angularFileUpload'),
  225. pdKey: 'weChatApplyStart',
  226. // formKey: 'requestMobileEditor',
  227. controller: 'customFormIndexCtrl'
  228. })
  229. //巡检查看
  230. .state('tab.reServiceCustomFormDetail', {
  231. url: '/reServiceCustomFormDetail/{pdKey}/{taskId}/{processInstanceId}/{formKey}',
  232. resolve: loadSequence('customFormIndexCtrl', 'uiSwitch', 'customFormDetailCtrl'),
  233. templateUrl: 'assets/views/weChat/customForm/customFormDetail.html',
  234. controller: 'customFormDetailCtrl'
  235. })
  236. //仪表盘
  237. .state('tab.handlerDashboard', {
  238. url: '/handlerDashboard',
  239. resolve: loadSequence('handlerDashboardCtrl'),
  240. templateUrl: 'assets/views/weChat/dashboard/handlerDashboard.html',
  241. controller: 'handlerDashboardCtrl'
  242. })
  243. .state('tab.requesterDashboard', {
  244. url: '/requesterDashboard',
  245. resolve: loadSequence('moment', 'angularMoment', 'requesterDashboardCtrl'),
  246. templateUrl: 'assets/views/weChat/dashboard/requesterDashboard.html',
  247. controller: 'requesterDashboardCtrl'
  248. })
  249. //服务指南
  250. .state('tab.serviceInformation', {
  251. url: '/serviceInformation',
  252. resolve: loadSequence('serviceInformationCtrl'),
  253. templateUrl: 'assets/views/weChat/myServiceInformation/serviceInformation.html',
  254. controller: 'serviceInformationCtrl'
  255. })
  256. //验证错误页面
  257. .state('err', {
  258. url: '/err',
  259. resolve: loadSequence('errorCtrl'),
  260. templateUrl: 'assets/views/weChat/err.html',
  261. controller: 'errorCtrl'
  262. })
  263. //测试
  264. .state('tab.aa', {
  265. url: '/aa',
  266. template: 'aa123',
  267. })
  268. $urlRouterProvider.otherwise('/login');
  269. // Generates a resolve object previously configured in constant.JS_REQUIRES (config.constant.js)
  270. function loadSequence() {
  271. var _args = arguments;
  272. return {
  273. deps: ['$ocLazyLoad', '$q',
  274. function($ocLL, $q) {
  275. var promise = $q.when(1);
  276. for (var i = 0, len = _args.length; i < len; i++) {
  277. promise = promiseThen(_args[i]);
  278. }
  279. return promise;
  280. function promiseThen(_arg) {
  281. if (typeof _arg == 'function')
  282. return promise.then(_arg);
  283. else
  284. return promise.then(function() {
  285. var nowLoad = requiredData(_arg);
  286. if (!nowLoad)
  287. return $.error('Route resolve: Bad resource name [' + _arg + ']');
  288. return $ocLL.load(nowLoad);
  289. });
  290. }
  291. function requiredData(name) {
  292. if (jsRequires.modules)
  293. for (var m in jsRequires.modules)
  294. if (jsRequires.modules[m].name && jsRequires.modules[m].name === name)
  295. return jsRequires.modules[m];
  296. return jsRequires.scripts && jsRequires.scripts[name];
  297. }
  298. }
  299. ]
  300. };
  301. }
  302. }
  303. ]);