index.js 1.6 KB

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