1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<template>
<div>
<el-dialog v-dialogDrag title="报文展示" :visible.sync="messageVisible" width="60%" @close="handleCloseMessage"
destroy-on-close :modal-append-to-body="false" v-if="messageVisible">
<div class="contentTable">
<el-table :data="messageData" style="width: 100%">
<el-table-column prop="docfil" label="报文标识号" width="140" :show-overflow-tooltip="true" fixed="left">
</el-table-column>
<el-table-column prop="extkey" label="业务编号" :show-overflow-tooltip="true" width="120">
</el-table-column>
<el-table-column prop="docpth" label="报文路径" :show-overflow-tooltip="true" width="120">
</el-table-column>
<el-table-column prop="nam" label="报文描述" :show-overflow-tooltip="true" width="120">
</el-table-column>
<el-table-column prop="sndkey" label="收报行" :show-overflow-tooltip="true" width="120">
</el-table-column>
<el-table-column prop="cortyp" label="报文类型" width="120">
</el-table-column>
<el-table-column prop="credattim" label="收报时间" :show-overflow-tooltip="true" width="120">
</el-table-column>
<c-table-column fixed="right" prop="op" label="操作" width="220px">
<template slot-scope="{ scope }">
<el-button type="primary" @click="showMsg(scope.row)">show</el-button>
</template>
</c-table-column>
</el-table>
</div>
</el-dialog>
<!-- 报文 -->
<message-view ref="msgView"></message-view>
</div>
</template>
<script>
import Api from "~/service/Api";
import MessageView from "~/components/business/docpan/views/MessageView";
export default {
props: {
visible: {
type: Boolean,
default: false
}
},
components:{MessageView},
data() {
return {
messageVisible: false,
messageData: [],
modelVisible: false,
opType: "",
};
},
methods: {
async init() {
let params = {}
if(this.$route.query.businessType==='TRN'){
params.trninr=this.$route.query.businessInr;
}
if(this.$route.query.businessType==='SPT'){
params.sptinr=this.$route.query.businessInr;
}
let res = await Api.post("/public/quesel/showSmhList", params);
if (res.respCode == SUCCESS) {
// 一条直接展示多条展示列表
if (res.data.smhList.length == 1) {
this.messageVisible = false;
this.$nextTick(()=>{
this.$refs.msgView.fileViewDispaly(-1,{smhinr:res.data.smhList[0].inr})
})
}else{
this.messageVisible = true;
this.messageData = res.data.smhList;
}
}
},
async showMsg(row) {
this.$refs.msgView.fileViewDispaly(-1,{smhinr:row.inr})
},
viewPdf(content) {
if (!content) {
console.log(content);
this.$message.error("暂无报文");
return;
}
const blob = this.base64ToBlob(content);
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(blob);
} else {
const fileURL = URL.createObjectURL(blob);
this.viewPdfUrl = fileURL;
}
},
base64ToBlob(code) {
code = code.replace(/[\n\r]/g, "");
const raw = window.atob(code);
const rawLength = raw.length;
const uInt8Array = new Uint8Array(rawLength);
for (let i = 0; i < rawLength; ++i) {
uInt8Array[i] = raw.charCodeAt(i);
}
return new Blob([uInt8Array], { type: "application/pdf" });
},
handleCloseMessage() {
this.$emit("onClose");
},
onClose() {
this.modelVisible = false;
}
}
};
</script>
<style scoped lang="less">
</style>