Project.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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: "#NewAnalysisAdded"
  25. }, {
  26. label: "近12月项目报备分析",
  27. model: "#ReportAnalysis"
  28. }, {
  29. label: "近12月项目报价分析",
  30. model: "#ProjectQuotationQuantity"
  31. }, {
  32. label: "近12月项目跟进分析",
  33. model: "#followUpAnalysis"
  34. }],
  35. },
  36. methods: {
  37. getList() {
  38. this.partialRenewal()
  39. this.data.init = true;
  40. },
  41. tabsChange({
  42. detail
  43. }) {
  44. this.setData({
  45. tabsActive: detail
  46. });
  47. this.partialRenewal();
  48. },
  49. //局部数据更新 tabs
  50. partialRenewal() {
  51. try {
  52. const model = this.data.tabsList[this.data.tabsActive].model;
  53. if (model) {
  54. const Component = this.selectComponent(model);
  55. Component.getList(true);
  56. }
  57. this.data.model = model;
  58. } catch (error) {
  59. setTimeout(() => {
  60. this.partialRenewal();
  61. }, 100)
  62. }
  63. },
  64. getContent() {
  65. const model = this.data.tabsList[this.data.tabsActive].model;
  66. if (model) return this.selectComponent(model).data.content
  67. }
  68. }
  69. })