zoukankan      html  css  js  c++  java
  • [2015-10-27]后台导出excel---前端部分----question

    1.以下这种方法是ok的

    //-jade部分

    button.btn.btn-primary.btn-sm(type="button" style=" 114px;margin-left: 30px" ng-click="exportcsv()") 导出Excel 

    //-coffee部分:加上表格的查询条件传到后台,然后进行导出

        $scope.exportcsv=()->
            $scope.page = 1
            if !$scope.querytext
                $scope.querytext=""
            $scope.input=[$scope.querystyle,$scope.querytext]
    
            if $scope.belonged is undefined
                $scope.belonged = ""
            if $scope.operation is undefined
                $scope.operation = ""
            if $scope.firm is undefined
                $scope.firm = ""
            if $scope.statusplan is undefined
                $scope.statusplan = ""
            if $scope.station_name is undefined
                $scope.station_name = "所有站点"
            if $scope.locat is undefined
                $scope.locat = ""
            if $scope.alertcheck is undefined
                $scope.alertcheck = false
    
            location.href="/api/outRepair/?"+
            "after="+$scope.after+'&'+
            "before="+$scope.before+'&'+
            "after_last="+$scope.aftertwo+'&'+
            "before_last="+$scope.beforetwo+'&'+
            "alertcheck="+$scope.alertcheck+'&'+
            "belonged="+$scope.belonged+'&'+
            "conditions="+$scope.input[0]+'&'+
            "contents="+$scope.input[1]+'&'+
            "firm="+$scope.firm+'&'+
            "operation="+$scope.operation+'&'+
            "page="+$scope.page+'&'+
            "per_page="+$scope.per_page+'&'+
            "plan_status="+$scope.statusplan+'&'+
            "station_name="+$scope.station_name+'&'+
            "locat="+$scope.locat

    2.以下此种方法是不ok的,不知道为什么有问题,后台是python写,是不是导出必须要是链接形式?

    //-jade部分

    button.btn.btn-primary.btn-sm(type="button" style=" 114px;margin-left: 30px" ng-click="exportcsv()") 导出Excel 

    //-coffee部分:加上表格的查询条件传到后台,然后进行导出

    在这个上添加   jianxiuexceldata

    module.exports=($scope,$rootScope,$modal,$http,locatdata,overhaulRegulatordata,allDatas,jianxiuexceldata,alertdata) ->
    $scope.exportcsv=()->
        jianxiuexceldata.excelport($scope.alertcheck,$scope.input,$scope.after,$scope.before,$scope.aftertwo,$scope.beforetwo,$scope.page,$scope.per_page,$scope.belonged,$scope.operation,$scope.firm,$scope.statusplan,$scope.station_name,$scope.locat).success (data)->
                console.log "excel导出成功"

    //-main.coffee部分---接口部分

    app.factory "jianxiuexceldata", ($http) ->
        url = "api/outRepair/"
        return {
            excelport: (alertcheck,input,after,before,after_last,before_last,page,per_page,belonged,operation,firm,plan_status,station_name,locat)->
                    $http.get "#{url}",{
                        "params":
                            "alertcheck": alertcheck
                            "conditions": input[0]
                            "contents": input[1]
                            "after": after
                            "before": before
                            "after_last": after_last
                            "before_last": moment(before_last).add(1,'days').format("YYYY-MM-DD")
                            "page" : page
                            "per_page" : per_page
                            "belonged" : belonged
                            "operation" : operation
                            "firm" : firm
                            "plan_status" : plan_status
                            "locat": locat
                            "station_name": station_name
                    }
    }    
  • 相关阅读:
    Flowable学习笔记(二、BPMN 2.0-基础 )
    Flowable学习笔记(一、入门)
    只有程序员才懂的幽默
    Navicat自动备份数据库
    两个原因导致Spring @Autowired注入的组件为空
    设计模式—— 十二 :代理模式
    设计模式—— 十 一:建造者模式
    SpringBoot学习笔记(十一:使用MongoDB存储文件 )
    Swagger API文档集中化注册管理
    Spring Boot2从入门到实战:集成AOPLog来记录接口访问日志
  • 原文地址:https://www.cnblogs.com/rysly/p/exportexcel-backend.html
Copyright © 2011-2022 走看看