|
|
@@ -1,36 +1,123 @@
|
|
|
import dialog from '@/utils/dialog'
|
|
|
+import Pdfh5 from "pdfh5";
|
|
|
+import "pdfh5/css/pdfh5.css";
|
|
|
+import { snapshoot } from '@/api/platform/file/attachment' //印章,快照
|
|
|
|
|
|
-const getPint = (tableForm,srcUrl) => {
|
|
|
- dialog(
|
|
|
+const getPint = (tableForm, srcUrl) => {
|
|
|
+ var flag = true;
|
|
|
+ if (/Mobi|Android|iPhone|iPad/i.test(navigator.userAgent)) {
|
|
|
+ flag = false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (flag) {
|
|
|
+ dialog(
|
|
|
+ {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ readonly: false,
|
|
|
+ data: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ template: '<div style="height:100%">' +
|
|
|
+ '<iframe src="' + srcUrl + '"' +
|
|
|
+ 'id="myiframe" frameborder="0" scrolling="no" height="100%" width="100%"></iframe>' +
|
|
|
+ '</div>'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ dialog: {
|
|
|
+ appendToBody: true,
|
|
|
+ width: '90%',
|
|
|
+ top: '1vh',
|
|
|
+ center: true,
|
|
|
+ title: '',
|
|
|
+ 'custom-class': 'ibps-dialog-91'
|
|
|
+ }
|
|
|
+ }, (tpl) => {
|
|
|
+ tableForm.dialogTemplate = tpl
|
|
|
+ }
|
|
|
+ ).catch((_this) => {
|
|
|
+ _this.visible = false
|
|
|
+ tableForm.dialogTemplate = null
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+
|
|
|
+ dialog(
|
|
|
+ {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ readonly: false,
|
|
|
+ data: '',
|
|
|
+ pdfh5: null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getYab()
|
|
|
+ this.getMet()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getYab(){
|
|
|
+ let srcUrl1 = srcUrl.split('rpx=')[1]
|
|
|
+ let srcUrlList = srcUrl1.split('.rpx&id_=')
|
|
|
+ let name = srcUrlList[0].split('/')
|
|
|
+
|
|
|
+ let url = tableForm.$getReportFile(srcUrlList[0], `id_=${ srcUrlList[1] }`)
|
|
|
+ console.log(url)
|
|
|
+ let params = {
|
|
|
+ url: url,
|
|
|
+ name: name[name.length - 1] || '暂无',
|
|
|
+ type: 'pdf'
|
|
|
+ }
|
|
|
+ snapshoot(params).then(res => {
|
|
|
+ if(res.state == 200){
|
|
|
+ const data = res.data
|
|
|
+ this.getMet(data.filePath)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getMet(url) {
|
|
|
+ let that = this
|
|
|
+ // //实例化1
|
|
|
+ that.$nextTick(() => {
|
|
|
+ that.pdfh5 = new Pdfh5("#demo", {
|
|
|
+ pdfurl: window.location.origin + '/'+url,
|
|
|
+ lazy: true
|
|
|
+ })
|
|
|
+ that.pdfh5.on("complete", function (status, msg, time) {
|
|
|
+ // console.log(status, msg, time)
|
|
|
+ })
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ template: '<div style="height:100%"><div id="demo"></div></div>'
|
|
|
+ },
|
|
|
{
|
|
|
- data(){
|
|
|
- return {
|
|
|
- readonly:false,
|
|
|
- data:''
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- template:'<div style="height:100%">' +
|
|
|
- '<iframe src="'+ srcUrl + '"'+
|
|
|
- 'id="myiframe" frameborder="0" scrolling="no" height="100%" width="100%"></iframe>'+
|
|
|
- '</div>'
|
|
|
- },
|
|
|
- {
|
|
|
- dialog:{
|
|
|
- appendToBody:true,
|
|
|
- width: '90%',
|
|
|
- top: '1vh',
|
|
|
- center: true,
|
|
|
- title: '',
|
|
|
- 'custom-class':'ibps-dialog-91'
|
|
|
- }
|
|
|
- },(tpl)=>{
|
|
|
- tableForm.dialogTemplate =tpl
|
|
|
- }
|
|
|
- ).catch((_this)=>{
|
|
|
- _this.visible = false
|
|
|
- tableForm.dialogTemplate = null
|
|
|
- })
|
|
|
+ dialog: {
|
|
|
+ appendToBody: true,
|
|
|
+ width: '90%',
|
|
|
+ top: '1vh',
|
|
|
+ center: true,
|
|
|
+ title: '',
|
|
|
+ 'custom-class': 'ibps-dialog-91'
|
|
|
+ }
|
|
|
+ }, (tpl) => {
|
|
|
+ tableForm.dialogTemplate = tpl
|
|
|
+ setTimeout(() => {
|
|
|
+
|
|
|
+ }, 2000);
|
|
|
+ //监听完成事件
|
|
|
+ // this.pdfh5.on("complete", function (status, msg, time) {
|
|
|
+ // })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ ).catch((_this) => {
|
|
|
+ _this.visible = false
|
|
|
+ tableForm.dialogTemplate = null
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|