快乐的昕的电脑
2025-11-19 aa03f85db96889256075adf31b52a94c4823dfb4
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
<template>
    <view>
        <!-- <image :src="pdfBase64" :data-src="pdfBase64" style="width: 172vh;height: 81vh;"></image> -->
        <image :src="pdfBase64" :data-src="pdfBase64" style="float: left;
    margin-left: 100px;
    width: 162vh;
    height: 95vh;"></image>
    </view>
</template>
 
<script>
    
    export default {
        props: {
            orderNo: String,
            orderId: Number,
            machineNo: String
        },
        data() {
            return {
                allUrl: '',
                engineeringNo: '',
                pdfBase64: '', // 存储Base64编码的PDF
            };
        },
        methods: {
            fetchData() {
                this.$sendPostRequest({
                    url: "http://192.168.0.94:9095/Numerical/PdfToBase64",
                    data: {
                        engineeringNo: this.engineeringNo,
                    },
                    contentType: "application/json"
                }).then(res1 => {
                    if (res1.code == 200) {
                        // this.pdfBase64 = 'data:application/pdf;base64,' + res1.data;
                        this.pdfBase64 = 'data:image/png;base64,' + res1.data;
                        
                        // base64ToPath(this.pdfBase64)
                        //     .then(path => {
                        //         uni.openDocument({
                        //             filePath: path,
                        //             success: function(FileRes) {
                        //                 console.log('打开成功');
                        //                 console.log(path);
                        //                 this.allUrl = path;
                        //             }
                        //         })
                        //     })
 
                        this.$showMessage("更新成功");
                    } else {
                        this.$showMessage(res1.message);
                    }
                });
            },
 
        },
        mounted() {
 
            let engineeringNo = uni.getStorageSync('engineeringNo');
 
            if (engineeringNo) {
                this.engineeringNo = engineeringNo;
            } else {
                return;
            }
 
            this.fetchData();
        }
    }
</script>
 
<style scoped>
    /* Optional styling */
</style>