• 前后端交互中出现的问题(一)


    1.data 数据缺失  在新增js文件中

       <button class="btn btn-info"   ng-click="vm.create()"><i class="fa fa-plus"></i>新增</button>
    

     在页面上的新增按钮添加了点击事件,来实现录入数据

      //新增
                vm.create = function () {
                    openCreateOrEditOrder();
                };
    

     设置按钮点击触发的函数,之后调用该函数

      //弹窗
                function openCreateOrEditOrder() {
                    var modalInstance = $uibModal.open({
                        templateUrl: '~/App/Main/views/international/policy/fluxCache/createOrEditModal.cshtml',
                        controller: 'app.views.international.policy.fluxCache.createOrEditModel as vm',
                        backdrop: 'static'
                        //size: 'lg'//lg:大窗口弹窗,默认的为小窗口弹窗
                        //resolve: {
                        //    data: function () {
                        //        return data;
                        //    }
                        //}
                    });
                    modalInstance.result.then(function (result) {
                        vm.getFluxCacheMx();//调用查询的函数
                    });
                };
    

    之后在新增的js文件中要进行相关操作,代码如下

    (function () {
        appModule.controller('app.views.international.policy.fluxCache.createOrEditModel', [
            '$scope', '$uibModalInstance',
            function ($scope, $uibModalInstance) {
                var vm = this;
                vm.saving = false;
                //界面输入正则验证条件
                vm.patternCarrier = app.consts.patterns.carriers;
                vm.patternCity = app.consts.patterns.cityCodes;
                    vm.data = {
                        tripType: '1',
                        departCode: '',
                        arriveCode: '',
                        goFlightDateRange: '',
                        backFlightDateRange: '',
                        cacheDays:''
                    };
              
                //保存操作
                //vm.save = function () {
                //    //如果单程,回程日期为空
                //    if (vm.data.tripType == 1)
                //        vm.data.backFlightDateRange = null;
                //    vm.saving = true;
                //    ctripPolicyService.createOrUpdatePolicy(
                //        vm.data
                //        ).success(function (result) {
                //                    if (result.code) {
                //                        abp.notify.success(result.message);
                //                        $uibModalInstance.close();
                //                    } else {
                //                        abp.notify.error(result.message);
                //                    }
                //        })
                //        .finally(function () {
                //            vm.saving = false;
                //        });
                //};
    
                //取消操作
                vm.cancel = function () {
                    $uibModalInstance.dismiss();
                };
            }
        ]);
    })();
    

     现在就出现了一个很容易忽略的问题,data数据的缺失

    appModule.controller('app.views.domestic.airweb.3u.modal', [
            '$scope','$uibModalInstance', 'uiGridConstants', 'abp.services.app.airWeb','data',
            function ($scope, $uibModalInstance, uiGridConstants, airwebService,data) {
    

     请求头上要定义data参数,后面才可以调用

    页面效果图:

  • 相关阅读:
    伪多项式时间 Pseudo-polynomial time
    Aho-Corasick算法
    写给十八岁以下的你
    网络流算法
    Java static关键字
    带有负权边的最短路径问题
    Miller_Rabin(米勒拉宾)素数测试
    关于同余与模运算的总结
    UVa1585
    UVa修改版02
  • 原文地址:https://www.cnblogs.com/baihb/p/6703038.html
Copyright © 2020-2023  润新知