viewpoint-useVue.html
4.26 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="../js/jquery-3.4.1.min.js"></script>
<script src="../js/JavaScript.js"></script>
<script src="../js/popupJS.js"></script>
<link rel="stylesheet" href="../css/layer.css">
<link rel="stylesheet" href="../icon/iconfont.css">
<!-- <link rel="stylesheet" href="../../src/assets/icon/iconfont.css"> -->
<!-- <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> -->
<!-- <link rel="stylesheet" type="text/css" href="../js/elementUI/lib-master/theme-chalk/index.css"> -->
<!-- import Vue before Element -->
<script src="../js/vue.min.js"></script>
<!-- import JavaScript -->
<!-- <script src="https://unpkg.com/element-ui/lib/index.js"></script> -->
<!-- <script src="../js/elementUI/lib-master/index.js"></script> -->
</head>
<body marginwidth="0" marginheight="0">
<!-- 视点管理 -->
<div id="mainDiv" class="dialog donghua">
<h1 class="title" onmousedown="MouseDown(event)" onmouseup="MouseUp(event)" onmouseout="MouseUp(event)">
视点管理<i class="guanbibtn" onclick="Close()">X</i>
</h1>
<div class="main">
<div class="tool">
<i class="iconfont icon-tianjia-" title="新增" @click="addView"></i>
<i class="iconfont icon-guanbi" title="删除" @click="delView"></i>
</div>
<ul class="ul">
<li class="item">
<span class="check"></span>
<span class="time">视点</span>
<span class="mode">操作</span>
</li>
<li class="item" v-if="viewarr.length" v-for="item in viewarr" :key="item.index">
<span class="check">
<input type="radio" class="checkStep" name="checkStep" :value="item.index"
v-model="selectValue" />
</span>
<span class="time">视点{{ item.index }}</span>
<span class="mode">
<!-- <el-button type="primary" icon="el-icon-check" round size="mini" @click="toview(item.index)">
</el-button> -->
<button @click="toview(item)">跳转</button>
</span>
</li>
</ul>
</div>
</div>
</body>
<script>
new Vue({
el: "#mainDiv",
data: function () {
return {
viewarr: [],
selectValue: -1
}
},
methods: {
addView() {
alert("添加");
var index = this.viewarr.length + 1;
var sgWorld = this.CreateSGObj();
this.viewarr.push({
index: index,
point: sgWorld.Navigate.GetPosition(0)
});
},
delView() {
alert("删除");
var delIndex = this.viewarr.findIndex(
item => item.index === this.selectValue
);
if (delIndex !== -1) {
this.viewarr.splice(delIndex, 1);
}
},
toview(item) {
var sgWorld = this.CreateSGObj();
sgWorld.Navigate.FlyTo(item.point);
},
CreateSGObj() {
try {
var obj = document.getElementById("SGWorld");
if (obj === null) {
obj = document.createElement('object');
obj.setAttribute("name", "SGWorld");
obj.setAttribute("id", "SGWorld");
obj.style.height = "1px";
obj.style.width = "1px";
//定义TerraExplorer对象
obj.setAttribute("classid", "CLSID:3A4F919C-65A8-11D5-85C1-0001023952C1");
document.body.appendChild(obj);
}
return obj;
}
catch (e) { alert("CreateSGWorld " + e); }
}
},
// mounted:function() {
// this.selectValue = -1;
// }
});
</script>
</html>