ZBLOG

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

根据你的需求,想要在点击“上一步”和“下一步”按钮时重新调用接口以更新参数。你可以在 self.getContactInfoGridSettings() 中添加对接口的调用,确保每次点击按钮时都能获取到最新的数据。

下面是如何修改你的代码,以确保在按钮点击时都会调用相应的接口:

self.getContactInfoGridSettings = ggNamespace.functions.WorkPage_getContactInfoGridSettings;

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

    updateContactPhonePanel();
});

self.nextButton.addClickHandler(function() {
    if (currentIndexs < allData.length - 1) {
        currentIndexs++;
    } else {
        currentIndexs = 0;
    }

    updateContactPhonePanel();
});

function updateContactPhonePanel() {
    self.contactPhones = new ContactPhonePanel({
        custId: allData[currentIndexs].customerId,
        queue: self.queue,
        complaintPhone: self.complaintPhone,
        complaintPhoneNew: self.complaintPhoneNew,
        complaintUsername: self.complaintUsername,
        complaintRelation: self.complaintRelation,
        auto: self.auto,
        callPhone: (phoneNum, customerId) => self.header.callPhone(phoneNum, customerId)
    });

    // 调用获取联系信息设置的方法
    self.getContactInfoGridSettings();
}

ggNamespace.functions.WorkPage.getContactInfoGridsettings = function() {
    const me = this;
    let settings;
    const columns = [];
    
    settings = {
        columns: columns,
        processing: true,
        serverSide: true,
        ajax: {
            url: '../d/detail/contacts',
            contentType: 'application/json',
            type: 'POST',
            lang: defLanguage,
            complete: function() {
                me.contacts = {
                    contactPersons: {},
                    contactNumbers: {},
                    contactIndexs: {},
                    ptpCode: 'promiseToPay',
                    callbackCode: 'callbackRequest',
                    contactPersonIds: {}
                };

                me.mobileContacts = {
                    contactPersons: {},
                    contactNumbers: {},
                    contactPersonIds: {}
                };
                
                me.phoneNumbers = {};
                me.detailAddresses = {};
                me.phoneNumberIndexes = {};
                me.phoneNumberIndexesForSms = {};
                me.contactPersonAddresses = {};

                const selfPhoneNumberArr = [];
                var result = me.contactPhones.contactInfo.getRecords();

                // 在这里处理返回结果
            }
        }
    };

    return settings;
};

修改说明:

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

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


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

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

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

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

联系我们

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

微信号:3007537140

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

关注我们
x

注册

已经有帐号?