yxl
2025-01-02 c0ff61d066a9f65aa0cdbeb1e10a249763f1e966
最新代码提交
已添加1个文件
已修改8个文件
380 ■■■■■ 文件已修改
public/config/config.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/gltf/tank.glb 补丁 | 查看 | 原始文档 | blame | 历史
src/App.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/api.js 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/map/mapServer.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/map/mapView.js 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/mapSetFunc.js 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/chartView/index.vue 184 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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",
public/gltf/tank.glb
Binary files differ
src/App.vue
@@ -70,4 +70,8 @@
  height: calc(100% - 36px) !important;
  padding: 0px !important;
}
.map-info-bar{
  display: block !important;
}
</style>
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){
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) => {
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;
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) {
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连接成功");
        //定时任务,由于使用nginx反向代理,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>
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': ''
        }
      },
    },
  },