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 c_page from "./c-page.vue"
import PtyPicker from "./PtyPicker" import PtyPicker from "./PtyPicker"
import DocShow from "./DocShow"
export default { export default {
install(Vue){ install(Vue){
Vue.component("c-page",c_page) Vue.component("c-page",c_page)
Vue.component("c-ptypicker",PtyPicker) Vue.component("c-ptypicker",PtyPicker)
Vue.component("c-docshow",DocShow)
} }
} }
\ No newline at end of file
...@@ -12,9 +12,46 @@ const instance = axios.create({ ...@@ -12,9 +12,46 @@ const instance = axios.create({
export default class Api 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(){ static logout(){
console.log('asdasdasdasdasd') console.log('asdasdasdasdasd')
......
<template> <template>
<span> <span>
<el-button type="button" size="mini" @click="showDocOrMsg">显示</el-button> <el-button type="button" size="mini" @click="showDocOrMsg">显示</el-button>
<el-dialog title="机构选择" :visible.sync="dialogOpen"> <el-dialog :title="title" :visible.sync="dialogOpen" width="95%">
<div v-if="srcmsg"> <c-docshow :path="path"/>
<span>{{srcmsg}}</span>
</div>
<!-- <div v-if="isdoc">
<embed :src="realdocpath" />
</div> -->
</el-dialog> </el-dialog>
</span> </span>
</template> </template>
<script> <script>
import Api from "~/service/Api"
export default { export default {
props:['path'], props:['path'],
data(){ data(){
return { return {
dialogOpen :false, dialogOpen :false,
srcmsg:""
} }
}, },
methods:{ methods:{
showDocOrMsg(){ async showDocOrMsg(){
this.dialogOpen = true this.dialogOpen = true
if(!this.isdoc)
{
//发出异步请求
}
else
window.open(this.realdocpath)
} }
}, },
computed:{ computed:{
...@@ -39,8 +29,11 @@ export default { ...@@ -39,8 +29,11 @@ export default {
else else
return false return false
}, },
realdocpath(){ title(){
return '/gjjs/files'+this.path if(this.isdoc)
return "面函展示"
else
return "报文展示"
} }
} }
} }
......
<template> <template>
<c-page title="复核夹查询"> <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-col :span="12">
<el-form-item label="经办"> <el-form-item label="经办">
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
sortable sortable
width="100"> width="100">
<template slot-scope="scope"> <template slot-scope="scope">
{{dateFormat(scope.row.inidattim)}} {{dateFormat(scope.row.inidattim,'yyyy-MM-dd hh:mm:ss' )}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
...@@ -280,7 +280,7 @@ export default { ...@@ -280,7 +280,7 @@ export default {
{ {
this.$notify.error({title: '错误',message: '服务请求失败!'}); this.$notify.error({title: '错误',message: '服务请求失败!'});
} }
this.$notify.info('提交成功!'); //this.$notify.info('提交成功!');
}) })
}, },
onDsp(){ onDsp(){
......
...@@ -33,6 +33,9 @@ ...@@ -33,6 +33,9 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<el-dialog :title="title" :visible.sync="dialogOpen" :destroy-on-close="true" width="95%">
<c-docshow :path="viewurl"/>
</el-dialog>
</div> </div>
</template> </template>
...@@ -42,6 +45,13 @@ import Utils from "~/utils" ...@@ -42,6 +45,13 @@ import Utils from "~/utils"
export default { export default {
props:['model'], props:['model'],
data(){
return {
viewurl:"",
title:'',
dialogOpen:false
}
},
methods:{ methods:{
async detail(row){ async detail(row){
let cortyp = row.cortyp let cortyp = row.cortyp
...@@ -57,9 +67,10 @@ export default { ...@@ -57,9 +67,10 @@ export default {
console.log(rtnmsg) console.log(rtnmsg)
if (rtnmsg.code == SUCCESS) { if (rtnmsg.code == SUCCESS) {
if (cortyp == 'SWT' || cortyp == 'FMT' || cortyp == 'CMT') { if (cortyp == 'SWT' || cortyp == 'FMT' || cortyp == 'CMT') {
let viewurl = "/gjjs/files" + rtnmsg.data.setmod_msgmod_docpth; let viewurl = rtnmsg.data.setmod_msgmod_docpth;
this.viewurl = viewurl
window.open(viewurl, 'newwindow', 'height=1200,width=800,top=100,left=100,toolbar=no,resizable=no,menubar=no,location=no, status=no'); 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') else if(cortyp == 'ELC')
{ {
...@@ -69,15 +80,18 @@ export default { ...@@ -69,15 +80,18 @@ export default {
}) })
} }
else { 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) //console.log(url)
window.open(url) //window.open(url)
// window.location.href = url // window.location.href = url
// let url = rtnmsg.data.trndoc_docpth; // let url = rtnmsg.data.trndoc_docpth;
// let viewurl = "/psbcfront/pdfjs/web/viewer.html"; // let viewurl = "/psbcfront/pdfjs/web/viewer.html";
// viewurl += "?file=" + url; // 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'); // 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 { else {
this.$notify.error({title: '错误',message: '服务请求失败!'}) 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