index.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. options: {
  4. addGlobalClass: true
  5. },
  6. properties: {
  7. ownertable: String,
  8. ownerid: String,
  9. },
  10. data: {
  11. content: {
  12. nocache: true,
  13. pageNumber: 1,
  14. pageSize: 10,
  15. pageTotal: 1,
  16. total: null
  17. },
  18. list: []
  19. },
  20. methods: {
  21. getList(id, init = false) {
  22. let content = {
  23. ...this.data.content,
  24. "ownertable": this.data.ownertable,
  25. "ownerid": this.data.ownerid,
  26. };
  27. if (init) {
  28. content.pageNumber = 1
  29. content.pageTotal = 1
  30. }
  31. _Http.basic({
  32. "id": 20220930121501,
  33. content
  34. }).then(res => {
  35. console.log("跟进动态", res)
  36. if (res.msg != '成功') return wx.showToast({
  37. title: res.data,
  38. icon: "none"
  39. });
  40. let deleteList = res.data.filter(v => v.content == "" && v.type == ""),
  41. list = res.data.filter(v => v.content != "" || !v.type == "");
  42. this.handleDeleteList(deleteList);
  43. this.setData({
  44. "content.pageNumber": res.pageNumber + 1,
  45. "content.pageTotal": res.pageTotal,
  46. "content.total": res.total - deleteList.length,
  47. list: res.pageNumber == 1 ? list : this.data.list.concat(list)
  48. })
  49. })
  50. },
  51. /* 批量删除空模板 */
  52. handleDeleteList(list) {
  53. list.forEach(v => {
  54. _Http.basic({
  55. "id": 20220930121701,
  56. "content": {
  57. "sys_datafollowupid": v.sys_datafollowupid,
  58. "deletereason": "系统删除空模板"
  59. }
  60. }, false).then(res => {
  61. console.log(res)
  62. })
  63. })
  64. },
  65. /* 去添加 */
  66. toAdd() {
  67. wx.navigateTo({
  68. url: `/packageA/setclient/modules/trace/add/index?ownertable=${this.data.ownertable}&ownerid=${this.data.ownerid}`,
  69. })
  70. },
  71. //跟进组件设置删除
  72. setDelete(id) {
  73. this.setData({
  74. list: this.data.list.filter(v => v.sys_datafollowupid != id)
  75. });
  76. wx.showToast({
  77. title: '作废成功!',
  78. icon: "none"
  79. })
  80. this.changeTotal()
  81. },
  82. changeTotal() {
  83. this.setData({
  84. "content.total": this.data.content.total - 1
  85. })
  86. }
  87. }
  88. })