viewpoint-useVue.html 4.26 KB
<!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>