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

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

<script>
SunJie committed
28
import Api from "~/service/Api";
1377875331@qq.com committed
29 30

export default {
SunJie committed
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
    data() {
        return {
            model: { docXML: "" },
            pdf: "data:application/pdf;base64,",
        };
    },
    created() {
        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 != "")
            Api.post("pdf", { xml: this.model.docXML }).then((res) => {
                if (res.respCode == "AAAAAA") {
                    this.pdf += res.data;
                }
            });
    },
};
1377875331@qq.com committed
57 58 59 60
</script>

<style scoped>
</style>