index.js 1.9 KB

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