credit.js
5.61 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
(function () {
"use strict";
/**
* 支付渠道费日汇总报表
*/
var setCreditController = function ($scope, $http, $modal, saleService, hrService, dialogService, wosaicustomizationService) {
$scope.$emit('navShow', 3);
$scope.vm = {
pageNumber: 1,
pageSize: 10,
};
//获取员工
$scope.getEmployeeLists = function (backdata) {
var param = {
keyword: backdata.data.keyword,
pageNumber: backdata.data.pageNumber,
pageSize: backdata.data.pageSize
};
//获取法律实体
hrService.apiHrEmployeeFindIndex(param).success(function (data) {
if (data.errors == null || data.errors.length > 0) {
dialogService.tip(data.errors);
}
else {
backdata.deferred.resolve({itemList: data.result, totalCount: data.totalCount});
}
});
}
//类型
$scope.typeList = [{key: "AREA", val: "区域"}, {key: "CITY", val: "城市"}, {key: "BD", val: "业务拓展员"}];
$scope.getList = function () {
wosaicustomizationService.apiEmployeeCreditFind($scope.vm).success(function (data) {
if (data.errors === null || data.errors.length > 0) {
dialogService.tip(data.errors, null, 0);
} else {
$scope.employeeCreditList = data.result;
$scope.vm.totalCount = data.totalCount;
}
});
}
$scope.doFind = function () {
$scope.vm.pageNumber = 1;
$scope.vm.pageSize = 10;
$scope.vm.employeeName = $scope.vm.employee ? $scope.vm.employee.name : null;
$scope.vm.type = $scope.vm.type ? $scope.vm.type : null;
$scope.getList();
};
//创建员工
$scope.addEmployee = function () {
var modalInstance = $modal.open({
templateUrl: "addEmployee.htm",
controller: addEmployeeController,
size: "",
resolve: {
items: function () {
return {operatingUnitList: $scope.operatingUnitList};
}
}
});
modalInstance.result.then(function () {
$scope.getList();
});
};
};
/**
* 新增
*/
var addEmployeeController = ["$scope", "$modalInstance", "items", "HrService", "SystemService", "dialogService","WosaicustomizationService",
function ($scope, $modalInstance, items, HrService, SystemService, dialogService,wosaicustomizationService) {
$scope.$emit('navShow', 3);
$scope.vm = {
pageNumber: 1,
pageSize: 10,
};
//获取员工
$scope.getEmployeeLists = function (backdata) {
var param = {
keyword: backdata.data.keyword,
pageNumber: backdata.data.pageNumber,
pageSize: backdata.data.pageSize
};
//获取法律实体
HrService.apiHrEmployeeFindIndex(param).success(function (data) {
if (data.errors == null || data.errors.length > 0) {
dialogService.tip(data.errors);
}
else {
backdata.deferred.resolve({itemList: data.result, totalCount: data.totalCount});
}
});
}
$scope.employee = $scope.vm.employee;
$scope.changeState = function (employee) {
$scope.vm.organizationName = $scope.vm.employee ? $scope.vm.employee.organizationName : null;
};
$scope.$watch("vm.employee", function (employee) {
$scope.vm.organizationName = $scope.vm.employee ? $scope.vm.employee.organizationName : null;
}, true);
//类型
$scope.typeList = [{key: "AREA", val: "区域"}, {key: "CITY", val: "城市"}, {key: "BD", val: "业务拓展员"}];
//保存
$scope.ok = function () {
if (!$scope.vm.employee) {
dialogService.tip([{message: "请填写员工!"}]);
return;
}
if (!$scope.vm.type) {
dialogService.tip([{message: "请填写类型!"}]);
return;
}
if (!$scope.vm.initCredit) {
dialogService.tip([{message: "请填写额度限制!"}]);
return;
}
$scope.vm.employeeName = $scope.vm.employee ? $scope.vm.employee.name : null;
wosaicustomizationService.apiEmployeeCreditCreate($scope.vm).success(function (data) {
if (data.errors === null || data.errors.length > 0) {
dialogService.tip(data.errors, null, 0);
} else {
dialogService.tip([{"message": "添加成功!"}]);
$modalInstance.close();
}
});
};
//关闭窗口
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
}];
angular.module("xn.page", [])
.controller("SetCreditController", ["$scope", "$http", "$modal", "SaleService", "HrService", "dialogService", "WosaicustomizationService", setCreditController])
})();