|
@@ -29,7 +29,7 @@ app.controller('scoreConfigurationPerformanceCtrl', ["$rootScope", "$scope", "$s
|
29
|
29
|
}
|
30
|
30
|
var defaultFilterData = {
|
31
|
31
|
"idx": 0,
|
32
|
|
- "sum": 10
|
|
32
|
+ "sum": 9999
|
33
|
33
|
};
|
34
|
34
|
|
35
|
35
|
$scope.gridOptions = {};
|
|
@@ -58,14 +58,6 @@ app.controller('scoreConfigurationPerformanceCtrl', ["$rootScope", "$scope", "$s
|
58
|
58
|
return row.id;
|
59
|
59
|
};
|
60
|
60
|
|
61
|
|
- $scope.transfer = function (status) {
|
62
|
|
- if (status === "执行中") {
|
63
|
|
- return "执行中"
|
64
|
|
- } else if (status === "暂停中") {
|
65
|
|
- return "暂停中"
|
66
|
|
- }
|
67
|
|
- }
|
68
|
|
-
|
69
|
61
|
$scope.gridOptions.columnDefs = [{
|
70
|
62
|
name: 'item',
|
71
|
63
|
displayName: '序号',
|
|
@@ -74,37 +66,43 @@ app.controller('scoreConfigurationPerformanceCtrl', ["$rootScope", "$scope", "$s
|
74
|
66
|
},
|
75
|
67
|
|
76
|
68
|
{
|
77
|
|
- name: 'one',
|
|
69
|
+ name: 'incidentCategory.parent.parent.category',
|
78
|
70
|
displayName: '一级分类',
|
79
|
71
|
width: '10%',
|
80
|
72
|
enableFiltering: false
|
81
|
73
|
},
|
82
|
74
|
{
|
83
|
|
- name: 'two',
|
|
75
|
+ name: 'incidentCategory.parent.category',
|
84
|
76
|
displayName: '二级分类',
|
85
|
77
|
width: '10%',
|
86
|
78
|
enableFiltering: false
|
87
|
79
|
},
|
88
|
80
|
{
|
89
|
|
- name: 'three',
|
|
81
|
+ name: 'incidentCategory.category',
|
90
|
82
|
displayName: '三级分类',
|
91
|
83
|
width: '10%',
|
92
|
84
|
enableFiltering: false
|
93
|
85
|
},
|
94
|
86
|
{
|
95
|
|
- name: 'four',
|
|
87
|
+ name: 'incidentCategory.complexity',
|
96
|
88
|
displayName: '默认积分',
|
97
|
|
- width: '10%',
|
98
|
|
- enableFiltering: false
|
|
89
|
+ width: '5%',
|
|
90
|
+ enableFiltering: false,
|
|
91
|
+ cellTemplate: '<div style="line-height:34px;">' +
|
|
92
|
+ '<span>{{row.entity.incidentCategory.complexity?row.entity.incidentCategory.complexity.value:0}}</span>' +
|
|
93
|
+ '</div>'
|
99
|
94
|
},
|
100
|
95
|
{
|
101
|
96
|
name: 'five',
|
102
|
97
|
displayName: '积分规则',
|
103
|
|
- width: '10%',
|
104
|
|
- enableFiltering: false
|
|
98
|
+ width: '50%',
|
|
99
|
+ enableFiltering: false,
|
|
100
|
+ cellTemplate: '<div style="line-height:34px;">' +
|
|
101
|
+ '<span ng-repeat="item in row.entity.rules">【{{item.startCount}}-{{item.endCount}}单】获得积分{{item.score}};</span>' +
|
|
102
|
+ '</div>'
|
105
|
103
|
},
|
106
|
104
|
{
|
107
|
|
- minWidth: '300',
|
|
105
|
+ minWidth: '100',
|
108
|
106
|
name: '操作',
|
109
|
107
|
enableFiltering: false,
|
110
|
108
|
cellTemplate: '<div class="cl-effect-1 ui-grid-cell-contents pull-left">' +
|
|
@@ -113,6 +111,42 @@ app.controller('scoreConfigurationPerformanceCtrl', ["$rootScope", "$scope", "$s
|
113
|
111
|
},
|
114
|
112
|
];
|
115
|
113
|
|
|
114
|
+ $scope.gridOptions.onRegisterApi = function (gridApi) {
|
|
115
|
+
|
|
116
|
+ //导入gridApi对象
|
|
117
|
+ $scope.gridApi = gridApi;
|
|
118
|
+
|
|
119
|
+ //勾选行事件
|
|
120
|
+ gridApi.selection.on.rowSelectionChanged($scope, function (data) {
|
|
121
|
+ if (data.isSelected) {
|
|
122
|
+ $scope.selected.items.push(data.entity);
|
|
123
|
+ } else {
|
|
124
|
+ //objs:需要遍历的集合 data:遍历时当前的数据 index:遍历时当前索引
|
|
125
|
+ //array:需要遍历的集合,每次遍历时都会把objs原样的传一次。
|
|
126
|
+ //angular.forEach(objs, function(data,index,array)
|
|
127
|
+ angular.forEach($scope.selected.items, function (ObjIndex, index, destObj) {
|
|
128
|
+ // console.log(ObjIndex);
|
|
129
|
+ // console.log(index);
|
|
130
|
+ // console.log(destObj);
|
|
131
|
+ if (ObjIndex.id == data.entity.id) {
|
|
132
|
+ destObj.splice(index, 1)
|
|
133
|
+ }
|
|
134
|
+ })
|
|
135
|
+ }
|
|
136
|
+ });
|
|
137
|
+
|
|
138
|
+ //批量全选
|
|
139
|
+ gridApi.selection.on.rowSelectionChangedBatch($scope, function (rows, event) {
|
|
140
|
+ angular.forEach(rows, function (ObjIndex, index, destObj) {
|
|
141
|
+ if (ObjIndex.isSelected) {
|
|
142
|
+ $scope.selected.items.push(ObjIndex.entity);
|
|
143
|
+ } else {
|
|
144
|
+ $scope.selected.items = [];
|
|
145
|
+ }
|
|
146
|
+ });
|
|
147
|
+ });
|
|
148
|
+ };
|
|
149
|
+
|
116
|
150
|
|
117
|
151
|
// 批量修改积分
|
118
|
152
|
$scope.edits = function (data) {
|
|
@@ -215,69 +249,12 @@ app.controller('scoreConfigurationPerformanceCtrl', ["$rootScope", "$scope", "$s
|
215
|
249
|
items: []
|
216
|
250
|
}
|
217
|
251
|
|
218
|
|
- $scope.gridOptions.onRegisterApi = function (gridApi) {
|
219
|
|
-
|
220
|
|
- //导入gridApi对象
|
221
|
|
- $scope.gridApi = gridApi;
|
222
|
|
-
|
223
|
|
- //勾选行事件
|
224
|
|
- gridApi.selection.on.rowSelectionChanged($scope, function (data) {
|
225
|
|
- if (data.isSelected) {
|
226
|
|
- $scope.selected.items.push(data.entity);
|
227
|
|
- } else {
|
228
|
|
- //objs:需要遍历的集合 data:遍历时当前的数据 index:遍历时当前索引
|
229
|
|
- //array:需要遍历的集合,每次遍历时都会把objs原样的传一次。
|
230
|
|
- //angular.forEach(objs, function(data,index,array)
|
231
|
|
- angular.forEach($scope.selected.items, function (ObjIndex, index, destObj) {
|
232
|
|
- // console.log(ObjIndex);
|
233
|
|
- // console.log(index);
|
234
|
|
- // console.log(destObj);
|
235
|
|
- if (ObjIndex.id == data.entity.id) {
|
236
|
|
- destObj.splice(index, 1)
|
237
|
|
- }
|
238
|
|
- })
|
239
|
|
- }
|
240
|
|
- });
|
241
|
|
-
|
242
|
|
- //批量全选
|
243
|
|
- gridApi.selection.on.rowSelectionChangedBatch($scope, function (rows, event) {
|
244
|
|
- // if ($scope.selected.items.length != 0) {
|
245
|
|
- // $scope.selected.items = [];
|
246
|
|
- angular.forEach(rows, function (ObjIndex, index, destObj) {
|
247
|
|
- if (ObjIndex.isSelected) {
|
248
|
|
- $scope.selected.items.push(ObjIndex.entity);
|
249
|
|
- } else {
|
250
|
|
- $scope.selected.items = [];
|
251
|
|
- // $scope.selected.items.splice(index, 1);
|
252
|
|
- }
|
253
|
|
- });
|
254
|
|
- // } else {
|
255
|
|
-
|
256
|
|
- // }
|
257
|
|
- // $scope.mySelectedRows = $scope.gridApi.selection.getSelectedRows();
|
258
|
|
- // if ($scope.selected.items.length == 0) {
|
259
|
|
- // $scope.selected.items = $scope.mySelectedRows;
|
260
|
|
- // } else if ($scope.mySelectedRows.length == 0) {
|
261
|
|
- // for (var i = 0; i < $scope.selected.items.length; i++) {
|
262
|
|
- // for (var j = 0; j < rows.length; j++) {
|
263
|
|
- // if ($scope.selected.items[i].id == rows[j].entity.id) {
|
264
|
|
- // $scope.selected.items.splice(i, 1);
|
265
|
|
- // }
|
266
|
|
- // }
|
267
|
|
- // }
|
268
|
|
- // } else {
|
269
|
|
- // angular.forEach($scope.mySelectedRows, function(item) {
|
270
|
|
- // $scope.selected.items.push(item);
|
271
|
|
- // });
|
272
|
|
- // }
|
273
|
|
- });
|
274
|
|
- };
|
275
|
|
-
|
276
|
252
|
//重置按钮
|
277
|
253
|
$scope.reload = function () {
|
278
|
|
- delete $scope.fileData.inspection.inspectionTypeDTO;
|
279
|
|
- delete $scope.fileData.inspection.executeUser;
|
280
|
|
- delete $scope.fileData.inspection.createUser;
|
|
254
|
+ this.one_cates = [];
|
|
255
|
+ this.two_cates = [];
|
|
256
|
+ delete $scope.fileData.incidentcategory.oneCate;
|
|
257
|
+ delete $scope.fileData.incidentcategory.twoCate;
|
281
|
258
|
$scope.refreshData('expand-right', $scope.fileData);
|
282
|
259
|
}
|
283
|
260
|
|
|
@@ -291,38 +268,40 @@ app.controller('scoreConfigurationPerformanceCtrl', ["$rootScope", "$scope", "$s
|
291
|
268
|
|
292
|
269
|
$scope.myData = [];
|
293
|
270
|
|
294
|
|
- api_bpm_data.fetchDataList('inspection', filterData).then(function (data) {
|
|
271
|
+ var postData = angular.copy(filterData);
|
|
272
|
+ if(postData.incidentcategory.twoCate){
|
|
273
|
+ postData.incidentcategory.categoryid = postData.incidentcategory.twoCate.id;
|
|
274
|
+ delete postData.incidentcategory.oneCate;
|
|
275
|
+ delete postData.incidentcategory.twoCate;
|
|
276
|
+ }else if(postData.incidentcategory.oneCate){
|
|
277
|
+ postData.incidentcategory.categoryid = postData.incidentcategory.oneCate.id;
|
|
278
|
+ delete postData.incidentcategory.oneCate;
|
|
279
|
+ }
|
|
280
|
+
|
|
281
|
+ api_bpm_data.fetchDataList('incidentcategory', postData).then(function (data) {
|
295
|
282
|
var myData = Restangular.stripRestangular(data);
|
296
|
283
|
$scope.gridOptions.totalItems = myData.totalNum;
|
297
|
284
|
if (angular.isArray(myData.list)) {
|
298
|
285
|
$scope.myData = myData.list;
|
299
|
|
- for (var i = 0; i < $scope.myData.length; i++) {
|
300
|
|
- $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
|
301
|
|
- if($scope.myData[i].onDoing + $scope.myData[i].onCompleted != 0){
|
302
|
|
- $scope.myData[i].onPercent = ($scope.myData[i].onCompleted*100/($scope.myData[i].onDoing + $scope.myData[i].onCompleted)).toFixed(1);
|
303
|
|
- }else if($scope.myData[i].onCompleted == 0){
|
304
|
|
- $scope.myData[i].onPercent = '0.0';
|
|
286
|
+ var arr = [];
|
|
287
|
+ $scope.myData.forEach(v => {
|
|
288
|
+ // 判断arr数组里是否有该事件分类
|
|
289
|
+ let index = arr.findIndex(vv => vv.id == v.categoryid);
|
|
290
|
+ if(index > -1){
|
|
291
|
+ arr[index].rules.push(v);
|
305
|
292
|
}else{
|
306
|
|
- $scope.myData[i].onPercent = '0.0';
|
|
293
|
+ arr.push({
|
|
294
|
+ id: v.categoryid,
|
|
295
|
+ incidentCategory: v.incidentCategory,
|
|
296
|
+ rules: [v]
|
|
297
|
+ })
|
307
|
298
|
}
|
308
|
|
-
|
309
|
|
- if($scope.myData[i].offDoing + $scope.myData[i].offCompleted != 0){
|
310
|
|
- $scope.myData[i].offPercent = ($scope.myData[i].offCompleted*100/($scope.myData[i].offDoing + $scope.myData[i].offCompleted)).toFixed(1);
|
311
|
|
- }else if($scope.myData[i].offCompleted == 0){
|
312
|
|
- $scope.myData[i].offPercent = '0.0';
|
313
|
|
- }else{
|
314
|
|
- $scope.myData[i].offPercent = '0.0';
|
315
|
|
- }
|
316
|
|
- }
|
317
|
|
- console.log($scope.myData)
|
|
299
|
+ })
|
|
300
|
+ $scope.myData = arr;
|
318
|
301
|
for (var i = 0; i < $scope.myData.length; i++) {
|
319
|
|
- if ($scope.myData[i].status == "执行中") {
|
320
|
|
- $scope.myData[i].style = "fa fa-play";
|
321
|
|
- } else if ($scope.myData[i].status == "暂停中") {
|
322
|
|
- $scope.myData[i].style = "fa fa-pause";
|
323
|
|
- };
|
324
|
|
- $scope.myData[i].runStatus = $scope.transfer($scope.myData[i].status);
|
|
302
|
+ $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum;
|
325
|
303
|
}
|
|
304
|
+ console.log($scope.myData)
|
326
|
305
|
} else {
|
327
|
306
|
SweetAlert.swal({
|
328
|
307
|
title: "数据为空",
|
|
@@ -342,30 +321,40 @@ app.controller('scoreConfigurationPerformanceCtrl', ["$rootScope", "$scope", "$s
|
342
|
321
|
filterData = defaultFilterData;
|
343
|
322
|
}
|
344
|
323
|
|
345
|
|
- api_bpm_data.fetchDataList('inspection', filterData).then(function (data) {
|
|
324
|
+ var postData = angular.copy(filterData);
|
|
325
|
+ if(postData.incidentcategory.twoCate){
|
|
326
|
+ postData.incidentcategory.categoryid = postData.incidentcategory.twoCate.id;
|
|
327
|
+ delete postData.incidentcategory.oneCate;
|
|
328
|
+ delete postData.incidentcategory.twoCate;
|
|
329
|
+ }else if(postData.incidentcategory.oneCate){
|
|
330
|
+ postData.incidentcategory.categoryid = postData.incidentcategory.oneCate.id;
|
|
331
|
+ delete postData.incidentcategory.oneCate;
|
|
332
|
+ }
|
|
333
|
+
|
|
334
|
+ api_bpm_data.fetchDataList('incidentcategory', postData).then(function (data) {
|
346
|
335
|
var myData = Restangular.stripRestangular(data);
|
347
|
336
|
$scope.gridOptions.totalItems = myData.totalNum;
|
348
|
337
|
if (angular.isArray(myData.list)) {
|
349
|
338
|
$scope.myData = myData.list;
|
350
|
|
- for (var i = 0; i < $scope.myData.length; i++) {
|
351
|
|
- $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
|
352
|
|
- if($scope.myData[i].doing + $scope.myData[i].completed != 0){
|
353
|
|
- $scope.myData[i].percent = ($scope.myData[i].completed*100/($scope.myData[i].doing + $scope.myData[i].completed)).toFixed(1);
|
354
|
|
- }else if($scope.myData[i].completed == 0){
|
355
|
|
- $scope.myData[i].percent = '0.0';
|
|
339
|
+ var arr = [];
|
|
340
|
+ $scope.myData.forEach(v => {
|
|
341
|
+ // 判断arr数组里是否有该事件分类
|
|
342
|
+ let index = arr.findIndex(vv => vv.id == v.categoryid);
|
|
343
|
+ if(index > -1){
|
|
344
|
+ arr[index].rules.push(v);
|
356
|
345
|
}else{
|
357
|
|
- $scope.myData[i].percent = '0.0';
|
|
346
|
+ arr.push({
|
|
347
|
+ id: v.categoryid,
|
|
348
|
+ incidentCategory: v.incidentCategory,
|
|
349
|
+ rules: [v]
|
|
350
|
+ })
|
358
|
351
|
}
|
359
|
|
- }
|
360
|
|
- console.log($scope.myData)
|
|
352
|
+ })
|
|
353
|
+ $scope.myData = arr;
|
361
|
354
|
for (var i = 0; i < $scope.myData.length; i++) {
|
362
|
|
- if ($scope.myData[i].status == "执行中") {
|
363
|
|
- $scope.myData[i].style = "fa fa-play";
|
364
|
|
- } else if ($scope.myData[i].status == "暂停中") {
|
365
|
|
- $scope.myData[i].style = "fa fa-pause";
|
366
|
|
- };
|
367
|
|
- $scope.myData[i].runStatus = $scope.transfer($scope.myData[i].status);
|
|
355
|
+ $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
|
368
|
356
|
}
|
|
357
|
+ console.log($scope.myData)
|
369
|
358
|
} else {
|
370
|
359
|
SweetAlert.swal({
|
371
|
360
|
title: "数据为空",
|
|
@@ -382,38 +371,47 @@ app.controller('scoreConfigurationPerformanceCtrl', ["$rootScope", "$scope", "$s
|
382
|
371
|
$scope.ldloading = {};
|
383
|
372
|
$scope.fileData = {
|
384
|
373
|
"idx": 0,
|
385
|
|
- "sum": 10,
|
386
|
|
- "inspection": {}
|
|
374
|
+ "sum": 9999,
|
|
375
|
+ "incidentcategory": {}
|
387
|
376
|
}
|
388
|
377
|
$scope.searchinspe = function () {
|
389
|
378
|
$scope.refreshData('expand-right', $scope.fileData);
|
390
|
379
|
}
|
391
|
380
|
// 获取一级分类
|
392
|
|
- $scope.getOneCates = function () {
|
|
381
|
+ $scope.getOneCates = function (keyword='') {
|
|
382
|
+ $scope.one_cates = [];
|
393
|
383
|
api_configure_data.fetchDataList("incidentcategory", {
|
394
|
384
|
"idx": 0,
|
395
|
385
|
"sum": 1000,
|
396
|
386
|
"incidentcategory": {
|
397
|
|
- hierarchy: 1
|
|
387
|
+ category: keyword,
|
|
388
|
+ selectType: 'one'
|
398
|
389
|
}
|
399
|
390
|
}).then(function (res) {
|
400
|
|
- $scope.one_cates = res.list
|
|
391
|
+ $scope.one_cates = res.list;
|
401
|
392
|
})
|
402
|
393
|
}
|
403
|
|
- $scope.getOneCates()
|
|
394
|
+ // 选择一级分类
|
|
395
|
+ $scope.changeOneCate = function(oneCate){
|
|
396
|
+ $scope.getTwoCates(oneCate);
|
|
397
|
+ }
|
404
|
398
|
// 获取二级分类
|
405
|
|
- $scope.getTwoCates = function () {
|
|
399
|
+ $scope.getTwoCates = function (oneCate, keyword='') {
|
|
400
|
+ $scope.two_cates = [];
|
|
401
|
+ if(!oneCate){
|
|
402
|
+ return;
|
|
403
|
+ }
|
406
|
404
|
api_configure_data.fetchDataList("incidentcategory", {
|
407
|
405
|
"idx": 0,
|
408
|
406
|
"sum": 1000,
|
409
|
407
|
"incidentcategory": {
|
410
|
|
- hierarchy: 1
|
|
408
|
+ category: keyword,
|
|
409
|
+ parentCategory:{id:oneCate.id}
|
411
|
410
|
}
|
412
|
411
|
}).then(function (res) {
|
413
|
412
|
$scope.two_cates = res.list
|
414
|
413
|
})
|
415
|
414
|
}
|
416
|
|
- $scope.getTwoCates()
|
417
|
415
|
|
418
|
416
|
$scope.refreshData('expand-right', $scope.fileData);
|
419
|
417
|
$scope.timer = $interval(function () {
|
|
@@ -422,75 +420,4 @@ app.controller('scoreConfigurationPerformanceCtrl', ["$rootScope", "$scope", "$s
|
422
|
420
|
$scope.$on('$destroy', function () {
|
423
|
421
|
$interval.cancel($scope.timer)
|
424
|
422
|
})
|
425
|
|
-}]);
|
426
|
|
-
|
427
|
|
-app.factory('inspectListMobileCtrlTree', ['api_bpm_data', function (api_bpm_data) {
|
428
|
|
-
|
429
|
|
- function convertListToTree(data, treeMap) {
|
430
|
|
- var idToNodeMap = {};
|
431
|
|
- var root = null;
|
432
|
|
- var parentNode = null;
|
433
|
|
- for (var i = 0; i < data.length; i++) {
|
434
|
|
- var datum = data[i];
|
435
|
|
- datum.children = [];
|
436
|
|
- idToNodeMap[datum.id] = datum;
|
437
|
|
- if (typeof datum.parent === "undefined" || datum.parent == null) {
|
438
|
|
- root = datum;
|
439
|
|
- treeMap[datum.id] = root;
|
440
|
|
- } else {
|
441
|
|
- parentNode = idToNodeMap[datum.parent];
|
442
|
|
- delete datum.parent;
|
443
|
|
- parentNode.children.push(datum);
|
444
|
|
- }
|
445
|
|
- }
|
446
|
|
- return root;
|
447
|
|
- };
|
448
|
|
-
|
449
|
|
- function convertParentToChildList(data) {
|
450
|
|
- var treeMap = {};
|
451
|
|
- var list = [];
|
452
|
|
- convertListToTree(data, treeMap);
|
453
|
|
- angular.forEach(treeMap, function (item) {
|
454
|
|
- list.push(item);
|
455
|
|
- });
|
456
|
|
- return list;
|
457
|
|
- };
|
458
|
|
-
|
459
|
|
-
|
460
|
|
- var forEachEelement = function forEachEelement(response) {
|
461
|
|
- var objects = [];
|
462
|
|
- angular.forEach(response.list, function (ObjIndex, index, destObj) {
|
463
|
|
- var object = {};
|
464
|
|
- object.id = ObjIndex.id;
|
465
|
|
- object.label = ObjIndex.type;
|
466
|
|
- if (ObjIndex.parent && ObjIndex.parent.id != 0) {
|
467
|
|
- object.parent = ObjIndex.parent.id;
|
468
|
|
- };
|
469
|
|
- if (ObjIndex.formUiEdit) {
|
470
|
|
- object.formUiEdit = ObjIndex.formUiEdit;
|
471
|
|
- };
|
472
|
|
- if (ObjIndex.formUiName) {
|
473
|
|
- object.formUiName = ObjIndex.formUiName;
|
474
|
|
- };
|
475
|
|
-
|
476
|
|
- if (ObjIndex.processKey) {
|
477
|
|
- object.processKey = ObjIndex.processKey;
|
478
|
|
- };
|
479
|
|
- if (ObjIndex.formUiStart) {
|
480
|
|
- object.formUiStart = ObjIndex.formUiStart;
|
481
|
|
- };
|
482
|
|
-
|
483
|
|
- objects.push(object);
|
484
|
|
- });
|
485
|
|
- var my_data = convertParentToChildList(objects);
|
486
|
|
- var tree_data = angular.copy(my_data);
|
487
|
|
-
|
488
|
|
- return {
|
489
|
|
- 'my_data': my_data,
|
490
|
|
- 'tree_data': tree_data
|
491
|
|
- }
|
492
|
|
- }
|
493
|
|
-
|
494
|
|
- return forEachEelement;
|
495
|
|
-
|
496
|
423
|
}]);
|