customListCtrl.js
2.9 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
(function(angular) {
function customListCtrl($scope, reportService, $resource, DTOptionsBuilder, DTColumnBuilder) {
//查询条件
$scope.dateRange = {
startDate: moment().startOf('day').format('YYYY-MM-DD 00:00:00'),
endDate: moment().endOf('day').format('YYYY-MM-DD 00:00:00')
}
$scope.onlineOptions = [
{id: 0, name: '全部'},
{id: 1, name: '在线'},
{id: 2, name: '离线'}
];
$scope.onlineSelected = $scope.onlineOptions[0];
//获取分组列表
$scope.groupOptions = null;
reportService.getGroup(function(data){
var result = data.obj;
$scope.groupOptions = result;
$scope.groupSelected = result[0];
}, function(data){
});
//获取分类
$scope.classOptions = null;
$scope.classSelected = null;
$scope.getClassByGroupId = function(groupId){
reportService.getClass({groupId: groupId}, function(data){
var result = data.obj;
$scope.classOptions = result;
$scope.classSelected = result[0];
}, function(data){
});
}
$scope.conditionOptions = [
{id: -1, name: '请选择'},
{id: 0, name: '设备号'},
{id: 1, name: '车架号'},
{id: 2, name: '姓名'},
{id: 3, name: '工单号'}
];
$scope.conditionSelected = $scope.conditionOptions[0];
$scope.activeListForm = function(){
$scope.dtInstance.query();
}
$scope.dtColumns = [
DTColumnBuilder.newColumn('id').withOption('width',60).withTitle('工单号'),
DTColumnBuilder.newColumn('name').withOption('width',60).withTitle('姓名'),
DTColumnBuilder.newColumn('standno').withOption('width',160).withTitle('车架号'),
DTColumnBuilder.newColumn('deviceNo2').withOption('width',100).withTitle('设备号'),
DTColumnBuilder.newColumn('deviceNo2').withOption('width',100).withTitle('设备型号'),
DTColumnBuilder.newColumn('deviceNo2').withOption('width',60).withTitle('是否在线'),
DTColumnBuilder.newColumn('groupId').withOption('width',100).withTitle('所属分类'),
DTColumnBuilder.newColumn('createTime').withOption('width',200).withTitle('激活时间'),
DTColumnBuilder.newColumn('operator').withOption('width',100).withTitle('操作人')
]
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withButtons([{
text : '导出excel',
className: 'btn btn-primary',
action : function(e, dt, node, config) {
var selectedArr = [];
$('.selectOne:checked').each(function(){
selectedArr.push($(this).data('id'));
});
console.log(selectedArr.join(','))
}
}])
.withOption('id','id')
.withOption('ordering',false)
.withFixedColumns({
leftColumns: 7,
rightColumns: 0
})
.withOption('select', {
type: 'checkbox'
});
$scope.dtInstance = {
serverData : reportService.getList
};
}
angular.module('report').controller('customListCtrl', customListCtrl);
})(angular);