adminrequesterCtrl.js 26 KB

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