index.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. Page({
  2. data: {
  3. active: "",
  4. page: null,
  5. ops: [],
  6. unfolds: [],
  7. },
  8. onLoad(options) {
  9. getApp().globalData.Language.getLanguagePackage(this, '360°画像');
  10. const ops = wx.getStorageSync('auth').wportrayal.options.filter(v => ["Client", "Project", "Contacts", "Sales"].includes(v))
  11. this.setData({
  12. active: ops[0],
  13. unfolds: [ops[0]]
  14. })
  15. this.setData({
  16. ops: ops.map(v => {
  17. return {
  18. name: v,
  19. title: {
  20. "Client": "客户",
  21. "Project": "项目",
  22. "Contacts": "联系人",
  23. "Sales": "业务员"
  24. } [v]
  25. }
  26. }),
  27. })
  28. },
  29. onChange(event) {
  30. const active = event.detail.name;
  31. if (!this.data.unfolds.includes(active)) {
  32. this.data.unfolds.push(active);
  33. }
  34. this.setData({
  35. active,
  36. unfolds: this.data.unfolds
  37. });
  38. this.getList({
  39. detail: active
  40. });
  41. },
  42. getList({
  43. detail
  44. }) {
  45. if (detail && this.data.active == "") return setTimeout(() => {
  46. this.getList({
  47. detail: detail
  48. })
  49. })
  50. if (detail && this.data.active != detail) return;
  51. const page = this.selectComponent("#" + this.data.active);
  52. if (page) {
  53. if (page.data.total == null) page.getList();
  54. this.data.page = page;
  55. }
  56. },
  57. changeSearchShow() {
  58. this.data.page.changeSearchShow();
  59. },
  60. openFiltrate() {
  61. this.data.page.setData({
  62. showFiltrate: true
  63. });
  64. }
  65. })