<!doctype html> <html> <head> <meta charset="utf-8"><meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache"> <title>pdf文件预览</title> <script type="text/javascript"> var pageVue = null; function loadJsCss(callback) { var jscss_urls = []; window.top.initJsCss(document, jscss_urls, callback); }; function initVue() { new ListVue({ el: "#vbody", data: { title: "附件预览", popupParames: {}, formdata: {},//fileid, filename, dataname filetype: "", file_pdf: "", imglist: [], seal: false, //æ¤å…¥ä¸ŠæŠ¥æ— 真å‘票转人工 reCheckInvoice: false, bill_no: "", }, created() { this.popupParames = clone(Root.popupParames); this.formdata = clone(this.popupParames.data); /* if (this.formdata.filename) { this.title += "-" + this.formdata.filename; } */ if (this.formdata.filename) { this.title += "-" + this.formdata.filename; Root.setPopupTitle(this.title); let fileName = clone(this.formdata.filename); let index1 = fileName.lastIndexOf("."); let index2 = fileName.length; let suffix = fileName.substring(index1, index2).toLowerCase(); //åŽç¼€å if (suffix == ".png" || suffix == ".jpg") { this.filetype = "img" } else { this.filetype = "pdf" } } if (this.formdata.isseal) { this.seal = true; } //æ¤å…¥ä¸ŠæŠ¥æ— 真å‘票转人工 if (this.popupParames.delta && this.popupParames.delta.reCheckInvoice) { this.reCheckInvoice = true; } }, mounted() { this.initData(); this.$nextTick(() => { // 以æœåŠ¡çš„æ–¹å¼è°ƒç”¨çš„ Loading 需è¦å¼‚æ¥å…³é— hideLoading(); //釿–°è®¾ç½®å¼¹çª—宽高 this.$nextTick(function(){ let w_ = "100vw"; let h_ = "100vh"; Root.setPopupWH(w_, h_); }) }); }, methods:{ closeDialog() {//å…³é— var me = this; if (me.popupParames.totab){ Root.tab.removeItem(Root.tab.selected); Root.tab.open(me.popupParames.parentOption, false); } else { Root.hidePopup(); } }, saveAfter() {//è°ƒå›žè°ƒçš„å…³é— var me = this; if (this.popupParames.callback) { let obj = { row: clone(this.formdata), bill_no: me.bill_no, } this.popupParames.callback(obj, function() { me.closeDialog(); }); } else { me.closeDialog(); } }, onServerInitData(data) { var me = this.data; }, initData() { var fileid = this.formdata.fileid; var dataname = this.formdata.dataname; var filepath = this.formdata.file_path; if (fileid && dataname) { this.getPDF(fileid, dataname); } else if (filepath) { this.getPDFByPath(filepath, "AsWord"); } //this.$refs.pdf_ref.src=file_pdf.url; }, // 预览 getPDF(fileid, dataname) { var me = this; getDownloadFileUrl(fileid, dataname, function(url) { me.file_pdf = url; if (me.filetype == "img") { me.imglist.push(url); } }); }, getPDFByPath(filePath, action) { var me = this; getFileByPathUrl(filePath, function(url) { me.file_pdf = url; if (me.filetype == "img") { me.imglist.push(url); } }, action); }, /* getPDF(fileid) { var me =this; var file_pdf_ = "http://grand-dev.highdatas.com/root/io/downloadOneFile?category=org&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvbmxpbmVDb2RlIjoiMTY5ODExMDU4OTI0MSIsInVzZXJJZCI6ImFkbWluIn0.z8tXKc5IhTSPnMlVxI88MUBc9r8dvYnznOV1FNN9-mc&file_index_id=16693709982b4d2989f17783f144287e&dataname=md_org_shipto" me.file_pdf = file_pdf_; me.imglist.push(file_pdf_); return getDownloadFileUrlPath(fileid, function(result_) { if (result_.data && result_.data.filepath) { var file_pdf_ = ""; var path_ = result_.data.filepath; if (path_.substring(0, 5) == "root/") { file_pdf_ = window.top.RootSetting.url_file + path_.substring(5); } else { file_pdf_ = path_; } if (file_pdf_.indexOf("?") > 0) { file_pdf_ = file_pdf_ + "&" + "t=" + new Date().getTime(); } else { file_pdf_ = file_pdf_ + "?" + "t=" + new Date().getTime(); } me.file_pdf = file_pdf_; if (me.filetype == "img") { me.imglist.push(file_pdf_); } } else { me.file_pdf = result_; } }); }, */ download() { var fileid = this.formdata.fileid; var dataname = this.formdata.dataname; var filepath = this.formdata.file_path; if (fileid && dataname) { handleDownload(fileid, dataname); } else if (filepath) { handleDownload(filepath); } }, onseal() { let row = this.formdata; //me.dataname: salesOrderDetail let url = "../order/sorder/signature.html?id=" + row.id + "&delta=" + row.dataname + "&userid=" + window.top.userinfo.user.id; let post_url = window.top.RootSetting.url.slice(0,-8) let win1= window.open(url,'a'); //win1.postMessage(param,"*"); }, //æ¤å…¥ä¸ŠæŠ¥æ— 真å‘票转人工 reCheckInvoiceConfirm() { var me = this; var config = { totab: false, width: "800px", height:"400px", icon: "icon-product", text: "查验å‘票", id: "checkInvoice" + me.formdata.fileid, url: "module/order/page/popup/implanted_invoice_check.html", data: me.formdata.fileid, delta: {}, sceneCode: "edit", callback: function(obj, callback) { me.bill_no = obj.realBillNo || ""; me.saveAfter(); if (callback) { callback(); } } }; this.doPopupByPublic(config); } } }); }; loadJsCss(function () { initVue(); }); </script> <style> html{ overflow-x: hidden; } </style> </head> <body> <div id="vbody"> <div id="page_root"> <div class="popup_topbar"> <span>{{title}}</span> </div> <div class="popup_tools_top"> <div style="float: right; margin-right: 24px;"> <el-button-group v-if="seal" style="margin: 0px 20px;"> <el-button type="success" @click="onseal">釿–°ç¾ç« </el-button> </el-button-group> <el-button-group v-if="reCheckInvoice"> <el-button @click="reCheckInvoiceConfirm">查验</el-button> </el-button-group> <el-button-group style="margin: 0px 20px;"> <el-button @click="download()">导出</el-button> </el-button-group> <!-- <el-button-group style="margin-left: 3px;"> <el-button type="danger" plain @click="closeDialog">å…³ é—</el-button> </el-button-group> --> </div> </div> <div class="versionNo" style="position: absolute; top: 40px; bottom: 10px; left: 10px; right: 10px; padding: 20px; text-align: center;"> <!-- <iframe ref="pdf_ref" :src="file_pdf" style="width: 100%; height: 100%;"></iframe> --> <iframe v-if="filetype == 'pdf' && file_pdf" ref="pdf_ref" :src="file_pdf" style="width: 100%; height: 100%; border: 0px;"></iframe> <el-image v-else-if="filetype == 'img' && file_pdf" style=" height: 400px; margin-left: 10px;" :src="file_pdf" :preview-src-list="imglist" fit="contain"> </el-image> </div> <!-- <div class="el-dialog__footer" style="position: absolute; bottom: 10px; width: 100%; text-align: right;"> <el-button type="default" @click="closeDialog">å…³ é—</el-button> </div> --> </div> <div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 50vh;"> <div class="spinner"> <div class="cube1"></div> <div class="cube2"></div> </div> </div> </div> </body> </html>