ng导入表格

1.html

 <div class="c_btn c_btn_active lh46 w200" ngf-select="handleFiles($file)" ngf-multiple="false"><span class="import_icon"></span>导入表格</div>

2.js

    // 导入表格  application/vnd.ms-excel

    $scope.handleFiles = function (file) {
        if (file) {
            if(/(xlsx|xls)$/g.test(file.name)){
                var fd = new FormData();
                fd.append('myfiles', file);
                $http({
                    method: 'POST',
                    url: serverAddr.normal + "/quality/api/v2/manage/saveQDFile",
                    data: fd,
                    headers: {'Content-Type': undefined},
                    transformRequest: angular.identity
                })
                  .success(function (response) {
                      //上传成功的操作
                      document.querySelector('input[type=file]').files[0] = null;
                      if(response.error_code === 0){
                          alertP('上传成功');
                          manageQDListFun();
                      }else{
                          alertP(response.error_info || '服务器有故障');
                      }
                  }).error(function (err) {
                    alertP('上传失败');
                });
            }else{
                alertP('请上传excel表格')
            }
        }

    };

   // 提示框
    function alertP(msg,time){
        var t=time||1000;
        vm.boostTip=msg;
        vm.boostTipFlag=true;
        var a=$timeout(function(){
            vm.boostTipFlag=false;
            $timeout.cancel(a);
        },t)
    }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值