|
|
|
@ -13,6 +13,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
|
|
|
|
|
}]);
|
|
|
|
|
app.controller('managerListCtrl', ['$scope', '$http', '$filter','$uibModal', 'commonDialog', function ($scope, $http,$filter, $uibModal, commonDialog) {
|
|
|
|
|
$scope.search = {role:'111111111111'};
|
|
|
|
|
$scope.params = {};
|
|
|
|
|
$scope.listManagers = function () {
|
|
|
|
|
$http.get('/sys/manager_accounts').then(function (resp) {
|
|
|
|
|
$scope.managers = resp.data;
|
|
|
|
@ -26,6 +27,14 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
|
|
|
|
|
};
|
|
|
|
|
$scope.listOrgs();
|
|
|
|
|
}
|
|
|
|
|
$scope.loadOrgsChild= function (org_id) {
|
|
|
|
|
var params = angular.copy($scope.params);
|
|
|
|
|
params.org_id = org_id;
|
|
|
|
|
$http.get('/sys/orgs/orgChild',{params: params}).then(function (resp) {
|
|
|
|
|
$scope.orgs_child = resp.data;
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.listManagers();
|
|
|
|
@ -65,6 +74,32 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
|
|
|
|
|
}]);
|
|
|
|
|
app.controller('modifyManagerDialogCtrl', ['$scope', '$http', 'manager', function ($scope, $http, manager) {
|
|
|
|
|
$scope.manager = manager;
|
|
|
|
|
$scope.params = {};
|
|
|
|
|
$scope.loadOrgs = function () {
|
|
|
|
|
$http.get('/sys/orgs').then(function (resp) {
|
|
|
|
|
$scope.orgs = resp.data;
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
$scope.loadOrgs();
|
|
|
|
|
|
|
|
|
|
$scope.loadOrgsChild= function (org_id) {
|
|
|
|
|
$scope.is_org2 = 'not_is';
|
|
|
|
|
$scope.choose_org = org_id;
|
|
|
|
|
var params = angular.copy($scope.params);
|
|
|
|
|
params.org_id = org_id;
|
|
|
|
|
$http.get('/sys/orgs/orgChild',{params: params}).then(function (resp) {
|
|
|
|
|
$scope.orgs_child = resp.data;
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if(!$scope.manager.parent_org_id){
|
|
|
|
|
$scope.is_org2 = 'not_is'
|
|
|
|
|
}else {
|
|
|
|
|
$scope.manager.org_id2 = $scope.manager.org_id;
|
|
|
|
|
$scope.manager.org_id = $scope.manager.parent_org_id;
|
|
|
|
|
$scope.loadOrgsChild($scope.manager.org_id);
|
|
|
|
|
$scope.is_org2 = 'is';
|
|
|
|
|
};
|
|
|
|
|
$scope.modify = function () {
|
|
|
|
|
$scope.errmsg = null;
|
|
|
|
|
if($scope.manager.password && $scope.manager.password.length < 8){
|
|
|
|
@ -76,20 +111,30 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
|
|
|
|
|
// $scope.errmsg = 'The password needs to consist of 8-16 digits and letters !';
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
if($scope.manager.org_id2 != null && $scope.manager.org_id2 != 'null') {
|
|
|
|
|
$scope.manager.org_id = $scope.manager.org_id2;
|
|
|
|
|
}
|
|
|
|
|
$http.put('/sys/manager_accounts/' + manager.manager_id, $scope.manager).then(function () {
|
|
|
|
|
$scope.$close();
|
|
|
|
|
}, function (resp) {
|
|
|
|
|
$scope.errmsg = resp.data.message;
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
$scope.loadOrgs = function () {
|
|
|
|
|
$http.get('/sys/orgs').then(function (resp) {
|
|
|
|
|
$scope.orgs = resp.data;
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
$scope.loadOrgs();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.changeIsOrg2 = function (choose_org2) {
|
|
|
|
|
if($scope.choose_org != choose_org2){
|
|
|
|
|
$scope.is_org2 = 'is';
|
|
|
|
|
}else {
|
|
|
|
|
$scope.is_org2 = 'not_is'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}]);
|
|
|
|
|
app.controller('newManagerDialogCtrl', ['$scope', '$http', function ($scope, $http) {
|
|
|
|
|
$scope.params = {};
|
|
|
|
|
$scope.is_org2 = 'not_is';
|
|
|
|
|
$scope.save = function (form) {
|
|
|
|
|
$scope.errmsg = null;
|
|
|
|
|
if (form.$invalid) {
|
|
|
|
@ -109,6 +154,10 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
|
|
|
|
|
// $scope.errmsg = 'The password needs to consist of 8-16 digits and letters !';
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
if($scope.manager.org_id2 != "null") {
|
|
|
|
|
$scope.manager.org_id = $scope.manager.org_id2;
|
|
|
|
|
}
|
|
|
|
|
delete $scope.manager.org_id2;
|
|
|
|
|
$http.post('/sys/manager_accounts', $scope.manager).then(function () {
|
|
|
|
|
$scope.$close();
|
|
|
|
|
}, function (resp) {
|
|
|
|
@ -121,6 +170,24 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
$scope.loadOrgs();
|
|
|
|
|
|
|
|
|
|
$scope.loadOrgsChild= function (org_id) {
|
|
|
|
|
$scope.is_org2 = 'not_is';
|
|
|
|
|
$scope.choose_org = org_id;
|
|
|
|
|
var params = angular.copy($scope.params);
|
|
|
|
|
params.org_id = org_id;
|
|
|
|
|
$http.get('/sys/orgs/orgChild',{params: params}).then(function (resp) {
|
|
|
|
|
$scope.orgs_child = resp.data;
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
$scope.changeIsOrg2 = function (choose_org2) {
|
|
|
|
|
if($scope.choose_org != choose_org2){
|
|
|
|
|
$scope.is_org2 = 'is';
|
|
|
|
|
}else {
|
|
|
|
|
$scope.is_org2 = 'not_is'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}]);
|
|
|
|
|
app.filter('managersFilter', [function () {
|
|
|
|
|
return function (arr, filterObj) {
|
|
|
|
@ -128,7 +195,7 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) {
|
|
|
|
|
return arr;
|
|
|
|
|
}
|
|
|
|
|
return arr.filter(function (item) {
|
|
|
|
|
return (filterObj.username==null || item.username.indexOf(filterObj.username) >= 0) && (item.role & parseInt(filterObj.role, 2)) > 0 && (!filterObj.org_id || item.org_id==filterObj.org_id)
|
|
|
|
|
return (filterObj.username==null || item.username.indexOf(filterObj.username) >= 0) && (item.role & parseInt(filterObj.role, 2)) > 0 && (!filterObj.org_id || (item.org_id==filterObj.org_id))
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}]);
|
|
|
|
|