From 6ae4841b48665145aa469d574fbadb988a9c498c Mon Sep 17 00:00:00 2001 From: suerprisePlus <15810472099@163.com> Date: 星期四, 27 六月 2024 15:55:17 +0800 Subject: [PATCH] 演示1版本 --- src/components/Chat/enterBox.vue | 1 package-lock.json | 13 + src/assets/js/map/mapView.js | 5 src/assets/js/msg/msgData.js | 10 src/assets/js/map/mapConfig.js | 92 ++++++ src/assets/js/map/mapInfo.js | 16 + src/views/chartView/index.vue | 203 +++++++++++++++ src/assets/js/map/modelLayer.js | 57 +++ src/views/homePage/index.vue | 5 src/api/api.js | 16 src/components/Chat/chatList.vue | 52 +++ public/config/config.js | 2 package.json | 1 src/components/Chat/index.vue | 19 + src/assets/js/map/mapJsonLayer.js | 275 +++++++++++++++++++- 15 files changed, 712 insertions(+), 55 deletions(-) diff --git a/package-lock.json b/package-lock.json index aa33b55..c587a8f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9660,6 +9660,11 @@ "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", "dev": true }, + "indento": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/indento/-/indento-1.1.13.tgz", + "integrity": "sha512-YZWk3mreBEM7sBPddsiQnW9Z8SGg/gNpFfscJq00HCDS7pxcQWWWMSVKJU7YkTRyDu1Zv2s8zaK8gQWKmCXHlg==" + }, "indexes-of": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/indexes-of/-/indexes-of-1.0.1.tgz", @@ -10417,6 +10422,14 @@ "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", "dev": true }, + "json2md": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/json2md/-/json2md-2.0.1.tgz", + "integrity": "sha512-VbwmZ83qmUfKBS2pUOHlzNKEZFPBeJSbzEok3trMYyboZUgdHNn1XZfc1uT8UZs1GHCrmRUBXCfqw4YmmQuOhw==", + "requires": { + "indento": "^1.1.13" + } + }, "json5": { "version": "2.2.3", "resolved": "https://registry.npmmirror.com/json5/-/json5-2.2.3.tgz", diff --git a/package.json b/package.json index c99647e..5d696c9 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "core-js": "^3.6.4", "element-ui": "^2.13.1", "jsencrypt": "^3.3.2", + "json2md": "^2.0.1", "jwchat": "^0.2.3", "vue": "^2.6.11", "vue-markdown": "^2.2.4", diff --git a/public/config/config.js b/public/config/config.js index 6e6821a..1c5f00e 100644 --- a/public/config/config.js +++ b/public/config/config.js @@ -6,7 +6,7 @@ loadTime: 2000, //闂撮殧澶氫箙鍥炴秷鎭� retTime: 2000, - apiUrl: "http://192.168.11.41:7777/", + apiUrl: "/api/", // apiUrl: "http://106.120.22.26:5367/", imgUrl: webHost + "/image/", modelBase: { diff --git a/src/api/api.js b/src/api/api.js index 2bfbdeb..7e1f1df 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -1,12 +1,18 @@ import service from "../utils/service.js"; export function getAIMessage(params) { //璇锋眰鍦板潃 - // return service.get("/api/v1/chat?message=" + params); + // return service.get("/v1/chat?message=" + params); // return service.get("/intention?message=" + params); - // return service.get("/api/v1/mix?message=" + params); - return service.get("/api/v1/intent?message=" + params); + return service.get("/v1/mix?message=" + params); + // return service.get("/v1/intent?message=" + params); } - +export function getChartMessage(params) { + //璇锋眰鍦板潃 + return service.get("/v1/chat?message=" + params); + + + // return service.get("/v1/intent?message=" + params); +} export function getV1Fastgpt(params){ - return service.get("/api/v1/fastgpt?message=" + params); + return service.get("/v1/fastgpt?message=" + params); } \ No newline at end of file diff --git a/src/assets/js/map/mapConfig.js b/src/assets/js/map/mapConfig.js index 00bca62..cf14d5e 100644 --- a/src/assets/js/map/mapConfig.js +++ b/src/assets/js/map/mapConfig.js @@ -1,4 +1,6 @@ import * as turf from "@turf/turf"; + +const json2md = require("json2md"); const mapConfig = { flyToImageryLayer(res) { earthCtrl.userScene.flyTo(res); @@ -9,15 +11,97 @@ steps: 10, properties: { foo: "bar" } }); - console.log(buffered); - const coord = buffered.geometry.coordinates[0]; const std = coord.map((item) => { const rs = turf.toMercator(turf.point(item)); - return rs.geometry.coordinates + return rs.geometry.coordinates; }); - buffered.geometry.coordinates[0] =std + buffered.geometry.coordinates[0] = std; return buffered; + }, + setScanList(response, filed) { + const obj = []; + for (var i in response) { + const item = response[i]; + if (item[filed]) { + const count = "count_" + filed; + obj.push(item[filed] + " : " + item[count]); + } + } + if (filed == "weaponname") { + return "鍙戠幇鐤戜技 " + obj.toString().replaceAll(",", "涓�; "); + }else if(filed==='targettype'){ + return "鍙戠幇 " + obj.toString().replaceAll(",", "涓�; "); + } + + return "鏆傛棤淇℃伅"; + }, + setArrList(list, flag) { + var result = []; + const item = list.split("{"); + for (var i in item) { + if (item[i]) { + if (item[i].indexOf(",") > -1) { + + result.push({ + p: item[i].replaceAll('"','').replaceAll('}','') + }); + } else { + result.push({ + h6: item[i].replaceAll('"','') + }); + } + } + } + return result; + }, + setJsonToMd(res) { + // const data = { + // "name": "John Doe", + // "age": 30, + // "hobbies": ["reading", "programming"] + // } + return json2md(res); + + // return json2md([ + // { h1: "JSON To Markdown" }, + // { blockquote: "A JSON to Markdown converter." }, + // { + // img: [ + // { + // title: "Some image", + // source: "https://www.bizhigq.com/pc-img/2023-05/g2246.jpg" + // }, + // { + // title: "Another image", + // source: + // "https://desk-fd.zol-img.com.cn/t_s960x600c5/g2/M00/0B/08/Cg-4WlUwdDWIZ7zKAAqGM6NxoXkAABuAQPwTs0ACoZL265.jpg" + // }, + // { + // title: "Yet another image", + // source: + // "https://pic4.zhimg.com/v2-f72106aeb21976228c3f0dff703cbc35_r.jpg" + // } + // ] + // }, + // { h2: "鐗规��" }, + // { ul: ["鏄撲簬浣跨敤", "鎮ㄥ彲浠ョ▼搴忓寲鍦扮敓鎴� Markdown 鍐呭", "..."] }, + // { h2: "濡備綍璐$尞" }, + // { ol: ["鍒涘缓椤圭洰鍒嗘敮", "寮�濮嬩綘鐨勫伐浣�", "鎻愬嚭 pull request"] }, + // { h2: "浠g爜鍧�" }, + // { p: "涓嬮潰浣犲彲浠ョ湅鍒颁竴涓唬鐮佸潡绀轰緥銆�" }, + // { + // code: { + // language: "js", + // content: [ + // "function sum (a, b) {", + // " return a + b", + // "}", + // "sum(1, 2)" + // ] + // } + // } + // ]); } }; export default mapConfig; diff --git a/src/assets/js/map/mapInfo.js b/src/assets/js/map/mapInfo.js index eede9a4..fee97f9 100644 --- a/src/assets/js/map/mapInfo.js +++ b/src/assets/js/map/mapInfo.js @@ -30,9 +30,23 @@ }); }, setEntityQueryInput(){ - earthCtrl.camera.flyTo(120.27012029869624, 14.794107005718674, 2921.642108119077, 0, -90, 0, 2); + // earthCtrl.camera.flyTo(120.27012029869624, 14.794107005718674, 2921.642108119077, 0, -90, 0, 2); // earthCtrl.camera.flyTo(120.298738742, 14.80902903, 2921.642108119077, 0, -90, 0, 2); + earthCtrl.camera.flyTo( + 120.25011537497547, + 14.785109412061856, + 2921.642108119077, + 57, -45, 0, 2 + ); }, + setFlyTo(res){ + earthCtrl.camera.flyTo( + res.longitude, + res.latitude, + res.height, + 0, -90, 0, 2 + ); + } }; export default mapInfo; diff --git a/src/assets/js/map/mapJsonLayer.js b/src/assets/js/map/mapJsonLayer.js index 8e3f97c..0105eff 100644 --- a/src/assets/js/map/mapJsonLayer.js +++ b/src/assets/js/map/mapJsonLayer.js @@ -17,6 +17,10 @@ url: null, coord: null, rectangularSensor: null, + targetList: [], + linePath: null, + richTextPoint1: null, + wfsLayer:null, init(url) { this.url = url; this.getJsonLayer(); @@ -73,7 +77,7 @@ }); }, setQyeryData(res) { - this.setTitleSetRest(); + // this.setTitleSetRest(); if (res.indexOf("娴峰啗闄嗘垬闃�") > -1) { this.setQueryExtent2(); } else if (res.indexOf("鍐涗簨鐩爣") > -1) { @@ -93,9 +97,28 @@ encrypt.setPublicKey(modelLayer.publickey + ""); return encrypt.encrypt(res); }, - setQueryTF2(name) { - const obj = "weaponname = '" + name + "'" + ""; + async setQueryFlywire() { + const obj = "ejfl = '缇庣┖鍐涙寚鎸ヤ腑蹇�'" + ""; const filed = this.getPublickey(obj); + const layer = modelLayer.layers.filter((item) => { + if (item.name == "寤虹瓚") { + return item; + } + }); + if (layer.length <= 0) return; + const data = getQueryEentity({ + token: getToken(), + start: 1, + count: 0, + containCount: true, + layerid: layer[0].id, + dbid: modelLayer.dbid, + where: filed + }); + }, + setQueryTF2(name) { + // const obj = "weaponname like '%" + name + "%'" + ""; + const filed = this.getPublickey(name); const layer = modelLayer.layers.filter((item) => { if (item.name == "姝﹀櫒鐐�") { return item; @@ -113,9 +136,10 @@ }).then((response) => { if (response.code != 200) return; const geom = response.data.items[0]; + const position = [geom._x, geom._y, 0]; const cylinder = { - radius: 1000, //鍗婂緞 + radius: 1500, //鍗婂緞 angle: 30, //鎵弿瑙掑害锛堝彲閫夛級 speed: 5, //鍊嶉�燂紙鍙�夛級 stackPartitions: 80, //妯悜缃戞牸鏁帮紙鍙�夛級 @@ -126,10 +150,44 @@ position, cylinder ); - Viewer.zoomTo(this.rectangularSensor.item); + // Viewer.zoomTo(this.rectangularSensor.item); }); }, - setQueryByFiled(name, color, label) { + setQueryByFiled(name, color) { + const filed = this.getPublickey(name); + var objItem = mapServer.listData.filter((item) => { + if (item.type === "Tileset") { + return item; + } + }); + if (objItem.length <= 0) return; + var tileset = objItem[0]; + getQueryEentity({ + token: getToken(), + start: 1, + count: 0, + containCount: true, + layerid: tileset.layerId, + dbid: modelLayer.dbid, + where: filed + }).then((response) => { + if (response.code != 200) return; + var std = []; + const items = response.data.items; + items.map((item) => { + std.push(item.seid); + }); + nextTick(() => { + if (std.length > 0) { + this.setTilesetColorChange(tileset, std, color); + } + }); + }); + }, + setQueryByFiledList(list, flag) { + const result = list[flag]; + const name = result.name; + const color = result.color; const obj = "targettype = '" + name + "'" + ""; const filed = this.getPublickey(obj); var objItem = mapServer.listData.filter((item) => { @@ -152,17 +210,41 @@ var std = []; const items = response.data.items; items.map((item) => { - if (item.targettype == name) { - std.push(item.seid); - } + // if (item.targettype == name) { + std.push(item.seid); + // }. }); nextTick(() => { - if (std.length <= 0) return; - this.setTilesetColorChange(tileset, std, color); + if (std.length > 0) { + this.targetList.push({ + ids: std, + color: color + }); + } + flag = flag + 1; + + if (flag >= list.length) { + this.setTilesetColorChangeTarget(); + } else { + this.setQueryByFiledList(list, flag); + } }); }); }, setTitleSetRest() { + this.targetList = []; + if(this.wfsLayer){ + // this.wfsLayer.removeFromMap(); + this.wfsLayer.destroy(); + } + if (this.linePath) { + this.linePath.clear(); + this.linePath = null; + } + if (this.richTextPoint1) { + this.richTextPoint1.deleteObject(); + this.richTextPoint1 = null; + } if (this.rectangularSensor) { this.rectangularSensor.wall.forEach((wall) => { Viewer.entities.remove(wall); @@ -193,12 +275,46 @@ const id = feature.getProperty("id"); if (ids.indexOf(id) > -1) { return new SmartEarth.Cesium.Color.fromCssColorString(color); - } else { - return new SmartEarth.Cesium.Color.fromCssColorString("#FFFFFF"); } } } }); + }, + setTilesetColorChangeTarget() { + var objItem = mapServer.listData.filter((item) => { + if (item.type === "Tileset") { + return item; + } + }); + if (objItem.length <= 0) return; + var tileset = objItem[0].layer; + const list = this.targetList; + + tileset.style = new Cesium.Cesium3DTileStyle({ + color: { + evaluateColor: (feature) => { + const id = feature.getProperty("id"); + for (var i in list) { + if (list[i].ids.indexOf(id) > -1) { + return new SmartEarth.Cesium.Color.fromCssColorString( + list[i].color + ); + } + } + // if (ids.indexOf(id) > -1) { + // return new SmartEarth.Cesium.Color.fromCssColorString(color); + // } + } + } + }); + }, + setAddWfsLayer(){ + this.wfsLayer = earthCtrl.factory.createWfsLayer('polygon', { + urls: 'https://cim.smartearth.cn/SEserver/wfsserver/SubicBayWeapon_wfs', + layer: 'weapons', + outlineColor:'#ff0000', + alpha:0, + }) }, getTileSet() { var objItem = mapServer.listData.filter((item) => { @@ -211,13 +327,13 @@ } return objItem[0]; }, - setQueryExtent2() { + setQueryExtent2(res, boolen) { const tileset = this.getTileSet(); if (!tileset) { return; } - const obj = "ejfl like '%绌哄啗鍩哄湴%'"; - const filed = this.getPublickey(obj); + // + const filed = this.getPublickey(res); getQueryEentity({ token: getToken(), start: 1, @@ -229,10 +345,133 @@ }).then((response) => { if (response.code != 200) return; const items = response.data.items[0]; - - this.getQueryGeomExtent(items, tileset.layerId); + const obj_val = response.data.items.filter((rs) => { + if (rs.seid == "1_b810b88e1c7144bcb1c73eb6f45c3cf0") { + return rs; + } + }); + if (boolen) { + this.getQueryGeomExtent(obj_val[0], tileset.layerId); + } else { + this.getshowQueryExtentLabel(obj_val[0]); + } }); }, + getshowQueryExtentLabel(res) { + this.richTextPoint1 = earthCtrl.factory.createRichTextPoint( + res.ejfl, + [res.lon, res.lat], + { + fontColor: "#ffff00", + fontSize: 18 + }, + "0" + ); + const center = { lon: res.lon, lat: res.lat }; + const cities = [ + { + lon: 120.26923413, + lat: 14.7887635155 + }, + { + lon: 120.266906151, + lat: 14.799529948 + }, + { + lon: 120.267382051, + lat: 14.788105695 + }, + { + lon: 120.26710735, + lat: 14.7993756478 + }, + { + lon: 120.286842844, + lat: 14.7924281921 + }, + { + lon: 120.286923225, + + lat: 14.7933412456 + }, + { + lon: 120.266707102, + + lat: 14.7996392512 + }, + { + lon: 120.268701861, + + lat: 14.7886095373 + }, + { + lon: 120.270684963, + + lat: 14.7919831852 + }, + { + lon: 120.266265954, + + lat: 14.7999317012 + }, + { + lon: 120.269896499, + + lat: 14.7901043245 + }, + { + lon: 120.286600837, + + lat: 14.7926858017 + }, + { + lon: 120.286991515, + + lat: 14.7927451318 + }, + { + lon: 120.286760149, + + lat: 14.7930139536 + }, + { + lon: 120.28633835, + + lat: 14.7929774056 + }, + { + lon: 120.266684567, + + lat: 14.7877010021 + }, + { + lon: 120.283448259, + + lat: 14.7972858134 + }, + { + lon: 120.286503613, + + lat: 14.7932728306 + }, + { + lon: 120.286649886, + lat: 14.7935912152 + } + ]; + let pathOption = { + width: 3, //绾垮锛堝彲閫夛級 + color: "#00ffff", //绾块鑹诧紙鍙�夛級, + LightSpot: true, //鏄惁浣跨敤鍏夌偣鏁堟灉锛堝彲閫夛級 + LightSpotColor: "#ffffff" ,//鍏夌偣棰滆壊锛堝彲閫夛級 + height: 100 + }; + this.linePath = earthCtrl.factory.createTrailLinePath( + center, + cities, + pathOption + ); + }, getQueryGeomExtent(items, layerid) { var geom = mapConfig.setPointToCrical(items.lon, items.lat, 1); const token = getToken(); diff --git a/src/assets/js/map/mapView.js b/src/assets/js/map/mapView.js index 515ac66..d397003 100644 --- a/src/assets/js/map/mapView.js +++ b/src/assets/js/map/mapView.js @@ -21,7 +21,9 @@ Viewer.scene.globe.baseColor = Cesium.Color.fromCssColorString("#A9A9A9"); //璁剧疆鍦扮悆棰滆壊 // 娓呯┖榛樿搴曞浘 Viewer.imageryLayers.removeAll(); - + // earthCtrl.factory.createTerrainLayer({sourceType: "ctb", + // url: 'https://tiles1.geovisearth.com/base/v1/terrain?token=486dac3bec56d7d7c2a581c150be2bd937462f1e8f3bc9c78b5658b396122405' + // }); mapServer.addServer({ sourceType: "arcgis", url: "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" @@ -30,6 +32,7 @@ sourceType: "tms", url: "http://192.168.11.41:9001/gisserver/tmsserver/SubicBayArea" }); + modelLayer.init(); mapInfo.setEntityQueryInput(); // const url = layerJson.getQueryUrl("SubicBayAreaVector_wfs", "GeoEntity"); diff --git a/src/assets/js/map/modelLayer.js b/src/assets/js/map/modelLayer.js index f7063ab..93942e1 100644 --- a/src/assets/js/map/modelLayer.js +++ b/src/assets/js/map/modelLayer.js @@ -23,16 +23,15 @@ this.modelBase = config.modelBase; this.getSettingPublicKey(); const token = getToken(); - console.log("token", token); if (token) { this.getModelLayerList(); } else { getPublickey().then((response) => { const password = this.modelBase.password; const userId = this.modelBase.userId; - const publickey = response.data; + this.publickey = response.data; const encrypt = new JSEncrypt(); - encrypt.setPublicKey(publickey); + encrypt.setPublicKey(this.publickey); let encrypted = encrypt.encrypt(password.substring(0, 50)) + ""; let submit = { userid: userId, @@ -92,6 +91,53 @@ } }); }, + getQueryGroupBy(layer, filed, ction) { + const layerId = this.layers.filter((item) => { + if (item.name == layer) { + return item; + } + }); + if (layerId.length <= 0) { + return; + } + + const url = + config.modelBase.url + + config.modelBase.geo + + "/entitydbdata/query/entity"; + const obj = [ + { + type: "count", + field: filed, + outfield: "count_" + filed + } + ]; + axios + .post( + url, + { + layerid: layerId[0].id, + dbid: this.dbid, + token: getToken(), + statistics: JSON.stringify(obj), + containCount: true, + groupby: filed + }, + { + headers: { + Authorization: getToken(), + "Content-Type": "application/x-www-form-urlencoded" + } + } + ) + .then((response) => { + ction(response); + }) + .catch((error) => { + error; + }); + }, + setLayerQuery() { const token = getToken(); this.geom = mapConfig.setPointToCrical(120.27, 14.79, null); @@ -178,7 +224,6 @@ } ) .then((response) => { - console.log("List", response); that.setLayerFilter(response.data.data.items); }); }, @@ -193,7 +238,6 @@ const a = []; // rs.filter((item) => { // if (item.targettype == "鍐涗簨鐩爣") { - // console.log(item); // // a.push(["${id} === '" + item.sid + "'", "color('#FF0000', 0.5)"]); // } // }); @@ -204,7 +248,6 @@ 'color("purple", 0.5)' ]); a.push(["true", "color('#E8F1F2', 0.5)"]); - console.log(tileset); tileset.style = new Cesium.Cesium3DTileStyle({ // color: "vec4(1.0,1.0,1.0, 1.0)", // 绾㈣壊 color: { @@ -219,11 +262,9 @@ }); // window.Cesium.when(tileset.readyPromise, function(tileset) { // var tilesetId = tileset.id; - // console.log('Tileset ID: ' + tilesetId); // }); // tileset.readyPromise.then( (item)=> { // tileset.tileVisible.addEventListener( (tile)=> { - // console.log(tile); // }) // }) } diff --git a/src/assets/js/msg/msgData.js b/src/assets/js/msg/msgData.js index 6149c3a..277fc70 100644 --- a/src/assets/js/msg/msgData.js +++ b/src/assets/js/msg/msgData.js @@ -24,6 +24,16 @@ } ]); }, + getJsonToMdData(res){ + this.mine = true; + var url = config.imgUrl + aiData.aiRole_img; + return this.getMsg(url, [ + { + type: "markdown", + val: res + } + ]) + }, getRagData(res, more, msg) { return [ diff --git a/src/components/Chat/chatList.vue b/src/components/Chat/chatList.vue index cd22876..94fbd7b 100644 --- a/src/components/Chat/chatList.vue +++ b/src/components/Chat/chatList.vue @@ -1,10 +1,10 @@ <template> - <div class="body"> - <div :style="pageConfig.width | setWidth"> + <div class="body webBody"> + <div :class="$store.state.setScreenFlag ? 'webmainBox_Active' : 'webmainBox'"> <div class="web__main" ref="main"> <div class="web__main-item" v-for="(item, index) in list" :key="loding(index)" :class="{ 'web__main-item--mine': item.mine }"> - + <div class="web__main_content"> <div> <img :src="item.img" /> @@ -44,6 +44,9 @@ </div> <div v-else-if="res.type == 'loader'"> <span v-html="handleDetail(res.val)" ref="content"></span> + </div> + <div v-else-if="res.type == 'markdown'"> + <vue-markdown :source="res.val" class="newConcentLeft my-markdown"></vue-markdown> </div> <div style="margin-bottom:10px" v-else-if="res.type == 'rag'"> <div v-show="res.acction"> @@ -271,6 +274,19 @@ } </style> <style scoped> +.webBody { + display: flex; + justify-content: center; +} + +.webmainBox { + width: 50%; +} + +.webmainBox_Active { + width: 90%; +} + .web__main-item { position: relative; font-size: 0; @@ -278,6 +294,7 @@ /* padding-left: 60px; */ min-height: 68px; text-align: left; + } .web__main-user, @@ -544,6 +561,35 @@ /* 缁撴潫鏃嬭浆 div 鍏冪礌 */ } } + +.newConcentLeft { + margin: 16px; + font-family: PingFangSC, PingFang SC; + font-weight: 400; + font-size: 14px; + + line-height: 20px; + text-align: left; + font-style: normal; + white-space: pre-wrap; + word-wrap: break-word; + + + + +} + +.newConcentLeft img { + width: 75%; +} + +.newConcentLeft table { + width: 100%; +} + +.newConcentLeft pre { + white-space: normal; +} </style> diff --git a/src/components/Chat/enterBox.vue b/src/components/Chat/enterBox.vue index 9fe3c5a..1d7adea 100644 --- a/src/components/Chat/enterBox.vue +++ b/src/components/Chat/enterBox.vue @@ -76,6 +76,7 @@ overflow: hidden; height: 100%; display: flex; + margin-top: 20px; } .web_flex_input { flex: 1; diff --git a/src/components/Chat/index.vue b/src/components/Chat/index.vue index 1403e52..2e4aa88 100644 --- a/src/components/Chat/index.vue +++ b/src/components/Chat/index.vue @@ -5,7 +5,10 @@ </div> <div class="toolBox"> <!-- <tools :tools="toolConfig" class="tools" @emoji="bindEmoji" /> --> - <EnterBox @submit="enter" v-model="msg" /> + <div :class=" $store.state.setScreenFlag ? 'isActive' : 'Active' "> + <EnterBox @submit="enter" v-model="msg" /> + </div> + </div> </div> </template> @@ -114,18 +117,26 @@ .taleBox { height: calc(100% - 100px); + width: 100%; overflow: auto; overflow-x: hidden; padding-top: 15px; - padding-left: 10px; - padding-right: 10px; + } .toolBox { - height:60px; + height: 60px; width: 100%; + display: flex; + justify-content: center; /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04); */ } +.isActive{ + width: 90% !important; +} +.Active{ + width: 50% !important; +} </style> <style> .scroll-container { diff --git a/src/views/chartView/index.vue b/src/views/chartView/index.vue index f1909c2..2dc0934 100644 --- a/src/views/chartView/index.vue +++ b/src/views/chartView/index.vue @@ -12,11 +12,16 @@ import msgData from "../../assets/js/msg/msgData"; import store from "../../store"; import bus from "./../../assets/js/bus.js"; -import { getAIMessage, getV1Fastgpt } from "../../api/api.js"; +import { getAIMessage, getV1Fastgpt, getChartMessage } from "../../api/api.js"; +import { getQueryEentity } from "../../api/modelBase.js"; import mapInfo from "../../assets/js/map/mapInfo.js"; import axios from "axios"; import layerJson from "../../assets/js/map/mapJsonLayer.js"; import { factors } from "@turf/turf"; +import mapConfig from "../../assets/js/map/mapConfig.js"; +import { getToken } from "../../utils/auth.js"; +import modelLayer from "../../assets/js/map/modelLayer.js"; + export default { name: "jwChat", @@ -69,7 +74,16 @@ // this.setLoading(); setTimeout(() => { this.setMsgStart("鎮ㄥソ"); - }, config.loadTime); + }, 1000); + setTimeout(() => { + const obj = mapConfig.setJsonToMd([{ + h6: "璀﹀憡: 鑿插緥瀹捐嫃姣斿厠婀惧尯鍩熸娴嬪嚭寮傚父鍐涗簨鐩爣!" + }, { + p: "寮傚父浠e彿:4r5as5s001" + }]); + var roleMsg = msgData.getJsonToMdData(obj); + this.list.push(roleMsg) + }, 3000); bus.$on("mapInfo", (res) => { if (res) { // this.setMapInfo(res); @@ -93,6 +107,13 @@ // }); }, methods: { + getMd() { + const obj = mapConfig.setJsonToMd(); + const length = this.list.length - 1; + var roleMsg = msgData.getJsonToMdData(obj); + this.list[length].list = roleMsg.list + this.loading = false; + }, bindEnter() { const msg = this.inputMsg; @@ -104,14 +125,107 @@ setTimeout(() => { this.setMsgStart(msg); + + }, 200); }, + getQueryGroupBy(layer, filed) { + const layerId = modelLayer.layers.filter((item) => { + if (item.name == layer) { + return item; + } + }); + if (layerId.length <= 0) { + return; + } + const obj = [ + { + type: "count", + field: filed, + outfield: "count_" + filed + } + ]; + return { + layerid: layerId[0].id, + dbid: modelLayer.dbid, + token: getToken(), + statistics: JSON.stringify(obj), + containCount: true, + groupby: filed + } + + }, + async getQueryEentityGroupBy(res, filed) { + const data = await getQueryEentity(res); + const message = mapConfig.setScanList(data.data, filed) + + this.getMsg("ai", message); + }, + async getQueryEentityDescription(res) { + const std = []; + const str = []; + const data = await getQueryEentity({ + token: res.token, + start: 1, + count: 0, + containCount: true, + layerid: res.layerid, + dbid: res.dbid, + }); + const items = data.data.items; + + items.map(rs => { + var name = rs["weaponname"] + if (name) { + var boolen = true; + if (str.length == 0) { + boolen = true; + } else if (str.indexOf(name) > -1) { + boolen = false; + } else { + boolen = true; + } + if (boolen) { + const obj = mapConfig.setArrList(rs["descriptio"]) + for (var i in obj) { + std.push(obj[i]) + } + str.push(name) + } + } + }) + const jstomd = mapConfig.setJsonToMd(std) + const length = this.list.length - 1; + var roleMsg = msgData.getJsonToMdData(jstomd); + this.list[length].list = roleMsg.list + this.loading = false; + }, + async setMsgStart(res) { if (res.indexOf("鍐涗簨鐩爣") > -1 || res.indexOf("姘戝畢") > -1 || res.indexOf("缁忔祹鐩爣") > -1 || res.indexOf("娴峰啗闄嗘垬闃�") > -1 || res.indexOf("鍫や赴") > -1) { this.$store.state.setScreenFlag = true; this.list.splice(-1, 1); this.loading = false; layerJson.setQyeryData(res); + } else if (res.indexOf("markDown") > -1) { + setTimeout(() => { + this.getMd(); + }, 2000); + + } else if (res.indexOf("scanWeapon") > -1) { + this.setQueryMapPlan("scanWeapon") + } else if (res.indexOf("weaponParameters") > -1) { + this.setQueryMapPlan("weaponParameters") + } else if (res.indexOf("searchTarget") > -1) { + this.setQueryMapPlan("searchTarget") + } else if (res.indexOf("searchStrikeableTarget") > -1) { + this.setQueryMapPlan("searchStrikeableTarget") + } else if (res.indexOf("USAFCommandCenterQuery") > -1) { + this.setQueryMapPlan("USAFCommandCenterQuery") + } else if (res.indexOf("attackUSAFCommandCenter") > -1) { + this.setQueryMapPlan("attackUSAFCommandCenter") + } else if (res.indexOf("defenceRangeTyphoonSystem") > -1) { + this.setQueryMapPlan("defenceRangeTyphoonSystem") } // else if(res.indexOf("鑻忔瘮鍏嬫咕") > -1){ // this.$store.state.setScreenFlag = true; @@ -128,8 +242,8 @@ this.setV1Fastgpt(res) } else { const data = await getAIMessage(res); - - if (data.code == 200) { + + if (data.status == 200) { if (data.content) { this.getMsg("ai", data.content); } else { @@ -139,13 +253,85 @@ this.$store.state.setScreenFlag = true; this.$nextTick(() => { setTimeout(() => { - mapInfo.init(data.name); + this.setQueryMapPlan(data.name) + }, 1000); }); } } } }, + setQueryMapPlan(res) { + + if (this.$store.state.setScreenFlag == false) { + this.$store.state.setScreenFlag = true; + } + layerJson.setTitleSetRest(); + mapInfo.setEntityQueryInput(); + switch (res) { + case "scanWeapon": + + mapInfo.setFlyTo({ + "longitude": 120.26907736668211, + "latitude": 14.791708841800627, + "height": 1371.1909347746105 + }); + var obj = this.getQueryGroupBy("姝﹀櫒", "weaponname") + this.getQueryEentityGroupBy(obj, "weaponname") + layerJson.setAddWfsLayer(); + + break; + case "weaponParameters": + var obj = this.getQueryGroupBy("姝﹀櫒", "description") + this.getQueryEentityDescription(obj) + break; + case "searchTarget": + var obj = this.getQueryGroupBy("寤虹瓚", "targettype") + this.getQueryEentityGroupBy(obj, "targettype") + var list = [{ + name: "鍐涗簨鐩爣", + color: "#409EFF" + }, { + name: "姘戝畢", + color: "#808080" + }, { + name: "缁忔祹鐩爣", + color: "#FFFF00" + } + ] + layerJson.setQueryByFiledList(list, 0) + break; + case "searchStrikeableTarget": + var obj = "strikeable = 'TRUE'" + ""; + layerJson.setQueryByFiled(obj, "#FF0000", false) + this.getMsg("ai", "鐩稿叧淇℃伅宸插湪鍦板浘妯″潡灞曠ず"); + break; + case "USAFCommandCenterQuery": + var obj = "ejfl like '%绌哄啗鍩哄湴%'"; + layerJson.setQueryExtent2(obj, false) + this.getMsg("ai", "鐩稿叧淇℃伅宸插湪鍦板浘妯″潡灞曠ず"); + break; + case "attackUSAFCommandCenter": + var obj = "ejfl like '%绌哄啗鍩哄湴%'"; + layerJson.setQueryExtent2(obj, true) + this.getMsg("ai", "鐩稿叧淇℃伅宸插湪鍦板浘妯″潡灞曠ず"); + break; + case "defenceRangeTyphoonSystem": + var obj = "weaponname like '%" + name + "%'" + ""; + layerJson.setQueryTF2(obj) + this.getMsg("ai", "鐩稿叧淇℃伅宸插湪鍦板浘妯″潡灞曠ず"); + break; + + default: + mapInfo.init(res); + break; + } + }, + + + + + setRagMoreList(res) { const obj = this.$store.state.ragList const val_data = obj.filter(item => { @@ -196,8 +382,9 @@ }, async setV1Fastgpt(res) { const data = await getV1Fastgpt(res); - + const length = this.list.length - 1; + const obj = data[0].quoteList this.$store.state.ragList.push({ quest: res, @@ -223,13 +410,13 @@ }, getMsg(type, msg) { var roleMsg = msgData.getRole(type, msg); - + if (this.loading) { this.loading = false; - + this.list[this.list.length - 1].list = roleMsg.msg.list; } else { this.list.push(roleMsg.msg); diff --git a/src/views/homePage/index.vue b/src/views/homePage/index.vue index 0b0cd92..fc201a3 100644 --- a/src/views/homePage/index.vue +++ b/src/views/homePage/index.vue @@ -65,14 +65,15 @@ .chartContent .chartBox { flex: 1; display: flex; - justify-content: center; + + /* justify-content: center; */ /* height: (100% - 38px); */ } .leftContent { - width: 40%; + width: 100%; height: 100%; transition: 1s ease-out; display: flex; -- Gitblit v1.9.3