index.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {},
  4. data: {
  5. list: [],
  6. sa_projectid: "",
  7. content: {
  8. "nacache": true,
  9. "pageNumber": 1,
  10. "pageSize": 10,
  11. "pageTotal": 1,
  12. "total": null,
  13. "where": {
  14. "condition": "",
  15. }
  16. },
  17. },
  18. lifetimes: {
  19. attached: function () {
  20. getApp().globalData.Language.getLanguagePackage(this)
  21. }
  22. },
  23. methods: {
  24. getList(id, init) {
  25. let content = this.data.content;
  26. content.sa_projectid = id;
  27. if (init) {
  28. content.pageNumber = 1
  29. content.pageTotal = 1
  30. }
  31. _Http.basic({
  32. "id": "20221124110002",
  33. content
  34. }).then(res => {
  35. console.log("线索列表", res)
  36. if (res.code != '1') return wx.showToast({
  37. title: res.data,
  38. icon: "none"
  39. })
  40. this.setData({
  41. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
  42. "content.pageNumber": res.pageNumber + 1,
  43. "content.pageSize": res.pageSize,
  44. "content.pageTotal": res.pageTotal,
  45. "content.total": res.total,
  46. sa_projectid: id
  47. })
  48. this.getTags()
  49. })
  50. },
  51. /* 获取列表标签 */
  52. getTags() {
  53. let list = this.data.list,
  54. ownerids = list.map(v => v.sat_orderclueid);
  55. _Http.basic({
  56. "id": 20221018102001,
  57. "content": {
  58. nocache: true,
  59. "ownertable": "sat_orderclue",
  60. ownerids
  61. }
  62. }).then(res => {
  63. console.log("标签", res)
  64. for (let key in res.data) {
  65. let index = list.findIndex(v => v.sat_orderclueid == key);
  66. list[index].tags = res.data[key]
  67. };
  68. this.setData({
  69. list
  70. })
  71. })
  72. },
  73. }
  74. })