client.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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: "医院类型情况统计",
  27. model: "#ClientType"
  28. }, {
  29. label: "客户联系人情况统计",
  30. model: "#CustomerContactPerson"
  31. }, {
  32. label: "客户关联项目情况统计",
  33. model: "#CustomerRelatedProject"
  34. }, {
  35. label: "客户跟进情况统计",
  36. model: "#ClientFollowUp"
  37. }, {
  38. label: "近12月客户跟进分析",
  39. model: "#followUpAnalysis"
  40. }, {
  41. label: "有效客户未跟进天数分析",
  42. model: "#YXKHWGJTSFX"
  43. }, {
  44. label: "近12月客户报价分析",
  45. model: "#ClientQuotationQuantity"
  46. }],
  47. init: false
  48. },
  49. methods: {
  50. getList() {
  51. this.partialRenewal()
  52. this.data.init = true;
  53. },
  54. tabsChange({
  55. detail
  56. }) {
  57. this.setData({
  58. tabsActive: detail
  59. });
  60. this.partialRenewal();
  61. },
  62. //局部数据更新 tabs
  63. partialRenewal() {
  64. try {
  65. const model = this.data.tabsList[this.data.tabsActive].model;
  66. if (model) {
  67. const Component = this.selectComponent(model);
  68. Component.getList(true);
  69. }
  70. this.data.model = model;
  71. } catch (error) {
  72. setTimeout(() => {
  73. this.partialRenewal();
  74. }, 100)
  75. }
  76. },
  77. getContent() {
  78. const model = this.data.tabsList[this.data.tabsActive].model;
  79. if (model) return this.selectComponent(model).data.content
  80. }
  81. }
  82. })