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

修改说明:

  1. 将重复代码提取到一个名为 updateContactPhonePanel 的函数中,以便在“上一步”和“下一步”按钮的事件处理程序中都可以调用。
  2. 确保每次更新联系人面板后,都调用 getContactInfoGridSettings 方法,这样就会触发 AJAX 请求来获取最新数据。

希望这些修改能够满足你的需求!如果有其他问题,请随时告诉我。


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

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

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

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

联系我们

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

微信号:3007537140

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

关注我们
x

注册

已经有帐号?