|
@@ -1,19 +1,14 @@
|
|
<template>
|
|
<template>
|
|
<div class="patent-pdf height_100">
|
|
<div class="patent-pdf height_100">
|
|
- <div v-if="!sign">
|
|
|
|
- <el-button-group class="float_left margin-bottom_10" v-if="patent.pdf && patent.pdf.length>1">
|
|
|
|
- <el-button size="small" :type="pdfType === 2 ? 'primary' : ''" @click="handleSelect(2)">授权文档</el-button>
|
|
|
|
- <el-button size="small" :type="pdfType === 1 ? 'primary' : ''" @click="handleSelect(1)">公开文档</el-button>
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <el-button-group class="float_left margin-bottom_10" v-if="patent.pdf && patent.pdf.length > 1">
|
|
|
|
+ <el-button size="small" :type="pdfType === 1 ? 'primary' : ''" @click="handleSelect(1)">授权文档</el-button>
|
|
|
|
+ <el-button size="small" :type="pdfType === 0 ? 'primary' : ''" @click="handleSelect(0)">公开文档</el-button>
|
|
</el-button-group>
|
|
</el-button-group>
|
|
- <el-upload
|
|
|
|
- class="float_right"
|
|
|
|
- action="#"
|
|
|
|
- :auto-upload="false"
|
|
|
|
- :show-file-list="false"
|
|
|
|
- :on-change="handleChange"
|
|
|
|
- :multiple="false"
|
|
|
|
- >
|
|
|
|
- <el-button type="success" size="small" :loading="btnLoading" v-if="projectId" :disabled="!($permission('/workspace/details/updataInstruction') && $r(projectId,[1,2]))">上传文档</el-button>
|
|
|
|
|
|
+ <el-upload class="float_right" action="#" :auto-upload="false" :show-file-list="false" :on-change="handleChange"
|
|
|
|
+ :multiple="false">
|
|
|
|
+ <el-button type="success" size="small" :loading="btnLoading" v-if="projectId"
|
|
|
|
+ :disabled="!($permission('/workspace/details/updataInstruction') && $r(projectId, [1, 2]))">上传文档</el-button>
|
|
<div slot="tip" class="el-upload__tip"></div>
|
|
<div slot="tip" class="el-upload__tip"></div>
|
|
</el-upload>
|
|
</el-upload>
|
|
</div>
|
|
</div>
|
|
@@ -28,7 +23,7 @@
|
|
import { patentDetails } from './mixins';
|
|
import { patentDetails } from './mixins';
|
|
export default {
|
|
export default {
|
|
mixins: [patentDetails],
|
|
mixins: [patentDetails],
|
|
- props: ['patent', 'projectId','pdfType1','sign','patentNo'],
|
|
|
|
|
|
+ props: ['patent', 'projectId', 'patentNo'],
|
|
components: {},
|
|
components: {},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -37,123 +32,111 @@ export default {
|
|
height: 0,
|
|
height: 0,
|
|
show: false,
|
|
show: false,
|
|
btnLoading: false,
|
|
btnLoading: false,
|
|
- pdfType: this.pdfType1||2,
|
|
|
|
|
|
+ pdfType: 1,
|
|
pdf: null
|
|
pdf: null
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
- fullHeight() {
|
|
|
|
- if(this.projectId){
|
|
|
|
- this.refresh()
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
patent() {
|
|
patent() {
|
|
- if(this.projectId){
|
|
|
|
|
|
+ if (!this.outside) {
|
|
this.refresh()
|
|
this.refresh()
|
|
}
|
|
}
|
|
-
|
|
|
|
},
|
|
},
|
|
- patentId() {
|
|
|
|
- if(this.projectId){
|
|
|
|
- this.refresh()
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- patentNo(){
|
|
|
|
- if(!this.projectId){
|
|
|
|
|
|
+ patentNo() {
|
|
|
|
+ if (this.outside) {
|
|
this.getData()
|
|
this.getData()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- created(){
|
|
|
|
|
|
+ created() {
|
|
window.addEventListener('resize', this.handleResize)
|
|
window.addEventListener('resize', this.handleResize)
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
- if(!this.projectId){
|
|
|
|
- if(this.patent.pdf && this.patent.pdf.length>0){
|
|
|
|
- this.show = false
|
|
|
|
- this.height = (this.fullHeight - 230) + 'px'
|
|
|
|
- var index = this.patent.pdf.findIndex(item => {
|
|
|
|
- return item.type == 2
|
|
|
|
- })
|
|
|
|
- if (index != -1) {
|
|
|
|
- this.pdfType = 2
|
|
|
|
- } else {
|
|
|
|
- this.pdfType = 1
|
|
|
|
- }
|
|
|
|
- this.getPDFSrc(this.pdfType)
|
|
|
|
- // let blob = this.base64ToBlob(this.patent.pdf[0])
|
|
|
|
- // this.$set(this,'src',URL.createObjectURL(blob))
|
|
|
|
- // // this.src = this.patent.pdf[0].url
|
|
|
|
- // this.$nextTick(() => {
|
|
|
|
- // this.show = true
|
|
|
|
- // })
|
|
|
|
- }else{
|
|
|
|
- this.getData()
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }else{
|
|
|
|
|
|
+ // outside为true是外部
|
|
|
|
+ if (this.outside) {//外部
|
|
|
|
+ this.getData()
|
|
|
|
+ } else {
|
|
this.refresh()
|
|
this.refresh()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- getData(){
|
|
|
|
- if(this.patent.pdf && this.patent.pdf.length>0){
|
|
|
|
|
|
+ // 获取外部的pdf地址
|
|
|
|
+ getData() {
|
|
|
|
+ if (this.patent.pdf && this.patent.pdf.length > 0) {
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
- this.show =false
|
|
|
|
|
|
+ this.show = false
|
|
this.height = (this.fullHeight - 230) + 'px'
|
|
this.height = (this.fullHeight - 230) + 'px'
|
|
var params = {
|
|
var params = {
|
|
- patentCell:3,
|
|
|
|
- patentNo:this.patent.publicNo,
|
|
|
|
- appNo:this.patent.applicationNo,
|
|
|
|
- }
|
|
|
|
- this.$api.getPatentPart(params).then(response=>{
|
|
|
|
- if(response.code == 200){
|
|
|
|
- if(Object.keys(response.data).length == 0){
|
|
|
|
- return false
|
|
|
|
- }
|
|
|
|
- if(response.data.pdf.length==0){
|
|
|
|
- return false
|
|
|
|
- }
|
|
|
|
- this.$set(this.patent,'pdf',response.data.pdf)
|
|
|
|
- var index = this.patent.pdf.findIndex(item => {
|
|
|
|
- return item.type == 2
|
|
|
|
- })
|
|
|
|
- if (index != -1) {
|
|
|
|
- this.pdfType = 2
|
|
|
|
- } else {
|
|
|
|
- this.pdfType = 1
|
|
|
|
- }
|
|
|
|
- this.getPDFSrc(this.pdfType)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ appNo: this.patent.appNo,
|
|
|
|
+ rowApplicationNo: this.patent.rowApplicationNo,
|
|
|
|
+ }
|
|
|
|
+ this.$api.getCnPdf(params).then(response => {
|
|
|
|
+ if (response.code == 200) {
|
|
|
|
+ // if (Object.keys(response.data).length == 0) {
|
|
|
|
+ // return false
|
|
|
|
+ // }
|
|
|
|
+ // if (response.data.pdf.length == 0) {
|
|
|
|
+ // return false
|
|
|
|
+ // }
|
|
|
|
+ this.$set(this.patent, 'pdf', response.data)
|
|
|
|
+ this.getSrc()
|
|
|
|
+ // var index = this.patent.pdf.findIndex(item => {
|
|
|
|
+ // return item.type == 2
|
|
|
|
+ // })
|
|
|
|
+ // if (index != -1) {
|
|
|
|
+ // this.pdfType = 2
|
|
|
|
+ // } else {
|
|
|
|
+ // this.pdfType = 1
|
|
|
|
+ // }
|
|
|
|
+ // this.getPDFSrc(this.pdfType)
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
- getPDFSrc(type) {
|
|
|
|
- let blob = this.base64ToBlob(this.patent.pdf.find(item => { return item.type == type }))
|
|
|
|
- this.$set(this, 'src', URL.createObjectURL(blob))
|
|
|
|
|
|
+ // getPDFSrc(type) {
|
|
|
|
+ // let blob = this.base64ToBlob(this.patent.pdf.find(item => { return item.type == type }))
|
|
|
|
+ // this.$set(this, 'src', URL.createObjectURL(blob))
|
|
|
|
+ // this.$nextTick(() => {
|
|
|
|
+ // this.show = true
|
|
|
|
+ // })
|
|
|
|
+ // },
|
|
|
|
+ // base64ToBlob(row) {
|
|
|
|
+ // var dataUrl = row.pictureStringData
|
|
|
|
+ // let bstr = window.atob(dataUrl)
|
|
|
|
+ // let n = bstr.length
|
|
|
|
+ // let u8arr = new Uint8Array(n)
|
|
|
|
+ // while (n--) {
|
|
|
|
+ // u8arr[n] = bstr.charCodeAt(n);
|
|
|
|
+ // }
|
|
|
|
+ // return new Blob([u8arr], { type: "application/pdf" });
|
|
|
|
+ // },
|
|
|
|
+ // 内部专利根据guid获取路径
|
|
|
|
+ getSrc() {
|
|
|
|
+ let obj = this.patent.pdf.find(item => {
|
|
|
|
+ return item.type == this.pdfType
|
|
|
|
+ })
|
|
|
|
+ if (this.outside) {
|
|
|
|
+ this.src = obj.pdfGuid
|
|
|
|
+ } else {
|
|
|
|
+ if (obj) {
|
|
|
|
+ this.src = this.$commonJS.checkViewer(obj.pdfGuid)
|
|
|
|
+ // console.log(this.src);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
this.show = true
|
|
this.show = true
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- base64ToBlob(row){
|
|
|
|
- var dataUrl = row.pictureStringData
|
|
|
|
- let bstr = window.atob(dataUrl)
|
|
|
|
- let n = bstr.length
|
|
|
|
- let u8arr = new Uint8Array(n)
|
|
|
|
- while (n--) {
|
|
|
|
- u8arr[n] = bstr.charCodeAt(n);
|
|
|
|
- }
|
|
|
|
- return new Blob([u8arr], { type: "application/pdf" });
|
|
|
|
- },
|
|
|
|
|
|
+ // 点击切换按钮(授权、公开)
|
|
handleSelect(type) {
|
|
handleSelect(type) {
|
|
this.pdfType = type
|
|
this.pdfType = type
|
|
- if(!this.projectId){
|
|
|
|
- this.show = false
|
|
|
|
- this.height = (this.fullHeight - 230) + 'px'
|
|
|
|
- this.getPDFSrc(type)
|
|
|
|
- return false
|
|
|
|
|
|
+ this.show = false
|
|
|
|
+ if (this.outside) {//外部
|
|
|
|
+ this.getSrc()
|
|
|
|
+ } else {//内部
|
|
|
|
+ this.getSrc()
|
|
}
|
|
}
|
|
- this.refresh()
|
|
|
|
},
|
|
},
|
|
handleChange(file, fileList) {
|
|
handleChange(file, fileList) {
|
|
if (file.name.split('.')[1].toLowerCase() !== 'pdf') {
|
|
if (file.name.split('.')[1].toLowerCase() !== 'pdf') {
|
|
@@ -177,20 +160,20 @@ export default {
|
|
this.btnLoading = false
|
|
this.btnLoading = false
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ // 请求内部pdf的guid
|
|
refresh() {
|
|
refresh() {
|
|
this.show = false
|
|
this.show = false
|
|
this.height = (this.fullHeight - 230) + 'px'
|
|
this.height = (this.fullHeight - 230) + 'px'
|
|
- this.pdf = this.patent.pdf.find(item => item.type === this.pdfType)
|
|
|
|
- if (this.pdf) {
|
|
|
|
- this.$api.getPatentInstructionFile({ patentNo: this.patent.patentNo, type: this.pdfType }).then(response => {
|
|
|
|
- this.src = '/pdfjs/web/viewer.html?file=' + encodeURIComponent(window.URL.createObjectURL(response))
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
- this.show = true
|
|
|
|
- })
|
|
|
|
- }).catch(error => {
|
|
|
|
- this.$message.error('加载失败')
|
|
|
|
- })
|
|
|
|
|
|
+ let params = {
|
|
|
|
+ appNo: this.patent.appNo,
|
|
|
|
+ // type: this.pdfType,//0公开1授权
|
|
}
|
|
}
|
|
|
|
+ this.$api.getTextPdf(params).then(response => {
|
|
|
|
+ if (response.code == 200) {
|
|
|
|
+ this.$set(this.patent, 'pdf', response.data)
|
|
|
|
+ this.getSrc()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
handleResize(event) {
|
|
handleResize(event) {
|
|
this.fullHeight = document.documentElement.clientHeight
|
|
this.fullHeight = document.documentElement.clientHeight
|
|
@@ -202,6 +185,7 @@ export default {
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
.patent-pdf {
|
|
.patent-pdf {
|
|
height: 100%;
|
|
height: 100%;
|
|
|
|
+
|
|
.no-pdf-file {
|
|
.no-pdf-file {
|
|
float: left;
|
|
float: left;
|
|
text-align: center;
|
|
text-align: center;
|
|
@@ -209,6 +193,7 @@ export default {
|
|
background: #e3e2e2;
|
|
background: #e3e2e2;
|
|
height: calc(100% - 120px);
|
|
height: calc(100% - 120px);
|
|
padding-top: 50px;
|
|
padding-top: 50px;
|
|
|
|
+
|
|
span {
|
|
span {
|
|
font-size: 50px;
|
|
font-size: 50px;
|
|
}
|
|
}
|