synchronization.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. getApp().globalData.Language.getLanguagePackage(this, '同步跟进内容');
  20. },
  21. getList(init = false) {
  22. if (init.detail != undefined) init = init.detail;
  23. let content = this.data.content;
  24. if (init) content.pageNumber = 1;
  25. if (content.pageNumber > content.pageTotal) return;
  26. this.selectComponent("#ListBox").setHeight(".total", this);
  27. _Http.basic({
  28. "id": 20231207130504,
  29. content
  30. }).then(res => {
  31. this.selectComponent('#ListBox').RefreshToComplete();
  32. console.log("跟进列表", res)
  33. this.setData({
  34. total: res.total
  35. })
  36. if (res.code != '1') return wx.showToast({
  37. title: res.data,
  38. icon: "none"
  39. })
  40. if (content.ownertable != 'sat_orderclue' && this.data.isShowType) res.data = res.data.map(v => {
  41. v.contentList = v.content.split("\n").map(v => {
  42. let obj = v.split(":")
  43. return {
  44. label: obj[0],
  45. value: obj[1] || ""
  46. }
  47. })
  48. return v
  49. })
  50. this.setData({
  51. 'content.pageNumber': res.pageNumber + 1,
  52. 'content.pageTotal': res.pageTotal,
  53. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  54. })
  55. })
  56. },
  57. onClick(e) {
  58. _Http.selectSync(e.currentTarget.dataset.item, this.data.content.ownertable)
  59. }
  60. })