瀏覽代碼

Merge branch 'master' of http://114.244.114.158:8802/siwei/real3d-portalsite

服务器 10 月之前
父節點
當前提交
995980b133

+ 10 - 3
src/api/aiModel.js

@@ -1,8 +1,8 @@
-export function GetMsg(msg) {
+export function GetMsg(data) {
     return axios({
         method: "POST",
         url: `${window.aiURI}/msg`,
-        data: JSON.stringify({ msg }),
+        data: JSON.stringify(data),
         headers: {
             "Content-Type": "application/json",
         },
@@ -17,4 +17,11 @@ export function uploadAudio(data) {
             "Content-Type": "application/json",
         },
     })
-}
+}
+export function closeMsg() {
+    return axios({
+        method: "DELETE",
+        url: `${window.aiURI}/closeMsg`,
+
+    })
+}

+ 8 - 9
src/components/TerrainAnalysis/TerrainCutFillAnalysis/TerrainCutFillAnalysisNew.vue

@@ -19,21 +19,17 @@
       <el-form-item label="分析范围:" prop="xzmj">
         <range type="cutfill" :keys="['hx', 'sc']" class="range" ref="range" />
       </el-form-item>
-      <el-form-item label="开挖高程:" v-if="radio == 'cut'">
+      <el-form-item label="填挖基准:" v-if="radio == 'cut'">
         <!-- readonly="readonly" -->
-        <el-input
-          v-model="smooth_height"
-          placeholder="深度为空时为平整土地"
-          size="mini"
-        ></el-input>
+        <el-input v-model="smooth_height" placeholder="" size="mini"></el-input>
       </el-form-item>
-      <div v-if="cutData.fillVolume" class="sdatadiv">
+      <div class="sdatadiv">
         分析结果:
         <p v-for="(sitem, index) in sdata" :key="index">
           <!-- <img src="/static/images/ghzc/iconSun.png" .toFixed(2) /> -->
           <span class="ptitle">{{ sitem.name }}</span>
           <span class="pvalue">
-            {{ cutData[sitem.prop] }}{{ sitem.unit }}
+            {{ cutData[sitem.prop] || 0 }}{{ sitem.unit }}
           </span>
         </p>
       </div>
