613 lines
26 KiB
613 lines
26 KiB
/**
|
|
* Created by yixian on 2017-01-07.
|
|
*/
|
|
define(['angular', 'uiRouter'], function (angular) {
|
|
'use strict';
|
|
var app = angular.module('sysconfig', ['ui.router']);
|
|
app.config(['$stateProvider', function ($stateProvider) {
|
|
$stateProvider.state('sysconfig', {
|
|
url: '/sysconfig',
|
|
templateUrl: '/static/config/sysconfigs/templates/sysconfig.html',
|
|
controller: 'sysConfigCtrl'
|
|
}).state('sysconfig.basic_config', {
|
|
url: '/basic',
|
|
templateUrl: '/static/config/sysconfigs/templates/basic.html',
|
|
controller: 'basicConfigCtrl'
|
|
}).state('permission', {
|
|
url: '/permission',
|
|
templateUrl: '/static/config/sysconfigs/templates/permission_config.html',
|
|
controller: 'permissionConfigRootCtrl'
|
|
}).state('permission.functions', {
|
|
url: '/functions',
|
|
templateUrl: '/static/config/sysconfigs/templates/permission_functions.html',
|
|
controller: 'permissionFuncCtrl'
|
|
}).state('permission.modules', {
|
|
url: '/modules',
|
|
templateUrl: '/static/config/sysconfigs/templates/permission_modules.html',
|
|
controller: 'permissionModuleCtrl',
|
|
resolve: {
|
|
modules: ['$http', function ($http) {
|
|
return $http.get('/sys/permission/modules')
|
|
}]
|
|
}
|
|
}).state('sysconfig.mail_subscribe', {
|
|
url: '/mail',
|
|
templateUrl: '/static/config/sysconfigs/templates/mail_subscribe.html',
|
|
controller: 'mailSubscribeCtrl'
|
|
}).state('servantsConfig', {
|
|
url: '/servantsConfig',
|
|
templateUrl: '/static/config/sysconfigs/templates/servants_config.html',
|
|
controller: 'servantsConfigCtrl'
|
|
})/*.state('sysconfig.payment_config',{
|
|
url: '/payment_config',
|
|
templateUrl: '/static/config/sysconfigs/templates/payemnt_config.html',
|
|
controller: 'paymentConfigCtrl'
|
|
})*/
|
|
.state('sysconfig.permissionPartner', {
|
|
url: '/permissionPartner',
|
|
templateUrl: '/static/config/sysconfigs/templates/permissionPartner_config.html',
|
|
controller: 'permissionPartnerConfigRootCtrl'
|
|
}).state('sysconfig.permissionPartner.functions', {
|
|
url: '/partnerFunctions',
|
|
templateUrl: '/static/config/sysconfigs/templates/permissionPartner_functions.html',
|
|
controller: 'permissionPartnerFuncCtrl'
|
|
}).state('sysconfig.permissionPartner.modules', {
|
|
url: '/partnerModules',
|
|
templateUrl: '/static/config/sysconfigs/templates/permissionPartner_modules.html',
|
|
controller: 'permissionPartnerModuleCtrl',
|
|
resolve: {
|
|
modules: ['$http', function ($http) {
|
|
return $http.get('/sys/permissionPartner/modules')
|
|
}]
|
|
}
|
|
})
|
|
}]);
|
|
app.controller('sysConfigCtrl', ['$scope', function ($scope) {
|
|
|
|
}]);
|
|
|
|
app.controller('servantsConfigCtrl', ['$scope','$http','commonDialog', function ($scope,$http,commonDialog) {
|
|
$scope.ctrl={};
|
|
$scope.loadServants = function () {
|
|
$http.get('/sys/manager_accounts/roles/servant').then(function (resp) {
|
|
$scope.servants = resp.data;
|
|
})
|
|
};
|
|
$scope.loadServants();
|
|
$scope.onoff = function (servant) {
|
|
var param = {onoff:servant.onoff};
|
|
$http.put('/sys/openim/servant/'+servant.manager_id+'/onoff',param).then(function (resp) {
|
|
if(!servant.password){
|
|
$scope.loadServants();
|
|
}
|
|
},function (resp) {
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
});
|
|
};
|
|
|
|
$scope.changeNick = function (servant) {
|
|
var param = {nick:servant.nick};
|
|
$http.put('/sys/openim/servant/'+servant.manager_id+'/nick',param).then(function (resp) {
|
|
$scope.ctrl.nick[servant.display_name] = false;
|
|
if(!servant.password){
|
|
$scope.loadServants();
|
|
}
|
|
},function (resp) {
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'});
|
|
});
|
|
};
|
|
}]);
|
|
|
|
|
|
|
|
app.controller('basicConfigCtrl', ['$scope', '$http', 'commonDialog', function ($scope, $http, commonDialog) {
|
|
$scope.loadSysConfigs = function () {
|
|
$http.get('/sysconfig/base').then(function (resp) {
|
|
$scope.sysconfig = resp.data;
|
|
$scope.sysconfig.refund_audit = resp.data.refund_audit=='true';
|
|
$scope.sysconfig.app_update = resp.data.app_update=='true';
|
|
$scope.sysconfig.android_update = resp.data.android_update=='true';
|
|
})
|
|
};
|
|
$scope.loadSysConfigs();
|
|
$scope.saveProperties = function () {
|
|
$http.put('/sysconfig/base', $scope.sysconfig).then(function () {
|
|
commonDialog.alert({title: 'Success', content: 'Properties updated.', type: 'success'})
|
|
}, function (resp) {
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
})
|
|
}
|
|
}]);
|
|
|
|
app.controller('permissionConfigRootCtrl', ['$scope', '$filter', '$http', '$uibModal','commonDialog', function ($scope, $filter, $http, $uibModal,commonDialog) {
|
|
/*$scope.authorizeRole = function (roleMask) {
|
|
$uibModal.open({
|
|
templateUrl: '/static/config/sysconfigs/templates/permission_authorize_dialog.html',
|
|
controller: 'permissionAuthorizeDialogCtrl',
|
|
size: 'lg',
|
|
resolve: {
|
|
authorized: ['$http', function ($http) {
|
|
return $http.get('/sys/permission/roles/' + roleMask + '/functions');
|
|
}],
|
|
modules: ['$http', function ($http) {
|
|
return $http.get('/sys/permission/functions');
|
|
}],
|
|
role: function () {
|
|
return roleMask
|
|
}
|
|
}
|
|
});
|
|
};*/
|
|
$scope.role = 1;
|
|
var roleParam = angular.copy($scope.role);
|
|
$scope.authorizeRole = function (roleMask) {
|
|
$scope.role = roleMask;
|
|
$http.get('/sys/permission/functions').then(function (resp) {
|
|
$scope.modules = resp.data;
|
|
});
|
|
$http.get('/sys/permission/roles/' + roleMask + '/functions').then(function (resp) {
|
|
$scope.authorized = resp.data;
|
|
});
|
|
};
|
|
$scope.submitAuthorize = function () {
|
|
commonDialog.confirm({
|
|
title: '修改角色接口权限',
|
|
content: '你确定修改当前角色接口权限吗?'
|
|
}).then(function () {
|
|
$http.put('/sys/permission/roles/' + $scope.role + '/functions', $scope.authorized).then(function () {
|
|
commonDialog.alert({title: 'Success', content: '修改成功.', type: 'success'})
|
|
}, function (resp) {
|
|
commonDialog.alert({type: 'error', title: 'Error', content: resp.data.message})
|
|
})
|
|
})
|
|
|
|
};
|
|
$scope.toggleAuthorize = function (func) {
|
|
var idx = $scope.authorized.indexOf(func.func_id);
|
|
if (idx >= 0) {
|
|
$scope.authorized.splice(idx, 1);
|
|
} else {
|
|
$scope.authorized.push(func.func_id);
|
|
}
|
|
};
|
|
$scope.moduleName = 'actChairty';
|
|
$scope.filterAuthorized = function (module) {
|
|
return module.module_name === $scope.moduleName;
|
|
};
|
|
$scope.switchModule = function (moduleName) {
|
|
$scope.moduleName = moduleName;
|
|
};
|
|
$scope.authorizeRole(roleParam);
|
|
}]);
|
|
app.controller('permissionAuthorizeDialogCtrl', ['$scope', '$http', 'authorized', 'modules', 'role',
|
|
function ($scope, $http, authorized, modules, role) {
|
|
$scope.authorized = authorized.data;
|
|
$scope.modules = modules.data;
|
|
$scope.submitAuthorize = function () {
|
|
$scope.errmsg = null;
|
|
$http.put('/sys/permission/roles/' + role + '/functions', $scope.authorized).then(function () {
|
|
$scope.$close();
|
|
}, function (resp) {
|
|
$scope.errmsg = resp.data.message;
|
|
})
|
|
};
|
|
$scope.toggleAuthorize = function (func) {
|
|
var idx = $scope.authorized.indexOf(func.func_id);
|
|
if (idx >= 0) {
|
|
$scope.authorized.splice(idx, 1);
|
|
} else {
|
|
$scope.authorized.push(func.func_id);
|
|
}
|
|
}
|
|
}]
|
|
);
|
|
app.controller('permissionFuncCtrl', ['$scope', '$http', '$state', '$uibModal', 'commonDialog',
|
|
function ($scope, $http, $state, $uibModal, commonDialog) {
|
|
$scope.loadFunctions = function () {
|
|
$http.get('/sys/permission/functions').then(function (functions) {
|
|
$scope.modFunctions = functions.data;
|
|
})
|
|
};
|
|
$scope.loadFunctions();
|
|
|
|
$scope.loadModules = function () {
|
|
$http.get('/sys/permission/modules').then(function (modules) {
|
|
$scope.modules = modules.data;
|
|
})
|
|
};
|
|
|
|
$scope.loadModules();
|
|
|
|
|
|
$scope.syncFunctions = function () {
|
|
$http.post('/sys/permission/synchronize').then(function () {
|
|
$scope.loadFunctions();
|
|
})
|
|
};
|
|
$scope.moveFunction = function (func) {
|
|
$uibModal.open({
|
|
templateUrl: '/static/config/sysconfigs/templates/permission_choose_module.html',
|
|
controller: 'permissionChooseModuleDialogCtrl',
|
|
resolve: {
|
|
modules: function () {
|
|
return $scope.modules;
|
|
}
|
|
}
|
|
}).result.then(function (modName) {
|
|
$http.put('/sys/permission/functions/' + func.func_id + '/modules', {module_name: modName}).then(function () {
|
|
$scope.loadFunctions();
|
|
}, function (resp) {
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
})
|
|
})
|
|
};
|
|
$scope.editFunctionInfo = function (func) {
|
|
$uibModal.open({
|
|
templateUrl: '/static/config/sysconfigs/templates/func_info_edit.html',
|
|
controller: 'permissionFuncEditDialogCtrl',
|
|
resolve: {
|
|
func: function () {
|
|
return angular.copy(func);
|
|
}
|
|
}
|
|
}).result.then(function () {
|
|
$scope.loadFunctions();
|
|
})
|
|
};
|
|
$scope.tabModuleName = 'no_module';
|
|
$scope.moduleTab = function(moduleName) {
|
|
$scope.tabModuleName = moduleName;
|
|
};
|
|
$scope.filterModFunctions = function (module) {
|
|
return module.module_name === $scope.tabModuleName;
|
|
};
|
|
}]
|
|
);
|
|
app.controller('permissionChooseModuleDialogCtrl', ['$scope', '$http', 'modules', function ($scope, $http, modules) {
|
|
$scope.modules = modules;
|
|
$scope.chooseModule = function (mod) {
|
|
$scope.$close(mod.module_name);
|
|
}
|
|
}]);
|
|
app.controller('permissionFuncEditDialogCtrl', ['$scope', '$http', 'func', function ($scope, $http, func) {
|
|
$scope.func = func;
|
|
$scope.modifyFunction = function () {
|
|
$scope.errmsg = null;
|
|
$http.put('/sys/permission/functions/' + func.func_id + '.end', $scope.func).then(function () {
|
|
$scope.$close();
|
|
}, function (resp) {
|
|
$scope.errmsg = resp.data.message;
|
|
})
|
|
};
|
|
}]);
|
|
app.controller('permissionModuleCtrl', ['$scope', '$http', '$state', '$uibModal', 'commonDialog', 'modules',
|
|
function ($scope, $http, $state, $uibModal, commonDialog, modules) {
|
|
$scope.modules = modules.data;
|
|
$scope.newModule = function () {
|
|
$uibModal.open({
|
|
templateUrl: '/static/config/sysconfigs/templates/permission_module_dialog.html',
|
|
controller: 'moduleNewCtrl',
|
|
resolve: {
|
|
module: function () {
|
|
return {};
|
|
}
|
|
}
|
|
}).result.then(function () {
|
|
$state.reload();
|
|
})
|
|
};
|
|
$scope.editModule = function (mod) {
|
|
$uibModal.open({
|
|
templateUrl: '/static/config/sysconfigs/templates/permission_module_dialog.html',
|
|
controller: 'moduleEditCtrl',
|
|
resolve: {
|
|
module: function () {
|
|
return mod;
|
|
}
|
|
}
|
|
}).result.then(function () {
|
|
$state.reload();
|
|
})
|
|
|
|
};
|
|
$scope.deleteModule = function (mod) {
|
|
commonDialog.confirm({
|
|
title: 'Warning',
|
|
content: 'You are deleting an exists module. Confirm?'
|
|
}).then(function () {
|
|
$http.delete('/sys/permission/modules/' + mod.module_name + '.end').then(function () {
|
|
$state.reload();
|
|
}, function (resp) {
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
})
|
|
});
|
|
}
|
|
}]
|
|
);
|
|
app.controller('moduleEditCtrl', ['$scope', '$http', 'module', function ($scope, $http, module) {
|
|
$scope.module = angular.copy(module);
|
|
$scope.nameEditable = !module.module_name;
|
|
$scope.save = function () {
|
|
$scope.errmsg = null;
|
|
$http.put('/sys/permission/modules/' + $scope.module.module_name + '.end', $scope.module).then(function () {
|
|
$scope.$close();
|
|
}, function (resp) {
|
|
$scope.errmsg = resp.data.message;
|
|
})
|
|
};
|
|
}]);
|
|
app.controller('moduleNewCtrl', ['$scope', '$http', 'module', function ($scope, $http, module) {
|
|
$scope.module = angular.copy(module);
|
|
$scope.nameEditable = !module.module_name;
|
|
$scope.save = function () {
|
|
$scope.errmsg = null;
|
|
$http.put('/sys/permission/modules/' + $scope.module.module_name + '.end', $scope.module).then(function () {
|
|
$scope.$close();
|
|
}, function (resp) {
|
|
$scope.errmsg = resp.data.message;
|
|
})
|
|
};
|
|
}]);
|
|
app.controller('mailSubscribeCtrl', ['$scope', '$http','commonDialog','$uibModal',function ($scope, $http,commonDialog,$uibModal) {
|
|
$scope.params = {};
|
|
$scope.pagination = {};
|
|
$scope.loadUnSubs = function (page) {
|
|
var params = angular.copy($scope.params);
|
|
params.page = page || $scope.pagination.page || 1;
|
|
$http.get('/sys/mail/unsub/query',{params:params}).then(function (resp) {
|
|
$scope.mailSubscribes = resp.data.data;
|
|
$scope.pagination = resp.data.pagination;
|
|
})
|
|
};
|
|
$scope.deleteSub = function (id) {
|
|
commonDialog.confirm({
|
|
title: 'Confirm',
|
|
content: 'Are you sure?'
|
|
}).then(function () {
|
|
$http.delete('/sys/mail/unsub/'+id).then(function () {
|
|
$scope.loadUnSubs();
|
|
}, function (resp) {
|
|
commonDialog.alert({title: 'Error!', content: resp.data.message, type: 'error'})
|
|
})
|
|
})
|
|
};
|
|
$scope.addUnSub = function () {
|
|
$uibModal.open({
|
|
templateUrl: '/static/config/sysconfigs/templates/add_mail_unsub.html',
|
|
controller: 'addUnSubDialogCtrl',
|
|
size: 'sm'
|
|
}).result.then(function () {
|
|
$scope.loadUnSubs();
|
|
});
|
|
};
|
|
$scope.loadUnSubs();
|
|
}]);
|
|
app.controller('addUnSubDialogCtrl', ['$scope', '$http', 'commonDialog','$state', function ($scope, $http, commonDialog,$state) {
|
|
$scope.unSub = {};
|
|
$scope.save = function () {
|
|
var unSub = angular.copy($scope.params);
|
|
if(!unSub.client_moniker){
|
|
alert("client_moniker 不可为空!")
|
|
}
|
|
$http.put('/sys/mail/unsub/'+unSub.client_moniker).then(function (resp) {
|
|
commonDialog.alert({title: 'Success', content: '新增成功', type: 'success'});
|
|
$scope.$close();
|
|
}, function (resp) {
|
|
commonDialog.alert({title: 'Error!', content: resp.data.message, type: 'error'})
|
|
})
|
|
}
|
|
}]);
|
|
/*app.controller('paymentConfigCtrl', ['$scope', '$http', 'commonDialog', function ($scope, $http, commonDialog) {
|
|
$scope.loadSysConfigs = function () {
|
|
$http.get('/sysconfig/base').then(function (resp) {
|
|
$scope.paymentconfig = resp.data;
|
|
})
|
|
};
|
|
$scope.loadSysConfigs();
|
|
$scope.saveProperties = function () {
|
|
$http.put('/sysconfig/base', $scope.paymentconfig).then(function () {
|
|
commonDialog.alert({title: 'Success', content: 'Properties updated.', type: 'success'})
|
|
}, function (resp) {
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
})
|
|
}
|
|
}]);*/
|
|
app.controller('permissionPartnerConfigRootCtrl', ['$scope', '$http', '$uibModal', function ($scope, $http, $uibModal) {
|
|
$scope.authorizeRole = function (roleMask) {
|
|
$uibModal.open({
|
|
templateUrl: '/static/config/sysconfigs/templates/permissionPartner_authorize_dialog.html',
|
|
controller: 'permissionPartnerAuthorizeDialogCtrl',
|
|
size: 'lg',
|
|
resolve: {
|
|
authorized: ['$http', function ($http) {
|
|
return $http.get('/sys/permissionPartner/roles/' + roleMask + '/functions');
|
|
}],
|
|
modules: ['$http', function ($http) {
|
|
return $http.get('/sys/permissionPartner/functions');
|
|
}],
|
|
role: function () {
|
|
return roleMask
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}]);
|
|
app.controller('permissionPartnerAuthorizeDialogCtrl', ['$scope', '$http', 'authorized', 'modules', 'role',
|
|
function ($scope, $http, authorized, modules, role) {
|
|
$scope.authorized = authorized.data;
|
|
$scope.modules = modules.data;
|
|
$scope.submitAuthorize = function () {
|
|
$scope.errmsg = null;
|
|
$http.put('/sys/permissionPartner/roles/' + role + '/functions', $scope.authorized).then(function () {
|
|
$scope.$close();
|
|
}, function (resp) {
|
|
$scope.errmsg = resp.data.message;
|
|
})
|
|
};
|
|
$scope.toggleAuthorize = function (func) {
|
|
var idx = $scope.authorized.indexOf(func.func_id);
|
|
if (idx >= 0) {
|
|
$scope.authorized.splice(idx, 1);
|
|
} else {
|
|
$scope.authorized.push(func.func_id);
|
|
}
|
|
}
|
|
}]
|
|
);
|
|
app.controller('permissionPartnerFuncCtrl', ['$scope', '$http', '$state', '$uibModal', 'commonDialog',
|
|
function ($scope, $http, $state, $uibModal, commonDialog) {
|
|
$scope.loadFunctions = function () {
|
|
$http.get('/sys/permissionPartner/functions').then(function (functions) {
|
|
$scope.modFunctions = functions.data;
|
|
})
|
|
};
|
|
$scope.loadFunctions();
|
|
|
|
$scope.loadModules = function () {
|
|
$http.get('/sys/permissionPartner/modules').then(function (modules) {
|
|
$scope.modules = modules.data;
|
|
})
|
|
};
|
|
|
|
$scope.loadModules();
|
|
|
|
|
|
$scope.syncFunctions = function () {
|
|
$http.post('/sys/permissionPartner/synchronize').then(function () {
|
|
$scope.loadFunctions();
|
|
})
|
|
};
|
|
$scope.moveFunction = function (func) {
|
|
$uibModal.open({
|
|
templateUrl: '/static/config/sysconfigs/templates/permissionPartner_choose_module.html',
|
|
controller: 'permissionPartnerChooseModuleDialogCtrl',
|
|
resolve: {
|
|
modules: function () {
|
|
return $scope.modules;
|
|
}
|
|
}
|
|
}).result.then(function (modName) {
|
|
$http.put('/sys/permissionPartner/functions/' + func.func_id + '/modules', {module_name: modName}).then(function () {
|
|
$scope.loadFunctions();
|
|
}, function (resp) {
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
})
|
|
})
|
|
};
|
|
$scope.editFunctionInfo = function (func) {
|
|
$uibModal.open({
|
|
templateUrl: '/static/config/sysconfigs/templates/PartnerFunc_info_edit.html',
|
|
controller: 'permissionPartnerFuncEditDialogCtrl',
|
|
resolve: {
|
|
func: function () {
|
|
return angular.copy(func);
|
|
}
|
|
}
|
|
}).result.then(function () {
|
|
$scope.loadFunctions();
|
|
})
|
|
}
|
|
}]
|
|
);
|
|
app.controller('permissionPartnerChooseModuleDialogCtrl', ['$scope', '$http', 'modules', function ($scope, $http, modules) {
|
|
$scope.modules = modules;
|
|
$scope.chooseModule = function (mod) {
|
|
$scope.$close(mod.module_name);
|
|
}
|
|
}]);
|
|
app.controller('permissionPartnerFuncEditDialogCtrl', ['$scope', '$http', 'func', function ($scope, $http, func) {
|
|
$scope.func = func;
|
|
$scope.modifyFunction = function () {
|
|
$scope.errmsg = null;
|
|
$http.put('/sys/permissionPartner/functions/' + func.func_id + '.end', $scope.func).then(function () {
|
|
$scope.$close();
|
|
}, function (resp) {
|
|
$scope.errmsg = resp.data.message;
|
|
})
|
|
};
|
|
}]);
|
|
app.controller('permissionPartnerModuleCtrl', ['$scope', '$http', '$state', '$uibModal', 'commonDialog', 'modules',
|
|
function ($scope, $http, $state, $uibModal, commonDialog, modules) {
|
|
$scope.modules = modules.data;
|
|
$scope.newPartnerModule = function () {
|
|
$uibModal.open({
|
|
templateUrl: '/static/config/sysconfigs/templates/permissionPartner_module_dialog.html',
|
|
controller: 'partnerModuleNewCtrl',
|
|
resolve: {
|
|
moduleall: function () {
|
|
return $scope.modules;
|
|
},
|
|
module: function () {
|
|
return {};
|
|
}
|
|
}
|
|
}).result.then(function () {
|
|
$state.reload();
|
|
})
|
|
};
|
|
$scope.editPartnerModule = function (mod) {
|
|
$uibModal.open({
|
|
templateUrl: '/static/config/sysconfigs/templates/permissionPartner_module_dialog.html',
|
|
controller: 'partnerModuleEditCtrl',
|
|
resolve: {
|
|
module: function () {
|
|
return mod;
|
|
}
|
|
}
|
|
}).result.then(function () {
|
|
$state.reload();
|
|
})
|
|
|
|
};
|
|
$scope.deletePartnerModule = function (mod) {
|
|
commonDialog.confirm({
|
|
title: 'Warning',
|
|
content: 'You are deleting an exists module. Confirm?'
|
|
}).then(function () {
|
|
$http.delete('/sys/permissionPartner/modules/' + mod.module_name + '.end').then(function () {
|
|
$state.reload();
|
|
}, function (resp) {
|
|
commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'})
|
|
})
|
|
});
|
|
}
|
|
}]
|
|
);
|
|
app.controller('partnerModuleEditCtrl', ['$scope', '$http', 'module', function ($scope, $http, module) {
|
|
$scope.module = angular.copy(module);
|
|
$scope.nameEditable = !module.module_name;
|
|
$scope.save = function () {
|
|
$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;
|
|
})
|
|
};
|
|
}]);
|
|
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;
|
|
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;
|
|
})
|
|
}
|
|
};
|
|
}]);
|
|
|
|
return app;
|
|
}); |