修改一级组织显示,账号管理增加二级组织筛选

master
yuan 7 years ago
parent 7cd41b90ee
commit d21d2210c6

@ -39,7 +39,7 @@ public interface OrgMapper {
void updateOrg(JSONObject org);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1")
@AdvanceSelect(addonWhereClause = "is_valid=1 AND parent_org_id is null")
List<JSONObject> listAllOrgs();
JSONObject findOrgByBDId(@Param("bd_id") int bd_id);

@ -17,7 +17,8 @@
username,role,m.is_valid,m.create_time,last_login,o.name org_name,
email,phone,wechat,
o.headimg,
o.nickname
o.nickname,
o.parent_org_id
FROM
sys_managers m
LEFT JOIN sys_org o ON o.org_id=m.org_id

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.OrgMapper">
<select id="listOrgs" resultType="com.alibaba.fastjson.JSONObject">
SELECT name,org_id,sort_no FROM sys_org WHERE is_valid=1
SELECT name,org_id,sort_no FROM sys_org WHERE is_valid=1 AND parent_org_id is null
<if test="type!=null">
and type=#{type}
</if>

@ -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))
})
}
}]);

@ -38,10 +38,18 @@
</div>
<div class="form-group" ng-if="'1'|withRole">
<select id="org-select" class="form-control" ng-model="search.org_id"
ng-options="org.org_id as org.name group by org.org_type for org in orgs">
ng-options="org.org_id as org.name group by org.org_type for org in orgs"
ng-change="loadOrgsChild(search.org_id)">
<option value="">All Organizations</option>
</select>
</div>
<div ng-if="((orgs_child.length > 1)&&( '1'|withRole))">
<select id="org-child-select" class="form-control" ng-model="search.org_id"
ng-options="org.org_id as org.name group by org.org_type for org in orgs_child">
<option value="">Sub Organizations</option>
</select>
</div>
<!--<div class="form-group" ng-if="'1'|withRole">
<label class="control-label" for="org-select">Organizations</label>
<select class="form-control" id="org-select" ng-model="search.org_id" ng-options="o.org_id as o.name for o in orgs">

@ -45,7 +45,7 @@
<input class="form-control" type="text" id="wechat-input" name="wechat"
ng-model="manager.wechat">
</div>
<div class="form-group">
<div class="form-group" ng-if="is_org2=='not_is'">
<label class="control-label">Roles</label>
<p class="checkbox-inline checkbox">
<label ng-if="('00001'|withRole)">
@ -86,13 +86,31 @@
</label>
</p>
</div>
<div class="form-group" ng-if="!currentUser.org_id && is_org2=='is'">
<label class="control-label">Roles</label>
<p class="checkbox checkbox-inline">
<label ng-if="!manager.admin && !manager.operator">
<input type="checkbox" ng-model="manager.bd" name="bd">BD User
</label>
</p>
</div>
<div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && !manager.sitemanager && orgs!=null">
<label class="control-label" for="org-select">Organization</label>
<select class="form-control" ng-model="manager.org_id" id="org-select"
ng-options="org.org_id as org.name for org in orgs">
ng-options="org.org_id as org.name for org in orgs"
ng-change="manager.org_id2 = 'null';loadOrgsChild(manager.org_id)">
<option value="">Global</option>
</select>
</div>
<div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && orgs_child.length > 1">
<label class="control-label" for="org-select">Sub Organization</label>
<select class="form-control" ng-model="manager.org_id2" id="org-child-select"
ng-options="org.org_id as org.name group by org.org_type for org in orgs_child"
ng-change="changeIsOrg2(manager.org_id2)">
<option value="">Choose</option>
</select>
</div>
</form>
</div>
</div>

@ -51,7 +51,7 @@
<input class="form-control" type="text" id="wechat-input" name="wechat"
ng-model="manager.wechat">
</div>
<div class="form-group" ng-if="!currentUser.org_id">
<div class="form-group" ng-if="!currentUser.org_id && is_org2=='not_is'">
<label class="control-label">Roles</label>
<p class="checkbox checkbox-inline">
<label ng-if="('00001'|withRole)">
@ -95,13 +95,33 @@
</label>
</p>
</div>
<div class="form-group" ng-if="!currentUser.org_id && is_org2=='is'">
<label class="control-label">Roles</label>
<p class="checkbox checkbox-inline">
<label ng-if="!manager.admin && !manager.operator">
<input type="checkbox" ng-model="manager.bd" name="bd">BD User
</label>
</p>
</div>
<div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && orgs != null">
<label class="control-label" for="org-select">Organization</label>
<select class="form-control" ng-model="manager.org_id" id="org-select"
ng-options="org.org_id as org.name for org in orgs">
ng-options="org.org_id as org.name for org in orgs"
ng-change="manager.org_id2 = 'null';loadOrgsChild(manager.org_id)">
<option value="">Global</option>
</select>
</div>
<div class="form-group" ng-if="('1'|withRole) && !manager.admin && !manager.operator && orgs_child.length > 1">
<label class="control-label" for="org-select">Sub Organization</label>
<select class="form-control" ng-model="manager.org_id2" id="org-child-select"
ng-options="org.org_id as org.name group by org.org_type for org in orgs_child"
ng-change="changeIsOrg2(manager.org_id2)">
<option value="">Choose</option>
</select>
</div>
</form>
</div>
</div>

Loading…
Cancel
Save