ZBLOG

self.getContactInfoGridSettings = ggNamespace.functions.WorkPage_getContactInfoGridSettings; self.lastButton.addClickHandler(function() { if (currentIndexs > 0) { currentIndexs--; } else { currentIndexs = allData.length - 1; } ...

你可以在现有的代码中,调整 self.getContactInfoGridsettings 方法,使其在点击“上一步”和“下一步”按钮时都会重新调用接口并更新参数。以下是修改后的代码示例:

  1. self.getContactInfoGridSettings = ggNamespace.functions.WorkPage_getContactInfoGridSettings;
  2. // 统一的方法来获取联系人信息
  3. function updateContactInfo() {
  4. self.contactPhones = new ContactPhonePanel({
  5. custId: allData[currentIndexs].customerId,
  6. queue: self.queue,
  7. complaintPhone: self.complaintPhone,
  8. complaintPhoneNew: self.complaintPhoneNew,
  9. complaintUsername: self.complaintUsername,
  10. complaintRelation: self.complaintRelation,
  11. auto: self.auto,
  12. callPhone: (phoneNum, customerId) => self.header.callPhone(phoneNum, customerId)
  13. });
  14. // 调用获取设置的方法
  15. self.getContactInfoGridsettings();
  16. }
  17. self.lastButton.addClickHandler(function() {
  18. if (currentIndexs > 0) {
  19. currentIndexs--;
  20. } else {
  21. currentIndexs = allData.length - 1;
  22. }
  23. updateContactInfo(); // 更新联系人信息
  24. });
  25. self.nextButton.addClickHandler(function() {
  26. if (currentIndexs < allData.length - 1) {
  27. currentIndexs++;
  28. } else {
  29. currentIndexs = 0;
  30. }
  31. updateContactInfo(); // 更新联系人信息
  32. });
  33. ggNamespace.functions.WorkPage.getContactInfoGridsettings = function() {
  34. const me = this;
  35. let settings;
  36. const columns = [];
  37. settings = {
  38. columns: columns,
  39. processing: true,
  40. serverSide: true,
  41. ajax: {
  42. url: '../d/detail/contacts',
  43. contentType: 'application/json',
  44. type: 'POST',
  45. lang: defLanguage,
  46. complete: function() {
  47. me.contacts = {
  48. contactPersons: {},
  49. contactNumbers: {},
  50. contactIndexs: {},
  51. ptpCode: 'promiseToPay',
  52. callbackCode: 'callbackRequest',
  53. contactPersonIds: {}
  54. };
  55. me.mobileContacts = {
  56. contactPersons: {},
  57. contactNumbers: {},
  58. contactPersonIds: {}
  59. };
  60. me.phoneNumbers = {};
  61. me.detailAddresses = {};
  62. me.phoneNumberIndexes = {};
  63. me.phoneNumberIndexesForSms = {};
  64. me.contactPersonAddresses = {};
  65. const selfPhoneNumberArr = [];
  66. var result = me.contactPhones.contactInfo.getRecords();
  67. }
  68. }
  69. };
  70. return settings;
  71. };

修改说明:

  • 抽取方法:创建了一个名为 updateContactInfo 的方法,用于处理更新联系人的逻辑,避免代码重复。
  • 按钮事件:在上一步和下一步按钮的点击事件中,调用 updateContactInfo() 来重新赋值参数并触发数据更新。

这样做后,当用户点击“上一步”或“下一步”按钮时,相关的联系人信息将会被重新加载并更新。


内容由零声教学AI助手提供,问题来源于学员提问

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=20277

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?