• 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);}); };
  • 相关阅读:
    openOPC与监控页面二
    Node教程——Gulp前端构建工具-教程
    回到顶部插件
    《软件测试52讲》——测试基础知识篇
    计算贝塞尔曲线上点坐标
    少年,不要滥用箭头函数啊
    JS属性defer
    leetcode-572-另一个树的子树
    leetcode-9.-回文数
    leetcode-300-最长上升子序列
  • 原文地址:https://www.cnblogs.com/cynthia-wuqian/p/7150220.html
Copyright © 2020-2023  润新知