dataprocessing.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. import store from '../common/store.js'
  2. class Dataprocessing {
  3. constructor() {
  4. this.initial();
  5. }
  6. initial() {
  7. let organlist=[];
  8. let ip = store.state.wholeSituationBackStageIp;
  9. let port = store.state.wholeSituationBackStagePort;
  10. uni.request({
  11. url: 'http://' + ip + ':' + port + '/GyeeorganController/gyeeOrganAll',
  12. data: {},
  13. method: 'GET',
  14. success: function(res) {
  15. for (let j = 0; j < res.data.data.length; j++) {
  16. var obj = {};
  17. obj.name = res.data.data[j].describes;
  18. obj.id = res.data.data[j].name;
  19. organlist.push(obj);
  20. }
  21. uni.setStorageSync('organlist', organlist);
  22. }
  23. })
  24. }
  25. //
  26. putWindPowerStationName(windPowerStationName) {
  27. uni.setStorageSync('windpowerstationName', windPowerStationName);
  28. }
  29. putWindPowerStationId(windPowerStationId) {
  30. uni.setStorageSync('windPowerStationId', windPowerStationId);
  31. }
  32. getWindPowerStationName() {
  33. return uni.getStorageSync('windpowerstationName');
  34. }
  35. getWindPowerStationId() {
  36. return uni.getStorageSync('windPowerStationId');
  37. }
  38. getWindPowerStationNameById(name) {
  39. let organlist=uni.getStorageSync('organlist');
  40. for (let j = 0; j < organlist.length; j++) {
  41. var obj = organlist[j];
  42. if (obj.name == name) {
  43. return obj.id;
  44. }
  45. }
  46. }
  47. getWindPowerStationNameByWeatherId(name) {
  48. let organlist=uni.getStorageSync('organlist');
  49. for (let j = 0; j < organlist.length; j++) {
  50. var obj = organlist[j];
  51. if (obj.name == name) {
  52. if (obj.id == "0") {
  53. return store.state.default_weather_wpid;
  54. } else {
  55. return obj.id;
  56. }
  57. }
  58. }
  59. }
  60. getWindPowerStationNameByNames(name) {
  61. let organlist=uni.getStorageSync('organlist');
  62. let windStations = [];
  63. for (let j = 0; j < organlist.length; j++) {
  64. var obj = organlist[j];
  65. if (obj.name != name) {
  66. windStations.push(obj.name);
  67. }
  68. }
  69. return windStations;
  70. }
  71. viewUserid() {
  72. let userid = uni.getStorageSync('userid');
  73. let ip = store.state.wholeSituationBackStageIp;
  74. let port = store.state.wholeSituationBackStagePort;
  75. uni.request({
  76. url: 'http://' + ip + ':' + port + '/GyeeorganController/GyeeOrganList?userid=' + userid,
  77. data: {},
  78. method: 'GET',
  79. success: function(res) {
  80. let plusDrawerList = [];
  81. let plusDrawerList_weather = [];
  82. for (let j = 0; j < res.data.data.length; j++) {
  83. var obj = {};
  84. obj.name = res.data.data[j].describes;
  85. obj.windId = res.data.data[j].name;
  86. plusDrawerList.push(obj);
  87. }
  88. uni.setStorageSync('windpowerstationName', plusDrawerList[0].name);
  89. uni.setStorageSync('windPowerStationId', plusDrawerList[0].windId);
  90. for (let j = 0; j < res.data.data.length; j++) {
  91. var obj = {};
  92. obj.name = res.data.data[j].describes;
  93. if (res.data.data[j].name == '0') {
  94. obj.windId = store.state.default_weather_wpid;
  95. } else {
  96. obj.windId = res.data.data[j].name;
  97. }
  98. plusDrawerList_weather.push(obj);
  99. }
  100. uni.setStorageSync('plusList', plusDrawerList);
  101. uni.setStorageSync('plusList_we', plusDrawerList_weather);
  102. }
  103. })
  104. }
  105. monitoringAuthority() {
  106. let userid = uni.getStorageSync('userid');
  107. let ip = store.state.wholeSituationBackStageIp;
  108. let port = store.state.wholeSituationBackStagePort;
  109. uni.request({
  110. url: 'http://' + ip + ':' + port + '/GyeepermissionController/GyeePermissionList?userid=' + userid,
  111. data: {},
  112. method: 'GET',
  113. success: function(res) {
  114. let leftlist1 = [];
  115. let leftlist2 = [];
  116. let leftlist3 = [];
  117. let leftlist4 = [];
  118. let leftlist5 = [];
  119. for (let j = 0; j < res.data.data.length; j++) {
  120. let gyeePermissionList = res.data.data[j].gyeePermissionList;
  121. if (j == 0) {
  122. for (let k = 0; k < gyeePermissionList.length; k++) {
  123. var obj = {};
  124. obj.name = gyeePermissionList[k].permisssionname;
  125. obj.remark1 = gyeePermissionList[k].remark1;
  126. leftlist1.push(obj);
  127. }
  128. } else if (j == 1) {
  129. for (let k = 0; k < gyeePermissionList.length; k++) {
  130. var obj = {};
  131. obj.name = gyeePermissionList[k].permisssionname;
  132. obj.remark1 = gyeePermissionList[k].remark1;
  133. leftlist2.push(obj);
  134. }
  135. } else if (j == 2) {
  136. for (let k = 0; k < gyeePermissionList.length; k++) {
  137. var obj = {};
  138. obj.name = gyeePermissionList[k].permisssionname;
  139. obj.remark1 = gyeePermissionList[k].remark1;
  140. leftlist3.push(obj);
  141. }
  142. } else if (j == 3) {
  143. for (let k = 0; k < gyeePermissionList.length; k++) {
  144. var obj = {};
  145. obj.name = gyeePermissionList[k].permisssionname;
  146. obj.remark1 = gyeePermissionList[k].remark1;
  147. leftlist4.push(obj);
  148. }
  149. } else if (j == 4) {
  150. for (let k = 0; k < gyeePermissionList.length; k++) {
  151. var obj = {};
  152. obj.id = gyeePermissionList[k].id;
  153. obj.name = gyeePermissionList[k].permisssionname;
  154. obj.remark1 = gyeePermissionList[k].remark1;
  155. leftlist5.push(obj);
  156. }
  157. }
  158. }
  159. uni.setStorageSync('leftlist1', leftlist1);
  160. uni.setStorageSync('leftlist2', leftlist2);
  161. uni.setStorageSync('leftlist3', leftlist3);
  162. uni.setStorageSync('leftlist4', leftlist4);
  163. uni.setStorageSync('leftlist5', leftlist5);
  164. }
  165. })
  166. }
  167. }
  168. let dataprocessing = new Dataprocessing();
  169. export default dataprocessing;