Project.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. options: {
  4. addGlobalClass: true,
  5. },
  6. properties: {
  7. update: {
  8. type: Function
  9. }
  10. },
  11. lifetimes: {
  12. attached: function () {
  13. getApp().globalData.Language.getLanguagePackage(this)
  14. this.triggerEvent('update', "Client")
  15. }
  16. },
  17. data: {
  18. tabsActive: 0,
  19. tabsList: [{
  20. label: "数据概况",
  21. model: "#DataOverview"
  22. }, {
  23. label: "近12月项目报价分析",
  24. model: "#ProjectQuotationQuantity"
  25. }, {
  26. label: "近12月项目跟进分析",
  27. model: "#followUpAnalysis"
  28. }, {
  29. label: "近12月项目新增分析",
  30. model: "#NewAnalysisAdded"
  31. }],
  32. },
  33. methods: {
  34. getList() {
  35. this.partialRenewal()
  36. this.data.init = true;
  37. },
  38. tabsChange({
  39. detail
  40. }) {
  41. this.setData({
  42. tabsActive: detail
  43. });
  44. this.partialRenewal();
  45. },
  46. //局部数据更新 tabs
  47. partialRenewal() {
  48. try {
  49. const model = this.data.tabsList[this.data.tabsActive].model;
  50. if (model) {
  51. const Component = this.selectComponent(model);
  52. Component.getList(true);
  53. }
  54. this.data.model = model;
  55. } catch (error) {
  56. setTimeout(() => {
  57. this.partialRenewal();
  58. }, 100)
  59. }
  60. },
  61. getContent() {
  62. const model = this.data.tabsList[this.data.tabsActive].model;
  63. if (model) return this.selectComponent(model).data.content
  64. }
  65. }
  66. })