@@ -130,6 +126,7 @@ export default {
       });
       if (res.success) {
         this.$refs.range.reset();
+        if (!res.data) this.$message.error("抱歉!不在分析范围内");
         this.cutData = res.data;
 
         Object.keys(this.cutData).forEach((key) => {
@@ -245,19 +242,21 @@ export default {
 <style lang="scss" scoped>
 .cut_fill_box {
   width: 100%;
-  height: 500px;
+  height: 580px;
   padding: 20px;
   box-sizing: border-box;
   position: relative;
   .ruleForm {
     width: 100%;
     height: calc(100% - 120px);
+    overflow-y: auto;
   }
   .el-form-item {
     margin-bottom: 0px !important;
   }
   .range {
     width: 90% !important;
+    text-align: left;
   }
   .sdatadiv {
     text-align: left;

+ 1 - 5
src/components/mapView/range.vue

@@ -20,7 +20,7 @@
         <el-button size="mini" @click="clearAll">清除</el-button>
       </div>
     </div>
-    <div v-if="type != 'cutfill'">
+    <div>
       <span v-if="model.xzmj != 0">{{ model.xzmj }} 亩</span>
       <el-tooltip
         v-if="fileList.length > 0"
@@ -267,10 +267,6 @@ export default {
           // var parse = require("wellknown"); //引入wellknow
           const wktPolygon = parse.stringify(geojsonPolygon);
           // console.log("WKT Polygon:", wktPolygon);
-          if (this.$props.type == "cutfill") {
-            this.model.geom = wktPolygon;
-            return;
-          }
 
           const formdata = new FormData();
           // formdata.append("file", file.raw);

+ 74 - 18
src/views/aiModel/index.vue

@@ -2,9 +2,10 @@
   <div class="counsel-container">
     <div class="counsel-header">
       <span>会话<i class="ai el-icon-chat-dot-round"></i></span>
+      <i class="el-icon-close cursor" @click="closeMsg"></i>
     </div>
-    <div class="counsel-chats" ref="scrollContainer" @scroll="handleScroll">
-      <div class="counsel-left flex">
+    <div class="counsel-chats" ref="scrollRef">
+      <div class="counsel-left flex" v-if="nowType == 'selectLand'">
         <div class="header-img">
           <img src="/static/images/aiModel/kefu.png" />
         </div>
@@ -13,7 +14,7 @@
           <span class="high" @click="sendDefault">{{ defaultMsg }}</span>
         </div>
       </div>
-      <!--右侧-->
+      <!--会话内容-->
       <div v-for="(item, index) in questionList" :key="index">
         <!--右侧-->
         <div class="counsel-right flex" v-if="item.type == 0">
@@ -53,7 +54,18 @@
         </div>
       </div>
     </div>
-
+    <div class="consel-types">
+      <div
+        v-for="(titem, i) in types"
+        :key="i"
+        class="typeitem cursor"
+        :class="{ heigType: nowType == titem.value }"
+        @click="nowType = titem.value"
+      >
+        <i :class="titem.icon"></i>
+        {{ titem.label }}
+      </div>
+    </div>
     <div class="voice" v-if="spdisabled">
       <div>正在识别</div>
       <div class="noise"></div>
@@ -85,7 +97,7 @@
 </template>
 <script>
 import { AddFzxz } from "../../api/ghss/ghxz.js";
-import { GetMsg, uploadAudio } from "../../api/aiModel.js";
+import { GetMsg, uploadAudio, closeMsg } from "../../api/aiModel.js";
 import record from "./record.js";
 let recognition = null;
 export default {
@@ -97,10 +109,16 @@ export default {
         "我要在抱坡区进行选址,用地面积30到50亩,选择居住用地,距离幼儿园200米,距离医院300米,距离火葬场大于5000米",
       sendContent: "",
       spdisabled: false,
+      nowType: "selectLand",
+      types: [
+        { label: "智能选址", value: "selectLand", icon: "el-icon-s-home" },
+        { label: "知识问答", value: "answer", icon: "el-icon-chat-line-round" },
+      ],
     };
   },
   created() {},
   mounted() {},
+
   methods: {
     initSpeech() {
       // 检查浏览器是否支持SpeechRecognition
@@ -205,7 +223,7 @@ export default {
     },
     sendToBackend(msg, mindex) {
       this.questionList[mindex].mstatus = 0;
-      GetMsg(msg)
+      GetMsg({ msg, type: this.nowType })
         .then((mres) => {
           if (mres.status == 200) {
             this.questionList[mindex].mstatus = 2;
@@ -213,6 +231,8 @@ export default {
               if (mres.data.type == "selectLand") {
                 this.questionList.push({ content: "分析中...请稍等" });
                 this.AddFzxz(mres.data.data, mres.data.type);
+              } else {
+                this.questionList.push({ content: mres.data.data });
               }
             } else {
               this.questionList.push({
@@ -264,22 +284,29 @@ export default {
         this.$emit("close");
       }
     },
-    handleScroll(event) {
-      const { scrollTop, scrollHeight, clientHeight } = event.target;
-      // 检查是否滚动到底部
-      if (scrollTop + clientHeight >= scrollHeight) {
-        // 滚动到最底部时的逻辑处理
-        console.log("已滚动到最底部");
-      }
+    closeMsg() {
+      this.$emit("close");
+      closeMsg().then((ares) => {
+        if (ares.status == 200) {
+          this.questionList[mindex].content = ares.data.voiceMsg;
+          this.sendToBackend(ares.data.voiceMsg, mindex);
+        } else {
+          this.$message.error(ares.data.msg);
+        }
+      });
     },
-    scrollToBottom() {
-      this.$refs.scroll.scrollTop = this.$refs.scroll.scrollHeight;
+  },
+  watch: {
+    questionList() {
+      this.$nextTick(() => {
+        this.$refs.scrollRef.scrollTop = this.$refs.scrollRef.scrollHeight;
+      });
     },
   },
 };
 </script>
 
-<style lang="less" scoped>
+<style lang="scss" scoped>
 .flex {
   display: flex;
 }
@@ -293,10 +320,12 @@ export default {
   .counsel-header {
     display: flex;
     align-items: center;
-    padding: 20px;
+    padding: 10px 20px;
     font-size: 16px;
     color: #fff;
     border-bottom: 1px solid #1f4099;
+    margin-bottom: 10px;
+    position: relative;
   }
 
   .time {
@@ -308,7 +337,7 @@ export default {
   }
 
   .counsel-chats {
-    height: calc(100% - 150px);
+    height: calc(100% - 190px);
     overflow-x: hidden;
     overflow-y: auto;
     .header-img {
@@ -382,6 +411,22 @@ export default {
     // color: #fff;
   }
 }
+.consel-types {
+  position: absolute;
+  bottom: 100px;
+  width: calc(100% - 20px);
+  display: flex;
+  .typeitem {
+    border: 1px solid #ffffff;
+    border-radius: 8px;
+    padding: 5px 10px;
+    margin-right: 20px;
+  }
+  .heigType {
+    border-color: #f0c472;
+    color: #f0c472;
+  }
+}
 .voice {
   width: 75%;
   // height: 100px;
@@ -429,4 +474,15 @@ export default {
     color: #0f7ac8;
   }
 }
+/deep/ .el-icon-close:before {
+  position: absolute;
+  top: 10px;
+  right: 10px;
+  font-size: larger;
+  font-weight: bold;
+
+  &:hover {
+    color: aqua;
+  }
+}
 </style>