From c0ff61d066a9f65aa0cdbeb1e10a249763f1e966 Mon Sep 17 00:00:00 2001 From: yxl <584911253@qq.com> Date: 星期四, 02 一月 2025 09:58:41 +0800 Subject: [PATCH] 最新代码提交 --- src/assets/js/mapSetFunc.js | 56 +++---- src/api/api.js | 5 vue.config.js | 13 + src/assets/js/map/mapServer.js | 2 src/assets/js/map/mapView.js | 107 ++++++++++++++ public/config/config.js | 9 src/views/chartView/index.vue | 184 ++++++++++++++----------- public/gltf/tank.glb | 0 src/App.vue | 4 9 files changed, 257 insertions(+), 123 deletions(-) diff --git a/public/config/config.js b/public/config/config.js index 4b68570..e1ea279 100644 --- a/public/config/config.js +++ b/public/config/config.js @@ -8,13 +8,16 @@ retTime: 2000, // apiUrl: "/api/", // apiUrl: "http://192.168.11.95:7777/api/", - wsHost: "ws://192.168.11.194/ws/asset", + // wsHost: "ws://192.168.11.194/ws/asset", + // wsHost: "ws://103.135.160.14:7800/ws/asset", + wsHost: "ws://103.135.160.14:7777/ws/asset", localUrl: "http://192.168.112.13:12315", - apiUrl: "http://192.168.11.125:7777", + // apiUrl: "http://192.168.11.125:7777", // apiUrl: "http://103.135.160.14:5381/",0 // apiUrl: location.origin, // apiUrl: "http://192.168.11.194", - // apiUrl:" http://103.135.160.14:7800", + // apiUrl:"http://103.135.160.14:7800", + apiUrl:"/dev-api", imgUrl: webHost + "/image/", reportMd: "/Data/Report.md", reportDocx: "/Data/Report.docx", diff --git a/public/gltf/tank.glb b/public/gltf/tank.glb new file mode 100644 index 0000000..be2a7ab --- /dev/null +++ b/public/gltf/tank.glb Binary files differ diff --git a/src/App.vue b/src/App.vue index 28ee1f1..56006a0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -70,4 +70,8 @@ height: calc(100% - 36px) !important; padding: 0px !important; } + +.map-info-bar{ + display: block !important; +} </style> diff --git a/src/api/api.js b/src/api/api.js index e8b12e9..58fa0ef 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -16,8 +16,11 @@ export function getV1Fastgpt(params){ return service.get("/v1/fastgpt?message=" + params); } +// export function getAgentIntention(params){ +// return service.post("/api/agent/intention" ,params); +// } export function getAgentIntention(params){ - return service.post("/api/agent/intention" ,params); + return service.post("/api/agent/intention2" ,params); } export function getAgentLayerList(params){ diff --git a/src/assets/js/map/mapServer.js b/src/assets/js/map/mapServer.js index 1567ab1..cfcac83 100644 --- a/src/assets/js/map/mapServer.js +++ b/src/assets/js/map/mapServer.js @@ -124,6 +124,8 @@ layerId: res.id, name: res.name }); + // console.log('tileset',tileset); + // earthCtrl.userScene.flyTo(tileset); }, traverseVisibleTiles() { tileset.readyPromise.then((tileset) => { diff --git a/src/assets/js/map/mapView.js b/src/assets/js/map/mapView.js index 21816c0..4bdab51 100644 --- a/src/assets/js/map/mapView.js +++ b/src/assets/js/map/mapView.js @@ -16,7 +16,7 @@ // 闅愯棌榛樿搴曞浘 defaultImagery: false, // 闅愯棌logo - printLog: false + printLog: false, // maxViewHeight: 1200000 // sceneMode: SmartEarth.Cesium.SceneMode.SCENE2D }); @@ -31,7 +31,7 @@ // 杩欓噷鍙互鑾峰彇鍒扮偣鍑荤殑瀹炰綋鎴栧叾浠栧璞� var featureId = pickedObject.getProperty("id"); console.log(featureId); - + // pickedObject.color = Cesium.Color.RED; console.log("鐐瑰嚮鐨勫璞�:", pickedObject); } @@ -66,9 +66,9 @@ 0.001313831409284339, 2 ); -// setTimeout(() => { -// mapModel.init(); -// }, 5000); + // setTimeout(() => { + // mapModel.init(); + // }, 5000); // mapServer.addServer({ // sourceType: "Tileset", // url: "http://103.135.160.14:9038/gisserver/c3dserver/JiashanBase/tileset.json", @@ -108,6 +108,14 @@ // } // }); // mapInfo.setEntityQueryInput(); + // this.addWfsLayer() + // this.addRaderLayer() + // this.addModel() + // this.addTetrahedron({ + // lon: 121.614202387521061, + // lat: 23.990136825668284, + // alt: 150 + // }) }, addTetrahedron(res) { earthCtrl.factory.addTetrahedron({ @@ -213,6 +221,95 @@ url: "https://rt0.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid=4&scene=0", tilingScheme: earthCtrl.core.getOffsetTilingScheme() // 鍋忕Щ绾犳 }); + }, + + // 娣诲姞wfs + addWfsLayer() { + earthCtrl.viewer.camera.flyTo({ + destination: { + x: -3475710.5684351875, + y: 5625834.799523204, + z: 2729961.751894543, + }, + orientation: { + heading: 5.73978482494632, + pitch: -1.2817819264676036, + roll: 6.282989918773924, + }, + }); + earthCtrl.factory.createWfsLayer('point', { + urls: 'https://cim.smartearth.cn/geoserver/JiaShanBase/ows', + layer: 'JiaShanBase:RadarSpot', + text: '[JiaShanBase:Type]', + color: '#de3', + disableDepthTestDistance: Infinity + }) + earthCtrl.factory.createWfsLayer('polyline', { + urls: 'https://cim.smartearth.cn/geoserver/JiaShanBase/ows', + layer: 'JiaShanBase:RadarL', + width: 1.5, + color: '#87CEFA', + }) + earthCtrl.factory.createWfsLayer('polyline', { + urls: 'https://cim.smartearth.cn/geoserver/JiaShanBase/ows', + layer: 'JiaShanBase:RadarM', + width: 1.5, + color: '#de3', + }) + + earthCtrl.factory.createWfsLayer('polyline', { + urls: 'https://cim.smartearth.cn/geoserver/JiaShanBase/ows', + layer: 'JiaShanBase:RadarS', + width: 1.5, + color: '#FF0000', + }) + }, + addRaderLayer() { + //闆疯揪閬僵鎵弿锛堣嚜瀹氫箟锛� + const option = { + radius: 1000, //鍗婂緞 + yaw: 0, //闆疯揪鏂瑰悜锛堝彲閫夛級 + angle: 120, //闆疯揪澶硅锛堝彲閫夛級 + scanAngle: 30, //鎵弿澶硅锛堝彲閫夛級 + speed: 5, //鍊嶉�燂紙鍙�夛級 + maxLat: 90, //涓嬬淮搴︼紙鍙�夛級 + minLat: 45, //涓婄淮搴︼紙鍙�夛級 + stackPartitions: 40, //妯悜缃戞牸鏁帮紙鍙�夛級 + slicePartitions: 80, //绾靛悜缃戞牸鏁帮紙鍙�夛級 + //color: 'rgba(255,255,255,0.5)', //闆疯揪閬僵棰滆壊锛堝彲閫夛級 + //outlineColor: 'rgba(255,255,255,0.5)', //闆疯揪閬僵杈规绾块鑹诧紙鍙�夛級 + //scanColor: 'rgba(255,0,0,0.5)', //鎵弿棰滆壊锛堝彲閫夛級 + }; + const position1 = [121.614202387521061, 23.990136825668284, 0]; + // 闆疯揪閬僵 + earthCtrl.factory.createRadarMaskScan('闆疯揪閬僵鎵弿1', position1, option) + }, + addModel() { + const entity = earthCtrl.viewer.entities.add({ + position: SmartEarth.Cesium.Cartesian3.fromDegrees( + 121.614202387521061, + 23.990136825668284, + 0 + ), + model: { + uri: '/gltf/tank.glb', + scale: 15, + heightReference: SmartEarth.Cesium.HeightReference.CLAMP_TO_GROUND, + disableDepthTestDistance: Number.POSITIVE_INFINITY // 绂佺敤娣卞害娴嬭瘯 + }, + label: { + show: true, + text: '缁忓害锛�121.6142023,绾害锛�23.9901368', + color: SmartEarth.Cesium.Color.fromCssColorString("#fff"), + font: "normal 14px MicroSoft YaHei", + showBackground: true, + outlineColor: SmartEarth.Cesium.Color.WHITE, + pixelOffset: new SmartEarth.Cesium.Cartesian2(10, -30), + horizontalOrigin: SmartEarth.Cesium.HorizontalOrigin.CENTER, + verticalOrigin: SmartEarth.Cesium.VerticalOrigin.BOTTOM, + heightReference: SmartEarth.Cesium.HeightReference.CLAMP_TO_GROUND, + }, + }); } }; export default mapViewer; diff --git a/src/assets/js/mapSetFunc.js b/src/assets/js/mapSetFunc.js index 535b587..34152f7 100644 --- a/src/assets/js/mapSetFunc.js +++ b/src/assets/js/mapSetFunc.js @@ -153,37 +153,31 @@ }, creatPoiMap(res) { - const poi = res.data; - // const label = earthCtrl.factory.createLabel({ - // lon: poi._x, - // lat: poi._y, - // text: this.getName(poi), - // alt: 150, - // image: SmartEarthRootUrl + "Workers/image/fighter.png", - // // 鏂囨湰鍋忕Щ閲� - // pixelOffset: new SmartEarth.Cesium.Cartesian2(0, -50), - // // 鍥剧墖鍋忕Щ閲� - // iPixelOffset: new SmartEarth.Cesium.Cartesian2(0, -20) - // }); - const label = earthCtrl.factory.createLabel({ - name: "鍒涘缓鏂囨湰", - id: earthCtrl.factory.createUUID(), - text: this.getName(poi), - font: "22pt monospace", - outlineWidth: 2, - fillColor: SmartEarth.Cesium.Color.YELLOW, - lon: poi._x, - lat: poi._y, - alt: poi.height ? poi.height + 10 : 100, - iDistanceDisplayCondition: (100, 3000) - }); - setTimeout(() => { - this.setEntityTitlesChangeColor(poi.seid); - }, 200); - earthCtrl.userScene.flyTo(label); - this.layerList.push({ - layer: label, - func: res.func + res.data.forEach((poi,index) => { + // const poi = res.data[0]; + console.log('poi------', poi) + const label = earthCtrl.factory.createLabel({ + name: "鍒涘缓鏂囨湰", + id: earthCtrl.factory.createUUID(), + text: poi.name,//this.getName(poi), + font: "22pt monospace", + outlineWidth: 2, + fillColor: SmartEarth.Cesium.Color.YELLOW, + lon: poi.lontitude, + lat: poi.lattitude, + alt: poi.height ? poi.height + 10 : 100, + iDistanceDisplayCondition: (100, 3000) + }); + setTimeout(() => { + this.setEntityTitlesChangeColor(poi.seid); + }, 200); + if (index == 0) { + earthCtrl.userScene.flyTo(label); + } + this.layerList.push({ + layer: label, + func: res.func + }); }); }, setEntityTitlesChangeColor(res) { diff --git a/src/views/chartView/index.vue b/src/views/chartView/index.vue index cdf71d4..d6299d3 100644 --- a/src/views/chartView/index.vue +++ b/src/views/chartView/index.vue @@ -1,7 +1,12 @@ <template> <div class="chartBox"> <div class="ChartBox"> - <JwChat-index :taleList="list" @enter="bindEnter" v-model="inputMsg" :toolConfig="tool"> + <JwChat-index + :taleList="list" + @enter="bindEnter" + v-model="inputMsg" + :toolConfig="tool" + > </JwChat-index> </div> </div> @@ -12,9 +17,14 @@ import msgData from "../../assets/js/msg/msgData"; import store from "../../store"; import bus from "./../../assets/js/bus.js"; -import { getAgentThistoryUpdate, getAgentIntention, getAgentLayerList, getAgentThistorySave } from "../../api/api.js"; +import { + getAgentThistoryUpdate, + getAgentIntention, + getAgentLayerList, + getAgentThistorySave, +} from "../../api/api.js"; import mapSetFunc from "../../assets/js/mapSetFunc.js"; -import { nanoid } from 'nanoid' +import { nanoid } from "nanoid"; import mapServer from "../../assets/js/map/mapServer.js"; import mapImg from "../../assets/js/map/mapImg.js"; import mapModel from "../../assets/js/map/mapModel.js"; @@ -32,20 +42,20 @@ obj: null, tool: { show: ["file", "history", "img"], - callback: this.toolEvent + callback: this.toolEvent, }, config: { img: "/image/cover.png", name: "JwChat", dept: "鏈�绠�鍗曘�佹渶渚挎嵎", - callback: this.bindCover - } + callback: this.bindCover, + }, }; }, computed: { Obj() { return store.state.setMsgData; - } + }, }, watch: { Obj(newVal, oldVal) { @@ -63,7 +73,7 @@ this.list[this.list.length - 1].text = newVal; } } - } + }, }, mounted() { this.uuid = nanoid(); @@ -78,7 +88,6 @@ // modelLayer.init(); setTimeout(() => { this.getMsg("ai", "鎮ㄥソ锛岃杈撳叆鎸囦护"); - }, 1000); bus.$on("mapInfo", (res) => { @@ -107,16 +116,15 @@ createSocket() { this.wsSocket = new WebSocket(config.wsHost); this.wsSocket.onopen = (event) => { - console.log('WebSocket杩炴帴鎴愬姛'); + console.log("WebSocket杩炴帴鎴愬姛"); //瀹氭椂浠诲姟锛岀敱浜庝娇鐢╪ginx鍙嶅悜浠g悊锛�60绉掓棤鏁版嵁浼犺緭浼氭柇寮� var timer = setInterval(() => { - if ( this.wsSocket.readyState == 1) { + if (this.wsSocket.readyState == 1) { this.wsSocket.send("蹇冭烦鍖呮娴�"); } else { //IM杩炴帴宸叉柇寮� } }, 50 * 1000); - }; this.wsSocket.onmessage = (event) => { // console.log('Received message:', event.data); @@ -124,29 +132,25 @@ if (event.data != "杩炴帴鎴愬姛") { console.log(event.data); - const val = JSON.parse(event.data) + const val = JSON.parse(event.data); if (val.session_id == this.uuid) { - this.setMapfunc(val, this.obj) + this.setMapfunc(val, this.obj); } } - - } + }; }, async getQueryLayerList() { - getAgentLayerList().then(response => { + getAgentLayerList().then((response) => { if (response.code != 200) return; const items = response.data; for (var i in items) { const name = items[i].name; - if ( - name != "FW20" && name != "FW12" - ) { - mapServer.addServer(items[i]) + if (name != "FW20" && name != "FW12") { + console.log("items[i]", items[i]); + mapServer.addServer(items[i]); } - } - - }) + }); }, bindEnter() { const msg = this.inputMsg; @@ -173,7 +177,9 @@ 2 ); mapImg.addImageLayer(); - var roleMsg1 = msgData.getAffairsData([{ type: "text", val: "鐩稿叧淇℃伅宸插湪鍦板浘灞曠ず" }]); + var roleMsg1 = msgData.getAffairsData([ + { type: "text", val: "鐩稿叧淇℃伅宸插湪鍦板浘灞曠ず" }, + ]); this.refashMsg(roleMsg1.list); }, getMsg(type, msg) { @@ -200,56 +206,54 @@ 2 ); - const formData = new FormData(); - formData.append("message", res); - formData.append("lib_id", "No1"); - formData.append("session_id", this.uuid.toString()); + // const formData = new FormData(); + // formData.append("message", res); + // formData.append("lib_id", "No1"); + // formData.append("session_id", this.uuid.toString()); + const formData = { + message: res, + lib_id: "No1", + session_id: this.uuid.toString(), + }; var obj = { - "ai": "", - "create_time": msgData.getDate1(), - "human": res, - "sessionid": this.uuid, - "update_time": "", - "userid": 0 - } + ai: "", + create_time: msgData.getDate1(), + human: res, + sessionid: this.uuid, + update_time: "", + userid: 0, + }; - getAgentThistorySave( - obj - ).then(response => { - + getAgentThistorySave(obj).then((response) => { if (response.code == 200) { obj.id = response.id; this.obj = obj; } - this.setAgentIntention(obj, formData) - }) - - - - + this.setAgentIntention(obj, formData); + }); }, async setAgentIntention(obj, formData) { getAgentIntention(formData).then((response) => { - if (response.code != 200) { var rolMsg = [ { type: "text", - val: "鏈煡璇㈠埌鐩稿叧淇℃伅銆�" - } + val: "鏈煡璇㈠埌鐩稿叧淇℃伅銆�", + }, ]; this.refashMsg(rolMsg); return; } - const type = response.type; if (type == "Map") { this.setMapfunc(response.content, obj); } else if (type == "Rag") { this.setMapRag(response, obj); + } else { + this.setMapfunc(response.content, obj); } }); }, @@ -258,26 +262,30 @@ switch (res.func) { case "queryRelationship": - var roleMsg = null; if (res.data) { - mapSetFunc.init(res) + mapSetFunc.init(res); var a = `${res.msg}`; this.setUpdateHistoryInFor(obj, a); roleMsg = msgData.getMdData("markdown", a); } else { roleMsg = msgData.getAffairsData([{ type: "text", val: res.msg }]); - } this.refashMsg(roleMsg.list); break; case "queryMeta": - var a = `${res.data}`; + // var a = `|鏁版嵁绫诲瀷 |鏁版嵁閲� |\n|------|------|\n|鍐涗簨鐩爣 |724|\n|`//`${res.data}`; + const subData = res.data + .filter((item) => item.subtype !== null) + .map((item) => `| ${item.subtype} | ${item.count} |`) + .join("\n"); + var a = `| 鏁版嵁绫诲瀷 | 鏁版嵁閲� |\n|------|------|\n` + subData; + console.log("aaa", subData, a); this.setUpdateHistoryInFor(obj, a); var roleMsg = msgData.getMdData("markdown", a); this.refashMsg(roleMsg.list); - mapSetFunc.init(res) + mapSetFunc.init(res); break; case "combatSimulate": this.setMsgStart2(); @@ -287,11 +295,9 @@ this.refashMsg(roleMsg1.list); break; case "batEnv": - if (res.msg) { var a = `${res.msg}`; var roleMsg = msgData.getMdData("markdown", a); - roleMsg.list[0].link = true; @@ -303,15 +309,36 @@ break; case "poiMap": - case "aroundPoi": - mapSetFunc.init(res) + mapSetFunc.init(res); this.setUpdateHistoryInFor(obj, res.msg); - var roleMsg = msgData.getAffairsData([{ type: "text", val: res.msg }]); + var roleMsg = msgData.getAffairsData([ + { type: "text", val: "鍦板浘宸叉樉绀�" }, + ]); + console.log("roleMsg----", roleMsg); + this.refashMsg(roleMsg.list); + break; + case "aroundPoi": + mapSetFunc.init(res); + this.setUpdateHistoryInFor(obj, res.msg); + var roleMsg = msgData.getAffairsData([ + { type: "text", val: res.msg }, + ]); + this.refashMsg(roleMsg.list); + break; + case "getParam": + mapSetFunc.init(res); + console.log('res.data.targetinfo',res); + this.setUpdateHistoryInFor(obj, res.msg); + var roleMsg = msgData.getAffairsData([ + { type: "text", val: res.data[0].targetinfo }, + ]); this.refashMsg(roleMsg.list); break; default: this.setUpdateHistoryInFor(obj, res.msg); - var roleMsg1 = msgData.getAffairsData([{ type: "text", val: res.msg }]); + var roleMsg1 = msgData.getAffairsData([ + { type: "text", val: res.msg }, + ]); this.refashMsg(roleMsg1.list); break; } @@ -319,10 +346,9 @@ setUpdateHistoryInFor(obj, message) { obj.ai = message; obj.update_time = msgData.getDate1(); - getAgentThistoryUpdate(obj).then(response => { + getAgentThistoryUpdate(obj).then((response) => { console.log(response); - - }) + }); }, setMapRag(res, objRes) { const val = res.content.split("\n"); @@ -331,8 +357,8 @@ if (val[i]) { obj.push({ type: "text", - val: val[i] - }) + val: val[i], + }); } } var listData = []; @@ -340,52 +366,46 @@ var obj_file = res.fileSrource; for (var i = 0; i < obj_file.length; i++) { const file_name = obj_file[i].metadata.split("/"); - const name = file_name[file_name.length - 1] + const name = file_name[file_name.length - 1]; if (listData.length == 0) { listData.push({ name: name, - val: [ - obj_file[i].page_content - ] - }) + val: [obj_file[i].page_content], + }); } else { var boolen = false; for (var k in listData) { if (listData[k].name == name) { boolen = true; - listData[k].val.push(obj_file[i].page_content) + listData[k].val.push(obj_file[i].page_content); } } if (boolen == false) { listData.push({ name: name, - val: [ - obj_file[i].page_content - ] - }) + val: [obj_file[i].page_content], + }); } - } } } if (listData.length > 0) { obj.push({ type: "fileSrource", - val: listData - }) + val: listData, + }); } var roleMsg = msgData.getAffairsData(obj); this.setUpdateHistoryInFor(objRes, JSON.stringify(roleMsg.list)); this.refashMsg(roleMsg.list); - }, refashMsg(res) { this.loading = false; this.list[this.list.length - 1].list = res; - } - } + }, + }, }; </script> <style scoped> diff --git a/vue.config.js b/vue.config.js index 70cda5d..6bf2bde 100644 --- a/vue.config.js +++ b/vue.config.js @@ -6,7 +6,18 @@ devServer: { host: "0.0.0.0", //鎸囧畾瑕佷娇鐢ㄧ殑 host port: 12315, //鎸囧畾绔彛鍙蜂互渚﹀惉 - hotOnly: false //鍚敤鐑ā鍧楁浛鎹紝鑰屾棤闇�椤甸潰鍒锋柊浣滀负鏋勫缓澶辫触鏃剁殑鍥為��銆� + hotOnly: false, //鍚敤鐑ā鍧楁浛鎹紝鑰屾棤闇�椤甸潰鍒锋柊浣滀负鏋勫缓澶辫触鏃剁殑鍥為��銆� + open: true, + proxy: { + "/dev-api": { + // target: 'http://103.135.160.14:7800', + target: 'http://103.135.160.14:7777', + changeOrigin: true, + pathRewrite: { + '^/dev-api': '' + } + }, + }, }, -- Gitblit v1.9.3