index.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {},
  4. data: {
  5. content: {
  6. nocache: true,
  7. pageNumber: 1,
  8. pageSize: 20,
  9. pageTotal: 1,
  10. total: null,
  11. },
  12. total: 0,
  13. list: []
  14. },
  15. methods: {
  16. getList(id, init = false) {
  17. if (id == 0) return;
  18. let content = this.data.content;
  19. content.sys_phonebookid = id;
  20. if (init) content.pageNumber = 1
  21. _Http.basic({
  22. id: "20231215134304",
  23. content
  24. }).then(res => {
  25. console.log("关联项目", res)
  26. if (res.msg != '成功') return wx.showToast({
  27. title: res.data,
  28. icon: "none"
  29. });
  30. res.data = res.data.map(v => {
  31. v.progress = v.stage / v.totalstage * 100;
  32. return v
  33. })
  34. this.setData({
  35. "content.pageNumber": res.pageNumber + 1,
  36. "content.pageTotal": res.pageTotal,
  37. "content.total": res.total,
  38. total: res.total,
  39. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  40. })
  41. })
  42. }
  43. }
  44. })