index.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. const _Http = getApp().globalData.http,
  2. getHeight = require("../../../../../utils/getRheRemainingHeight");
  3. Page({
  4. data: {
  5. content: {
  6. "sa_projectid": 1,
  7. "pageNumber": 1,
  8. "pageTotal": 1,
  9. "pageSize": 20,
  10. "where": {
  11. "condition": ""
  12. }
  13. },
  14. },
  15. onLoad(options) {
  16. console.log(options)
  17. },
  18. getList(init = false) {
  19. if (init.detail != undefined) init = init.detail;
  20. let content = this.data.content;
  21. if (init) content.pageNumber = 1;
  22. if (content.pageNumber > content.pageTotal) return;
  23. _Http.basic({
  24. "id": 20221111131004,
  25. content
  26. }).then(res => {
  27. console.log("项目联系人搜索", res)
  28. this.selectComponent('#ListBox').RefreshToComplete();
  29. if (res.msg != '成功') return wx.showToast({
  30. title: res.data,
  31. icon: "none"
  32. })
  33. this.setData({
  34. 'content.pageNumber': res.pageNumber + 1,
  35. 'content.pageTotal': res.pageTotal,
  36. 'content.total': res.total,
  37. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  38. })
  39. })
  40. },
  41. /* 开始搜索 */
  42. onSearch({
  43. detail
  44. }) {
  45. if (this.data.content.where.condition == detail) return;
  46. this.setData({
  47. 'content.where.condition': detail
  48. });
  49. this.getList(true)
  50. },
  51. onClear() {
  52. this.setData({
  53. 'content.where.condition': ""
  54. });
  55. this.getList(true)
  56. },
  57. onReady() {
  58. getHeight.getHeight('.total', this).then(res => this.setData({
  59. listHeight: res
  60. }));
  61. },
  62. })