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参数,后面才可以调用
页面效果图: