|
@@ -0,0 +1,698 @@
|
|
1
|
+'use strict';
|
|
2
|
+/**
|
|
3
|
+ * controller for User Profile Example
|
|
4
|
+ */
|
|
5
|
+app.controller('auditLogCtrl', ["$rootScope", "$scope", "$state", "$timeout", "$interval", "$modal", "SweetAlert", "i18nService", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_user_data", "api_login", "api_configure_data", function ($rootScope, $scope, $state, $timeout, $interval, $modal, SweetAlert, i18nService, uiGridConstants, uiGridGroupingConstants, Restangular, api_user_data, api_login, api_configure_data) {
|
|
6
|
+ $scope.langs = i18nService.getAllLangs();
|
|
7
|
+ $scope.lang = 'zh-cn';
|
|
8
|
+
|
|
9
|
+ i18nService.setCurrentLang($scope.lang);
|
|
10
|
+
|
|
11
|
+ var loginUser = $rootScope.user;
|
|
12
|
+ $scope.xinzeng = false;
|
|
13
|
+ $scope.shanchu = false;
|
|
14
|
+ $scope.bianji = false;
|
|
15
|
+ $scope.fabu = false;
|
|
16
|
+ $scope.chehui = false;
|
|
17
|
+ for (var i = 0; i < loginUser.menu.length; i++) {
|
|
18
|
+ if (loginUser.menu[i].link == "gonggaoliebiao_xinzeng") {
|
|
19
|
+ $scope.xinzeng = true
|
|
20
|
+ }
|
|
21
|
+ if (loginUser.menu[i].link == "gonggaoliebiao_shanchu") {
|
|
22
|
+ $scope.shanchu = true
|
|
23
|
+ }
|
|
24
|
+ if (loginUser.menu[i].link == "gonggaoliebiao_bianji") {
|
|
25
|
+ $scope.bianji = true
|
|
26
|
+ }
|
|
27
|
+ if (loginUser.menu[i].link == "gonggaoliebiao_fabu") {
|
|
28
|
+ $scope.fabu = true
|
|
29
|
+ }
|
|
30
|
+ if (loginUser.menu[i].link == "gonggaoliebiao_chehui") {
|
|
31
|
+ $scope.chehui = true
|
|
32
|
+ }
|
|
33
|
+ }
|
|
34
|
+ $scope.gridOptions = {};
|
|
35
|
+ $scope.gridOptions.data = 'myData';
|
|
36
|
+ $scope.gridOptions.enableColumnResizing = true;
|
|
37
|
+ $scope.gridOptions.enableFiltering = true;
|
|
38
|
+ $scope.gridOptions.enableGridMenu = true;
|
|
39
|
+ $scope.gridOptions.enableRowSelection = true;
|
|
40
|
+ $scope.gridOptions.showGridFooter = true;
|
|
41
|
+ $scope.gridOptions.showColumnFooter = false;
|
|
42
|
+ $scope.gridOptions.fastWatch = true;
|
|
43
|
+ $scope.gridOptions.useExternalFiltering = true;
|
|
44
|
+ $scope.gridOptions.useExternalPagination = true;
|
|
45
|
+ $scope.gridOptions.paginationPageSizes = [10, 20, 50, 100];
|
|
46
|
+ $scope.gridOptions.paginationPageSize = 10;
|
|
47
|
+ $scope.gridOptions.multiSelect = true;
|
|
48
|
+
|
|
49
|
+ $scope.gridOptions.rowTemplate = "<div ng-dblclick=\"grid.appScope.onDblClick(row.entity)\" ng-repeat=\"(colRenderIndex, col) in colContainer.renderedColumns track by col.uid\" ui-grid-one-bind-id-grid=\"rowRenderIndex + '-' + col.uid + '-cell'\" class=\"ui-grid-cell\" ng-class=\"{ 'ui-grid-row-header-cell': col.isRowHeader }\" role=\"{{col.isRowHeader ? 'rowheader' : 'gridcell'}}\" ui-grid-cell></div>";
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+ $scope.gridOptions.rowIdentity = function (row) {
|
|
53
|
+ return row.id;
|
|
54
|
+ };
|
|
55
|
+ $scope.gridOptions.getRowIdentity = function (row) {
|
|
56
|
+ return row.id;
|
|
57
|
+ };
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+ $scope.transferRole = function (roles) {
|
|
61
|
+ var tempValue = "";
|
|
62
|
+ angular.forEach(roles, function (item) {
|
|
63
|
+ if (tempValue != "") {
|
|
64
|
+ tempValue = tempValue + "/";
|
|
65
|
+ }
|
|
66
|
+ tempValue = tempValue + item.role;
|
|
67
|
+ })
|
|
68
|
+ return tempValue;
|
|
69
|
+ }
|
|
70
|
+
|
|
71
|
+ $scope.transferStatus = function (flag) {
|
|
72
|
+ return (flag == 0) ? "有效" : "无效";
|
|
73
|
+ }
|
|
74
|
+ $scope.transfergroup = function (group) {
|
|
75
|
+ var groupData = '';
|
|
76
|
+ angular.forEach(group, function (item) {
|
|
77
|
+ if (groupData == '') {
|
|
78
|
+ groupData = item.groupName;
|
|
79
|
+ } else {
|
|
80
|
+ groupData = groupData + "/" + item.groupName;
|
|
81
|
+ }
|
|
82
|
+ })
|
|
83
|
+ return groupData;
|
|
84
|
+ }
|
|
85
|
+
|
|
86
|
+ //remote data
|
|
87
|
+
|
|
88
|
+ $scope.gridOptions.columnDefs = [{
|
|
89
|
+ name: 'item',
|
|
90
|
+ displayName: '序号',
|
|
91
|
+ enableFiltering: false,
|
|
92
|
+ width: 50
|
|
93
|
+ },
|
|
94
|
+ {
|
|
95
|
+ name: 'opTime',
|
|
96
|
+ displayName: '日期时间',
|
|
97
|
+ width: '15%',
|
|
98
|
+ enableFiltering: false,
|
|
99
|
+ cellTemplate: '<div>' +
|
|
100
|
+ '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center">{{grid.appScope.transferTime(row.entity.opTime)}}</div>' +
|
|
101
|
+ '</div>'
|
|
102
|
+ },
|
|
103
|
+ {
|
|
104
|
+ name: 'userAccount',
|
|
105
|
+ displayName: '用户工号',
|
|
106
|
+ width: '15%',
|
|
107
|
+ enableFiltering: false
|
|
108
|
+ },
|
|
109
|
+ {
|
|
110
|
+ name: 'userName',
|
|
111
|
+ displayName: '用户姓名',
|
|
112
|
+ width: '15%',
|
|
113
|
+ enableFiltering: false
|
|
114
|
+ },
|
|
115
|
+ {
|
|
116
|
+ name: 'extra1',
|
|
117
|
+ displayName: '事件类型',
|
|
118
|
+ width: '15%',
|
|
119
|
+ enableFiltering: false
|
|
120
|
+ },
|
|
121
|
+ {
|
|
122
|
+ name: 'opValue',
|
|
123
|
+ displayName: '事件是否成功',
|
|
124
|
+ width: '15%',
|
|
125
|
+ enableFiltering: false,
|
|
126
|
+ cellTemplate: '<div>' +
|
|
127
|
+ '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center">{{row.entity.opValue ? "是" : "否"}}</div>' +
|
|
128
|
+ '</div>'
|
|
129
|
+ },
|
|
130
|
+ // { name: 'content', displayName: '内容', enableFiltering: false }
|
|
131
|
+ // '<div class="links cl-effect-1">' +
|
|
132
|
+ // '<a ng-click="grid.appScope.selectRowFunction(row.entity)" tooltip="编辑" tooltip-placement="left"><i class="fa fa-pencil-square-o"></i></a>'+
|
|
133
|
+ // '</div>' , width:100, enableFiltering:false}
|
|
134
|
+ // {
|
|
135
|
+ // name: '操作',
|
|
136
|
+ // enableFiltering: false,
|
|
137
|
+ // minWidth: "300",
|
|
138
|
+ // cellTemplate: '<div class="links cl-effect-1 pull-left ui-grid-cell-contents">' +
|
|
139
|
+ // '<a ng-click="grid.appScope.saveData(row.entity)" ng-show="grid.appScope.showBianji(row.entity)&&grid.appScope.bianji">编辑</a>' +
|
|
140
|
+ // '<a ng-click="grid.appScope.removeData(row.entity)" ng-show="grid.appScope.showShanchu(row.entity)&&grid.appScope.shanchu">删除</a>' +
|
|
141
|
+ // '<a ng-click="grid.appScope.seeData(row.entity)">查看</a>' +
|
|
142
|
+ // '<a ng-click="grid.appScope.release(row.entity)" ng-show="grid.appScope.showFabu(row.entity)&&grid.appScope.fabu">发布</a>' +
|
|
143
|
+ // '<a ng-click="grid.appScope.withdraw(row.entity)" ng-show="grid.appScope.showChehui(row.entity)&&grid.appScope.chehui">撤回</a>' +
|
|
144
|
+ // '</div>'
|
|
145
|
+
|
|
146
|
+ // },
|
|
147
|
+ ];
|
|
148
|
+
|
|
149
|
+ $scope.transferTime = function(time) {
|
|
150
|
+ if(time){
|
|
151
|
+ return moment(time).format('YYYY-MM-DD HH:mm:ss');
|
|
152
|
+ }else{
|
|
153
|
+ return '';
|
|
154
|
+ }
|
|
155
|
+ }
|
|
156
|
+ // 查看显示隐藏
|
|
157
|
+ $scope.showChehui = function (data) {
|
|
158
|
+ if (data.statusName == "已发布") {
|
|
159
|
+ return true
|
|
160
|
+ } else {
|
|
161
|
+ return false
|
|
162
|
+ }
|
|
163
|
+ }
|
|
164
|
+ // 发布显示隐藏
|
|
165
|
+ $scope.showFabu = function (data) {
|
|
166
|
+ if (data.statusName == "暂存" || data.statusName == "已撤销") {
|
|
167
|
+ return true
|
|
168
|
+ } else {
|
|
169
|
+ return false
|
|
170
|
+ }
|
|
171
|
+ }
|
|
172
|
+ // // 查看显示隐藏
|
|
173
|
+ // $scope.showChakan=function(data){
|
|
174
|
+ // if(data.statusName=="已发布"){
|
|
175
|
+ // return true
|
|
176
|
+ // }else{
|
|
177
|
+ // return false
|
|
178
|
+ // }
|
|
179
|
+ // }
|
|
180
|
+ // 删除显示隐藏
|
|
181
|
+ $scope.showShanchu = function (data) {
|
|
182
|
+ if (data.statusName == "暂存" || data.statusName == "已撤销") {
|
|
183
|
+ return true
|
|
184
|
+ } else {
|
|
185
|
+ return false
|
|
186
|
+ }
|
|
187
|
+ }
|
|
188
|
+ // 编辑显示隐藏
|
|
189
|
+ $scope.showBianji = function (data) {
|
|
190
|
+ if (data.statusName == "暂存" || data.statusName == "已撤销") {
|
|
191
|
+ return true
|
|
192
|
+ } else {
|
|
193
|
+ return false
|
|
194
|
+ }
|
|
195
|
+ }
|
|
196
|
+ //区域地点过滤
|
|
197
|
+ $scope.key = {};
|
|
198
|
+ api_user_data.fetchDataList('area', {
|
|
199
|
+ "idx": 0,
|
|
200
|
+ "sum": 1000
|
|
201
|
+ }).then(function (response) {
|
|
202
|
+ if (response) {
|
|
203
|
+ if (response.status = 200) {
|
|
204
|
+ $scope.outarea = response.list;
|
|
205
|
+ }
|
|
206
|
+ }
|
|
207
|
+ })
|
|
208
|
+ $scope.onChangearea = function (data) {
|
|
209
|
+ delete $scope.key.place;
|
|
210
|
+ if ($scope.memoryfilterData.incident) {
|
|
211
|
+ delete $scope.memoryfilterData.incident.place;
|
|
212
|
+ }
|
|
213
|
+ var fildata = {
|
|
214
|
+ "idx": 0,
|
|
215
|
+ "sum": 1000,
|
|
216
|
+ "place": {
|
|
217
|
+ areaId: data.area.id
|
|
218
|
+ }
|
|
219
|
+ };
|
|
220
|
+ api_user_data.fetchDataList('place', fildata).then(function (response) {
|
|
221
|
+ if (response) {
|
|
222
|
+ if (response.status = 200) {
|
|
223
|
+ $scope.outplace = response.list;
|
|
224
|
+ }
|
|
225
|
+ }
|
|
226
|
+ })
|
|
227
|
+ };
|
|
228
|
+ $scope.open = function ($event) {
|
|
229
|
+ $event.preventDefault();
|
|
230
|
+ $event.stopPropagation();
|
|
231
|
+
|
|
232
|
+ $scope.opened = !$scope.opened;
|
|
233
|
+ };
|
|
234
|
+ $scope.endOpen = function ($event) {
|
|
235
|
+ $event.preventDefault();
|
|
236
|
+ $event.stopPropagation();
|
|
237
|
+ $scope.startOpened = false;
|
|
238
|
+ $scope.endOpened = !$scope.endOpened;
|
|
239
|
+ };
|
|
240
|
+ $scope.startOpen = function ($event) {
|
|
241
|
+ $event.preventDefault();
|
|
242
|
+ $event.stopPropagation();
|
|
243
|
+ $scope.endOpened = false;
|
|
244
|
+ $scope.startOpened = !$scope.startOpened;
|
|
245
|
+ };
|
|
246
|
+ // 获取创建人
|
|
247
|
+ $scope.getCreateUser = function () {
|
|
248
|
+ api_configure_data.fetchDataList("user", {
|
|
249
|
+ "idx": 0,
|
|
250
|
+ "sum": 1000,
|
|
251
|
+ "user":{
|
|
252
|
+ "simple":true
|
|
253
|
+ }
|
|
254
|
+ }).then(function (res) {
|
|
255
|
+ $scope.createUserData = res.list
|
|
256
|
+ })
|
|
257
|
+ }
|
|
258
|
+ // $scope.getCreateUser()
|
|
259
|
+ //列表操作按钮-编辑
|
|
260
|
+ $scope.saveData = function (data) {
|
|
261
|
+ var modelData = {
|
|
262
|
+ model: {
|
|
263
|
+ notice: data
|
|
264
|
+ }
|
|
265
|
+ };
|
|
266
|
+ $state.go('app.system.form', {
|
|
267
|
+ formKey: 'noticeEdi',
|
|
268
|
+ service: 'api_user_data',
|
|
269
|
+ model: JSON.stringify(modelData),
|
|
270
|
+ 'isNoticeEdit': "true"
|
|
271
|
+ });
|
|
272
|
+ };
|
|
273
|
+ //列表操作按钮-查看
|
|
274
|
+ // $scope.onDblClick = function(data) {
|
|
275
|
+ // var modelfile = { model: { notice: data } };
|
|
276
|
+ // $state.go('app.system.form_editor', { formKey: 'noticeDetail', service: 'api_user_data', model: JSON.stringify(modelfile) });
|
|
277
|
+ // };
|
|
278
|
+ $scope.seeData = function (data) {
|
|
279
|
+ var modelfile = {
|
|
280
|
+ model: {
|
|
281
|
+ notice: data
|
|
282
|
+ }
|
|
283
|
+ };
|
|
284
|
+ $state.go('app.system.form_editor', {
|
|
285
|
+ formKey: 'noticeDetail',
|
|
286
|
+ service: 'api_user_data',
|
|
287
|
+ model: JSON.stringify(modelfile)
|
|
288
|
+ });
|
|
289
|
+ };
|
|
290
|
+ //列表操作按钮-新增
|
|
291
|
+ $scope.addData = function () {
|
|
292
|
+ // console.log(loginUser)
|
|
293
|
+ var modelData = {
|
|
294
|
+ model: {
|
|
295
|
+ notice: {
|
|
296
|
+ dept: {
|
|
297
|
+ id: loginUser.dept.id
|
|
298
|
+ }
|
|
299
|
+ }
|
|
300
|
+ }
|
|
301
|
+ };
|
|
302
|
+ $state.go('app.system.form', {
|
|
303
|
+ formKey: 'noticeEditor',
|
|
304
|
+ service: 'api_user_data',
|
|
305
|
+ model: JSON.stringify(modelData)
|
|
306
|
+ });
|
|
307
|
+ }
|
|
308
|
+ // 发布
|
|
309
|
+ $scope.release = function (data) {
|
|
310
|
+ var modalInstance = $modal.open({
|
|
311
|
+ templateUrl: 'assets/views/delete.html',
|
|
312
|
+ controller: function ($scope, scope, $modalInstance, api_bpm_data) {
|
|
313
|
+ $scope.title = '公告发布';
|
|
314
|
+ $scope.connect = '确定要发布此公告?';
|
|
315
|
+ $scope.ok = function () {
|
|
316
|
+ $modalInstance.close(data);
|
|
317
|
+ };
|
|
318
|
+ $scope.cancel = function () {
|
|
319
|
+ $modalInstance.dismiss('cancel');
|
|
320
|
+ };
|
|
321
|
+ },
|
|
322
|
+ size: 'sm',
|
|
323
|
+ resolve: {
|
|
324
|
+ scope: function () {
|
|
325
|
+ return $scope;
|
|
326
|
+ }
|
|
327
|
+ }
|
|
328
|
+ });
|
|
329
|
+ modalInstance.result.then(function (selectedItem) {
|
|
330
|
+ if (selectedItem) {
|
|
331
|
+ // console.log(selectedItem);
|
|
332
|
+ selectedItem.status = 1;
|
|
333
|
+ delete selectedItem.item;
|
|
334
|
+ delete selectedItem.statusName;
|
|
335
|
+ api_user_data.updData('notice', {
|
|
336
|
+ "notice": selectedItem
|
|
337
|
+ }).then(function (response) {
|
|
338
|
+ if (response.data) {
|
|
339
|
+ SweetAlert.swal({
|
|
340
|
+ title: "发布成功!",
|
|
341
|
+ type: "success",
|
|
342
|
+ confirmButtonColor: "#007AFF"
|
|
343
|
+ }, function () {
|
|
344
|
+ $scope.myData = _.reject($scope.myData, function (o) {
|
|
345
|
+ return _.includes(selectedItem, o.id);
|
|
346
|
+ });
|
|
347
|
+ $scope.gridOptions.totalItems = $scope.gridOptions.totalItems - selectedItem.length;
|
|
348
|
+ $scope.refreshData('expand-right', $scope.jry_fileData);
|
|
349
|
+ });
|
|
350
|
+
|
|
351
|
+ } else {
|
|
352
|
+ SweetAlert.swal({
|
|
353
|
+ title: "操作异常!",
|
|
354
|
+ text: "系统异常,请稍后重试,或者联系管理员!",
|
|
355
|
+ type: "error"
|
|
356
|
+ });
|
|
357
|
+ }
|
|
358
|
+ })
|
|
359
|
+ }
|
|
360
|
+ })
|
|
361
|
+ }
|
|
362
|
+ $scope.minTime = "";
|
|
363
|
+ $scope.maxTime = "";
|
|
364
|
+ // 搜索
|
|
365
|
+ $scope.searchData = function () {
|
|
366
|
+ if ($scope.minTime) {
|
|
367
|
+ $scope.jry_fileData.notice.createTime = moment($scope.minTime).format("YYYY-MM-DD HH:mm:ss")
|
|
368
|
+ }
|
|
369
|
+ if ($scope.maxTime) {
|
|
370
|
+ $scope.jry_fileData.notice.endTime = moment($scope.maxTime).format("YYYY-MM-DD HH:mm:ss")
|
|
371
|
+ }
|
|
372
|
+ $scope.refreshData('expand-right', $scope.jry_fileData);
|
|
373
|
+ }
|
|
374
|
+ // 清空
|
|
375
|
+ $scope.clean = function () {
|
|
376
|
+ delete $scope.jry_fileData.notice.title;
|
|
377
|
+ delete $scope.jry_fileData.notice.createTime;
|
|
378
|
+ $scope.minTime = "";
|
|
379
|
+ delete $scope.jry_fileData.notice.endTime;
|
|
380
|
+ $scope.maxTime = "";
|
|
381
|
+ delete $scope.jry_fileData.notice.createUser;
|
|
382
|
+ $scope.refreshData('expand-right', $scope.jry_fileData);
|
|
383
|
+ }
|
|
384
|
+ // 撤回
|
|
385
|
+ $scope.withdraw = function (data) {
|
|
386
|
+ var modalInstance = $modal.open({
|
|
387
|
+ templateUrl: 'assets/views/delete.html',
|
|
388
|
+ controller: function ($scope, scope, $modalInstance, api_bpm_data) {
|
|
389
|
+ $scope.title = '公告撤回';
|
|
390
|
+ $scope.connect = '确定要撤回此公告?';
|
|
391
|
+ $scope.ok = function () {
|
|
392
|
+ $modalInstance.close(data);
|
|
393
|
+ };
|
|
394
|
+ $scope.cancel = function () {
|
|
395
|
+ $modalInstance.dismiss('cancel');
|
|
396
|
+ };
|
|
397
|
+ },
|
|
398
|
+ size: 'sm',
|
|
399
|
+ resolve: {
|
|
400
|
+ scope: function () {
|
|
401
|
+ return $scope;
|
|
402
|
+ }
|
|
403
|
+ }
|
|
404
|
+ });
|
|
405
|
+ modalInstance.result.then(function (selectedItem) {
|
|
406
|
+ if (selectedItem) {
|
|
407
|
+ // console.log(selectedItem);
|
|
408
|
+ selectedItem.status = 2;
|
|
409
|
+ delete selectedItem.item;
|
|
410
|
+ delete selectedItem.statusName;
|
|
411
|
+ api_user_data.updData('notice', {
|
|
412
|
+ "notice": selectedItem
|
|
413
|
+ }).then(function (response) {
|
|
414
|
+ if (response.data) {
|
|
415
|
+ SweetAlert.swal({
|
|
416
|
+ title: "撤回成功!",
|
|
417
|
+ type: "success",
|
|
418
|
+ confirmButtonColor: "#007AFF"
|
|
419
|
+ }, function () {
|
|
420
|
+ $scope.myData = _.reject($scope.myData, function (o) {
|
|
421
|
+ return _.includes(selectedItem, o.id);
|
|
422
|
+ });
|
|
423
|
+ $scope.gridOptions.totalItems = $scope.gridOptions.totalItems - selectedItem.length;
|
|
424
|
+ $scope.refreshData('expand-right', $scope.jry_fileData);
|
|
425
|
+ });
|
|
426
|
+
|
|
427
|
+ } else {
|
|
428
|
+ SweetAlert.swal({
|
|
429
|
+ title: "操作异常!",
|
|
430
|
+ text: "系统异常,请稍后重试,或者联系管理员!",
|
|
431
|
+ type: "error"
|
|
432
|
+ });
|
|
433
|
+ }
|
|
434
|
+ })
|
|
435
|
+ }
|
|
436
|
+ })
|
|
437
|
+ }
|
|
438
|
+
|
|
439
|
+ // 删除
|
|
440
|
+ $scope.removeData = function (data) {
|
|
441
|
+ var modalInstance = $modal.open({
|
|
442
|
+ templateUrl: 'assets/views/delete.html',
|
|
443
|
+ controller: function ($scope, scope, $modalInstance, api_bpm_data) {
|
|
444
|
+ var rmvList = [];
|
|
445
|
+ $scope.title = '公告删除';
|
|
446
|
+ $scope.connect = '确定要删除此公告?';
|
|
447
|
+ // angular.forEach(scope.selected.items, function(item) {
|
|
448
|
+ // rmvList.push(item.id);
|
|
449
|
+ // });
|
|
450
|
+ rmvList.push(data.id);
|
|
451
|
+ $scope.ok = function () {
|
|
452
|
+ $modalInstance.close(rmvList);
|
|
453
|
+ };
|
|
454
|
+ $scope.cancel = function () {
|
|
455
|
+ $modalInstance.dismiss('cancel');
|
|
456
|
+ };
|
|
457
|
+ },
|
|
458
|
+ size: 'sm',
|
|
459
|
+ resolve: {
|
|
460
|
+ scope: function () {
|
|
461
|
+ return $scope;
|
|
462
|
+ }
|
|
463
|
+ }
|
|
464
|
+ });
|
|
465
|
+ modalInstance.result.then(function (selectedItem) {
|
|
466
|
+ if (selectedItem) {
|
|
467
|
+ if (selectedItem.length > 0) {
|
|
468
|
+ api_user_data.rmvData('notice', selectedItem).then(function (response) {
|
|
469
|
+ if (response.data) {
|
|
470
|
+ SweetAlert.swal({
|
|
471
|
+ title: "删除成功!",
|
|
472
|
+ type: "success",
|
|
473
|
+ confirmButtonColor: "#007AFF"
|
|
474
|
+ }, function () {
|
|
475
|
+ $scope.myData = _.reject($scope.myData, function (o) {
|
|
476
|
+ return _.includes(selectedItem, o.id);
|
|
477
|
+ });
|
|
478
|
+ $scope.selected = {
|
|
479
|
+ items: []
|
|
480
|
+ };
|
|
481
|
+ $scope.gridOptions.totalItems = $scope.gridOptions.totalItems - selectedItem.length;
|
|
482
|
+ // $scope.gridApi.grid.selection.selectedCount = 0;
|
|
483
|
+ $scope.refreshData('expand-right', $scope.jry_fileData);
|
|
484
|
+ });
|
|
485
|
+
|
|
486
|
+ } else {
|
|
487
|
+ SweetAlert.swal({
|
|
488
|
+ title: "操作异常!",
|
|
489
|
+ text: "系统异常,请稍后重试,或者联系管理员!",
|
|
490
|
+ type: "error"
|
|
491
|
+ });
|
|
492
|
+ }
|
|
493
|
+ })
|
|
494
|
+ }
|
|
495
|
+ }
|
|
496
|
+ })
|
|
497
|
+ }
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+ $scope.selected = {
|
|
502
|
+ items: []
|
|
503
|
+ }
|
|
504
|
+
|
|
505
|
+ $scope.editted = {
|
|
506
|
+ items: []
|
|
507
|
+ }
|
|
508
|
+ $scope.jry_fileData = {
|
|
509
|
+ "idx": 0,
|
|
510
|
+ "sum": 10,
|
|
511
|
+ "operationLog": {
|
|
512
|
+ opType:'audit_log',
|
|
513
|
+ }
|
|
514
|
+ }
|
|
515
|
+ $scope.gridOptions.onRegisterApi = function (gridApi) {
|
|
516
|
+ $scope.gridApi = gridApi;
|
|
517
|
+
|
|
518
|
+ // gridApi.edit.on.afterCellEdit($scope,function(rowEntity, colDef, newValue, oldValue){
|
|
519
|
+ // // console.log(rowEntity);
|
|
520
|
+ // });
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+ gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
|
|
524
|
+ var filtersData = $scope.memoryfilterData;
|
|
525
|
+ filtersData.idx = newPage - 1;
|
|
526
|
+ $scope.jry_fileData.idx = newPage - 1;
|
|
527
|
+ filtersData.sum = pageSize;
|
|
528
|
+ $scope.jry_fileData.sum = pageSize;
|
|
529
|
+ defaultFilterData = filtersData;
|
|
530
|
+ $scope.refreshData('expand-right', $scope.jry_fileData);
|
|
531
|
+ });
|
|
532
|
+
|
|
533
|
+ // gridApi.selection.on.rowSelectionChanged($scope, function(scope) {
|
|
534
|
+ // console.log("ok");
|
|
535
|
+ // var j = 0;
|
|
536
|
+ // for (var i = 0; i <= scope.grid.appScope.selected.items.length; i++) {
|
|
537
|
+ // if (scope.grid.appScope.selected.items[i] == scope.entity) {
|
|
538
|
+ // j++;
|
|
539
|
+ // break;
|
|
540
|
+ // }
|
|
541
|
+ // }
|
|
542
|
+ // // console.log("j="+j)
|
|
543
|
+ // if (j == 1) {
|
|
544
|
+ // scope.grid.appScope.selected.items.splice(i, 1);
|
|
545
|
+ // } else {
|
|
546
|
+ // scope.grid.appScope.selected.items.push(scope.entity)
|
|
547
|
+ // }
|
|
548
|
+ // });
|
|
549
|
+ // gridApi.selection.on.rowSelectionChangedBatch($scope, function(rows) {
|
|
550
|
+ // var selectitem = [];
|
|
551
|
+ // selectitem = angular.copy($scope.selected.items);
|
|
552
|
+ // for (var j = 0; j < rows.length; j++) {
|
|
553
|
+ // if (rows[j].isSelected == true) {
|
|
554
|
+ // selectitem.push(rows[j].entity);
|
|
555
|
+ // } else {
|
|
556
|
+ // delete selectitem[j];
|
|
557
|
+ // // rows.splice(j, 1);
|
|
558
|
+ // }
|
|
559
|
+ // }
|
|
560
|
+ // $scope.selected.items = [];
|
|
561
|
+ // for (var i = 0; i < selectitem.length; i++) {
|
|
562
|
+ // if (selectitem[i]) {
|
|
563
|
+ // $scope.selected.items.push(selectitem[i]);
|
|
564
|
+ // }
|
|
565
|
+ // }
|
|
566
|
+ // });
|
|
567
|
+
|
|
568
|
+ gridApi.core.on.filterChanged($scope, function () {
|
|
569
|
+ var grid = this.grid;
|
|
570
|
+ // var filtersData = {
|
|
571
|
+ // idx: 0,
|
|
572
|
+ // sum: 10
|
|
573
|
+ // };
|
|
574
|
+ var filtersData = $scope.memoryfilterData;
|
|
575
|
+ angular.forEach(grid.columns, function (item) {
|
|
576
|
+ if (item.enableFiltering) {
|
|
577
|
+ if (angular.isDefined(item.filters[0].term) && item.filters[0].term != '') {
|
|
578
|
+ if (angular.isUndefined(filtersData['user'])) {
|
|
579
|
+ filtersData['notice'] = {};
|
|
580
|
+ // filtersData['user']['flag'] = -1;
|
|
581
|
+ filtersData['notice'][item.field] = item.filters[0].term;
|
|
582
|
+ } else {
|
|
583
|
+ // filtersData.user.flag = -1;
|
|
584
|
+ filtersData.notice[item.field] = item.filters[0].term;
|
|
585
|
+ }
|
|
586
|
+ // filtersData['user']['flag'] = -1;
|
|
587
|
+ // filtersData['user'][item.field] = item.filters[0].term;
|
|
588
|
+ }
|
|
589
|
+ }
|
|
590
|
+ });
|
|
591
|
+ $scope.memoryfilterData = filtersData;
|
|
592
|
+ $scope.refreshData('expand-right', filtersData);
|
|
593
|
+ });
|
|
594
|
+ };
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+ var defaultFilterData = {
|
|
598
|
+ "idx": 0,
|
|
599
|
+ "sum": 10,
|
|
600
|
+ operationLog:{
|
|
601
|
+ opType:'audit_log',
|
|
602
|
+ }
|
|
603
|
+ };
|
|
604
|
+
|
|
605
|
+ $scope.memoryfilterData = {
|
|
606
|
+ "idx": 0,
|
|
607
|
+ "sum": 10,
|
|
608
|
+ operationLog:{
|
|
609
|
+ opType:'audit_log',
|
|
610
|
+ }
|
|
611
|
+ }
|
|
612
|
+
|
|
613
|
+ $scope.ldloading = {};
|
|
614
|
+ $scope.refresh = function (style, filterData) {
|
|
615
|
+ $scope.selected = {
|
|
616
|
+ items: []
|
|
617
|
+ };
|
|
618
|
+ if ($scope.gridApi) {
|
|
619
|
+ // $scope.gridApi.grid.options.paginationCurrentPage = 0;
|
|
620
|
+ // $scope.gridApi.grid.selection.selectedCount = 0;
|
|
621
|
+ }
|
|
622
|
+ $scope.refreshData('expand-right', defaultFilterData);
|
|
623
|
+ }
|
|
624
|
+ //获取数据
|
|
625
|
+ $scope.refreshData = function (style, filterData) {
|
|
626
|
+ $scope.ldloading[style.replace('-', '_')] = true;
|
|
627
|
+ if (angular.isUndefined(filterData)) {
|
|
628
|
+ filterData = defaultFilterData;
|
|
629
|
+ }
|
|
630
|
+ if (angular.isDefined($scope.searchTypes)) {
|
|
631
|
+ filterData['searchType'] = $scope.searchTypes;
|
|
632
|
+ }
|
|
633
|
+ $scope.myData = [];
|
|
634
|
+ // filterData['flag'] = -1;
|
|
635
|
+ // console.log("filterData=" + JSON.stringify(filterData))
|
|
636
|
+ api_user_data.fetchDataList('operationLog', filterData).then(function (data) {
|
|
637
|
+ var myData = Restangular.stripRestangular(data);
|
|
638
|
+ $scope.gridOptions.totalItems = myData.totalNum;
|
|
639
|
+ $scope.myData = myData.list;
|
|
640
|
+ for (var i = 0; i < $scope.myData.length; i++) {
|
|
641
|
+ $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum;
|
|
642
|
+ // $scope.myData[i]['createTime'] = $scope.myData[i]['createTime'].split('.')[0];
|
|
643
|
+ // if ($scope.myData[i].status == 1) {
|
|
644
|
+ // $scope.myData[i]["statusName"] = "已发布"
|
|
645
|
+ // } else if ($scope.myData[i].status == 2) {
|
|
646
|
+ // $scope.myData[i]["statusName"] = "已撤销"
|
|
647
|
+ // } else if ($scope.myData[i].status == 3) {
|
|
648
|
+ // $scope.myData[i]["statusName"] = "暂存"
|
|
649
|
+ // }
|
|
650
|
+ }
|
|
651
|
+ $scope.ldloading[style.replace('-', '_')] = false;
|
|
652
|
+ // console.log("$scope.myData="+JSON.stringify($scope.myData))
|
|
653
|
+ }, function () {
|
|
654
|
+ $scope.ldloading[style.replace('-', '_')] = false;
|
|
655
|
+ });
|
|
656
|
+
|
|
657
|
+ };
|
|
658
|
+ //获取数据2
|
|
659
|
+ $scope.refreshData2 = function (style, filterData) {
|
|
660
|
+ $scope.ldloading[style.replace('-', '_')] = true;
|
|
661
|
+ if (angular.isUndefined(filterData)) {
|
|
662
|
+ filterData = defaultFilterData;
|
|
663
|
+ }
|
|
664
|
+ if (angular.isDefined($scope.searchTypes)) {
|
|
665
|
+ filterData['searchType'] = $scope.searchTypes;
|
|
666
|
+ }
|
|
667
|
+ // filterData['flag'] = -1;
|
|
668
|
+ // console.log("filterData=" + JSON.stringify(filterData))
|
|
669
|
+ api_user_data.fetchDataList('operationLog', filterData).then(function (data) {
|
|
670
|
+ var myData = Restangular.stripRestangular(data);
|
|
671
|
+ $scope.gridOptions.totalItems = myData.totalNum;
|
|
672
|
+ $scope.myData = myData.list;
|
|
673
|
+ for (var i = 0; i < $scope.myData.length; i++) {
|
|
674
|
+ $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum;
|
|
675
|
+ // $scope.myData[i]['createTime'] = $scope.myData[i]['createTime'].split('.')[0];
|
|
676
|
+ // if ($scope.myData[i].status == 1) {
|
|
677
|
+ // $scope.myData[i]["statusName"] = "已发布"
|
|
678
|
+ // } else if ($scope.myData[i].status == 2) {
|
|
679
|
+ // $scope.myData[i]["statusName"] = "已撤销"
|
|
680
|
+ // } else if ($scope.myData[i].status == 3) {
|
|
681
|
+ // $scope.myData[i]["statusName"] = "暂存"
|
|
682
|
+ // }
|
|
683
|
+ }
|
|
684
|
+ $scope.ldloading[style.replace('-', '_')] = false;
|
|
685
|
+ // console.log("$scope.myData="+JSON.stringify($scope.myData))
|
|
686
|
+ }, function () {
|
|
687
|
+ $scope.ldloading[style.replace('-', '_')] = false;
|
|
688
|
+ });
|
|
689
|
+
|
|
690
|
+ };
|
|
691
|
+ $scope.timer = $interval(function () {
|
|
692
|
+ $scope.refreshData2('expand-right', $scope.jry_fileData);
|
|
693
|
+ }, $rootScope.refreshTime);
|
|
694
|
+ $scope.$on('$destroy', function () {
|
|
695
|
+ $interval.cancel($scope.timer)
|
|
696
|
+ })
|
|
697
|
+ $scope.refreshData('expand-right', defaultFilterData);
|
|
698
|
+}]);
|