Commit 73931ea0 by 傅凯

支持面函预览

parent 93bf2a36
<template>
<div>
<div v-if="!isdoc" style="height:600px;overflow:auto;">
<pre>{{srcmsg}}</pre>
</div>
<div v-if="isdoc">
<embed :src="realdocpath" style="width:100%;height:600px;"/>
</div>
</div>
</template>
<script>
import Api from "~/service/Api"
export default {
props:['path'],
data(){
return {
srcmsg:""
}
},
methods:{
async showDocOrMsg(){
this.dialogOpen = true
console.log(this.realdocpath)
if(!this.isdoc)
{
//发出异步请求
let msg = await Api.pget(this.realdocpath)
this.srcmsg = msg
}
}
},
computed:{
isdoc(){
if(this.path.endsWith(".pdf"))
return true
else
return false
},
realdocpath(){
return '/gjjs/files'+this.path
},
title(){
if(this.isdoc)
return "面函展示"
else
return "报文展示"
}
},
mounted(){
this.showDocOrMsg()
},
watch:{
path(newValue,oldValue){
if(newValue!=oldValue)
this.showDocOrMsg()
}
},
updated(){
}
}
</script>
\ No newline at end of file
import c_page from "./c-page.vue"
import PtyPicker from "./PtyPicker"
import DocShow from "./DocShow"
export default {
install(Vue){
Vue.component("c-page",c_page)
Vue.component("c-ptypicker",PtyPicker)
Vue.component("c-docshow",DocShow)
}
}
\ No newline at end of file
......@@ -12,9 +12,46 @@ const instance = axios.create({
export default class Api
{
static get(url,data)
static pget(url,data)
{
let token = window.sessionStorage.token
let userId = window.sessionStorage.userId
let headers = {userId,token,"terminal":"WEB"};
if(url!= `${BASE_URI}login` && token)
headers.token = token;
return new Promise( (resolve, reject) =>{
axios.get(url,data,{
headers,
timeout: 50000,
})
.then(response=>{
const {data} = response;
resolve(data)
})
.catch(error=> {
if (error.response) {
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
console.log(error.response.data);
console.log(error.response.status);
console.log(error.response.headers);
resolve(error.response.status);
} else if (error.request) {
// The request was made but no response was received
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js
console.log(error.request);
resolve('error.request');
} else {
// Something happened in setting up the request that triggered an Error
console.log('Error', error.message);
resolve(error.message);
}
console.log(error.config);
});
})
}
static logout(){
console.log('asdasdasdasdasd')
......
<template>
<span>
<el-button type="button" size="mini" @click="showDocOrMsg">显示</el-button>
<el-dialog title="机构选择" :visible.sync="dialogOpen">
<div v-if="srcmsg">
<span>{{srcmsg}}</span>
</div>
<!-- <div v-if="isdoc">
<embed :src="realdocpath" />
</div> -->
<el-dialog :title="title" :visible.sync="dialogOpen" width="95%">
<c-docshow :path="path"/>
</el-dialog>
</span>
</template>
<script>
import Api from "~/service/Api"
export default {
props:['path'],
data(){
return {
dialogOpen :false,
srcmsg:""
}
},
methods:{
showDocOrMsg(){
async showDocOrMsg(){
this.dialogOpen = true
if(!this.isdoc)
{
//发出异步请求
}
else
window.open(this.realdocpath)
}
},
computed:{
......@@ -39,8 +29,11 @@ export default {
else
return false
},
realdocpath(){
return '/gjjs/files'+this.path
title(){
if(this.isdoc)
return "面函展示"
else
return "报文展示"
}
}
}
......
<template>
<c-page title="复核夹查询">
<el-form :model="model" :rules="rules" ref="modelForm" label-width="100px" size="small">
<el-form :model="model" :rules="rules" ref="modelForm" label-width="100px" size="mini">
<el-col :span="12">
<el-form-item label="经办">
......@@ -113,7 +113,7 @@
sortable
width="100">
<template slot-scope="scope">
{{dateFormat(scope.row.inidattim)}}
{{dateFormat(scope.row.inidattim,'yyyy-MM-dd hh:mm:ss' )}}
</template>
</el-table-column>
<el-table-column
......@@ -280,7 +280,7 @@ export default {
{
this.$notify.error({title: '错误',message: '服务请求失败!'});
}
this.$notify.info('提交成功!');
//this.$notify.info('提交成功!');
})
},
onDsp(){
......
......@@ -33,6 +33,9 @@
</el-table-column>
</el-table>
</div>
<el-dialog :title="title" :visible.sync="dialogOpen" :destroy-on-close="true" width="95%">
<c-docshow :path="viewurl"/>
</el-dialog>
</div>
</template>
......@@ -42,6 +45,13 @@ import Utils from "~/utils"
export default {
props:['model'],
data(){
return {
viewurl:"",
title:'',
dialogOpen:false
}
},
methods:{
async detail(row){
let cortyp = row.cortyp
......@@ -57,9 +67,10 @@ export default {
console.log(rtnmsg)
if (rtnmsg.code == SUCCESS) {
if (cortyp == 'SWT' || cortyp == 'FMT' || cortyp == 'CMT') {
let viewurl = "/gjjs/files" + rtnmsg.data.setmod_msgmod_docpth;
window.open(viewurl, 'newwindow', 'height=1200,width=800,top=100,left=100,toolbar=no,resizable=no,menubar=no,location=no, status=no');
let viewurl = rtnmsg.data.setmod_msgmod_docpth;
this.viewurl = viewurl
this.title="报文"
//window.open(viewurl, 'newwindow', 'height=1200,width=800,top=100,left=100,toolbar=no,resizable=no,menubar=no,location=no, status=no');
}
else if(cortyp == 'ELC')
{
......@@ -69,15 +80,18 @@ export default {
})
}
else {
let url = "/gjjs/files" + rtnmsg.data.trnmod_trndoc_docpth;
let url = rtnmsg.data.trnmod_trndoc_docpth;
this.viewurl = url
this.title = "面函"
//console.log(url)
window.open(url)
//window.open(url)
// window.location.href = url
// let url = rtnmsg.data.trndoc_docpth;
// let viewurl = "/psbcfront/pdfjs/web/viewer.html";
// viewurl += "?file=" + url;
// window.open(viewurl, 'newwindow', 'height=1200,width=800,top=100,left=100,toolbar=no,resizable=no,menubar=no,location=no, status=no');
}
this.dialogOpen=true
}
else {
this.$notify.error({title: '错误',message: '服务请求失败!'})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment