zoukankan      html  css  js  c++  java
  • angular post 带参数 导出excel

    原文地址:http://www.cnblogs.com/xujanus/p/5985644.html

    html

     <button class="btn btn-info" ng-click="getDownloadLink()">导出查询结果</button>

    js

    // 导出查询结果
    $scope.getDownloadLink = function () {
        var url = $rootScope.interfaceCtx + '/salesorder/exportOrderList.do';
        var params = {
            bizType:$scope.selectOrderType,
            bizNo:$scope.selectOrderTypeRefCode,
            channelId:$scope.channelId,
            prodId:$scope.prodId,
            orgId:$scope.orgId,
            userId:$scope.buyerAccountId,
            dateType:$scope.selectTimeType,
            dateStart:$scope.effStartDate,
            dateEnd:$scope.effEndDate,
            orderStatus:$scope.selectInsureState,
            promoter:$scope.promoterAccountId,
            holderId:$scope.policyHolderId,
            insuredId:$scope.insuredPersonId,
        };
        $http.post(url,params,{responseType: 'arraybuffer'}).success(function (res) {
         //begin
    var blob = new Blob([res], {type: "application/vnd.ms-excel"}); var objectUrl = URL.createObjectURL(blob); var aForExcel = $("<a><span class='forExcel'>下载excel</span></a>").attr("href",objectUrl); $("body").append(aForExcel); $(".forExcel").click(); aForExcel.remove();
         //end }).error(function (res) {$scope.toastError(res);}); };
  • 相关阅读:
    【English】20190522
    06_Intent和IntentFilter
    05_Content Provider
    04_ Broadcast Receiver
    03_Service的绑定
    02_启动和销毁Service
    01_Activity生命周期及传递数据
    Android对应版本号
    如何在word中插入代码
    项目经验总结
  • 原文地址:https://www.cnblogs.com/cynthia-wuqian/p/7150220.html
Copyright © 2011-2022 走看看