synchronization.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. total: 0,
  5. isShowType: false
  6. },
  7. onLoad(options) {
  8. let content = {
  9. nocache: true,
  10. pageNumber: 1,
  11. pageTotal: 1,
  12. ...JSON.parse(options.data)
  13. }
  14. this.setData({
  15. content,
  16. isShowType: ["sys_task", "sat_orderclue", "sa_customers", "sa_project"].includes(content.ownertable)
  17. });
  18. this.getList()
  19. },
  20. getList(init = false) {
  21. if (init.detail != undefined) init = init.detail;
  22. let content = this.data.content;
  23. if (init) content.pageNumber = 1;
  24. if (content.pageNumber > content.pageTotal) return;
  25. this.selectComponent("#ListBox").setHeight(".total", this);
  26. _Http.basic({
  27. "id": 20231207130504,
  28. content
  29. }).then(res => {
  30. this.selectComponent('#ListBox').RefreshToComplete();
  31. console.log("跟进列表", res)
  32. this.setData({
  33. total: res.total
  34. })
  35. if (res.msg != '成功') return wx.showToast({
  36. title: res.data,
  37. icon: "none"
  38. })
  39. if (content.ownertable != 'sat_orderclue' && this.data.isShowType) res.data = res.data.map(v => {
  40. v.contentList = v.content.split("\n").map(v => {
  41. let obj = v.split(":")
  42. return {
  43. label: obj[0],
  44. value: obj[1] || ""
  45. }
  46. })
  47. return v
  48. })
  49. this.setData({
  50. 'content.pageNumber': res.pageNumber + 1,
  51. 'content.pageTotal': res.pageTotal,
  52. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  53. })
  54. })
  55. },
  56. onClick(e) {
  57. _Http.selectSync(e.currentTarget.dataset.item, this.data.content.ownertable)
  58. }
  59. })