美文网首页
2018-03-26打印库存变化

2018-03-26打印库存变化

作者: NOTEBOOK2 | 来源:发表于2018-03-26 15:39 被阅读0次

    路径和文件名称设定:

        let fetchUrl;
        let pdfName;
        switch (payload.iv.humanizedType){
          case "Opening":
            fetchUrl = "http://ssr.stg.bindolabs.com/pdf/2";
            pdfName = "Inventory_opening.pdf";
            break;
          case "Adjustment by actual quantity":
            fetchUrl = "http://ssr.stg.bindolabs.com/pdf/3";
            pdfName = "Inventory_qty_adjustment.pdf";
            break;
          case "Adjustment by variance quantity":
            fetchUrl = "http://ssr.stg.bindolabs.com/pdf/4";
            pdfName = "Inventory_Variance_qty_adjustment.pdf";
            break;
          case "Cost adjustment":
            fetchUrl = "http://ssr.stg.bindolabs.com/pdf/5";
            pdfName = "Inventory_cost_adjustment.pdf";
            break;
        }  
    

    download:

        function downloadFile(fileName, content){
          const aLink = document.createElement('a');
          aLink.download = fileName;
          aLink.href = URL.createObjectURL(content);
          aLink.click()
        }
    
        fetch(fetchUrl, {
          method: 'post',
          body: JSON.stringify(payload)
        }).then(r => r.blob()).then(content => {
          downloadFile(pdfName, content)
        })   
    

    相关文章

      网友评论

          本文标题:2018-03-26打印库存变化

          本文链接:https://www.haomeiwen.com/subject/kzercftx.html