|
|
@@ -4,26 +4,38 @@
|
|
|
*/
|
|
|
define(['app/app'], function(app) {
|
|
|
"use strict";
|
|
|
- app.register.controller('vendorAccountManagementCtrl', ['$scope', '$rootScope', 'Enterprise', 'User', 'toaster', '$modal','BaseService','ngTableParams','$http', function($scope, $rootScope, Enterprise, User, toaster, $modal, BaseService, ngTableParams, $http) {
|
|
|
+ app.register.controller('vendorAccountManagementCtrl', ['$scope', '$rootScope', 'Enterprise', 'User', 'toaster', '$modal','BaseService','ngTableParams','$http', 'AuthenticationService', function($scope, $rootScope, Enterprise, User, toaster, $modal, BaseService, ngTableParams, $http, AuthenticationService) {
|
|
|
$rootScope.active = 'vendor_account_management';
|
|
|
$scope.tab = 'base';
|
|
|
$scope.userInfo = $rootScope.userInfo;
|
|
|
$scope.updateState = false;
|
|
|
- // 获取企业信息
|
|
|
- Enterprise.getEnterpriseInfo({enuu : $scope.userInfo.enterprise.uu}, function(data) {
|
|
|
- $scope.enterpriseInfo = data;
|
|
|
- $scope.enterpriseInfoBackup = angular.copy($scope.enterpriseInfo);
|
|
|
- $scope.enAdminuu = $scope.enterpriseInfo.enAdminuu;
|
|
|
- User.getUserByUU({uu: $scope.enAdminuu}, {}, function(data){
|
|
|
- $scope.adminInfo = data;
|
|
|
- console.log($scope.adminInfo);
|
|
|
- }, function(){
|
|
|
- toaster.pop('error', '获取管理员信息失败');
|
|
|
- });
|
|
|
- },function(response) {
|
|
|
- toaster.pop('error', '获取企业信息失败');
|
|
|
- });
|
|
|
|
|
|
+ var getEnterprise = function () {
|
|
|
+ // 获取企业信息
|
|
|
+ Enterprise.getEnterpriseInfo({enuu : $scope.userInfo.enterprise.uu}, function(data) {
|
|
|
+ $scope.enterpriseInfo = data;
|
|
|
+ $scope.enterpriseInfoBackup = angular.copy($scope.enterpriseInfo);
|
|
|
+ $scope.enAdminuu = $scope.enterpriseInfo.enAdminuu;
|
|
|
+ User.getUserByUU({uu: $scope.enAdminuu}, {}, function(data){
|
|
|
+ $scope.adminInfo = data;
|
|
|
+ console.log($scope.adminInfo);
|
|
|
+ }, function(){
|
|
|
+ toaster.pop('error', '获取管理员信息失败');
|
|
|
+ });
|
|
|
+ },function(response) {
|
|
|
+ toaster.pop('error', '获取企业信息失败');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if ($scope.userInfo.enterprise) {
|
|
|
+ getEnterprise();
|
|
|
+ } else {
|
|
|
+ AuthenticationService.getAuthentication().success(function (data) {
|
|
|
+ $scope.userInfo = data;
|
|
|
+ getEnterprise();
|
|
|
+ }, function (error) {
|
|
|
+ toaster.pop('error', '获取用户信息失败');
|
|
|
+ })
|
|
|
+ }
|
|
|
$scope.tableParams = new ngTableParams({
|
|
|
page : 1, // show first page
|
|
|
count : 10 // count per page
|