machineManage.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /**
  2. 入驻小区
  3. **/
  4. (function (vc) {
  5. var DEFAULT_PAGE = 1;
  6. var DEFAULT_ROWS = 10;
  7. vc.extends({
  8. data: {
  9. machineManageInfo: {
  10. machines: [],
  11. total: 0,
  12. records: 1,
  13. moreCondition: false,
  14. machineName: '',
  15. conditions: {
  16. machineCode: '',
  17. machineTypeCd: '',
  18. machineName: '',
  19. machineIp: '',
  20. machineMac: '',
  21. communityId: vc.getCurrentCommunity().communityId
  22. }
  23. }
  24. },
  25. _initMethod: function () {
  26. vc.component._listMachines(DEFAULT_PAGE, DEFAULT_ROWS);
  27. },
  28. _initEvent: function () {
  29. vc.on('machineManage', 'listMachine', function (_param) {
  30. vc.component._listMachines(DEFAULT_PAGE, DEFAULT_ROWS);
  31. });
  32. vc.on('pagination', 'page_event', function (_currentPage) {
  33. vc.component._listMachines(_currentPage, DEFAULT_ROWS);
  34. });
  35. },
  36. methods: {
  37. _listMachines: function (_page, _rows) {
  38. vc.component.machineManageInfo.conditions.page = _page;
  39. vc.component.machineManageInfo.conditions.row = _rows;
  40. var param = {
  41. params: vc.component.machineManageInfo.conditions
  42. };
  43. //发送get请求
  44. vc.http.get('machineManage',
  45. 'list',
  46. param,
  47. function (json, res) {
  48. var _machineManageInfo = JSON.parse(json);
  49. vc.component.machineManageInfo.total = _machineManageInfo.total;
  50. vc.component.machineManageInfo.records = _machineManageInfo.records;
  51. vc.component.machineManageInfo.machines = _machineManageInfo.machines;
  52. vc.emit('pagination', 'init', {
  53. total: vc.component.machineManageInfo.records,
  54. currentPage: _page
  55. });
  56. }, function (errInfo, error) {
  57. console.log('请求失败处理');
  58. }
  59. );
  60. },
  61. _openAddMachineModal: function () {
  62. vc.emit('addMachine', 'openAddMachineModal', {});
  63. },
  64. _openEditMachineModel: function (_machine) {
  65. vc.emit('editMachine', 'openEditMachineModal', _machine);
  66. },
  67. _openDeleteMachineModel: function (_machine) {
  68. vc.emit('deleteMachine', 'openDeleteMachineModal', _machine);
  69. },
  70. _queryMachineMethod: function () {
  71. vc.component._listMachines(DEFAULT_PAGE, DEFAULT_ROWS);
  72. },
  73. _moreCondition: function () {
  74. if (vc.component.machineManageInfo.moreCondition) {
  75. vc.component.machineManageInfo.moreCondition = false;
  76. } else {
  77. vc.component.machineManageInfo.moreCondition = true;
  78. }
  79. },
  80. _openMachineDetailModel: function (_machine) {
  81. },
  82. _openRestartMachineModel: function (_machine) { //设备重启处理
  83. vc.emit('machineState', 'openMachineStateModal', {
  84. machineId: _machine.machineId,
  85. stateName: '重启',
  86. state: '1400'
  87. });
  88. },
  89. _openUpgradeMachineModel: function (_machine) { //设备升级处理
  90. vc.emit('machineState', 'openMachineStateModal', {
  91. machineId: _machine.machineId,
  92. stateName: '升级',
  93. state: '1500'
  94. });
  95. },
  96. _openForbiddenMachineModel: function (_machine) { //设备禁用处理
  97. vc.emit('machineState', 'openMachineStateModal', {
  98. machineId: _machine.machineId,
  99. stateName: '禁用',
  100. state: '1600'
  101. });
  102. }
  103. }
  104. });
  105. })(window.vc);