diff --git a/src/main/ui/static/config/sysconfigs/sysconfigs.js b/src/main/ui/static/config/sysconfigs/sysconfigs.js index 89c1c053d..a653673d8 100644 --- a/src/main/ui/static/config/sysconfigs/sysconfigs.js +++ b/src/main/ui/static/config/sysconfigs/sysconfigs.js @@ -448,6 +448,9 @@ define(['angular', 'uiRouter'], function (angular) { templateUrl: '/static/config/sysconfigs/templates/permissionPartner_module_dialog.html', controller: 'partnerModuleNewCtrl', resolve: { + moduleall: function () { + return $scope.modules; + }, module: function () { return {}; } @@ -496,17 +499,31 @@ define(['angular', 'uiRouter'], function (angular) { }) }; }]); - app.controller('partnerModuleNewCtrl', ['$scope', '$http', 'module', function ($scope, $http, module) { + app.controller('partnerModuleNewCtrl', ['$scope', '$http', 'module','moduleall','commonDialog', function ($scope, $http, module,moduleall,commonDialog) { + + + $scope.module = angular.copy(module); $scope.nameEditable = !module.module_name; $scope.module.initialize = true; $scope.save = function () { + var hasOne =0; $scope.errmsg = null; - $http.put('/sys/permissionPartner/modules/' + $scope.module.module_name + '.end', $scope.module).then(function () { - $scope.$close(); - }, function (resp) { - $scope.errmsg = resp.data.message; + angular.forEach(moduleall,function (data) { + if ($scope.module.module_name == data.module_name) { + commonDialog.alert({title: 'Error', content: "Module Has Exists", type: 'error'}) + hasOne=1 + return hasOne; + } }) + if (hasOne != 1) { + + $http.put('/sys/permissionPartner/modules/' + $scope.module.module_name + '.end', $scope.module).then(function () { + $scope.$close(); + }, function (resp) { + $scope.errmsg = resp.data.message; + }) + } }; }]);