index.js 2.7 KB

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