Show.vue 1.69 KB
Newer Older
1377875331@qq.com committed
1
<template>
SunJie committed
2 3 4
    <div>
        <div style="height: 800px; overflow: auto">
            <embed
hulei committed
5
                v-if="this.model.docXML && pdf"
SunJie committed
6 7 8 9 10 11
                :src="pdf"
                type="application/pdf"
                height="100%"
                width="100%"
            />

潘际乾 committed
12 13 14
            <c-row v-if="!this.model.docXML">
                <c-col v-for="(item, index) in model.docTXT" :key="index" >
                    <c-col :offset="4" :span="8">
SunJie committed
15
                        {{ item[0] }}
潘际乾 committed
16 17
                    </c-col>
                    <c-col :span="12">
SunJie committed
18
                        {{ item[1] }}
潘际乾 committed
19 20
                    </c-col>
                </c-col>
SunJie committed
21
               
潘际乾 committed
22
            </c-row>
SunJie committed
23
        </div>
1377875331@qq.com committed
24 25 26 27
    </div>
</template>

<script>
潘际乾 committed
28
import { getPdf } from "~/service/business/file";
1377875331@qq.com committed
29 30

export default {
SunJie committed
31 32 33
    data() {
        return {
            model: { docXML: "" },
hulei committed
34
            pdf: "",
SunJie committed
35 36 37
        };
    },
    created() {
38
        let doclang= window.sessionStorage.doclang||"";
SunJie committed
39 40 41 42 43 44 45 46 47 48 49 50
        this.model.docXML = window.sessionStorage.docXML;
        this.model.docTXT = window.sessionStorage.docTXT
            .split("\r\n")
            .filter((item) => item)
            .map((item) => {
                let idx = item.indexOf(":");
                return [
                    item.substring(0, idx).trim(),
                    item.substring(idx + 1).trim(),
                ];
            });
        if (this.model.docXML != "")
潘际乾 committed
51
            getPdf({ xml: this.model.docXML, doclang: window.sessionStorage.docuil }).then((res) => {
潘际乾 committed
52
                if (res.respCode == SUCCESS) {
hulei committed
53
                    this.pdf ="data:application/pdf;base64,"+ res.data;
SunJie committed
54 55 56 57
                }
            });
    },
};
1377875331@qq.com committed
58 59 60 61
</script>

<style scoped>
</style>