index.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. options: {
  4. addGlobalClass: true
  5. },
  6. properties: {
  7. list: {
  8. type: Array
  9. },
  10. ownertable: {
  11. type: String
  12. },
  13. ownerid: {
  14. type: String
  15. },
  16. changeTotal: {
  17. type: Function
  18. },
  19. disabled: {
  20. type: Boolean
  21. }
  22. },
  23. lifetimes: {
  24. attached: function () {
  25. this.setData({
  26. userid: wx.getStorageSync('userMsg').userid,
  27. })
  28. getApp().globalData.Language.getLanguagePackage(this)
  29. }
  30. },
  31. methods: {
  32. toDetail(e) {
  33. const {
  34. item
  35. } = e.currentTarget.dataset;
  36. wx.navigateTo({
  37. url: `/prsx/trace/detail/index?data=` + JSON.stringify({
  38. "sys_datafollowupid": item.sys_datafollowupid,
  39. "ownertable": this.data.ownertable,
  40. "ownerid": this.data.ownerid
  41. }),
  42. })
  43. },
  44. editItem(e) {
  45. const {
  46. item
  47. } = e.currentTarget.dataset;
  48. wx.navigateTo({
  49. url: `/prsx/trace/add/index?ownertable=${this.data.ownertable}&ownerid=${this.data.ownerid}&sys_datafollowupid=${item.sys_datafollowupid}`
  50. });
  51. },
  52. deleteItem(e) {
  53. const {
  54. item
  55. } = e.currentTarget.dataset;
  56. _Http.traceHandleDelete(item)
  57. },
  58. comment(e) {
  59. let page = this.selectComponent('#' + e.currentTarget.id);
  60. page.changeShow()
  61. },
  62. updateCommentList({
  63. detail
  64. }) {
  65. console.log("detail", detail)
  66. detail.pageSize = 99999;
  67. _Http.basic({
  68. "id": 20240920092204,
  69. content: detail
  70. }).then(res => {
  71. console.log("更新评论列表", res)
  72. if (res.code == 1) {
  73. let idName = detail.ownertable + 'id';
  74. const index = this.data.list.findIndex(v => v[idName] == detail.ownerid)
  75. if (index != -1) {
  76. let item = this.data.list[index];
  77. item.commentqty = res.total == 0 ? 0 : res.data[0].totalqty;
  78. item.comment = res.data;
  79. this.setData({
  80. [`list[${index}]`]: item
  81. })
  82. }
  83. }
  84. })
  85. }
  86. }
  87. })