supplierManagerCtrl.js
4.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
(function (angular) {
function supplierManagerCtrl($scope,supplierService,DTColumnBuilder,DTOptionsBuilder,$http,$state,$uibModal,Utils) {
$scope.statusList = [{
text : '禁用',
value : 0
},{
text : '启用',
value : 1
}]
$scope.dtColumns = [
DTColumnBuilder.newColumn('loginName').withOption('width',60).withTitle('供应商账号'),
DTColumnBuilder.newColumn('supplierCode').withOption('width',60).withTitle('供应商SAP代码'),
DTColumnBuilder.newColumn('supplierName').withOption('width',60).withTitle('供应商SAP名称'),
DTColumnBuilder.newColumn('productCount').withOption('width',60).withTitle('产品总数'),
DTColumnBuilder.newColumn('brandCount').withOption('width',60).withTitle('品牌数'),
DTColumnBuilder.newColumn('putawayCount').withOption('width',60).withTitle('上架中'),
DTColumnBuilder.newColumn(null).withTitle(function(){
return '操作';
}).withOption('width', 70).withClass('text-center').renderWith(function(data, type, full, oSettings) {
var str = '<div class="form-inline">'
+'<div class="form-group"><a class="btn btn-link" ng-click="brandManager(\''+ data.supplierCode +'\')">品牌管理</a></div>'
+'<div class="form-group"><a class="btn btn-link" ng-click="detail(\''+ data.supplierCode +'\')">查看详情</a></div>';
str += '</div>';
return str;
})
];
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withOption('id','id')
.withFixedColumns({
leftColumns: 1,
rightColumns: 0
})
.withOption('lengthMenu', [20,40,60,100])
.withOption('num', true)
.withButtons([{
text : '批量导入供应商',
action : function(e, dt, node, config) {
$scope.import();
}
},{
text : '导出EXCEL',
action : function(e, dt, node, config) {
$scope.export();
}
}]);
$scope.dtInstance = {
serverData : supplierService.list
};
$scope.detail = function (supplierCode) {
$state.go('electronicDirectory.productManager',{supplierCode:supplierCode});
}
$scope.brandManager = function (supplierCode) {
$uibModal.open({
templateUrl : 'biz/electronicDirectory/view/brandManager.html',
controller : 'brandManagerCtrl',
size : 'lg',
scope:$scope,
resolve : {
param : function() {
return {
supplierCode: supplierCode
};
}
}
}).result.then(function(){
//关闭弹框后执行方法
},function () {
$scope.dtInstance.query();
});
}
$scope.getParam = function () {
var param = {};
if ($scope.selectCondition && $scope.conditionText) {
param[$scope.selectCondition] = $scope.conditionText;
}
if($scope.status){
param.status = $scope.status.value;
}
var obj = {
condition:param
};
return obj;
}
$scope.select = function () {
var param = $scope.getParam();
$scope.dtInstance.query(param);
}
$scope.import = function(){
$uibModal.open({
templateUrl : 'biz/electronicDirectory/view/importModal.html',
controller : 'importModalCtrl',
size : 'md',
scope:$scope,
resolve : {
pagetType : function() {
return {
source: 'supplierManager'
};
}
}
}).result.then(function(){
//关闭弹框后执行方法
},function () {
$scope.dtInstance.query();
});
};
$scope.export=function(){
var options = $scope.getParam().condition;
Utils.exportExcel2('supplier/export',options,'供应商列表');
};
}
angular.module('electronicDirectory')
.controller('supplierManagerCtrl', supplierManagerCtrl);
})(angular);