2023西安数博会CIM演示-【前端】-Web
AdaKing88
2023-08-21 bc03b832caa49bbcd2674fe4cae3701b5059bf95
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<template>
    <div class="info_box" v-if="infoBoxShow" v-draw>
        <div class="info_header">
            <i class="el-icon-info"></i>
            <div class="info_title">
                属性查看
            </div>
            <i class="el-icon-close" @click="closeInfoBox"></i>
        </div>
        <div class="info_body scrollbar">
 
            <el-table :data="infoList" border style="width: 100%">
                <!-- :span-method="objectSpanMethod" -->
                <el-table-column prop="key" label="属性名">
                </el-table-column>
                <el-table-column prop="value" label="属性值">
                    <template slot-scope="scope">
                        {{ scope.row.value }}
                    </template>
                </el-table-column>
            </el-table>
        </div>
    </div>
</template>
 
<script>
import identifyTool from '@/utils/identifyTools.js'
export default {
    name: "IdentifyTool",
    data() {
        return {
            infoBoxShow: false,
            bimInfoList: [],
            modelinfoList: [],
            activeNames: [],
            infoList: []
        }
    },
    methods: {
        open(infoList, infoType) {
            console.log(infoList, infoType)
            let arr = []
            this.infoList = []
 
            if (!infoList) {
                this.infoList = []
                this.infoBoxShow = false
                return
            }
 
            debugger
            switch (infoType) {
                case 'B3DM':
                    if (infoList) {
                        let keys = infoList.getPropertyIds()
                        if (keys.length > 0) {
                            keys.forEach(key => {
                                arr.push({
                                    key: key,
                                    value: infoList.getProperty(key)
                                })
                            });
                        }
                    }
                    this.infoList = arr
                    break;
                case 'bim':
                    if (infoList.code === 200) {
                        if (Object.keys(infoList.data.attributes).length > 0) {
                            infoList = infoList.data.attributes
                        }
                    }
                    for (const key in infoList) {
                        const value = infoList[key];
                        arr.push({
                            key: key,
                            value: value
                        })
                    }
                    this.infoList = arr
                    break;
                case '':
                    break;
                default:
                    break;
            }
            this.infoBoxShow = true
        },
        closeInfoBox() {
            this.infoBoxShow = false
            identifyTool.close()
        },
        objectSpanMethod({ row, column, rowIndex, columnIndex }) {
            if (columnIndex === 0) {
                if (typeof row.value === 'object') {
                    return {
                        rowspan: 2,
                        colspan: 1
                    };
                }
                else {
                    return {
                        rowspan: 1,
                        colspan: 1
                    };
                }
            }
        }
    }
}
</script>
 
<style lang="less" scoped>
.info_box {
    position: absolute;
    width: 300px;
    height: 600px;
    background: white;
    top: 80px;
    left: 400px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
    padding: 15px;
    border-radius: 5px;
    pointer-events: all;
 
    .info_header {
        padding: 8px 2px;
        border-bottom: 1px solid #f0f0f0;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        position: relative;
        height: 5%;
 
        .el-icon-info {
            font-size: 24px;
        }
 
        .info_title {
            margin-left: 8px;
        }
 
 
        .el-icon-close {
            position: absolute;
            right: 3px;
            font-size: 24px;
            cursor: pointer;
        }
    }
 
    .info_body {
        height: 92%;
        overflow: auto;
        overflow-x: hidden;
 
        .items {
            display: flex;
 
        }
    }
}
</style>