controllers.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. starter.controller('ProcessCtrl', function ($scope, $state) {
  2. $scope.toman = function () {
  3. $state.go('process-manage');
  4. }
  5. $scope.toapply = function () {
  6. $state.go('process-apply');
  7. }
  8. })
  9. .controller('ProcessManageCtrl', function ($scope) {
  10. })
  11. .controller('ProcessApplyCtrl', function ($scope) {
  12. })
  13. .controller('ProcessCreateCtrl', function ($scope, $stateParams, $state, $ionicSlideBoxDelegate, $ionicHistory, Process) {
  14. $scope.datatext = {
  15. leftbtn: [{
  16. text: '取消',
  17. click: "cancel",
  18. params: "c"
  19. }, {
  20. text: '上一步',
  21. click: 'back'
  22. }],
  23. rightbtn: [{
  24. text: '下一步',
  25. click: 'down'
  26. }, {
  27. text: '完成',
  28. click: 'ok'
  29. }]
  30. };
  31. $scope.titleName = ['填写流程名称', '选择流程模板', '创建审批人步骤', '添加流程介绍'];
  32. $scope.leftIndex = 0;
  33. $scope.rightIndex = 0;
  34. $scope.activeIndex = 0;
  35. //下一步
  36. $scope.down = function () {
  37. $ionicSlideBoxDelegate.next();
  38. console.log($ionicSlideBoxDelegate.currentIndex());
  39. $scope.activeIndex = $ionicSlideBoxDelegate.currentIndex();
  40. if ($scope.activeIndex >= 1) {
  41. $scope.leftIndex = 1;
  42. $scope.rightIndex = 0;
  43. if ($scope.activeIndex == 3) {
  44. $scope.rightIndex = 1;
  45. }
  46. } else {
  47. $scope.leftIndex = 0;
  48. $scope.rightIndex = 1;
  49. }
  50. };
  51. $scope.cancel = function (op) {
  52. $ionicHistory.goBack();
  53. };
  54. $scope.back = function () {
  55. if ($scope.activeIndex != 0) {
  56. $ionicSlideBoxDelegate.previous();
  57. $scope.activeIndex = $ionicSlideBoxDelegate.currentIndex();
  58. $scope.rightIndex = 0;
  59. if ($scope.activeIndex == 0) {
  60. $scope.leftIndex = 0;
  61. }
  62. } else {
  63. $ionicHistory.goBack();
  64. }
  65. };
  66. $scope.lockSlide = function () {
  67. $ionicSlideBoxDelegate.enableSlide(false);
  68. };
  69. $scope.setitems = [{
  70. id: 1,
  71. show: false
  72. }, {
  73. id: 2,
  74. show: false
  75. }, {
  76. id: 3,
  77. show: false
  78. }, {
  79. id: 4,
  80. show: false
  81. }, {
  82. id: 5,
  83. show: true
  84. }];
  85. $scope.checkmoban = function (op) {
  86. var items = _.filter($scope.setitems, function (_item) {
  87. return _item.id == parseInt(op);
  88. });
  89. if (!items[0].show) {
  90. items[0].show = true;
  91. }
  92. _.each($scope.setitems, function (_item) {
  93. if (_item.id != parseInt(op)) {
  94. _item.show = false;
  95. }
  96. });
  97. };
  98. $scope.toSetItem = function () {
  99. $state.go('process-setfielditem', {
  100. id: -1
  101. });
  102. };
  103. })
  104. .controller('ProcessSetFieldItemCtrl', function ($scope, $ionicHistory) {
  105. $scope.cancel = function () {
  106. $ionicHistory.goBack();
  107. };
  108. });