yisier / nps

基于NPS 0.29.10 版本二开而来,NPS接力项目。公益云NPS:https://natnps.com
GNU General Public License v3.0
2.09k stars 266 forks source link

v0.26.16 新增一次客户端,列表会增加2个一样的客户端 #89

Closed GMYXDS closed 1 year ago

GMYXDS commented 1 year ago

Describe the bug 点击新增客户端,会提示2次增加成功,然后然后客户端列表,发现刚才新增了2个重复的客户端

To Reproduce 如上

Expected behavior 点击新增只增加一个客户端

Screenshots or logs

Server (please complete the following information):

Client (please complete the following information):

Additional context

GMYXDS commented 1 year ago
function submitform(action, url, postdata) {
    postsubmit = false;
    switch (action) {
        case 'start':
        case 'stop':
        case 'delete':
            var langobj = languages['content']['confirm'][action];
            action = (langobj[languages['current']] || langobj[languages['default']] || 'Are you sure you want to ' + action + ' it?');
            if (! confirm(action)) return;
            postsubmit = true;
        case 'add':
        case 'edit':
            $.ajax({
                type: "POST",
                url: url,
                data: postdata,
                success: function (res) {
                    alert(langreply(res.msg));
                    if (res.status) {
                        if (postsubmit) {document.location.reload();}else{history.back(-1);}
                    }
                }
            });
        case 'global':
            $.ajax({
                type: "POST",
                url: url,
                data: postdata,
                success: function (res) {
                    alert(langreply(res.msg));
                    if (res.status) {
                        document.location.reload();
                    }
                }
            });
    }
}

猜测问题可能是,触发add之后,同时走了edit 和 global

yisier commented 1 year ago

已修复