zoukankan      html  css  js  c++  java
  • 前后端交互中出现的问题(一)

    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参数,后面才可以调用

    页面效果图:

  • 相关阅读:
    再谈TextField
    IOS-TextField知多少
    leftBarButtonItems
    LeftBarButtonItems,定制导航栏返回按钮
    Apple Mach-O Linker (id) Error "_OBJC_CLASS...错误解决办法 Apple Mach-O Linker (id) Error "_OBJC_CLASS...错误解决办法
    Unrecognized Selector Sent to Instance问题之诱敌深入关门打狗解决办法
    UNRECOGNIZED SELECTOR SENT TO INSTANCE 问题快速定位的方法
    Present ViewController,模态详解
    UILABEL AUTOLAYOUT自动换行 版本区别
    iOS自动布局解决警告Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
  • 原文地址:https://www.cnblogs.com/baihb/p/6703038.html
Copyright © 2011-2022 走看看