visitManage.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. 入驻小区
  3. **/
  4. (function (vc) {
  5. var DEFAULT_PAGE = 1;
  6. var DEFAULT_ROWS = 10;
  7. vc.extends({
  8. data: {
  9. appManageInfo: {
  10. apps: [],
  11. total: 0,
  12. records: 1
  13. }
  14. },
  15. _initMethod: function () {
  16. vc.component._listApps(DEFAULT_PAGE, DEFAULT_ROWS);
  17. },
  18. _initEvent: function () {
  19. vc.on('appManage', 'listApp', function (_param) {
  20. vc.component._listApps(DEFAULT_PAGE, DEFAULT_ROWS);
  21. });
  22. vc.on('pagination', 'page_event', function (_currentPage) {
  23. vc.component._listApps(_currentPage, DEFAULT_ROWS);
  24. });
  25. },
  26. methods: {
  27. _listApps: function (_page, _rows) {
  28. var param = {
  29. params: {
  30. page: _page,
  31. row: _rows,
  32. communityId:vc.getCurrentCommunity().communityId
  33. }
  34. }
  35. //发送get请求
  36. vc.http.get('visitManage',
  37. 'list',
  38. param,
  39. function (json, res) {
  40. var _visitManageInfo = JSON.parse(json);
  41. console.log(_visitManageInfo);
  42. vc.component.appManageInfo.total = _visitManageInfo.total;
  43. vc.component.appManageInfo.records = _visitManageInfo.records;
  44. vc.component.appManageInfo.visits = _visitManageInfo.visits;
  45. vc.emit('pagination', 'init', {
  46. total: _visitManageInfo.records,
  47. currentPage: _page
  48. });
  49. }, function (errInfo, error) {
  50. console.log('请求失败处理');
  51. }
  52. );
  53. },
  54. _openAddVisitModal: function () {
  55. vc.jumpToPage("/flow/addNewOneVisit")
  56. // vc.emit('addApp','openAddAppModal',{});
  57. },
  58. _openEditVisitModel: function (_app) {
  59. vc.emit('editVisit', 'openEditVisitModel', _app);
  60. // vc.emit('deleteApp','openDeleteAppModal',_app);
  61. },
  62. _openDeleteAppModel: function (_app) {
  63. vc.emit('deleteApp', 'openDeleteAppModal', _app);
  64. }
  65. }
  66. });
  67. })(window.vc);