cancellationCtrl.js
1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
(function (angular) {
function cancellationCtrl($scope, $rootScope, $window, systemService, $uibModal, $state,SweetAlertX) {
$scope.loginUser = $rootScope.loginUser
console.log($scope.loginUser)
$scope.reasonList = [{'id':1,'text':'这是多余的账号'},{'id':2,'text':'暂不需要使用'},{'id':3,'text':'安全隐私考虑'}]
$scope.agreeRemind = false
$scope.next_two = false
$scope.selected = []
$scope.showDialog = function(){
$uibModal.open({
templateUrl: 'biz/system/view/cancellationRemind.html',
controller: 'cancellationRemindCtrl',
size: 'lg'
})
}
$scope.next = function(){
if($scope.next_two){
if($scope.selected.length == 0){
SweetAlertX.alert('请选择注销原因', '', 'info');
return
}
systemService.updateUserEnabledFlag({enabledFlag:'C'}, function(data) {
if (data.returnCode == '0') {
swal({type: 'success',title: '注销成功',text: '',showConfirmButton:true},function(){
$window.location.href = 'logout';
localStorageService.set('isLogout', true);
});
} else {
SweetAlertX.alert(data.message,'注销失败','error');
}
});
}else{
if(!$scope.agreeRemind){
SweetAlertX.alert('请阅读并同意勾选重要提醒', '', 'info');
}else{
$scope.next_two = true
}
}
}
$scope.changeReason = function(item){
console.log(item);
if(item.checked){
$scope.selected.push(item.id);
}else{
var idx = $scope.selected.indexOf(item.id);
$scope.selected.splice(idx, 1);
}
console.log($scope.selected)
}
}
angular.module('system').controller('cancellationCtrl', cancellationCtrl)
})(angular);