adminUserCtrl.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. 'use strict';
  2. /**
  3. * controller for User Profile Example
  4. */
  5. app.controller('adminUserListCtrl', ["$rootScope", "$scope", "$state", "$timeout", "$interval", "$modal", "SweetAlert", "i18nService", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_user_data", "api_login", function ($rootScope, $scope, $state, $timeout, $interval, $modal, SweetAlert, i18nService, uiGridConstants, uiGridGroupingConstants, Restangular, api_user_data, api_login) {
  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.chongzhimima = false;
  14. for (var i = 0; i < loginUser.menu.length; i++) {
  15. if (loginUser.menu[i].link == "renyuanguanli_xinzeng") {
  16. $scope.xinzeng = true
  17. }
  18. if (loginUser.menu[i].link == "renyuanguanli_shanchu") {
  19. $scope.shanchu = true
  20. }
  21. if (loginUser.menu[i].link == "renyuanguanli_bianji") {
  22. $scope.bianji = true
  23. }
  24. if (loginUser.menu[i].link == "renyuanguanli_chongzhimima") {
  25. $scope.chongzhimima = true
  26. }
  27. }
  28. //$scope.allright=false;
  29. //$scope.allrightnot=true;
  30. $scope.gridOptions = {};
  31. $scope.gridOptions.data = 'myData';
  32. $scope.gridOptions.enableColumnResizing = true;
  33. $scope.gridOptions.enableFiltering = true;
  34. $scope.gridOptions.enableGridMenu = true;
  35. $scope.gridOptions.enableRowSelection = true;
  36. $scope.gridOptions.showGridFooter = true;
  37. $scope.gridOptions.showColumnFooter = false;
  38. $scope.gridOptions.fastWatch = true;
  39. $scope.gridOptions.useExternalFiltering = true;
  40. $scope.gridOptions.useExternalPagination = true;
  41. $scope.gridOptions.paginationPageSizes = [10, 20, 50, 100];
  42. $scope.gridOptions.paginationPageSize = 10;
  43. $scope.gridOptions.multiSelect = false;
  44. //$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>";
  45. $scope.gridOptions.rowIdentity = function (row) {
  46. return row.id;
  47. };
  48. $scope.gridOptions.getRowIdentity = function (row) {
  49. return row.id;
  50. };
  51. $scope.transferRole = function (roles) {
  52. var tempValue = "";
  53. angular.forEach(roles, function (item) {
  54. if (tempValue != "") {
  55. tempValue = tempValue + "/";
  56. }
  57. tempValue = tempValue + item.role;
  58. })
  59. return tempValue;
  60. }
  61. $scope.transferStatus = function (flag) {
  62. return (flag == 0) ? "有效" : "无效";
  63. }
  64. $scope.transfergroup = function (group) {
  65. var groupData = '';
  66. angular.forEach(group, function (item) {
  67. if (groupData == '') {
  68. groupData = item.groupName;
  69. } else {
  70. groupData = groupData + "/" + item.groupName;
  71. }
  72. })
  73. return groupData;
  74. }
  75. //remote data
  76. $scope.gridOptions.columnDefs = [{
  77. name: 'item',
  78. displayName: '序号',
  79. width: 50,
  80. enableFiltering: false,
  81. cellTemplate: '<div>' +
  82. '<div class="ui-grid-cell-contents">{{row.entity.item}}</div>' +
  83. '</div>'
  84. },
  85. {
  86. name: 'account',
  87. displayName: '账号',
  88. width: '8%',
  89. minWidth: '105',
  90. enableFiltering: false
  91. },
  92. {
  93. name: 'name',
  94. displayName: '姓名',
  95. width: '6%',
  96. minWidth: '100',
  97. enableFiltering: false
  98. },
  99. {
  100. name: 'weixin',
  101. displayName: '微信',
  102. width: '6%',
  103. minWidth: '120',
  104. enableFiltering: false
  105. },
  106. {
  107. name: 'userType',
  108. displayName: '人员类别',
  109. width: '6%',
  110. minWidth: '120',
  111. enableFiltering: false,
  112. cellTemplate: '<div>' +
  113. '<div class="ui-grid-cell-contents">{{row.entity.userType.value == 2 ?row.entity.company.name:row.entity.userType.name}}</div>' +
  114. '</div>'
  115. },
  116. // {
  117. // name: 'gender.name',
  118. // displayName: '性别',
  119. // width: '5%',
  120. // enableFiltering: false
  121. // },
  122. {
  123. name: 'phone',
  124. displayName: '联系电话',
  125. width: '8%',
  126. minWidth: '115',
  127. enableFiltering: false
  128. },
  129. {
  130. name: 'email',
  131. displayName: '邮箱',
  132. width: '14%',
  133. minWidth: '150',
  134. enableFiltering: false
  135. },
  136. {
  137. name: 'dept.dept',
  138. displayName: '科室',
  139. width: '12%',
  140. enableFiltering: false
  141. },
  142. {
  143. name: 'dept.phone',
  144. displayName: '科室电话',
  145. width: '11%',
  146. enableFiltering: false
  147. },
  148. {
  149. name: 'extensionNo',
  150. displayName: '分机号码',
  151. width: '11%',
  152. enableFiltering: false
  153. },
  154. {
  155. name: 'group',
  156. displayName: '所属工作组',
  157. width: '15%',
  158. minWidth: '150',
  159. cellTemplate: '<div class="ui-grid-cell-contents">{{grid.appScope.transfergroup(row.entity.group)}}</div>',
  160. enableFiltering: false
  161. },
  162. {
  163. name: 'flag',
  164. displayName: '状态',
  165. cellTemplate: '<div class="ui-grid-cell-contents">{{grid.appScope.transferStatus(row.entity.flag)}}</div>',
  166. width: '5%',
  167. enableFiltering: false
  168. },
  169. {
  170. name: '操作',
  171. minWidth: '150',
  172. cellTemplate: '<div><div class="cl-effect-1 ui-grid-cell-contents pull-left">' +
  173. // '<a ng-click="grid.appScope.saveData(row.entity)" tooltip="编辑" tooltip-placement="right">' +
  174. // '<i class="fa fa-pencil-square-o"/></a>' +
  175. '<a ng-click="grid.appScope.saveData(row.entity)" ng-show="grid.appScope.bianji" class="bianjifont">编辑</a>' +
  176. // '<a ng-click="grid.appScope.resetpassword(row.entity.id)" tooltip="重置密码" tooltip-placement="right">' +
  177. // '<i class="ti-back-right"/></a>' +
  178. '<a ng-click="grid.appScope.resetpassword(row.entity.id)" ng-show="grid.appScope.chongzhimima" class="bianjifont" >重置密码</a>' +
  179. // '<a ng-show="row.entity.isRegis&&row.entity.isRegis==1" ng-click="grid.appScope.registerfunction(row.entity.id)" tooltip="消息中心注册" tooltip-placement="right">' +
  180. // '<i class="ti-write"/></a>' +
  181. // '<a ng-show="row.entity.isRegis&&row.entity.isRegis==1" ng-click="grid.appScope.registerfunction(row.entity.id)" class="handlefont" tooltip="消息中心注册" tooltip-placement="left">注册</a>' +
  182. '</div></div>',
  183. enableFiltering: false
  184. }
  185. ];
  186. $scope.groupdata = {};
  187. var apple_selected, tree, treedata_avm, treedata_geography;
  188. // $scope.onFilterCallback = function(branch) {
  189. // var filedata = $scope.memoryfilterData;
  190. // if (filedata.user) {
  191. // filedata.user.groupdata = { id: branch.id };
  192. // } else {
  193. // filedata.user = { groupdata: { id: branch.id } };
  194. // }
  195. // // filedata.user.group = branch.groupName;
  196. // $scope.refreshData('expand-right', $scope.fileData);
  197. // };
  198. $scope.my_data = [];
  199. $scope.deselectItem = function (item) {
  200. console.log(item)
  201. console.log($scope)
  202. }
  203. function convertListToTree(data, treeMap) {
  204. var idToNodeMap = {}; //Keeps track of nodes using id as key, for fast lookup
  205. var root = null; //Initially set our loop to null
  206. var parentNode = null;
  207. //loop over data
  208. for (var i = 0; i < data.length; i++) {
  209. var datum = data[i];
  210. //each node will have children, so let's give it a "children" poperty
  211. datum.children = [];
  212. //add an entry for this node to the map so that any future children can
  213. //lookup the parent
  214. idToNodeMap[datum.id] = datum;
  215. //Does this node have a parent?
  216. if (typeof datum.parent === "undefined" || datum.parent == null) {
  217. //Doesn't look like it, so this node is the root of the tree
  218. root = datum;
  219. treeMap[datum.id] = root;
  220. } else {
  221. //This node has a parent, so let's look it up using the id
  222. parentNode = idToNodeMap[datum.parent.id];
  223. //We don't need this property, so let's delete it.
  224. delete datum.parent;
  225. //Let's add the current node as a child of the parent node.
  226. parentNode.children.push(datum);
  227. }
  228. }
  229. return root;
  230. }
  231. function convertParentToChildList(data) {
  232. var treeMap = {};
  233. var list = [];
  234. convertListToTree(data, treeMap);
  235. angular.forEach(treeMap, function (item) {
  236. list.push(item);
  237. });
  238. return list;
  239. }
  240. $scope.my_tree = tree = {};
  241. $scope.try_async_load = function () {
  242. $scope.my_data = [];
  243. $scope.select_treedata = [];
  244. $scope.doing_async = true;
  245. api_user_data.fetchDataList('group', {
  246. "idx": 0,
  247. "sum": 1000,
  248. group:{
  249. 'selectType':'nouser'
  250. }
  251. }).then(function (data) {
  252. $scope.select_treedata = $scope.my_data = convertParentToChildList(data['list']);
  253. $scope.doing_async = false;
  254. // tree.expand_all();
  255. //console.log(treelist);
  256. });
  257. };
  258. $scope.select_treedata = [];
  259. $scope.propTypeOptions = [];
  260. $scope.try_async_load();
  261. //注册
  262. $scope.registerfunction = function (id) {
  263. var modalInstance = $modal.open({
  264. templateUrl: 'assets/views/system/tpl/register.html',
  265. controller: function ($scope, scope, $modalInstance) {
  266. $scope.ok = function (key) {
  267. var filedata = {
  268. 'id': id,
  269. 'email': key
  270. };
  271. $modalInstance.dismiss('cancel');
  272. api_user_data.register(filedata).then(function (response) {
  273. var myData = Restangular.stripRestangular(response);
  274. if (response.status == 200) {
  275. SweetAlert.swal({
  276. title: "注册成功!",
  277. type: "success",
  278. confirmButtonColor: "#007AFF"
  279. }, function () {
  280. scope.refreshData('expand-right', scope.fileData);
  281. });
  282. } else {
  283. SweetAlert.swal({
  284. title: "注册失败!",
  285. text: response.msg,
  286. type: "error"
  287. });
  288. }
  289. })
  290. };
  291. $scope.cancel = function () {
  292. $modalInstance.dismiss('cancel');
  293. };
  294. },
  295. resolve: {
  296. scope: function () {
  297. return $scope;
  298. }
  299. }
  300. })
  301. }
  302. $scope.resetpassword = function (id) {
  303. var modalInstance = $modal.open({
  304. templateUrl: 'assets/views/delete.html',
  305. controller: function ($scope, $modalInstance) {
  306. var data;
  307. $scope.title = '重置密码';
  308. $scope.connect = '确定要重置密码?';
  309. $scope.ok = function () {
  310. $modalInstance.dismiss('cancel');
  311. api_login.resetpwd(id).then(function (response) {
  312. var myData = Restangular.stripRestangular(response);
  313. // console.log("myData=" + JSON.stringify(myData));
  314. if (response.status == 200) {
  315. SweetAlert.swal({
  316. title: "重置成功!重置后密码 888888",
  317. type: "success",
  318. confirmButtonColor: "#007AFF"
  319. });
  320. } else {
  321. SweetAlert.swal({
  322. title: "操作异常!",
  323. text: "系统异常,请稍后重试,或者联系管理员!",
  324. type: "error"
  325. });
  326. }
  327. })
  328. };
  329. $scope.cancel = function () {
  330. $modalInstance.dismiss('cancel');
  331. };
  332. },
  333. size: 'sm'
  334. })
  335. }
  336. $scope.saveData = function (data) {
  337. var modelData = {
  338. model: {
  339. user: data
  340. }
  341. };
  342. if (modelData.model.user && modelData.model.user.item) {
  343. delete modelData.model.user.item;
  344. }
  345. modelData.model.user.deptPhone=data.dept?data.dept.phone:''
  346. $state.go('app.system.form', {
  347. formKey: 'system_edit',
  348. service: 'api_user_data',
  349. model: JSON.stringify(modelData)
  350. });
  351. };
  352. $scope.addData = function () {
  353. var modelData = {
  354. model: {
  355. user: {
  356. flag: "0"
  357. }
  358. }
  359. };
  360. $state.go('app.system.form', {
  361. formKey: 'system_edit',
  362. service: 'api_user_data',
  363. model: JSON.stringify(modelData)
  364. });
  365. }
  366. $scope.removeData = function () {
  367. var modalInstance = $modal.open({
  368. templateUrl: 'assets/views/delete.html',
  369. controller: function ($scope, scope, $modalInstance, api_bpm_data) {
  370. var rmvList = [];
  371. $scope.title = '人员删除';
  372. $scope.connect = '确定要删除此人员?';
  373. angular.forEach(scope.selected.items, function (item) {
  374. rmvList.push(item.id);
  375. });
  376. $scope.ok = function () {
  377. $modalInstance.close(rmvList);
  378. };
  379. $scope.cancel = function () {
  380. $modalInstance.dismiss('cancel');
  381. };
  382. },
  383. size: 'sm',
  384. resolve: {
  385. scope: function () {
  386. return $scope;
  387. }
  388. }
  389. });
  390. modalInstance.result.then(function (selectedItem) {
  391. if (selectedItem) {
  392. if (selectedItem.length > 0) {
  393. api_user_data.rmvData('user', selectedItem).then(function (response) {
  394. if (response.data) {
  395. SweetAlert.swal({
  396. title: "删除成功!",
  397. type: "success",
  398. confirmButtonColor: "#007AFF"
  399. }, function () {
  400. $scope.myData = _.reject($scope.myData, function (o) {
  401. return _.includes(selectedItem, o.id);
  402. });
  403. $scope.selected = {
  404. items: []
  405. };
  406. $scope.gridOptions.totalItems = $scope.gridOptions.totalItems - selectedItem.length;
  407. $scope.gridApi.grid.selection.selectedCount = 0;
  408. });
  409. } else {
  410. SweetAlert.swal({
  411. title: "操作异常!",
  412. text: "系统异常,请稍后重试,或者联系管理员!",
  413. type: "error"
  414. });
  415. }
  416. })
  417. }
  418. }
  419. })
  420. }
  421. $scope.selected = {
  422. items: []
  423. }
  424. $scope.editted = {
  425. items: []
  426. }
  427. $scope.gridOptions.onRegisterApi = function (gridApi) {
  428. $scope.gridApi = gridApi;
  429. // gridApi.edit.on.afterCellEdit($scope,function(rowEntity, colDef, newValue, oldValue){
  430. // // console.log(rowEntity);
  431. // });
  432. gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
  433. var filtersData = $scope.memoryfilterData;
  434. filtersData.idx = newPage - 1;
  435. filtersData.sum = pageSize;
  436. $scope.fileData.idx = newPage - 1;
  437. $scope.fileData.sum = pageSize;
  438. defaultFilterData = filtersData;
  439. $scope.refreshData('expand-right', $scope.fileData);
  440. });
  441. gridApi.selection.on.rowSelectionChanged($scope, function (scope) {
  442. var j = 0;
  443. for (var i = 0; i <= scope.grid.appScope.selected.items.length; i++) {
  444. if (scope.grid.appScope.selected.items[i] == scope.entity) {
  445. j++;
  446. break;
  447. }
  448. }
  449. // console.log("j="+j)
  450. if (j == 1) {
  451. scope.grid.appScope.selected.items.splice(i, 1);
  452. } else {
  453. scope.grid.appScope.selected.items.push(scope.entity)
  454. }
  455. });
  456. // gridApi.core.on.filterChanged($scope, function() {
  457. // var grid = this.grid;
  458. // var filtersData = {
  459. // idx: 0,
  460. // sum: 10
  461. // };
  462. // angular.forEach(grid.columns, function(item) {
  463. // if (item.enableFiltering) {
  464. // if (angular.isDefined(item.filters[0].term) && item.filters[0].term != '') {
  465. // if (angular.isUndefined(filtersData['requester'])) {
  466. // filtersData['requester'] = {};
  467. // }
  468. // filtersData['requester'][item.field] = item.filters[0].term;
  469. // }
  470. // }
  471. // });
  472. // $scope.memoryfilterData = filtersData;
  473. // $scope.refreshData('expand-right', filtersData);
  474. // });
  475. gridApi.core.on.filterChanged($scope, function () {
  476. var grid = this.grid;
  477. // var filtersData = {
  478. // idx: 0,
  479. // sum: 10
  480. // };
  481. var filtersData = $scope.memoryfilterData;
  482. angular.forEach(grid.columns, function (item) {
  483. if (item.enableFiltering) {
  484. if (angular.isDefined(item.filters[0].term) && item.filters[0].term != '') {
  485. if (angular.isUndefined(filtersData['user'])) {
  486. filtersData['user'] = {};
  487. filtersData['user']['flag'] = -1;
  488. filtersData['user'][item.field] = item.filters[0].term;
  489. } else {
  490. filtersData.user.flag = -1;
  491. filtersData.user[item.field] = item.filters[0].term;
  492. }
  493. // filtersData['user']['flag'] = -1;
  494. // filtersData['user'][item.field] = item.filters[0].term;
  495. }
  496. }
  497. });
  498. $scope.memoryfilterData = filtersData;
  499. $scope.refreshData('expand-right', $scope.fileData);
  500. });
  501. };
  502. var defaultFilterData = {
  503. "idx": 0,
  504. "sum": 10
  505. };
  506. $scope.memoryfilterData = {
  507. "idx": 0,
  508. "sum": 10
  509. }
  510. $scope.ldloading = {};
  511. $scope.fileData = {
  512. "idx": 0,
  513. "sum": 10,
  514. "user": {}
  515. }
  516. $scope.treeItem = "";
  517. $scope.onFilterCallback = function (item) {
  518. $scope.treeItem = item
  519. }
  520. // 搜索
  521. $scope.searchData = function () {
  522. if ($scope.treeItem) {
  523. $scope.fileData.user.groupdata = $scope.treeItem
  524. }
  525. if($scope.fileData.user.name){
  526. $scope.fileData.user.selectType= "pinyin_qs"
  527. }
  528. $scope.refreshData('expand-right', $scope.fileData);
  529. }
  530. // 清空
  531. $scope.clean = function () {
  532. delete $scope.fileData.user.account;
  533. delete $scope.fileData.user.name;
  534. delete $scope.fileData.user.groupdata;
  535. $scope.treeItem = "";
  536. $scope.try_async_load();
  537. $scope.refreshData('expand-right', $scope.fileData);
  538. }
  539. //刷新
  540. $scope.refresh = function (style, filterData) {
  541. $scope.selected = {
  542. items: []
  543. };
  544. if ($scope.gridApi) {
  545. // $scope.gridApi.grid.options.paginationCurrentPage = 0;
  546. $scope.gridApi.grid.selection.selectedCount = 0;
  547. }
  548. $scope.refreshData('expand-right', $scope.fileData);
  549. }
  550. //获取列表数据
  551. $scope.refreshData = function (style, filterData) {
  552. $scope.ldloading[style.replace('-', '_')] = true;
  553. if (angular.isUndefined(filterData)) {
  554. filterData = defaultFilterData;
  555. }
  556. if (angular.isDefined($scope.searchTypes)) {
  557. filterData['searchType'] = $scope.searchTypes;
  558. }
  559. $scope.myData = [];
  560. filterData['flag'] = -1;
  561. // if ($scope.gridApi) {
  562. // $scope.gridApi.grid.selection.selectedCount = 0;
  563. // $scope.selected = { items: [] };
  564. // }
  565. console.log("filterData=" + JSON.stringify(filterData))
  566. api_user_data.fetchDataList('user', filterData).then(function (data) {
  567. var myData = Restangular.stripRestangular(data);
  568. $scope.gridOptions.totalItems = myData.totalNum;
  569. $scope.myData = myData.list;
  570. for (var i = 0; i < $scope.myData.length; i++) {
  571. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
  572. }
  573. $scope.ldloading[style.replace('-', '_')] = false;
  574. // console.log("$scope.myData="+JSON.stringify($scope.myData))
  575. }, function () {
  576. $scope.ldloading[style.replace('-', '_')] = false;
  577. });
  578. };
  579. $scope.refreshData2 = function (style, filterData) {
  580. $scope.ldloading[style.replace('-', '_')] = true;
  581. if (angular.isUndefined(filterData)) {
  582. filterData = defaultFilterData;
  583. }
  584. if (angular.isDefined($scope.searchTypes)) {
  585. filterData['searchType'] = $scope.searchTypes;
  586. }
  587. // $scope.myData = [];
  588. filterData['flag'] = -1;
  589. // if ($scope.gridApi) {
  590. // $scope.gridApi.grid.selection.selectedCount = 0;
  591. // $scope.selected = { items: [] };
  592. // }
  593. console.log("filterData=" + JSON.stringify(filterData))
  594. api_user_data.fetchDataList('user', filterData).then(function (data) {
  595. var myData = Restangular.stripRestangular(data);
  596. $scope.gridOptions.totalItems = myData.totalNum;
  597. $scope.myData = myData.list;
  598. for (var i = 0; i < $scope.myData.length; i++) {
  599. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
  600. }
  601. $scope.ldloading[style.replace('-', '_')] = false;
  602. // console.log("$scope.myData="+JSON.stringify($scope.myData))
  603. }, function () {
  604. $scope.ldloading[style.replace('-', '_')] = false;
  605. });
  606. };
  607. $scope.refreshData('expand-right', $scope.fileData);
  608. $scope.timer = $interval(function () {
  609. $scope.refreshData2('expand-right', $scope.fileData);
  610. }, $rootScope.refreshTime);
  611. $scope.$on('$destroy', function () {
  612. $interval.cancel($scope.timer)
  613. });
  614. }]);