user.js
4.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
(function () {
"use strict";
//员工免登令牌列表页面
var userIndexController= function ($scope, $http, $modal,SystemService, dialogService) {
$scope.$emit('navShow',4);
//分页传入的数值
$scope.vm = {
pageNumber: 1,
pageSize: 10,
sourceTypes : ["EMPLOYEE", "NONE"]
};
$scope.pagedResult = [];
/**
* 搜索用户列表
*/
$scope.getList = function () {
SystemService.apiSystemUsersSearchBySourceType($scope.vm).success(function (data) {
if (data.errors && data.errors.length === 0) {
$scope.pagedResult = data.result;
$scope.vm.totalCount=data.totalCount;
} else {
var msg = "由于以下原因,未能取得数据\n";
for (var i = 0; i < data.errors.length; i++) {
msg += (i + 1) + "." + data.errors[i].message + "\n";
}
dialogService.tip(msg);
}
});
};
//页面初始化加载数据
$scope.doSearch=function(){
$scope.vm.pageNumber=1;
$scope.getList();
};
$scope.doSearch();
//令牌编辑弹窗
$scope.ssoTokenEdit=function(id){
var modalInstance = $modal.open({
templateUrl: "ssotoken.html",
controller: SsoTokenController,
size:"",
resolve: {
id: function () {
return id ;
}
}
});
};
}
//用户免登令牌弹窗
var SsoTokenController= ["$scope","$modalInstance","$modal","id","PurchasingService","InventoryService","CustomizationService","dialogService",
function($scope, $modalInstance, $modal,id,purchasingService,inventoryService,customizationService,dialogService){
console.log(id);
$scope.vm = {
pageSize:0,
id:id
};
customizationService.apiCustomizationSsoTokenFind($scope.vm).success(function(data){
if (data.errors == null || data.errors.length > 0){
dialogService.tip(data.errors,null,0);
} else {
$scope.result=data.result[0];
$scope.result.id=id;
}
});
$scope.doSave=function(){
if( $scope.result.userName==null || $scope.result.userName.length!=16){
dialogService.tip([{"message": "账户必须为16位且不能为空"}]);
return ;
}
if($scope.result.userPassWord==null || $scope.result.userPassWord.length!=16){
dialogService.tip([{"message": "密码必须为16位且不能为空"}]);
return ;
}
customizationService.apiCustomizationSsoTokenUpdate($scope.result).success(function(data){
if (data.errors == null || data.errors.length > 0)
dialogService.tip(data.errors,null,0);
else {
dialogService.tip([{"message": "更新成功!"}],"/customization/user.htm");
$modalInstance.close();
}
});
};
$scope.clean = function () {
$scope.itemCategoryList =[];
$modalInstance.dismiss('cancel');
};
}];
angular.module("xn.page", [])
.controller("UserIndexController", ["$scope", "$http", "$modal","SystemService", "dialogService","CustomizationService",userIndexController])
// .controller("SsoTokenController",["$scope","$modalInstance","$modal","supplierId","PurchasingService","InventoryService","dialogService",UserIndexController])
})();