Explorar el Código

Merge branch 'master' of http://221.182.8.141:11666/sujunlin/xld-gis-admin

xiaxin hace 1 año
padre
commit
a0036942da

+ 1 - 1
build/script/postBuild.ts

@@ -25,7 +25,7 @@ export const runBuild = async () => {
     }
 
     console.log(`✨ ${chalk.cyan(`[${pkg.name}]`)}` + ' - build successfully!');
-    removeFile('./target/dist/_app.config.js');
+    // removeFile('./target/dist/_app.config.js');
   } catch (error) {
     console.log(chalk.red('vite build error:\n' + error));
     process.exit(1);

+ 170 - 53
public/sceneview.html

@@ -1,72 +1,189 @@
 <!DOCTYPE html>
-<html lang="en" id="htmlRoot">
+<html lang="en">
 
 <head>
-    <meta charset="UTF-8" />
-    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
-    <meta name="renderer" content="webkit" />
-    <meta name="keywords" content="空间数据管理平台" />
-    <meta name="description" content="空间数据管理平台" />
-    <meta http-equiv="Expires" content="0" />
-    <meta http-equiv="Cache-control" content="no-cache" />
-    <meta http-equiv="Cache" content="no-cache" />
-    <title>空间数据管理平台</title>
-    <link rel="icon" href="/favicon.ico" />
+    <meta charset="UTF-8">
+    <title>场景浏览</title>
+    <!-- <script src="/build/grant.js"></script> -->
+    <script src="http://localhost:4001/build/grant.js"></script>
+</head>
+
+<body>
     <style>
+        html,
         body {
+            font-size: 14px;
             margin: 0;
             padding: 0;
-            overflow: hidden;
-            -ms-overflow-style: none;
-            scrollbar-width: none;
         }
 
-        body::-webkit-scrollbar {
-            display: none;
+        #map {
+            width: 100vw;
+            height: 100vh;
         }
     </style>
-</head>
+    <div id="map"></div>
+</body>
+<script type="text/javascript">
+    window.onload = function () {
+        var url = sessionStorage.getItem('mapViewUrl');
+        if (url) {
+            var type = getType(url);
+            initMap({
+                servicetype: type,
+                mapingurl: url
+            })
+        } else {
+            var obj = JSON.parse(JSON.stringify(location.href));
+            var arr = obj.split("?")
+            if (arr.length && arr[1]) {
+                var url = arr[1];
+                var type = getType(url);
+                initMap({
+                    servicetype: type,
+                    mapingurl: url
+                })
+            }
+        }
+    }
 
-<body>
-    <script>
-        new BroadcastChannel('myChannel').onmessage = function (event) {
-            console.log('Message received:', event.data);
-            sessionStorage.clear();
-            localStorage.clear();
-            window.close();
-        };
-        window.onload = function () {
-            var t1 = sessionStorage.getItem('tokenSpace');
-            var t2 = sessionStorage.getItem('tokenV2');
-            if (t1 && t2) {
-                var obj = JSON.parse(JSON.stringify(window.location.href));
-                var arr = obj.split("?")
-                if (arr.length && arr[1]) {
-                    if (arr[1].indexOf("onlineIde_") > -1) {
-                        creteIframe(`http://106.12.170.138:4001/examples/onlineIde.html#${arr[1].replace("onlineIde_", "")}`)
-                        // creteIframe(`http://127.0.0.1:8080/examples/webgl/onlineIde.html#${arr[1].replace("onlineIde_", "")}`)
-                        // creteIframe(`http://192.168.119.143/examples/webgl/onlineIde.html#${arr[1].replace("onlineIde_", "")}`)
-                    } else {
-                        // creteIframe(arr[1])
-                        // creteIframe(`http://192.168.119.143:8080/onemapV5.0/sceneview.html?${arr[1]}`)
-                        creteIframe(`http://106.12.170.138:8080/onemapV5.0/sceneview.html?${arr[1]}`)
+    function getType(url) {
+        return url.indexOf('realspace') > -1 ? 'SuperMap_realspace' : 'SuperMap';
+    }
+
+    function initMap(obj) {
+        var viewer = new Cesium.Viewer('map', {
+            animation: false,
+            timeline: false,
+            shadows: true,
+            infoBox: false,
+            geocoder: false,
+            homeButton: false,
+            navigation: true
+        });
+        var scene = viewer.scene;
+        var widget = viewer.cesiumWidget;
+        try {
+            //场景
+            switch (obj.servicetype) {
+                case "SuperMap_realspace": {
+                    var url = obj.mapingurl.split('realspace')[0] + 'realspace'
+                    //添加S3M图层服务
+                    var promise = scene.open(url);
+                    //***为场景名称
+                    //定位到场景
+                    Cesium.loadJson(url + '/scenes.json').then(function (scenes) {
+                        var sname = scenes[0].name;
+                        Cesium.loadJson(url + '/scenes/' + sname + '.json').then(function (jsonData) {
+                            var cameraPosition = jsonData.camera;
+                            var tilt = Cesium.Math.toRadians(cameraPosition.tilt - 90);
+                            Cesium.when(promise, function (layer) {
+                                //设置相机位置、视角,便于观察场景
+                                var dest = new Cesium.Cartesian3.fromDegrees(cameraPosition.longitude, cameraPosition.latitude, cameraPosition.altitude);
+                                var ori = { heading: cameraPosition.heading, pitch: tilt, roll: 0 };
+                                scene.camera.setView({
+                                    destination: dest,
+                                    orientation: ori
+                                });
+                            });
+                        });
+                    });
+                    break;
+                }
+                case "SuperMap_terrain": {
+                    var url = obj.mapingurl + "/config";
+                    var config = sendRequestWithResponse(url, "GET");
+                    viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
+                        url: obj.mapingurl,
+                        isSct: true
+                    });
+                    var left = parseFloat(config.substring(config.indexOf("<sml:Left>") + "<sml:Left>".length, config.indexOf("</sml:Left>")));
+                    var right = parseFloat(config.substring(config.indexOf("<sml:Right>") + "<sml:Right>".length, config.indexOf("</sml:Right>")));
+                    var top = parseFloat(config.substring(config.indexOf("<sml:Top>") + "<sml:Top>".length, config.indexOf("</sml:Top>")));
+                    var bottom = parseFloat(config.substring(config.indexOf("<sml:Bottom>") + "<sml:Bottom>".length, config.indexOf("</sml:Bottom>")));
+                    var x = (left + right) / 2;
+                    var y = (top + bottom) / 2;
+                    var z = parseFloat(config.substring(config.indexOf("<sml:MaxHeight>") + "<sml:MaxHeight>".length, config.indexOf("</sml:MaxHeight>"))) || 2000;
+                    scene.camera.setView({
+                        destination: new Cesium.Cartesian3.fromDegrees(x, y, z)
+                    });
+                    break;
+                }
+                case "SuperMap_s3m": {
+                    var url = obj.mapingurl + "/config";
+                    var config = sendRequestWithResponse(url, "GET");
+                    scene.addS3MTilesLayerByScp(url, { name: 1 });
+                    if (config.indexOf("<sml:OSGFiles>") != -1) {//s3m
+                        var x = parseFloat(config.substring(config.indexOf("<sml:X>") + 7, config.indexOf("</sml:X>")));
+                        var y = parseFloat(config.substring(config.indexOf("<sml:Y>") + 7, config.indexOf("</sml:Y>")));
+                        var z = parseFloat(config.substring(config.indexOf("<sml:Z>") + 7, config.indexOf("</sml:Z>")));
+                        if (Math.abs(z - 0.0) < 0.000001) {
+                            z = 2000;
+                        }
+                        scene.camera.setView({
+                            destination: new Cesium.Cartesian3.fromDegrees(x, y, z)
+                        });
+                    } else {//s3mb
+                        var configJSON = JSON.parse(config);
+                        var x = configJSON.position.x;
+                        var y = configJSON.position.y;
+                        var z = configJSON.position.z;
+                        if (Math.abs(z - 0.0) < 0.000001) {
+                            z = 2000;
+                        }
+                        scene.camera.setView({
+                            destination: new Cesium.Cartesian3.fromDegrees(x, y, z)
+                        });
                     }
+                    break;
                 }
-            } else {
-                window.location.href = '/spatialDataMng/index.html#/login?redirect=/dashboard/workbench'
-            }
+                case "ArcGISRestMap": {
+                    var config = JSON.parse(sendRequestWithResponse(obj.mapingurl + "?f=pjson", "GET"));
+                    var fullExtent = config.fullExtent
+                    var provider = new Cesium.ArcGisMapServerImageryProvider({
+                        url: obj.mapingurl //'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
+                    });
+                    fullExtentToGeographicSR(fullExtent)
+                    viewer.imageryLayers.addImageryProvider(provider);
+                    viewer.camera.setView({
+                        destination: Cesium.Rectangle.fromDegrees(fullExtent.xmin, fullExtent.ymin, fullExtent.xmax, fullExtent.ymax)
+                    })
+                    break;
+                }
+                case "ArcGISTiledMap": {
+                    var config = JSON.parse(sendRequestWithResponse(obj.mapingurl + "?f=pjson", "GET"));
+                    var fullExtent = config.fullExtent
+                    fullExtentToGeographicSR(fullExtent)
 
-        }
+                    var provider = new Cesium.CGCS2000MapServerImageryProvider({
+                        //token,
+                        suggest: config.spatialReference.wkid === 4490 ? true : undefined,//4490坐标系,按照suggest切片方案切的瓦片,需要设置该参数
+                        url: obj.mapingurl //'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
+                    })
+                    viewer.imageryLayers.addImageryProvider(provider);
+                    viewer.camera.setView({
+                        destination: Cesium.Rectangle.fromDegrees(fullExtent.xmin, fullExtent.ymin, fullExtent.xmax, fullExtent.ymax)
+                    })
+                    break;
+                }
 
-        function creteIframe(url) {
-            const iframe = document.createElement('iframe');
-            iframe.style.width = '100vw';
-            iframe.style.height = '100vh';
-            iframe.style.border = '0px';
-            iframe.src = url;
-            document.body.appendChild(iframe);
+                case "SuperMap": {
+                    var provider = new Cesium.SuperMapImageryProvider({
+                        url: obj.mapingurl
+                    });
+                    var imagery = viewer.imageryLayers.addImageryProvider(provider);
+                    viewer.zoomTo(imagery);
+                }
+                default:
+                    break;
+            }
+        } catch (e) {
+            if (widget._showRenderLoopErrors) {
+                var title = '渲染时发生错误,已停止渲染。';
+                widget.showErrorPanel(title, undefined, e);
+            }
         }
-    </script>
-</body>
+    }
+</script>
 
 </html>

+ 72 - 0
public/sceneview2.html

@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<html lang="en" id="htmlRoot">
+
+<head>
+    <meta charset="UTF-8" />
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
+    <meta name="renderer" content="webkit" />
+    <meta name="keywords" content="空间数据管理平台" />
+    <meta name="description" content="空间数据管理平台" />
+    <meta http-equiv="Expires" content="0" />
+    <meta http-equiv="Cache-control" content="no-cache" />
+    <meta http-equiv="Cache" content="no-cache" />
+    <title>空间数据管理平台</title>
+    <link rel="icon" href="/favicon.ico" />
+    <style>
+        body {
+            margin: 0;
+            padding: 0;
+            overflow: hidden;
+            -ms-overflow-style: none;
+            scrollbar-width: none;
+        }
+
+        body::-webkit-scrollbar {
+            display: none;
+        }
+    </style>
+</head>
+
+<body>
+    <script>
+        new BroadcastChannel('myChannel').onmessage = function (event) {
+            console.log('Message received:', event.data);
+            sessionStorage.clear();
+            localStorage.clear();
+            window.close();
+        };
+        window.onload = function () {
+            var t1 = sessionStorage.getItem('tokenSpace');
+            var t2 = sessionStorage.getItem('tokenV2');
+            if (t1 && t2) {
+                var obj = JSON.parse(JSON.stringify(window.location.href));
+                var arr = obj.split("?")
+                if (arr.length && arr[1]) {
+                    if (arr[1].indexOf("onlineIde_") > -1) {
+                        creteIframe(`http://106.12.170.138:4001/examples/onlineIde.html#${arr[1].replace("onlineIde_", "")}`)
+                        // creteIframe(`http://127.0.0.1:8080/examples/webgl/onlineIde.html#${arr[1].replace("onlineIde_", "")}`)
+                        // creteIframe(`http://192.168.119.143/examples/webgl/onlineIde.html#${arr[1].replace("onlineIde_", "")}`)
+                    } else {
+                        // creteIframe(arr[1])
+                        // creteIframe(`http://192.168.119.143:8080/onemapV5.0/sceneview.html?${arr[1]}`)
+                        creteIframe(`http://106.12.170.138:8080/onemapV5.0/sceneview.html?${arr[1]}`)
+                    }
+                }
+            } else {
+                window.location.href = '/spatialDataMng/index.html#/login?redirect=/dashboard/workbench'
+            }
+
+        }
+
+        function creteIframe(url) {
+            const iframe = document.createElement('iframe');
+            iframe.style.width = '100vw';
+            iframe.style.height = '100vh';
+            iframe.style.border = '0px';
+            iframe.src = url;
+            document.body.appendChild(iframe);
+        }
+    </script>
+</body>
+
+</html>

+ 84 - 51
src/views/resource/plat/item/EmpowerInfo.vue

@@ -1,14 +1,25 @@
 <template>
-    <BasicModal :maskClosable="false" width="900px" v-bind="$attrs" :title="props.title" :showOkBtn="false" :showCancelBtn="false">
-        <ul class="info">
-            <li>
-                <span>审核结果:{{ info?.shzt }}</span><span>审核意见:{{ shyjInfo }}</span>
-            </li>
-            <li>
-                <p>访问地址:{{ info?.resInfo?.PUBLICCURL }}</p>
-            </li>
-        </ul>
-    </BasicModal>
+  <BasicModal
+    :maskClosable="false"
+    width="900px"
+    v-bind="$attrs"
+    :title="props.title"
+    :showOkBtn="false"
+    :showCancelBtn="false"
+  >
+    <ul class="info">
+      <li>
+        <span>审核结果:{{ info?.shzt }}</span
+        ><span>审核意见:{{ shyjInfo }}</span>
+      </li>
+      <li v-if="dataType == 'DR'">
+        <p>下载地址:{{ downloadUrl }}</p>
+      </li>
+      <li v-else>
+        <p>访问地址:{{ info?.resInfo?.PUBLICCURL }}</p>
+      </li>
+    </ul>
+  </BasicModal>
 </template>
 
 <script>
@@ -20,65 +31,87 @@ import { setHtmlImg } from '/@/views/minWidgets/CommonWay.js';
 import { getResInCar, getResViewInfo, queryServiceTags } from '/@/api/resource/plat';
 import { getAllTags } from '/@/api/sys/tag';
 import { BasicModal } from '/@/components/Modal';
+import { getImgUrl } from '/@/api/dataAdmin/assembly';
 
 export default defineComponent({
-    name: 'EmpowerInfo',
-    components: { BasicModal },
-    props: {
-        title: {
-            type: String,
-            default: '资源申请信息'
-        }
+  name: 'EmpowerInfo',
+  components: { BasicModal },
+  props: {
+    title: {
+      type: String,
+      default: '资源申请信息',
     },
-    setup(props, { emit }) {
-        const show = ref(false);
-        const info = ref({});
-        const shyjInfo = ref("");
+  },
+  setup(props, { emit }) {
+    const show = ref(false);
+    const info = ref({});
+    const shyjInfo = ref('');
+    const dataType = ref('');
+    const downloadUrl = ref('')
 
+    function showInfo(e) {
+      show.value = !show.value;
+      if (e) {
+        dataType.value = e.RTYPE;
+        getInfo(e);
+        if (e.RTYPE == 'DR') getRes(e);
+      }
+    }
 
-        function showInfo(e) {
-            show.value = !show.value;
-            if (e) getInfo(e);
+    function getRes(e) {
+      getResViewInfo(e.SERVICEID).then((r) => {
+        if (r.metadata && r.metadata.bz) {
+          var arr = r.metadata.bz.split(',');
+          if (arr.length > 1) {
+            getImgUrl(arr[0], arr[1]).then((r) => {
+              if (r) {
+                downloadUrl.value = r;
+              }
+            });
+          }
         }
+      });
+    }
 
-        function getInfo(e) {
-            console.log("1111:", e);
-            getResInCar({
-                keyword: e.SERVICENAME,
-                userId: session.getItem('userId')
-            }).then(r => {
-                if (r?.resp_code == 0 && r?.datas?.length) {
-                    var a = r.datas.find(i => i.resInfo.SERVICEID == e.SERVICEID);
-                    if (a) {
-                        var shyj = a?.shlc?.slice(1, -1).map(i => i.USER_NAME + ":" + i.CHECKINFO) || [];
-                        shyjInfo.value = shyj.join(";");
-                        info.value = a;
-                    }
-                }
-            })
+    function getInfo(e) {
+      getResInCar({
+        keyword: e.SERVICENAME,
+        userId: session.getItem('userId'),
+      }).then((r) => {
+        if (r?.resp_code == 0 && r?.datas?.length) {
+          var a = r.datas.find((i) => i.resInfo.SERVICEID == e.SERVICEID);
+          if (a) {
+            var shyj = a?.shlc?.slice(1, -1).map((i) => i.USER_NAME + ':' + i.CHECKINFO) || [];
+            shyjInfo.value = shyj.join(';');
+            info.value = a;
+          }
         }
+      });
+    }
 
-        return {
-            shyjInfo,
-            info,
-            showInfo,
-            show,
-            props,
-        };
-    },
+    return {
+      dataType,
+      downloadUrl,
+      shyjInfo,
+      info,
+      showInfo,
+      show,
+      props,
+    };
+  },
 });
 </script>
 <style lang="less">
 .info {
-    padding: 20px;
+  padding: 20px;
 }
 
 .info li span {
-    display: inline-block;
-    width: 50%;
+  display: inline-block;
+  width: 50%;
 }
 
 .info li {
-    margin-bottom: 20px;
+  margin-bottom: 20px;
 }
 </style>

+ 4 - 1
src/views/resource/plat/item/MapData.vue

@@ -28,7 +28,10 @@
             <div class="left">
               <div class="operation-item browse-item-btn browse-item-MR00001936"
                 style="background: #E1EBFB;color: #2D74E7;">
-                <a target="_blank" :href="`./mapview.html?${i.SERVICEID}`" rel="opener">
+                <!-- 小浪底 -->
+                <!-- <a target="_blank" :href="`./mapview.html?${i.SERVICEID}`" rel="opener"> -->
+                <!-- 黑龙滩 -->
+                <a target="_blank" :href="`./sceneview.html?${i.MAPINGURL}`" rel="opener">
                   <span style="color: #2D74E7;">浏览</span>
                 </a>
               </div>

+ 2 - 1
src/views/resource/plat/item/SceneData.vue

@@ -49,7 +49,8 @@
           <div class="operation-box">
             <div class="left">
               <div class="operation-item browse-item-btn browse-item-MR00001936">
-                <a target="_blank" :href="`./sceneview.html?${i.SERVICEID}`" rel="opener">
+                <!-- <a target="_blank" :href="`./sceneview.html?${i.SERVICEID}`" rel="opener"> -->
+                <a target="_blank" :href="`./sceneview.html?${i.MAPINGURL}`" rel="opener">
                   <span style="color: #2d74e7">浏览</span>
                 </a>
               </div>