index.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // components/toufang/index.ts
  2. namespace shiduan {
  3. const { line, upLine } = require("./F2");
  4. let { getSaturation } = require('../../../../utils/api')
  5. let first = true;
  6. Component({
  7. /**
  8. * 组件的属性列表
  9. */
  10. properties: {
  11. array: {
  12. type: Object
  13. },
  14. channel: {
  15. type: Object
  16. },
  17. },
  18. observers: {
  19. },
  20. ready() {
  21. first && this.init()
  22. first = false
  23. },
  24. /**
  25. * 组件的初始数据
  26. */
  27. data: {
  28. onInitChart: undefined,
  29. DayList: {},
  30. },
  31. /**
  32. * 组件的方法列表
  33. */
  34. methods: {
  35. init() {
  36. let channelItem = this.data.channel;
  37. let arrayItem = this.data.array;
  38. Promise.all([
  39. getSaturation({
  40. channelId: channelItem.channelId,
  41. end: arrayItem.endDate,
  42. start: arrayItem.startDate
  43. }),
  44. ]).then((res: adDay[]) => {
  45. this.data.DayList = res[0];
  46. this.setData({
  47. onInitChart: line.bind(this)
  48. })
  49. })
  50. },
  51. channelChange(event:wxPicker){
  52. this.setData({
  53. select_act: Number(event.detail.value)
  54. },()=>this.upData())
  55. }
  56. }
  57. })
  58. }