yxl
2025-01-20 7c24257d14c8a773aef0586c0195642c15246038
src/views/chartView/index.vue
@@ -50,6 +50,7 @@
        dept: "最简单、最便捷",
        callback: this.bindCover,
      },
      closeMap: false,
    };
  },
  computed: {
@@ -130,7 +131,7 @@
        // console.log('Received message:', event.data);
        console.log(event);
        if (event.data != "连接成功") {
        if (event.data != "连接成功" || event.data != "收到消息,消息内容:心跳包检测") {
          console.log(event.data);
          const val = JSON.parse(event.data);
          if (val.session_id == this.uuid) {
@@ -201,19 +202,52 @@
      }
    },
    async setMsgStart(res) {
      console.log("res----", res);
      //输入@map打开地图
      if (res == "@map") {
        var rolMsg = [
          {
            type: "text",
            val: "地图已打开",
          },
        ];
        this.refashMsg(rolMsg);
        //打开地图
        this.$store.state.setScreenFlag = true;
        this.closeMap = true;
        earthCtrl.viewer.camera.flyTo({
          destination: {
            x: -1803769.3854512463,
            y: 29158371.286777183,
            z: 13465105.223495383,
          },
          orientation: {
            heading: 6.283185307179586,
            pitch: -1.5707963267948966,
            roll: 0,
          },
        });
      }
      //有map关键字定位
      else if (res.indexOf("@map") > -1) {
        this.closeMap = true;
        window.earthCtrl.camera.flyTo(
          121.5898036178841,
          23.93799083591751,
          2732.163687177577,
          4.501790216143808,
          -32.230361363631324,
          0.001313831409284339,
          2
        );
      } else {
        //关闭地图
        // this.$store.state.setScreenFlag = false;
      }
      mapImg.removeInit();
      mapSetFunc.removeAll();
      this.$store.state.setListColor = [];
      this.$store.state.showLenged = false;
      window.earthCtrl.camera.flyTo(
        121.5898036178841,
        23.93799083591751,
        2732.163687177577,
        4.501790216143808,
        -32.230361363631324,
        0.001313831409284339,
        2
      );
      // const formData = new FormData();
      // formData.append("message", res);
@@ -244,27 +278,60 @@
      });
    },
    async setAgentIntention(obj, formData) {
      getAgentIntention(formData).then((response) => {
        if (response.code != 200) {
      console.log("obj", formData);
      getAgentIntention(formData)
        .then((response) => {
          if (response.code != 200) {
            if (formData.message != "@map") {
              var rolMsg = [
                {
                  type: "text",
                  val: "未查询到相关信息。",
                },
              ];
              this.refashMsg(rolMsg);
            }
            return;
          }
          const type = response.type;
          //普通对话信息查询
          if (type == "message") {
            //关闭地图
            if (!this.closeMap) {
              this.$store.state.setScreenFlag = false;
            }
            var rolMsg = [
              {
                type: "text",
                val: response.msg,
              },
            ];
            this.refashMsg(rolMsg);
          }
          //地图查询
          else {
            //打开地图
            this.$store.state.setScreenFlag = true;
            this.setMapfunc(response.content, obj);
          }
          // if (type == "Map") {
          //   this.setMapfunc(response.content, obj);
          // } else if (type == "Rag") {
          //   this.setMapRag(response, obj);
          // } else {
          //   // this.setMapfunc(response.content, obj);
          // }
        })
        .catch((error) => {
          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);
        }
      });
        });
    },
    setMapfunc(res, obj) {
      this.$store.state.showLenged = false;
@@ -366,6 +433,47 @@
          };
          mapSetFunc.init(finalData);
          break;
        case "getStrike":
          let dataList1 = [
            {
              type: "可打击目标",
              color: "#FF3366",
              list: [],
            },
            {
              type: "不可打击目标",
              color: "#33FF66",
              list: [],
            },
            {
              type: "其他",
              color: "#3366FF",
              list: [],
            },
          ];
          res.data.forEach((item) => {
            if (item.ifstrike === "1") {
              dataList1[0].list.push(item.uuid);
            } else if (item.ifstrike === "2") {
              dataList1[1].list.push(item.uuid);
            } else {
              dataList1[2].list.push(item.uuid);
            }
          });
          const resultData1 = dataList1
            .map((item) => `| ${item.type} | ${item.list.length} |`)
            .join("\n");
          var a = `| 数据类型 | 数据量 |\n|------|------|\n` + resultData1;
          console.log("aaa", a);
          this.setUpdateHistoryInFor(obj, a);
          var roleMsg = msgData.getMdData("markdown", a);
          this.refashMsg(roleMsg.list);
          const finalData1 = {
            func: "aroundPoi",
            data: dataList1,
          };
          mapSetFunc.init(finalData1);
          break;
        case "getParam":
          mapSetFunc.init(res);
          console.log("res.data.targetinfo", res);
@@ -396,13 +504,13 @@
          this.setUpdateHistoryInFor(obj, res.msg);
          this.refashMsg(roleMsg.list);
          break;
        default:
          this.setUpdateHistoryInFor(obj, res.msg);
          var roleMsg1 = msgData.getAffairsData([
            { type: "text", val: res.msg },
          ]);
          this.refashMsg(roleMsg1.list);
          break;
        // default:
        //   this.setUpdateHistoryInFor(obj, res.msg);
        //   var roleMsg1 = msgData.getAffairsData([
        //     { type: "text", val: res.msg },
        //   ]);
        //   this.refashMsg(roleMsg1.list);
        //   break;
      }
    },
    setUpdateHistoryInFor(obj, message) {