index.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. lifetimes: {
  16. attached: function () {
  17. getApp().globalData.Language.getLanguagePackage(this)
  18. }
  19. },
  20. methods: {
  21. getList(id, init = false) {
  22. if (id == 0) return;
  23. let content = this.data.content;
  24. content.sys_phonebookid = id;
  25. if (init) content.pageNumber = 1
  26. _Http.basic({
  27. id: "20231215134304",
  28. content
  29. }).then(res => {
  30. console.log("关联项目", res)
  31. if (res.code != '1') return wx.showToast({
  32. title: res.data,
  33. icon: "none"
  34. });
  35. res.data = res.data.map(v => {
  36. v.progress = v.stage / v.totalstage * 100;
  37. return v
  38. })
  39. this.setData({
  40. "content.pageNumber": res.pageNumber + 1,
  41. "content.pageTotal": res.pageTotal,
  42. "content.total": res.total,
  43. total: res.total,
  44. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  45. })
  46. })
  47. }
  48. }
  49. })