123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- 'use strict';
- /**
- * controller for User Profile Example
- */
- app.controller('taskDetailedListCtrl', ["$rootScope", "$scope", "$state", "$timeout", "$interval", "$modal", "SweetAlert", "i18nService", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_bpm_schedule", "api_bpm_data","api_doc_data","api_user_data","api_wechatfile","FileUploader","api_bpm_domain","$http","$stateParams","moment","api_task_export", function($rootScope, $scope, $state, $timeout, $interval, $modal, SweetAlert, i18nService, uiGridConstants, uiGridGroupingConstants, Restangular, api_bpm_schedule, api_bpm_data,api_doc_data,api_user_data,api_wechatfile,FileUploader,api_bpm_domain,$http,$stateParams,moment,api_task_export) {
- // $scope.ceshi="哈哈"
- $scope.monthList=[];//所有月份的集合
- $scope.yearList=[];//所有年份集合
- $scope.yearData={};//
- $scope.exeData=[];
- // $scope.monthIdx="";//月份选择
- $scope.nowYear=moment(new Date().getTime()).format('YYYY');
- $scope.nowMonth=moment(new Date().getTime()).format('MM');
- $scope.yearData.data={year:$scope.nowYear};//当前年份
- $scope.monthData=$scope.nowMonth;//当前月份
- $scope.monthIdx=$scope.nowMonth-1;
- // 所有月份
- for(var i=1;i<13;i++){
- $scope.monthList.push({"month":i})
- }
- //所有年份
- for(var i=1990;i<Number($scope.nowYear)+1;i++){
- $scope.yearList.push({"year":i})
- }
- // 换年份
- $scope.changeYear=function(){
- // console.log("ok")
- $scope.exeData=[];
- api_task_export.yearListSee($scope.yearData.data.year,$scope.monthData).then(function(res){
- if(res.status==200){
- $scope.exeData=res.data;
- for(var i=0;i<$scope.exeData.length;i++){
- $scope.exeData[i]["item"]=i+1
- }
- }
- })
- }
- // 点击获取表单
- $scope.selectMonth=function(value,idx){
- $scope.monthData=value;
- $scope.monthIdx=idx;
- $scope.exeData=[];
- api_task_export.yearListSee($scope.yearData.data.year,$scope.monthData).then(function(res){
- if(res.status==200){
- $scope.exeData=res.data;
- for(var i=0;i<$scope.exeData.length;i++){
- $scope.exeData[i]["item"]=i+1
- }
- }
- })
- }
- // 导出
- $scope.export=function(){
- $http({
- url: api_task_export.yearListExport($scope.yearData.data.year, $scope.monthData).getRequestedUrl(),
- method: 'GET',
- // data: JSON.stringify(filadata),
- headers: {
- // 'Content-type': 'application/xls',
- 'Accept': '*/*'
- },
- responseType: 'arraybuffer'
- }).success(function (data, status, headers, config) {
- // $scope.ldloading.zoom_in = false;
- var file = new Blob([data], {
- type: 'application/vnd.ms-excel'
- });
- //trick to download store a file having its URL
- var fileURL = URL.createObjectURL(file);
- var a = document.createElement('a');
- a.href = fileURL;
- a.target = '_blank';
- a.download = '任务清单.xls';
- document.body.appendChild(a);
- a.click();
- }).error(function (data, status, headers, config) {
- // $scope.ldloading.zoom_in = false;
- });
- }
- // 进来获取当前报表
- $scope.refash=function(){
- $scope.exeData=[];
- api_task_export.yearListSee($scope.yearData.data.year,$scope.monthData).then(function(res){
- if(res.status==200){
- $scope.exeData=res.data;
- for(var i=0;i<$scope.exeData.length;i++){
- $scope.exeData[i]["item"]=i+1
- }
- }
- })
- }
- $scope.refash()
- }]);
|