123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- 'use strict';
- /**
- * Config for the router
- */
- app.config(['$httpProvider', '$stateProvider', '$urlRouterProvider', '$controllerProvider', '$compileProvider', '$filterProvider', '$provide', '$ocLazyLoadProvider', 'JS_REQUIRES',
- function($httpProvider, $stateProvider, $urlRouterProvider, $controllerProvider, $compileProvider, $filterProvider, $provide, $ocLazyLoadProvider, jsRequires) {
- app.controller = $controllerProvider.register;
- app.directive = $compileProvider.directive;
- app.filter = $filterProvider.register;
- app.factory = $provide.factory;
- app.service = $provide.service;
- app.constant = $provide.constant;
- app.value = $provide.value;
- $ocLazyLoadProvider.config({
- debug: false,
- events: true,
- modules: jsRequires.modules
- });
- // setup an abstract state for the tabs directive
- $stateProvider.state('tab', {
- url: '/tab',
- abstract: true,
- resolve: loadSequence('mainCtrl'),
- templateUrl: 'assets/views/weChat/tabs.html',
- controller: 'mainCtrl'
- })
- .state('tab.index', {
- url: '/index',
- resolve: loadSequence('indexCtrl'),
- templateUrl: 'assets/views/weChat/tab-index.html',
- controller: 'indexCtrl'
- // views: {
- // 'tab-index': {
- // templateUrl: 'assets/views/weChat/tab-index.html',
- // controller: 'loginCtrl'
- // }
- // }
- })
- .state('tab.login', {
- url: '/login',
- resolve: loadSequence('loginCtrl'),
- templateUrl: 'assets/views/weChat/tab-login.html',
- controller: 'loginCtrl'
- })
- //
- .state('tab.chats', {
- url: '/chats',
- resolve: loadSequence('customformCtrl'),
- views: {
- 'tab-chats': {
- templateUrl: 'assets/views/weChat/customForm/customFormIndex.html',
- controller: 'CustomformCtrl'
- }
- }
- // resolve: loadSequence('aa'),
- // views: {
- // 'tab-chats': {
- // templateUrl: 'ionic/templates/tab-chats.html',
- // controller: 'aa'
- // }
- // }
- })
- //我的事件
- // .state('tab.myIncident', {
- // url: '/myIncident',
- // resolve: loadSequence('myIncidentCtrl'),
- // views: {
- // 'tab-myIncident': {
- // templateUrl: 'assets/views/weChat/myIncident/myIncident.html',
- // controller: 'myIncidentCtrl'
- // }
- // }
- // })
- //请求人列表
- .state('tab.myIncident', {
- url: '/myIncident',
- resolve: loadSequence('myIncidentCtrl'),
- templateUrl: 'assets/views/weChat/myIncident/myIncident.html',
- controller: 'myIncidentCtrl'
- })
- //请求人表单创建
- .state('tab.customFormIndex', {
- url: '/customFormIndex/{formKey}',
- templateUrl: "assets/views/weChat/customForm/customFormIndex.html",
- resolve: loadSequence('customFormIndexCtrl', 'ui.select', 'angularFileUpload'),
- pdKey: 'weChatApplyStart',
- // formKey: 'requestMobileEditor',
- controller: 'customFormIndexCtrl'
- })
- //请求人表单查看
- .state('tab.customFormDetail', {
- url: '/customFormDetail/{formKey}/{pdKey}/{dataId}/{taskId}/{processInstanceId}',
- resolve: loadSequence('customFormIndexCtrl', 'customFormDetailCtrl'),
- templateUrl: 'assets/views/weChat/customForm/customFormDetail.html',
- controller: 'customFormDetailCtrl'
- })
- //请求人满意的评价
- .state('tab.requesterDegree', {
- url: '/customFormIndex/{formKey}/{incidentid}',
- templateUrl: "assets/views/weChat/customForm/customFormIndex.html",
- resolve: loadSequence('customFormIndexCtrl', 'ui.select', 'angularFileUpload'),
- pdKey: 'weChatApplySave',
- // formKey: 'requestMobileEditor',
- controller: 'customFormIndexCtrl'
- })
- //处理人列表
- .state('tab.incidentHandler', {
- url: '/incidentHandler',
- resolve: loadSequence('incidentHandlerCtrl'),
- templateUrl: 'assets/views/weChat/myIncident/incidentHandler.html',
- controller: 'incidentHandlerCtrl'
- })
- //处理人表单查看
- .state('tab.incidentHandlerCustomFormDetail', {
- url: '/incidentHandlerCustomFormDetail/{formKey}/{pdKey}/{dataId}/{taskId}/{processInstanceId}',
- templateUrl: "assets/views/weChat/customForm/customFormDetail.html",
- resolve: loadSequence('customFormIndexCtrl', 'customFormDetailCtrl'),
- pdKey: 'bpm_incident',
- controller: 'customFormDetailCtrl'
- })
- //处理人表单操作
- .state('tab.incidentHandlerCustomFormIndex', {
- // url: '/incidentHandlerCustomFormIndex',
- // templateUrl: "assets/views/weChat/customForm/customFormIndex.html",
- // resolve: loadSequence('customFormIndexCtrl'),
- // pdKey: 'bpm_incident',
- resolve: loadSequence('customFormIndexCtrl', 'multi.select.tree', 'ui.select', 'angularFileUpload'),
- url: '/incidentHandlerCustomFormIndex/{taskId}/{processInstanceId}',
- templateUrl: "assets/views/weChat/customForm/customFormIndex.html",
- pdKey: 'bpm_incident',
- controller: 'customFormIndexCtrl'
- })
- //知识库
- .state('tab.myKnowledge', {
- url: '/myKnowledge',
- resolve: loadSequence('myKnowledgeCtrl'),
- templateUrl: 'assets/views/weChat/myKnowledge/myKnowledge.html',
- controller: 'myKnowledgeCtrl'
- })
- //知识库查看
- .state('tab.myKnowledgeDetail', {
- url: '/myKnowledgeDetail/{item}',
- resolve: loadSequence('myKnowledgeDetailCtrl'),
- templateUrl: 'assets/views/weChat/myKnowledge/myKnowledgeDetail.html',
- controller: 'myKnowledgeDetailCtrl'
- })
- //公告列表
- .state('tab.myNotice', {
- url: '/myNotice',
- resolve: loadSequence('myNoticeCtrl'),
- templateUrl: 'assets/views/weChat/myNotice/myNotice.html',
- controller: 'myNoticeCtrl'
- })
- //验证错误页面
- .state('err', {
- url: '/err',
- resolve: loadSequence('errorCtrl'),
- templateUrl: 'assets/views/weChat/err.html',
- controller: 'errorCtrl'
- })
- //测试
- .state('tab.aa', {
- url: '/aa',
- template: 'aa123',
- })
- $urlRouterProvider.otherwise('/tab/login');
- // Generates a resolve object previously configured in constant.JS_REQUIRES (config.constant.js)
- function loadSequence() {
- var _args = arguments;
- return {
- deps: ['$ocLazyLoad', '$q',
- function($ocLL, $q) {
- var promise = $q.when(1);
- for (var i = 0, len = _args.length; i < len; i++) {
- promise = promiseThen(_args[i]);
- }
- return promise;
- function promiseThen(_arg) {
- if (typeof _arg == 'function')
- return promise.then(_arg);
- else
- return promise.then(function() {
- var nowLoad = requiredData(_arg);
- if (!nowLoad)
- return $.error('Route resolve: Bad resource name [' + _arg + ']');
- return $ocLL.load(nowLoad);
- });
- }
- function requiredData(name) {
- if (jsRequires.modules)
- for (var m in jsRequires.modules)
- if (jsRequires.modules[m].name && jsRequires.modules[m].name === name)
- return jsRequires.modules[m];
- return jsRequires.scripts && jsRequires.scripts[name];
- }
- }
- ]
- };
- }
- }
- ]);
|