notice.js 25 KB

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