微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

第二次按下按钮时淘汰赛失败的模型

如何解决第二次按下按钮时淘汰赛失败的模型

在 .net 中有一个需要很少新功能的旧项目。当第一次按下按钮时,我们有一个主要的问题是淘汰赛,一切正常,但是当它第二次按下时,它会停止。 错误

GeneratedCode.ts:5564 Uncaught TypeError: source.accountNumber is not a function
    at _Mapper.unwrapPnsBankReportListItem (GeneratedCode.ts:5564)
    at Function._Mapper.convert (GeneratedCode.ts:4673)
    at Function._Mapper.unwrapDlgBankReportviewmodel (GeneratedCode.ts:4714)
    at DlgBankReport.OnClickSearchButton (DlgBankReport.ts:102)
    at Object.eval (eval at createBindingsstringEvaluator (knockout-3.1.0.debug.js:2437),<anonymous>:3:101)
    at HTMLButtonElement.<anonymous> (knockout-3.1.0.debug.js:3108)
    at HTMLButtonElement.dispatch (jquery-2.1.0.js:4371)
    at HTMLButtonElement.elemData.handle (jquery-2.1.0.js:4057) 

cshtml 按钮

        <div class="col-md-3">
            <button type="button" class="btn btn-block click-by-enter btn-primary" 
                    data-bind="click: function (data,event) { $root._Dialog.OnClickSearchButton($root,function (r) { $root._mapviewmodel(r); }); }">Meklēt</button>
        </div>

ts

public OnClickSearchButton(modelObservable: Pns.Models.viewmodels.DlgBankReportviewmodelObservable,success: (r: Pns.Models.viewmodels.DlgBankReportviewmodel) => any): void {
            var focusElem = $(':focus');
            Pns.Instance.showPleaseWaitDlg();
            const obs = Pns.Models.viewmodels._Mapper.unwrapDlgBankReportviewmodel(modelObservable);
            DynamicLocator.CreateProxy("Pns.Business.Dialogs.DlgBankReport",null,(<any>window).PnsInstance._connection,function (dlg: Pns.Business.Dialogs.DlgBankReport) {
                $.ajax(Pns.Configuration.ApiRootUri + "AccountReport/rpc/ExecuteCreation",{
                    data: JSON.stringify(obs),dataType: 'json',contentType: 'application/json',type: 'POST',success: function (modelResult: Pns.Models.viewmodels.DlgBankReportviewmodel) {

                    },error: function () {

                    }
                });
            });
        }

它在 ts 中的这一行出现了上述错误

const obs = Pns.Models.viewmodels._Mapper.unwrapDlgBankReportviewmodel(modelObservable);

不知道为什么它不起作用,因为在其他任何地方它都可以正常工作。如果有人知道为什么以及如何解决它,请告诉我。生成模型,因此其中没有错误。 其他模型在列表中发生错误。它的映射也是代码生成的,可以在别处工作,这是它唯一崩溃的地方。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。