adminrequesterCtrl.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. // 'use strict';
  2. /**
  3. * controller for User Profile Example
  4. */
  5. app.controller('adminUserListCtrl_requ', ["$rootScope", "$scope", "$http", "$state", "FileUploader", "$timeout", "$interval", "$modal", "SweetAlert", "i18nService", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_user_data", function ($rootScope, $scope, $http, $state, FileUploader, $timeout, $interval, $modal, SweetAlert, i18nService, uiGridConstants, uiGridGroupingConstants, Restangular, api_user_data) {
  6. $scope.langs = i18nService.getAllLangs();
  7. $scope.lang = 'zh-cn';
  8. i18nService.setCurrentLang($scope.lang);
  9. var loginUser = $rootScope.user;
  10. //$scope.allright=false;
  11. //$scope.allrightnot=true;
  12. $scope.gridOptions = {};
  13. $scope.gridOptions.data = 'myData';
  14. $scope.gridOptions.enableColumnResizing = true;
  15. $scope.gridOptions.enableFiltering = true;
  16. $scope.gridOptions.enableGridMenu = true;
  17. $scope.gridOptions.enableRowSelection = true;
  18. $scope.gridOptions.showGridFooter = false;
  19. $scope.gridOptions.showColumnFooter = false;
  20. $scope.gridOptions.fastWatch = true;
  21. $scope.gridOptions.useExternalFiltering = true;
  22. $scope.gridOptions.useExternalPagination = true;
  23. $scope.gridOptions.paginationPageSizes = [10, 20, 50, 100];
  24. $scope.gridOptions.paginationPageSize = 10;
  25. $scope.gridOptions.multiSelect = false;
  26. //$scope.gridOptions.rowTemplate= "<div ng-dblclick=\"grid.appScope.onDblClick(row)\" 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>";
  27. $scope.gridOptions.rowIdentity = function (row) {
  28. return row.id;
  29. };
  30. $scope.gridOptions.getRowIdentity = function (row) {
  31. return row.id;
  32. };
  33. $scope.transferRole = function (roles) {
  34. var tempValue = "";
  35. angular.forEach(roles, function (item) {
  36. if (tempValue != "") {
  37. tempValue = tempValue + "/";
  38. }
  39. tempValue = tempValue + item.role;
  40. })
  41. return tempValue;
  42. }
  43. //remote data
  44. $scope.gridOptions.columnDefs = [{
  45. name: 'item',
  46. displayName: '序号',
  47. width: 50,
  48. enableFiltering: false,
  49. cellTemplate: '<div>' +
  50. '<div class="ui-grid-cell-contents">{{row.entity.item}}</div>' +
  51. '</div>'
  52. },
  53. {
  54. name: 'name',
  55. displayName: '姓名',
  56. width: '10%',
  57. enableFiltering: false
  58. },
  59. // { name: 'studentNo', displayName: '学工号', width: 120 },
  60. {
  61. name: 'account',
  62. displayName: '工号',
  63. width: '10%',
  64. enableFiltering: false
  65. },
  66. {
  67. name: 'weixin',
  68. displayName: '微信',
  69. width: '10%',
  70. minWidth: '120',
  71. enableFiltering: false
  72. },
  73. {
  74. name: 'dept.dept',
  75. displayName: '科室',
  76. width: '10%',
  77. enableFiltering: false
  78. },
  79. {
  80. name: 'requesterType.name',
  81. displayName: '职务',
  82. width: '8%',
  83. enableFiltering: false
  84. },
  85. {
  86. name: 'mphone',
  87. displayName: '电话',
  88. width: '8%',
  89. minWidth: '125',
  90. enableFiltering: false
  91. },
  92. {
  93. name: 'branch.hosName',
  94. displayName: '校区',
  95. width: '10%',
  96. enableFiltering: false
  97. },
  98. {
  99. name: 'place.area.area',
  100. displayName: '区域',
  101. width: '10%',
  102. enableFiltering: false
  103. },
  104. {
  105. name: 'place.place',
  106. displayName: '地点',
  107. width: '10%',
  108. enableFiltering: false
  109. },
  110. {
  111. name: '操作',
  112. cellTemplate: '<div><div class="cl-effect-1 ui-grid-cell-contents pull-left">' +
  113. // '<a ng-click="grid.appScope.saveData(row.entity)" tooltip="编辑" tooltip-placement="right">' +
  114. // '<i class="fa fa-pencil-square-o"></i></a>'+
  115. '<a ng-click="grid.appScope.saveData(row.entity)" class="bianjifont">编辑</a>' +
  116. '</div></div>',
  117. enableFiltering: false
  118. }
  119. ];
  120. //导入
  121. $scope.importopen = function () { //导入触发事件
  122. var modalInstance = $modal.open({
  123. templateUrl: 'assets/views/import.html',
  124. controller: function ($scope, $modalInstance, FileUploader) {
  125. var importUploader = $scope.importUploader = new FileUploader({
  126. url: api_user_data.jry_importData().getRequestedUrl(),
  127. });
  128. // importUploader.filters.push({
  129. // name: 'customFilter',
  130. // fn: function(item /*{File|FileLikeObject}*/ , options) {
  131. // var type = item.name.slice(item.name.lastIndexOf('.') + 1);
  132. // //var type = '|' + item.type.slice(item.type.lastIndexOf('/') + 1) + '|';
  133. // return (type == 'xlsx');
  134. // }
  135. // });
  136. importUploader.filters.push({
  137. name: 'customFilter',
  138. fn: function (item /*{File|FileLikeObject}*/ , options) {
  139. this.queue = [];
  140. return this.queue.length < 2;
  141. }
  142. });
  143. importUploader.onWhenAddingFileFailed = function (item /*{File|FileLikeObject}*/ , filter, options) {
  144. console.info('onWhenAddingFileFailed', item, filter, options);
  145. };
  146. importUploader.onAfterAddingFile = function (fileItem) {
  147. console.info('onAfterAddingFile', fileItem);
  148. };
  149. importUploader.onAfterAddingAll = function (addedFileItems) {
  150. console.info('onAfterAddingAll', addedFileItems);
  151. };
  152. importUploader.onProgressItem = function (fileItem, progress) {
  153. console.info('onProgressItem', fileItem, progress);
  154. };
  155. importUploader.onProgressAll = function (progress) {
  156. console.info('onProgressAll', progress);
  157. };
  158. importUploader.onSuccessItem = function (fileItem, response, status, headers) {
  159. if (response.status == 200) {
  160. SweetAlert.swal({
  161. title: "导入成功!",
  162. confirmButtonColor: "#007AFF",
  163. type: "success"
  164. }, function () {
  165. // $scope.ldloading.contract_overlay = false;
  166. $rootScope.isMask = false;
  167. $scope.refreshData('expand-right', $scope.fileData);
  168. });
  169. } else {
  170. // $scope.ldloading.contract_overlay = false;
  171. $rootScope.isMask = false;
  172. SweetAlert.swal({
  173. title: "导入失败!",
  174. text: response.error,
  175. type: "error"
  176. })
  177. }
  178. console.info('onSuccessItem', fileItem, response, status, headers);
  179. };
  180. importUploader.onErrorItem = function (fileItem, response, status, headers) {
  181. console.info('onErrorItem', fileItem, response, status, headers);
  182. SweetAlert.swal({
  183. title: "系统错误!",
  184. text: "系统错误,请稍候重试!",
  185. type: "error"
  186. });
  187. };
  188. importUploader.onCancelItem = function (fileItem, response, status, headers) {
  189. console.info('onCancelItem', fileItem, response, status, headers);
  190. };
  191. importUploader.onCompleteItem = function (fileItem, response, status, headers) {
  192. console.info('onCompleteItem', fileItem, response, status, headers);
  193. };
  194. importUploader.onCompleteAll = function () {
  195. console.info('onCompleteAll');
  196. };
  197. $scope.ldloading = {};
  198. $rootScope.isMask = false;
  199. $scope.import = function (style) {
  200. // $scope.ldloading[style.replace('-', '_')] = true;
  201. $modalInstance.dismiss('cancel');
  202. $rootScope.isMask = true;
  203. importUploader.onBeforeUploadItem = function (item) {
  204. angular.extend(item.headers, $rootScope.getSession());
  205. // item.formData[0]['filename'] = item.file.name;
  206. // item.formData[0]['type'] = "requester";
  207. item.formData.push({
  208. 'fileName': item.file.name
  209. });
  210. item.formData.push({
  211. 'type': "requester"
  212. });
  213. console.info('onBeforeUploadItem', item);
  214. };
  215. importUploader.uploadAll();
  216. }
  217. $scope.cancel = function () {
  218. $modalInstance.dismiss('cancel');
  219. };
  220. },
  221. size: 'sm',
  222. resolve: {
  223. importUploader: function () {
  224. return $scope.importUploader;
  225. }
  226. }
  227. });
  228. modalInstance.result.then(function (selectedItem) {
  229. if (selectedItem) {}
  230. })
  231. }
  232. //导出
  233. $scope.openmodel = function () {
  234. var modalInstance = $modal.open({
  235. templateUrl: 'assets/views/system/tpl/getdown.html',
  236. controller: function ($scope, $modalInstance) {
  237. $scope.key = {};
  238. $scope.title = '报修人导入模版下载';
  239. $scope.lable = '下载模版版本';
  240. $scope.onChange = function (key) {
  241. $scope.key = key;
  242. }
  243. $scope.downmodel = [{
  244. id: 1,
  245. name: "EXCEL2003版(xls)"
  246. }, {
  247. id: 2,
  248. name: "EXCEL2007及以上版(xlsx)"
  249. }]
  250. $scope.ok = function () {
  251. $modalInstance.close($scope.key);
  252. };
  253. $scope.cancel = function () {
  254. $modalInstance.dismiss('cancel');
  255. };
  256. },
  257. size: 'sm',
  258. });
  259. modalInstance.result.then(function (selectedItem) {
  260. if (selectedItem) {
  261. var selectedItemId = "";
  262. if (selectedItem.id == 2) {
  263. selectedItemId = ".xlsx";
  264. }
  265. var type = "requester";
  266. var month = 0;
  267. $http({
  268. url: api_user_data.downDataModel(type, month).getRequestedUrl(),
  269. method: 'GET',
  270. headers: {
  271. 'Accept': '*/*'
  272. },
  273. responseType: 'arraybuffer'
  274. }).success(function (data, status, headers, config) {
  275. var file = new Blob([data], {
  276. // type : 'application/octet-stream'
  277. type: 'application/vnd.ms-excel'
  278. });
  279. //trick to download store a file having its URL
  280. var fileURL = URL.createObjectURL(file);
  281. var a = document.createElement('a');
  282. a.href = fileURL;
  283. a.target = '_blank';
  284. a.download = "报修人" + selectedItemId;
  285. document.body.appendChild(a);
  286. a.click();
  287. }).error(function (data, status, headers, config) {
  288. console.log(data);
  289. });
  290. }
  291. });
  292. }
  293. //修改
  294. $scope.saveData = function (data) {
  295. if (data.place) {
  296. var modelData = {
  297. model: {
  298. requester: {
  299. "id": data.id,
  300. "account": data.account,
  301. "name": data.name,
  302. "gender": data.gender,
  303. "email": data.email,
  304. "mphone": data.mphone,
  305. "deptName": data.deptName,
  306. "telephone": data.telephone,
  307. "dept": data.dept,
  308. "branch": data.branch,
  309. "area": data.place.area,
  310. "place": data.place,
  311. "studentNo": data.studentNo,
  312. "houseNumber": data.houseNumber,
  313. "requesterType": data.requesterType,
  314. "weixin": data.weixin
  315. }
  316. }
  317. };
  318. } else {
  319. var modelData = {
  320. model: {
  321. requester: {
  322. "id": data.id,
  323. "account": data.account,
  324. "name": data.name,
  325. "gender": data.gender,
  326. "email": data.email,
  327. "mphone": data.mphone,
  328. "deptName": data.deptName,
  329. "telephone": data.telephone,
  330. "dept": data.dept,
  331. "branch": data.branch,
  332. // "area": data.place.area,
  333. // "place": data.place,
  334. "studentNo": data.studentNo,
  335. "houseNumber": data.houseNumber,
  336. "requesterTypeDTO": data.requesterTypeDTO,
  337. "weixin": data.weixin
  338. }
  339. }
  340. };
  341. }
  342. $state.go('app.system.user.requester', {
  343. formKey: 'system_edit_requester',
  344. service: 'api_user_data',
  345. model: JSON.stringify(modelData)
  346. });
  347. };
  348. // 下拉树
  349. function convertListToTree(data, treeMap) {
  350. var idToNodeMap = {}; //Keeps track of nodes using id as key, for fast lookup
  351. var root = null; //Initially set our loop to null
  352. //loop over data
  353. for (var i = 0; i < data.length; i++) {
  354. var datum = data[i];
  355. //each node will have children, so let's give it a "children" poperty
  356. datum.children = [];
  357. //add an entry for this node to the map so that any future children can
  358. //lookup the parent
  359. idToNodeMap[datum.id] = datum;
  360. //Does this node have a parent?
  361. // console.log("datum="+JSON.stringify(datum))
  362. if (typeof datum.parent === "undefined" || datum.parent === null) {
  363. //Doesn't look like it, so this node is the root of the tree
  364. root = datum;
  365. treeMap[datum.id] = root;
  366. } else {
  367. //This node has a parent, so let's look it up using the id
  368. parentNode = idToNodeMap[datum.parent.id];
  369. //We don't need this property, so let's delete it.
  370. // delete datum.parent;
  371. //Let's add the current node as a child of the parent node.
  372. parentNode.children.push(datum);
  373. }
  374. }
  375. return root;
  376. }
  377. function convertParentToChildList(data) {
  378. var treeMap = {};
  379. var list = [];
  380. convertListToTree(data, treeMap);
  381. angular.forEach(treeMap, function (item) {
  382. list.push(item);
  383. });
  384. return list;
  385. }
  386. $scope.parentdata = {};
  387. $scope.try_async_load = function () {
  388. $scope.my_data = [];
  389. $scope.doing_async = true;
  390. var data = {
  391. "idx": 0,
  392. "sum": 1000
  393. };
  394. api_user_data.fetchDataList('department', data).then(function (response) {
  395. var data = response.list;
  396. var objects = [];
  397. $scope.parentdata = data;
  398. for (var i = 0; i < data.length; i++) {
  399. var object = {};
  400. object.id = data[i].id;
  401. if (angular.isDefined(data[i].parent)) {
  402. object.parent = data[i].parent;
  403. }
  404. if (angular.isDefined(data[i].hasArea)) {
  405. object.hasArea = data[i].hasArea;
  406. }
  407. if (angular.isDefined(data[i].hasSimple)) {
  408. object.hasSimple = data[i].hasSimple;
  409. }
  410. if (angular.isDefined(data[i].group)) {
  411. object.group = data[i].group;
  412. }
  413. if (angular.isDefined(data[i].priority)) {
  414. object.priority = data[i].priority;
  415. }
  416. object.label = data[i].dept;
  417. // object.actions = data[i][3]; //权限部分
  418. // object.group = "1";
  419. // object.user = "2";
  420. object.state = {
  421. "opened": true
  422. };
  423. object.typeName = "type";
  424. // if()
  425. // if (object.actions.indexOf("2") >= 0) { //知识库类型 具有增加权限--系统管理员
  426. $scope.showAddSolutionType = true;
  427. // }
  428. // if (object.actions.indexOf("5") >= 0) { //知识库类型 具有授权权限--系统管理员
  429. $scope.showReviewKnowledgeType = true;
  430. // }
  431. objects.push(object);
  432. }
  433. $scope.my_data = convertParentToChildList(objects);
  434. $scope.tree_data = angular.copy($scope.my_data);
  435. // if ($scope.my_data.length > 0) {
  436. $scope.doing_async = false;
  437. // }
  438. });
  439. };
  440. $scope.try_async_load();
  441. //新增
  442. $scope.addData = function () {
  443. $state.go('app.system.user.requester', {
  444. formKey: 'system_edit_requester',
  445. service: 'api_user_data'
  446. })
  447. }
  448. $scope.removeData = function () {
  449. var modalInstance = $modal.open({
  450. templateUrl: 'assets/views/delete.html',
  451. controller: function ($scope, scope, $modalInstance, api_bpm_data) {
  452. var rmvList = [];
  453. $scope.title = '报修人删除';
  454. $scope.connect = '确定要删除此报修人?';
  455. rmvList.push(scope.selected.items[0].id);
  456. $scope.ok = function () {
  457. $modalInstance.close(rmvList);
  458. };
  459. $scope.cancel = function () {
  460. $modalInstance.dismiss('cancel');
  461. };
  462. },
  463. size: 'sm',
  464. resolve: {
  465. scope: function () {
  466. return $scope;
  467. }
  468. }
  469. });
  470. modalInstance.result.then(function (selectedItem) {
  471. if (selectedItem) {
  472. if (selectedItem.length > 0) {
  473. api_user_data.rmvData('requester', selectedItem).then(function (response) {
  474. if (response.data) {
  475. SweetAlert.swal({
  476. title: "删除成功!",
  477. type: "success",
  478. confirmButtonColor: "#007AFF"
  479. }, function () {
  480. $scope.myData = _.reject($scope.myData, function (o) {
  481. return _.includes(selectedItem, o.id)
  482. });
  483. $scope.selected = {
  484. items: []
  485. };
  486. $scope.gridOptions.totalItems = $scope.gridOptions.totalItems - selectedItem.length
  487. $scope.gridApi.grid.selection.selectedCount = 0;
  488. });
  489. } else {
  490. SweetAlert.swal({
  491. title: "操作异常!",
  492. text: "系统异常,请稍后重试,或者联系管理员!",
  493. type: "error"
  494. });
  495. }
  496. })
  497. }
  498. }
  499. })
  500. }
  501. $scope.selected = {
  502. items: []
  503. }
  504. $scope.editted = {
  505. items: []
  506. }
  507. $scope.gridOptions.onRegisterApi = function (gridApi) {
  508. $scope.gridApi = gridApi;
  509. // gridApi.edit.on.afterCellEdit($scope,function(rowEntity, colDef, newValue, oldValue){
  510. // console.log(rowEntity);
  511. // });
  512. gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
  513. var filtersData = $scope.memoryfilterData;
  514. filtersData.idx = newPage - 1;
  515. filtersData.sum = pageSize;
  516. defaultFilterData = filtersData;
  517. $scope.fileData.idx = newPage - 1;
  518. $scope.fileData.sum = pageSize;
  519. $scope.refreshData('expand-right', $scope.fileData);
  520. });
  521. // gridApi.selection.on.rowSelectionChanged($scope, function(data) {
  522. // data.grid.appScope.selected.items = data.entity
  523. // });
  524. gridApi.selection.on.rowSelectionChanged($scope, function (data) {
  525. if (data.isSelected) {
  526. data.grid.appScope.selected.items[0] = data.entity;
  527. } else {
  528. if (data.grid.appScope.selected.items[0].id == data.entity.id) {
  529. data.grid.appScope.selected.items = [];
  530. }
  531. }
  532. });
  533. gridApi.core.on.filterChanged($scope, function () {
  534. var grid = this.grid;
  535. var filtersData = {
  536. idx: 0,
  537. sum: 10
  538. };
  539. angular.forEach(grid.columns, function (item) {
  540. if (item.enableFiltering) {
  541. if (angular.isDefined(item.filters[0].term) && item.filters[0].term != '') {
  542. if (angular.isUndefined(filtersData['requester'])) {
  543. filtersData['requester'] = {};
  544. }
  545. filtersData['requester'][item.field] = item.filters[0].term;
  546. }
  547. }
  548. });
  549. $scope.memoryfilterData = filtersData;
  550. $scope.refreshData('expand-right', $scope.fileData);
  551. });
  552. };
  553. var defaultFilterData = {
  554. "idx": 0,
  555. "sum": 10
  556. };
  557. $scope.memoryfilterData = {
  558. "idx": 0,
  559. "sum": 10
  560. }
  561. $scope.ldloading = {};
  562. $scope.refresh = function (style, filterData) {
  563. $scope.selected = {
  564. items: []
  565. };
  566. if ($scope.gridApi) {
  567. // $scope.gridApi.grid.options.paginationCurrentPage = 0;
  568. $scope.gridApi.grid.selection.selectedCount = 0;
  569. }
  570. $scope.refreshData('expand-right', $scope.fileData);
  571. }
  572. $scope.fileData = {
  573. "idx": 0,
  574. "sum": 10,
  575. "requester": {
  576. }
  577. };
  578. // 搜索
  579. $scope.searchData = function () {
  580. $scope.refreshData('expand-right', $scope.fileData);
  581. }
  582. // 清空
  583. $scope.clean = function () {
  584. delete $scope.fileData.requester.name;
  585. delete $scope.fileData.requester.account;
  586. delete $scope.fileData.requester.dept;
  587. $scope.try_async_load();
  588. $scope.refreshData('expand-right', $scope.fileData);
  589. }
  590. $scope.onFilterCallback = function (data) {
  591. // console.log(data);
  592. $scope.fileData.requester.dept = data;
  593. }
  594. $scope.refreshData = function (style, filterData) {
  595. $scope.ldloading[style.replace('-', '_')] = true;
  596. if (angular.isUndefined(filterData)) {
  597. filterData = defaultFilterData;
  598. }
  599. if (angular.isDefined($scope.searchTypes)) {
  600. filterData['searchType'] = $scope.searchTypes;
  601. }
  602. $scope.myData = [];
  603. // if ($scope.gridApi) {
  604. // $scope.gridApi.grid.options.paginationCurrentPage = 0;
  605. // $scope.gridApi.grid.selection.selectedCount = 0;
  606. // }
  607. api_user_data.fetchDataList('requester', filterData).then(function (data) {
  608. var myData = Restangular.stripRestangular(data);
  609. $scope.gridOptions.totalItems = myData.totalNum;
  610. $scope.myData = myData.list;
  611. for (var i = 0; i < $scope.myData.length; i++) {
  612. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
  613. }
  614. $scope.ldloading[style.replace('-', '_')] = false;
  615. }, function () {
  616. $scope.ldloading[style.replace('-', '_')] = false;
  617. });
  618. };
  619. $scope.refreshData2 = function (style, filterData) {
  620. $scope.ldloading[style.replace('-', '_')] = true;
  621. if (angular.isUndefined(filterData)) {
  622. filterData = defaultFilterData;
  623. }
  624. if (angular.isDefined($scope.searchTypes)) {
  625. filterData['searchType'] = $scope.searchTypes;
  626. }
  627. // $scope.myData = [];
  628. // if ($scope.gridApi) {
  629. // $scope.gridApi.grid.options.paginationCurrentPage = 0;
  630. // $scope.gridApi.grid.selection.selectedCount = 0;
  631. // }
  632. api_user_data.fetchDataList('requester', filterData).then(function (data) {
  633. var myData = Restangular.stripRestangular(data);
  634. $scope.gridOptions.totalItems = myData.totalNum;
  635. $scope.myData = myData.list;
  636. for (var i = 0; i < $scope.myData.length; i++) {
  637. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
  638. }
  639. $scope.ldloading[style.replace('-', '_')] = false;
  640. }, function () {
  641. $scope.ldloading[style.replace('-', '_')] = false;
  642. });
  643. };
  644. $scope.refreshData('expand-right', $scope.fileData);
  645. $scope.timer = $interval(function () {
  646. $scope.refreshData2('expand-right', $scope.fileData);
  647. }, $rootScope.refreshTime);
  648. $scope.$on('$destroy', function () {
  649. $interval.cancel($scope.timer)
  650. });
  651. }]);