运维小程序
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

index.js 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. // pages/statistics/index.js
  2. const api = require('../../api/index.js');
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. // 状态栏高度
  9. statusBarHeight: wx.getStorageSync('statusBarHeight'),
  10. // 导航栏高度
  11. navBarHeight: wx.getStorageSync('navBarHeight'),
  12. // 导航栏和状态栏高度
  13. navStatusBarHeight: wx.getStorageSync('navStatusBarHeight'),
  14. // 胶囊
  15. menu:wx.getStorageSync('menu'),
  16. sunec: {
  17. lazyLoad: true
  18. }
  19. },
  20. /**
  21. * 生命周期函数--监听页面加载
  22. */
  23. onLoad(options) {
  24. this.sunline = this.selectComponent('#sunlinechart')
  25. this.onworkorder()
  26. // this.getsunlinechart()
  27. },
  28. onlevel(){
  29. console.log(1111111);
  30. wx.navigateBack({
  31. data:1
  32. })
  33. },
  34. onworkorder(){
  35. let data = {
  36. workorderType:''
  37. }
  38. api.request(`/workoder/statistics`, 'POST',data)
  39. .then((res) => {
  40. console.log(res);
  41. this.setData({
  42. workorder:res.data
  43. })
  44. })
  45. .catch((err) => {
  46. console.error('请求失败:', err);
  47. // 在这里处理请求失败的情况
  48. });
  49. },
  50. // 日用电价走势
  51. getsunlinechart() {
  52. this.sunline.init((canvas, width, height, dpr) => {
  53. const chart = echarts.init(canvas, null, {
  54. width: width,
  55. height: height,
  56. devicePixelRatio: dpr
  57. });
  58. canvas.setChart(chart);
  59. var option = {
  60. xAxis: {
  61. type: 'category',
  62. data: [1,2,3,4,5,6,7,8,9,10]
  63. },
  64. yAxis: {
  65. type: 'value',
  66. axisLine: {
  67. show: true,
  68. lineStyle: {
  69. color: '#999',
  70. width: 1
  71. }
  72. },
  73. axisTick: {
  74. show: false
  75. },
  76. splitLine: {
  77. show: true,
  78. lineStyle: {
  79. type: 'dotted',
  80. color: '#ccc',
  81. width: 1,
  82. opacity: 0.6
  83. }
  84. }
  85. },
  86. grid: {
  87. top: '10%',
  88. left: '0%',
  89. right: '4%',
  90. bottom: '3%',
  91. containLabel: true
  92. },
  93. series: [
  94. {
  95. data: [10,20,30,40,50,60,70,70,70,70,70],
  96. showSymbol: false,
  97. type: 'line',
  98. step: 'start',
  99. color: '#B2D5CB',
  100. }
  101. ]
  102. };
  103. chart.setOption(option);
  104. return chart;
  105. });
  106. },
  107. /**
  108. * 生命周期函数--监听页面初次渲染完成
  109. */
  110. onReady() {
  111. },
  112. onstatistics(){
  113. wx.switchTab({
  114. url: '/pages/tool/index',
  115. })
  116. },
  117. /**
  118. * 生命周期函数--监听页面显示
  119. */
  120. onShow() {
  121. },
  122. /**
  123. * 生命周期函数--监听页面隐藏
  124. */
  125. onHide() {
  126. },
  127. /**
  128. * 生命周期函数--监听页面卸载
  129. */
  130. onUnload() {
  131. },
  132. /**
  133. * 页面相关事件处理函数--监听用户下拉动作
  134. */
  135. onPullDownRefresh() {
  136. },
  137. /**
  138. * 页面上拉触底事件的处理函数
  139. */
  140. onReachBottom() {
  141. },
  142. /**
  143. * 用户点击右上角分享
  144. */
  145. onShareAppMessage() {
  146. }
  147. })