starter.controller('ProcessCtrl', function ($scope, $state) { $scope.toman = function () { $state.go('process-manage'); } $scope.toapply = function () { $state.go('process-apply'); } }) .controller('ProcessManageCtrl', function ($scope) { }) .controller('ProcessApplyCtrl', function ($scope) { }) .controller('ProcessCreateCtrl', function ($scope, $stateParams, $state, $ionicSlideBoxDelegate, $ionicHistory, Process) { $scope.datatext = { leftbtn: [{ text: '取消', click: "cancel", params: "c" }, { text: '上一步', click: 'back' }], rightbtn: [{ text: '下一步', click: 'down' }, { text: '完成', click: 'ok' }] }; $scope.titleName = ['填写流程名称', '选择流程模板', '创建审批人步骤', '添加流程介绍']; $scope.leftIndex = 0; $scope.rightIndex = 0; $scope.activeIndex = 0; //下一步 $scope.down = function () { $ionicSlideBoxDelegate.next(); console.log($ionicSlideBoxDelegate.currentIndex()); $scope.activeIndex = $ionicSlideBoxDelegate.currentIndex(); if ($scope.activeIndex >= 1) { $scope.leftIndex = 1; $scope.rightIndex = 0; if ($scope.activeIndex == 3) { $scope.rightIndex = 1; } } else { $scope.leftIndex = 0; $scope.rightIndex = 1; } }; $scope.cancel = function (op) { $ionicHistory.goBack(); }; $scope.back = function () { if ($scope.activeIndex != 0) { $ionicSlideBoxDelegate.previous(); $scope.activeIndex = $ionicSlideBoxDelegate.currentIndex(); $scope.rightIndex = 0; if ($scope.activeIndex == 0) { $scope.leftIndex = 0; } } else { $ionicHistory.goBack(); } }; $scope.lockSlide = function () { $ionicSlideBoxDelegate.enableSlide(false); }; $scope.setitems = [{ id: 1, show: false }, { id: 2, show: false }, { id: 3, show: false }, { id: 4, show: false }, { id: 5, show: true }]; $scope.checkmoban = function (op) { var items = _.filter($scope.setitems, function (_item) { return _item.id == parseInt(op); }); if (!items[0].show) { items[0].show = true; } _.each($scope.setitems, function (_item) { if (_item.id != parseInt(op)) { _item.show = false; } }); }; $scope.toSetItem = function () { $state.go('process-setfielditem', { id: -1 }); }; }) .controller('ProcessSetFieldItemCtrl', function ($scope, $ionicHistory) { $scope.cancel = function () { $ionicHistory.goBack(); }; });