residenceAnalysis.js
8.07 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
(function(angular) {
function residenceAnalysis($scope, aiNicheService, DTOptionsBuilder, DTColumnBuilder, $compile, $rootScope, Utils, $uibModal, $filter) {
/**
* 定义常量
* */
$scope.totalItems = 0;
$scope.currentPage = 1;
$scope.totalPage = '';
$scope.maxSize = 2000;
$scope.pageType = 0;
$scope.displayTable = true;
$scope.timePicked = '';
$scope.timePick = function (timePicked) {
this.timePicked = timePicked;
};
$scope.loginUserUserTypeCss='';
if($rootScope.loginUser.merchantUserType == 2) {
$scope.loginUserUserTypeCss = 'display: flex;';
} else {
$scope.loginUserUserTypeCss = 'display: none;';
}
$scope.ngModel = true;
$scope.isNgModel = true;
if($rootScope.loginUser.merchantUserType == 2) {
$scope.ngModel = true;
$scope.isNgModel = true;
} else {
$scope.ngModel = false;
$scope.isNgModel = false;
}
$scope.isLineXY = function () {
if(!$scope.ngModel){
$scope.isNgModel = false
}else {
$scope.isNgModel = true
}
};
//常驻地标点
var LngLat = [];
$scope.carPermanentInfo = [];
$scope.dtColumns = [
DTColumnBuilder.newColumn('name').withOption('width', '10%').withTitle('姓名'),
DTColumnBuilder.newColumn('standNo').withOption('width', '20%').withTitle('车架号'),
DTColumnBuilder.newColumn('sn').withOption('width', '20%').withTitle('设备号'),
DTColumnBuilder.newColumn('mobile').withOption('width', '20%').withTitle('手机号'),
DTColumnBuilder.newColumn('distance').withOption('width', '17%').withTitle('常驻地到门店距离'),
DTColumnBuilder.newColumn('azimuthDesc').withOption('width', 101).withTitle('方位')
];
$scope.dtOptions = DTOptionsBuilder.newOptions().withOption('num', true);
$scope.dtInstance = {
serverData: aiNicheService.getCarPermanentInfo
};
// 这边定义一个 init 方法
$scope.umcInstance = {
init: function () {
//$scope.umcInstance.setMapStyle();
$scope.umcInstance.setMapFeatures();
var shopPoint,info;
//点
aiNicheService.getLngLatShop(function (response) {
if(response.data && response.data.lng){
$scope.isShop = true;
if($rootScope.loginUser.merchantUserType == 2) {
$scope.isShop = true;
} else {
$scope.isShop = false;
}
if($scope.isShop) {
if(null != response.data.lng && null != response.data.lat) {
var lngLatShopStr = response.data.lng + ","+response.data.lat;
shopPoint = lngLatShopStr;
info = response.data.store_name;
$scope.umcInstance.residenceCircle(shopPoint,info,$scope);
//drawXY()
}
}
}
});
//画点
getHotPointInfo();
//getCarPermanentInfoWay();
$scope.tableSearch = function(){
$scope.currentPage = 1;
LngLat = [];
$scope.carPermanentInfo = [];
$scope.umcInstance.clearMarker();
getHotPointInfo();
var params = getParams();
$scope.dtInstance.query(params);
//$scope.doMore = new scrollLoadData();
// getCarPermanentInfoWay();
};
}
};
var getHotPointInfo = function () {
var params = getParams();
$scope.loading = true;
aiNicheService.getHotPointInfo(params,function (res) {
$scope.points = res.data;
for(var i = 0; i < res.data.length; i++){
var thisItem = res.data[i];
LngLat.push(thisItem);
}
$scope.umcInstance.residenceMarkers(LngLat);
$scope.loading = false;
})
};
// var getCarPermanentInfoWay = function () {
// var paramCopy = {};
// var params = getParams();
// $scope.loading = true;
// angular.extend(paramCopy, {
// maxSize:10
// });
// angular.extend(params, paramCopy);
// aiNicheService.getCarPermanentInfo(params,function(response) {
// $scope.totalItems = response.recordsTotal;
// $scope.totalPage = (response.recordsTotal/$scope.maxSize)<1?1:Math.ceil((response.recordsTotal/$scope.maxSize));
// for(var i = 0; i < response.data.length; i++){
// var thisItem = response.data[i];
// $scope.carPermanentInfo.push(thisItem);
// }
// if($scope.currentPage < $scope.totalPage) {
// $scope.currentPage = $scope.currentPage + 1;
// $scope.timeOutId = setTimeout(function(){
// getCarPermanentInfoWay();
// }, 1000);
// } else {
// clearTimeout($scope.timeOutId);
// }
// $scope.loading = false;
// });
// };
function getParams() {
var obj = {};
if($scope.timePicked==4){
obj.minDistance = 0;
obj.maxDistance = 5;
}else if($scope.timePicked==3){
obj.minDistance = 5;
obj.maxDistance = 10;
}else if($scope.timePicked==2){
obj.minDistance = 10;
obj.maxDistance = 20;
}else if($scope.timePicked==1){
obj.minDistance = 20;
obj.maxDistance = 300;
}
var factoryMerchantId = $scope.factoryMerchantId;
var provinceMerchantId = $scope.provinceMerchantId;
var cityMerchantId = $scope.cityMerchantId;
var shopMerchantId = $scope.shopMerchantId;
if(factoryMerchantId) {
obj.factoryMerchantId = $scope.factoryMerchantId;
}
if(provinceMerchantId) {
obj.provinceMerchantId = $scope.provinceMerchantId;
}
if(cityMerchantId) {
obj.cityMerchantId = $scope.cityMerchantId;
}
if(shopMerchantId) {
obj.merchantId = $scope.shopMerchantId;
}
if($scope.minDistance){
obj.minDistance = $scope.minDistance
}
if($scope.maxDistance){
obj.maxDistance = $scope.maxDistance
}
//obj.currentPage = $scope.currentPage;
// obj.maxSize = $scope.maxSize = 2000;
// obj.pageSize = $scope.maxSize = 2000;
return obj;
}
$scope.exportExcel = function () {
if($scope.isExporting) return;
var params = getParams();
$scope.isExporting = true;
var customerTitle = '客户热力图';
Utils.exportExcel3("carPermanent/exportCarPermanent",params,customerTitle,'GET',function(){
$scope.isExporting = false;
});
/*
if ($scope.isExporting) return;
var params = getParams();
var options = {
url: "carPermanent/exportCarPermanent"
};
Utils.exportExcel(options, params, function () {
$scope.$apply(function () {
$scope.isExporting = false
})
});
*/
};
}
angular.module('AIniche').controller('residenceAnalysis', residenceAnalysis)
})(angular);