auditLogCtrl.js 26 KB

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