问题描述
angular.module('controllers',[]);
angular.module('app',['controllers','ui.bootstrap','angularUtils.directives.dirPagination']);;
angular.module('控制器')
.controller('MainCtrl',function($ scope,$ element,CommonService,$ timeout){
$ scope.index = 0;
$ scope.tables = [];
$ scope.canShowDrop = false;
$ scope.country =“选择国家”;
$ scope.dateFormat ='dd-MM-yyyy';
$ scope.startDatePopup = {
打开:错误
};
$ scope.endDatePopup = {
打开:错误
};
$ scope.OpenStartDate = function(){
$ scope.startDatePopup.opened =!$ scope.startDatePopup.opened;
};
$ scope.OpenEndDate = function(){
$ scope.endDatePopup.opened =!$ scope.endDatePopup.opened;
};
$ scope.Search = function(){
CommonService.GetData($ scope);
};
$ scope.ChangeCountry =函数(名称){
$ scope.country =名称;
CommonService.GetData($ scope);
}
$ scope.exportToExcel =函数(tableId){
CommonService.ExportData($ scope);
返回false;
}
$ scope.ShowDrop = function(){
$ scope.canShowDrop = true;
}
$ scope.HideDrop =函数(){
$ scope.canShowDrop = false;
}
$ scope.ExcludedColumns =函数(列){
return!(column =='JoiningDate'|| column =='Total');
};
CommonService.GetData($ scope).then(function(){
$ scope.countrylist = $ scope.tables [0] .cols;
});
})
.service('CommonService',function CommonService($ http,$ q){
var service = {};
service.GetData = GetData;
service.ExportData =导出;
退货服务;
函数GetData($ scope){
var paramStartDate = $ scope.StartDate吗? $ scope.StartDate:“”;
var paramEndDate = $ scope.EndDate吗? $ scope.EndDate:“”;
var payload = {'selectedCountry':$ scope.country,'startDate':paramStartDate,'endDate':paramEndDate,'isExport':'false'};
var params = [];
params.method =“ POST”;
** params.url ='DailyReport.aspx / GetDailyReport'; **
params.data =有效负载;
params.contentType =“ application / json; charset = utf-8”;
params.dataType =“ json”;
返回$ q.all([
$ http(params).then(function(response){
// document.write(response.data);
//返回response.statusText;
//返回response.data.d;
// var data = response.data.d;
// console.log(data);
警报(response.status)
//提醒(标题)
//警告(config)
返回response.data.d;
})。catch(函数(e){
console.log('Error:',e);
抛出e;
//在这里处理错误
})
])。then(函数(结果){
警报(结果)
var jsonData = results [0];
$ scope.tables = [];
$ scope.tables.push({行:jsonData,cols:Object.keys(jsonData [0])});
});
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)