Browse Source

预览PDF

master
zuowenwen 4 years ago
parent
commit
82e3e083ff
  1. 3
      src/api/purchaseorder/purchaseRequisition.js
  2. 67
      src/views/modules/knifemold/receive.vue
  3. 76
      src/views/modules/purchaseorder/procurementReview.vue
  4. 61
      src/views/modules/purchaseorder/purchaseRequisition.vue
  5. 4
      src/views/modules/warehouse/warehouse.vue

3
src/api/purchaseorder/purchaseRequisition.js

@ -27,6 +27,9 @@ export const downFtpFile = data => createAPI(`ftp/file/downFtpFile?ossEntity=`+d
//获取审批记录信息
export const getFileList = data => createAPI(`sys/oss/getSysOssEntityList`,'POST' ,data)
//获取工具类型
export const getPartFamilyList = data => createAPI(`base/getPartFamilyList`,'POST' ,data)

67
src/views/modules/knifemold/receive.vue

@ -200,11 +200,56 @@
:label="buttons.operating">
<template slot-scope="scope">
<a @click="fileDownload(scope.row)">{{ buttons.fileDownload }}</a>
<a @click="filePreview(scope.row)">{{ buttons.preview }}</a>
</template>
</el-table-column>
</el-table>
</el-form>
</el-dialog>
<el-dialog title="预览" :visible.sync="pdfVisible" center width="60%" >
<iframe :src="this.pdfUrl" frameborder="0" width="100%" height="400px"></iframe>
<!-- <div class="pdf">-->
<!-- <div class="pdf-tab">-->
<!-- <span-->
<!-- class="btn-def btn-pre"-->
<!-- @click.stop="prePage">上一页</span>-->
<!-- <span-->
<!-- class="btn-def btn-next"-->
<!-- @click.stop="nextPage">下一页</span>-->
<!-- <span-->
<!-- class="btn-def"-->
<!-- @click.stop="clock">顺时针</span>-->
<!-- <span-->
<!-- class="btn-def"-->
<!-- @click.stop="counterClock">逆时针</span>-->
<!-- <span-->
<!-- class="btn-def"-->
<!-- @click.stop="pdfPrintAll">全部打印</span>-->
<!-- <span-->
<!-- class="btn-def"-->
<!-- @click.stop="pdfPrint">部分打印</span>-->
<!-- </div>-->
<!-- <pdf-->
<!-- ref="pdf"-->
<!-- :src="this.pdfUrl"-->
<!-- :page="pageNum"-->
<!-- :rotate="pageRotate"-->
<!-- @password="password"-->
<!-- @progress="loadedRatio = $event"-->
<!-- @page-loaded="pageLoaded($event)"-->
<!-- @num-pages="pageTotalNum=$event"-->
<!-- @error="pdfError($event)"-->
<!-- @link-clicked="page = $event">-->
<!-- </pdf>-->
<!--&lt;!&ndash; <div>{{pageNum}}/{{pageTotalNum}}</div>&ndash;&gt;-->
<!--&lt;!&ndash; <div>进度{{loadedRatio}}</div>&ndash;&gt;-->
<!--&lt;!&ndash; <div>页面加载成功: {{curPageNum}}</div>&ndash;&gt;-->
<!-- </div>-->
</el-dialog>
</div>
</template>
@ -235,6 +280,8 @@
exportList,
getFileList,
} from "@/api/knifemold/receive.js"
import axios from "axios";
import Vue from "vue";
export default {
components: {
@ -255,6 +302,8 @@
value: 'N',
label: '不显示'
}],
select2 :[
],
},
height: 0,
//
@ -273,6 +322,7 @@
//
bannersFlag : false,
bannersBut : false,
pdfVisible : false,
torNumacc : '',
torNumdown : '',
//
@ -848,13 +898,11 @@
methods: {
//
fileDownload(row) {
this.$http({
url: this.$http.adornUrl('ftp/file/downFtpFile'),
method: 'post',
data: JSON.stringify(row),
axios.get('/api/ftp/file/downFtpFile/' + row.id, {
responseType: 'blob',
headers: {
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'token':Vue.cookie.get('token')
}
}).then(({data}) => {
//
@ -866,12 +914,21 @@
linkNode.download = fileName // adownload
linkNode.style.display = 'none'
linkNode.href = URL.createObjectURL(blob) // Blob URL
// if(val == 'Y'){
// this.pdfVisible = true
// this.pdfUrl = linkNode.href
// }else {
document.body.appendChild(linkNode)
linkNode.click() //
URL.revokeObjectURL(linkNode.href) // URL
document.body.removeChild(linkNode)
// }
})
},
filePreview(row){
this.pdfVisible = true
this.pdfUrl= 'http://192.168.1.2:9002/file/'+row.newFileName
},
//
initFileModel(row){
this.getFileList(row)

76
src/views/modules/purchaseorder/procurementReview.vue

@ -175,10 +175,11 @@
<el-table-column
header-align="center"
align="center"
width="50"
width="80"
:label="buttons.operating">
<template slot-scope="scope">
<a @click="fileDownload(scope.row)">{{ buttons.fileDownload }}</a>
<a @click="filePreview(scope.row)">{{ buttons.preview }}</a>
</template>
</el-table-column>
</el-table>
@ -505,6 +506,23 @@
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: 2101,
serialNumber: 'review2101EnterDate',
tableId: "review2101",
tableName: "PRHeader",
columnProp: "enterDate",
headerAlign: "center",
align: "left",
columnLabel: "创建时间",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: 2101,
@ -677,6 +695,7 @@
reviewDetails: '审批详情',
appendixInfo: '附件信息',
fileDownload: '下载',
preview : '预览',
},
// start
exportData: [],
@ -792,33 +811,36 @@
methods: {
//
fileDownload(row) {
// window.open( this.baseUrl+'/file/'+row.newFileName)
axios.get('/api/ftp/file/downFtpFile/' + row.id, {
responseType: 'blob',
headers: {
'Content-Type': 'application/json',
'token':Vue.cookie.get('token')
}
}).then(({data}) => {
//
const blob = new Blob([data], {type: "application/octet-stream"})
//
const fileName = row.fileName
// a
const linkNode = document.createElement('a')
linkNode.download = fileName // adownload
linkNode.style.display = 'none'
linkNode.href = URL.createObjectURL(blob) // Blob URL
// if(val == 'Y'){
// this.pdfVisible = true
// this.pdfUrl = linkNode.href
// }else {
document.body.appendChild(linkNode)
linkNode.click() //
URL.revokeObjectURL(linkNode.href) // URL
document.body.removeChild(linkNode)
// }
})
},
filePreview(row){
this.pdfVisible = true
this.pdfUrl= 'http://192.168.1.83:9002/file/'+row.newFileName
// axios.get('/proxyApi/ftp/file/downFtpFile/' + row.id, {
// responseType: 'blob',
// headers: {
// 'Content-Type': 'application/json',
// 'token':Vue.cookie.get('token')
// }
// }).then(({data}) => {
// //
// const blob = new Blob([data], {type: "application/octet-stream"})
// //
// const fileName = row.fileName
// // a
// const linkNode = document.createElement('a')
// linkNode.download = fileName // adownload
// linkNode.style.display = 'none'
// linkNode.href = URL.createObjectURL(blob) // Blob URL
// this.pdfUrl = linkNode.href
// // window.open( this.pdfUrl)
// // document.body.appendChild(linkNode)
// // linkNode.click() //
// // URL.revokeObjectURL(linkNode.href) // URL
// // document.body.removeChild(linkNode)
// })
this.pdfUrl= 'http://192.168.1.2:9002/file/'+row.newFileName
},
prePage(){
var p = this.pageNum

61
src/views/modules/purchaseorder/purchaseRequisition.vue

@ -253,10 +253,11 @@
<el-table-column
header-align="center"
align="center"
width="50"
width="80"
:label="buttons.operating">
<template slot-scope="scope">
<a @click="fileDownload(scope.row)">{{ buttons.fileDownload }}</a>
<a @click="filePreview(scope.row)">{{ buttons.preview }}</a>
</template>
</el-table-column>
</el-table>
@ -295,6 +296,50 @@
</el-table>
</el-dialog>
<el-dialog title="预览" :visible.sync="pdfVisible" center width="60%" >
<iframe :src="this.pdfUrl" frameborder="0" width="100%" height="400px"></iframe>
<!-- <div class="pdf">-->
<!-- <div class="pdf-tab">-->
<!-- <span-->
<!-- class="btn-def btn-pre"-->
<!-- @click.stop="prePage">上一页</span>-->
<!-- <span-->
<!-- class="btn-def btn-next"-->
<!-- @click.stop="nextPage">下一页</span>-->
<!-- <span-->
<!-- class="btn-def"-->
<!-- @click.stop="clock">顺时针</span>-->
<!-- <span-->
<!-- class="btn-def"-->
<!-- @click.stop="counterClock">逆时针</span>-->
<!-- <span-->
<!-- class="btn-def"-->
<!-- @click.stop="pdfPrintAll">全部打印</span>-->
<!-- <span-->
<!-- class="btn-def"-->
<!-- @click.stop="pdfPrint">部分打印</span>-->
<!-- </div>-->
<!-- <pdf-->
<!-- ref="pdf"-->
<!-- :src="this.pdfUrl"-->
<!-- :page="pageNum"-->
<!-- :rotate="pageRotate"-->
<!-- @password="password"-->
<!-- @progress="loadedRatio = $event"-->
<!-- @page-loaded="pageLoaded($event)"-->
<!-- @num-pages="pageTotalNum=$event"-->
<!-- @error="pdfError($event)"-->
<!-- @link-clicked="page = $event">-->
<!-- </pdf>-->
<!--&lt;!&ndash; <div>{{pageNum}}/{{pageTotalNum}}</div>&ndash;&gt;-->
<!--&lt;!&ndash; <div>进度{{loadedRatio}}</div>&ndash;&gt;-->
<!--&lt;!&ndash; <div>页面加载成功: {{curPageNum}}</div>&ndash;&gt;-->
<!-- </div>-->
</el-dialog>
</div>
</template>
@ -328,6 +373,7 @@ import {
updatePRHeaderAuthorizeFlag,
downFtpFile,
getFileList,
getPartFamilyList,
} from '@/api/purchaseorder/purchaseRequisition.js'
import upload from "../common/upload";
import axios from "axios";
@ -399,6 +445,7 @@ export default {
//
favorite: false,
addLanguage: false,
pdfVisible : false,
functionId: 2001,
tableId: "common1001",
value1: true,
@ -909,6 +956,7 @@ export default {
close: '关闭',
fileDownload: '下载',
reapply: '重新申请',
preview: '预览',
},
// start
exportData: [],
@ -1056,13 +1104,22 @@ export default {
const linkNode = document.createElement('a')
linkNode.download = fileName // adownload
linkNode.style.display = 'none'
linkNode.href = window.URL.createObjectURL(blob) // Blob URL
linkNode.href = URL.createObjectURL(blob) // Blob URL
// if(val == 'Y'){
// this.pdfVisible = true
// this.pdfUrl = linkNode.href
// }else {
document.body.appendChild(linkNode)
linkNode.click() //
URL.revokeObjectURL(linkNode.href) // URL
document.body.removeChild(linkNode)
// }
})
},
filePreview(row){
this.pdfVisible = true
this.pdfUrl= 'http://192.168.1.2:9002/file/'+row.newFileName
},
childByValue(childValue) {
// childValue
this.fileList.push(childValue)

4
src/views/modules/warehouse/warehouse.vue

@ -193,9 +193,9 @@ import {
headerInput : {
label1 : '仓库编码',
label2 : '仓库名称',
label3 : '库类型',
label3 : '库类型',
label4 : '使用状态',
label5 : '库信息',
label5 : '库信息',
},
},
selectList: {

Loading…
Cancel
Save