ServiceCenterHealth.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>服务中心-健康数据</title>
  8. <script src="Scripts/vue/vue.js"></script>
  9. <script src="Scripts/jquery/jquery.min.js"></script>
  10. <script src="Scripts/Sers/sers.apiClient.js"></script>
  11. <style>
  12. .line {
  13. border: 1px solid #cccccc;
  14. border-collapse: collapse;
  15. }
  16. </style>
  17. </head>
  18. <body>
  19. <h1>服务中心-健康数据</h1>
  20. <div id="items">
  21. <div v-for="item in items" style="width:300px;height:500px; float:left;margin:2px;padding:4px;word-wrap:break-word;" class="line">
  22. {{ item.route }} <br />
  23. -----------------------<br />
  24. <p v-html="item.html"></p>
  25. </div>
  26. </div>
  27. <script>
  28. var items = new Vue({
  29. el: '#items',
  30. data: {
  31. items: [
  32. {
  33. connGuid: ''
  34. }
  35. ]
  36. }, methods: {
  37. start: function (station) {
  38. sers.apiClient.serviceStation_start(station.connKey, function (data) {
  39. rendItems();
  40. });
  41. }, pause: function (station) {
  42. sers.apiClient.serviceStation_pause(station.connKey, function (data) {
  43. rendItems();
  44. });
  45. }
  46. }
  47. });
  48. function rendItems() {
  49. sers.apiClient.post({
  50. api: '/_gover_/serviceCenter/healthInfo', onSuc: function (data) {
  51. var jsonInfos = data.data;
  52. var infos = [];
  53. for (var route in jsonInfos) {
  54. var html = '';
  55. var jsonInfo = jsonInfos[route];
  56. if (typeof (jsonInfo) == 'object') {
  57. for (var key in jsonInfo) {
  58. var value = jsonInfo[key];
  59. if (typeof (value) == 'object') value = JSON.stringify(value);
  60. html += key + ' ' + value + '<br/>';
  61. }
  62. } else {
  63. html += jsonInfo;
  64. }
  65. var info = { route: route, html: html };
  66. infos.push(info);
  67. }
  68. items.items = infos;
  69. }
  70. });
  71. }
  72. rendItems();
  73. var intervals = [];
  74. function startRefreshTask() {
  75. var interval = setInterval(rendItems, 2000);
  76. intervals.push(interval);
  77. }
  78. function stopRefreshTask() {
  79. for (var t in intervals) {
  80. clearInterval(intervals[t]);
  81. }
  82. intervals = [];
  83. }
  84. startRefreshTask();
  85. </script>
  86. </body>
  87. </html>