Browse Source

智能选址前端

liutao 2 months ago
parent
commit
cc7d2e8834

+ 216 - 36
web_ui/src/views/industrial-land/AiIndustriaLandDetail.vue

@@ -80,7 +80,7 @@
             />
           </div>
 
-          <div class="layer-legend" >
+          <div class="layer-legend">
             <div v-for="(item, index) in legend" :key="index" class="item">
               <div class="label" :class="{ c: item.children }">
                 <i
@@ -94,14 +94,14 @@
                 :key="index"
                 class="zl"
               >
-              <img v-if="item.type=='img'" :src="citem.imgSrc"> 
-               <i v-else
+                <img v-if="item.type == 'img'" :src="citem.imgSrc" />
+                <i
+                  v-else
                   :style="{
                     background: citem.fill == 'transparent' ? '' : citem.fill,
                     borderColor: citem.border,
                   }"
-                ></i
-                >
+                ></i>
                 {{ citem.name }}&nbsp;&nbsp;&nbsp;
               </div>
             </div>
@@ -115,22 +115,48 @@
             <div class="content_box">
               <div class="one_box">
                 <div>智选未来,慧定乾坤</div>
-                <div class="desc">你好,我是你的AI智能选址助手,我可以根据你的指令帮你推荐想要的地块。</div>
+                <div class="desc">
+                  你好,我是你的AI智能选址助手,我可以根据你的指令帮你推荐想要的地块。
+                </div>
               </div>
               <div class="two_box">
                 <p class="title">你可以试着这样问我:</p>
                 <ul>
-                  <li @click="hotQuestionReset('请帮我在杭州市萧山机场附近推荐几块总价不超过2000万的工业用地')">
+                  <li
+                    @click="
+                      hotQuestionReset(
+                        '请帮我在杭州市萧山机场附近推荐几块总价不超过2000万的工业用地'
+                      )
+                    "
+                  >
                     <span class="icon"></span>
-                    <span class="desc">请帮我在杭州市萧山机场附近推荐几块总价不超过2000万的工业用地</span>
+                    <span class="desc"
+                      >请帮我在杭州市萧山机场附近推荐几块总价不超过2000万的工业用地</span
+                    >
                   </li>
-                  <li @click="hotQuestionReset('帮我在杭州市西湖区找几块面积35亩左右,人口相对密集的工业用地')">
+                  <li
+                    @click="
+                      hotQuestionReset(
+                        '帮我在杭州市西湖区找几块面积35亩左右,人口相对密集的工业用地'
+                      )
+                    "
+                  >
                     <span class="icon"></span>
-                    <span class="desc">帮我在杭州市西湖区找几块面积35亩左右,人口相对密集的工业用地</span>
+                    <span class="desc"
+                      >帮我在杭州市西湖区找几块面积35亩左右,人口相对密集的工业用地</span
+                    >
                   </li>
-                  <li @click="hotQuestionReset('请帮我杭州市找几块在开发区内,园区主导产业为新能源的工业用地')">
+                  <li
+                    @click="
+                      hotQuestionReset(
+                        '请帮我杭州市找几块在开发区内,园区主导产业为新能源的工业用地'
+                      )
+                    "
+                  >
                     <span class="icon"></span>
-                    <span class="desc">请帮我杭州市找几块在开发区内,园区主导产业为新能源的工业用地</span>
+                    <span class="desc"
+                      >请帮我杭州市找几块在开发区内,园区主导产业为新能源的工业用地</span
+                    >
                   </li>
                 </ul>
               </div>
@@ -257,11 +283,7 @@
                         </p>
                         <p>
                           <span>位置周边:</span>
-                          <span
-                            >该地块位于工业区内,距离机场(萧山国际机场)
-                            4.4km,距高速出入口(萧山南)1.5km,距高铁站(杭州南)
-                            2.8km。</span
-                          >
+                          <span>{{ citem.wzxx }}</span>
                         </p>
                       </div>
                     </div>
@@ -509,8 +531,7 @@ export default {
       showIndentify: false,
       detailData: null,
       cyyqLayer: null,
-      legend: [
-      ],
+      legend: [],
       mockInterval: null,
     };
   },
@@ -544,6 +565,7 @@ export default {
       // //     id: 40175,
       // //   },
       // // ];
+      // let that = this;
       // this.getDetailByIdList(this.xgdk, (data) => {
       //   this.xgdk = data;
       // });
@@ -707,8 +729,12 @@ export default {
       }
       this.hotQuestionReset(this.inputText);
     },
-    hotQuestionReset (text = '') {
-      this.inputText = text
+    hotQuestionReset(text = "") {
+      if (this.dSource === "3") {
+        this.$Message.error("暂无数据,请选择其他数据源!");
+        return;
+      }
+      this.inputText = text;
       if (this.inputText == "" || this.inputText == null) {
         this.$Message.info("请输入");
         return;
@@ -835,7 +861,7 @@ export default {
           if (!find) {
             this.legend.push({
               name: item.name,
-              type:item.legend.type,
+              type: item.legend.type,
               children: item.legend.children,
             });
           }
@@ -1124,6 +1150,7 @@ export default {
     },
     getDetailByIdList(idList, func) {
       let layerName = null;
+      let that = this;
       //公告地块
       if (this.dSource == "2") {
         layerName = "ecgap_klyzy";
@@ -1135,8 +1162,10 @@ export default {
               name: ele.dkmc,
               tdyt: ele.tdyt,
               dkmj: ele.dkmj.toFixed(2),
+              center_wkt: ele.center_wkt,
             };
           });
+
           func(result);
         });
       } else if (this.dSource == "1") {
@@ -1145,17 +1174,162 @@ export default {
         idList = idList.map((ele) => ele.objectid);
         this.kgQuery(idList, (res) => {
           let result = res.map((ele) => {
-            return {
+            let viewObj = {
               id: ele.objectid,
               name: ele.ydxz,
               tdyt: `${ele.ydxz}(${ele.yddm})`,
               dkmj: (ele.pfmarea * 0.0015).toFixed(2),
+              center_wkt: ele.center_wkt,
             };
+            let geojson = wkt.parse(ele.center_wkt);
+            // that.getGyydWzxx(geojson.coordinates, viewObj);
+            // that.getNoGyydWzxx(geojson.coordinates, viewObj);
+            return viewObj;
           });
           func(result);
         });
       }
     },
+    getGyydWzxx(point, viewObj) {
+      console.log("getGyydWzxx");
+      let unit = 5000;
+      let that = this;
+      let gsPromiseList = this.sendQueryList(
+        ["高速入口", "高速出口", "互通"],
+        unit,
+        point
+      );
+      let tlPromiseList = this.sendQueryList(["高铁"], unit, point);
+      let gkPromiseList = this.sendQueryList(["港口"], unit, point);
+      let jcPromiseList = this.sendQueryList(["机场"], unit, point);
+      let gjPromiseList = this.sendQueryList(["公交站"], unit, point);
+      let addressMsgList = [];
+      Promise.all(gsPromiseList).then(function (posts) {
+        let gsResult = that.handlePromise(posts, "高速");
+        addressMsgList.push(gsResult);
+        Promise.all(tlPromiseList).then(function (posts) {
+          let tlResult = that.handlePromise(posts, "高铁站");
+          addressMsgList.push(tlResult);
+          Promise.all(gkPromiseList).then(function (posts) {
+            let gkResult = that.handlePromise(posts, "港口");
+            addressMsgList.push(gkResult);
+            Promise.all(gjPromiseList).then(function (posts) {
+              let gjResult = that.handlePromise(posts, "公交站");
+              addressMsgList.push(gjResult);
+              Promise.all(jcPromiseList).then(function (posts) {
+                let jcResult = that.handlePromise(posts, "机场");
+                addressMsgList.push(jcResult);
+                let msgList = addressMsgList.filter((item) => item != null);
+                let resultMsg = msgList.join(",");
+                console.log("resultMsg:" + resultMsg);
+                viewObj.wzxx = resultMsg;
+              });
+            });
+          });
+        });
+      });
+    },
+    getNoGyydWzxx(point, viewObj) {
+      console.log("getNoGyydWzxx");
+      let unit = 5000;
+      let that = this;
+      let yyPromiseList = this.sendQueryList(
+        ["医院", "诊所", "卫生"],
+        unit,
+        point
+      );
+      let xxPromiseList = this.sendQueryList(
+        ["小学", "中学", "高中", "学校"],
+        unit,
+        point
+      );
+      let scPromiseList = this.sendQueryList(
+        ["商场", "购物", "超市"],
+        unit,
+        point
+      );
+      let ydPromiseList = this.sendQueryList(["药店", "医药"], unit, point);
+      let cyPromiseList = this.sendQueryList(
+        ["餐饮", "快餐", "中餐"],
+        unit,
+        point
+      );
+      let addressMsgList = [];
+      Promise.all(yyPromiseList).then(function (posts) {
+        let gsResult = that.handlePromise(posts, "医院");
+        addressMsgList.push(gsResult);
+        Promise.all(xxPromiseList).then(function (posts) {
+          let tlResult = that.handlePromise(posts, "学校");
+          addressMsgList.push(tlResult);
+          Promise.all(scPromiseList).then(function (posts) {
+            let gkResult = that.handlePromise(posts, "商场");
+            addressMsgList.push(gkResult);
+            Promise.all(ydPromiseList).then(function (posts) {
+              let jcResult = that.handlePromise(posts, "药店");
+              addressMsgList.push(jcResult);
+              let msgList = addressMsgList.filter((item) => item != null);
+              let resultMsg = msgList.join(",");
+              console.log("resultMsg:" + resultMsg);
+              viewObj.wzxx = resultMsg;
+            });
+          });
+        });
+      });
+    },
+    sendQueryList(queryList, unit, markercenter) {
+      const [lng, lat] = markercenter;
+      const url = "https://api.tianditu.gov.cn/v2/search";
+      const promiseList = [];
+      for (let i = 0; i < queryList.length; i++) {
+        const params = {
+          postStr: {
+            keyWord: queryList[i],
+            level: 12,
+            queryRadius: unit,
+            pointLonlat: lng + "," + lat,
+            queryType: 3,
+          },
+          type: "query",
+          tk: "3b2d9954565a494ffab9cfd26d7fc522",
+        };
+
+        const queryPromise = axios.get(url, {
+          withCredentials: false,
+          params: params,
+        });
+        promiseList.push(queryPromise);
+      }
+      return promiseList;
+    },
+    handlePromise(posts, type) {
+      const featureResultsList = [];
+      for (let i = 0; i < posts.length; i++) {
+        if (posts[i].data.count != "0") {
+          const tempresults = posts[i].data.pois;
+          for (let i = 0; i < tempresults.length; i++) {
+            let titem = tempresults[i];
+            const lnglat = titem.lonlat;
+            const lng = lnglat.split(",")[0];
+            const lat = lnglat.split(",")[1];
+            titem.location = { lng: lng, lat: lat };
+            featureResultsList.push(titem);
+          }
+        }
+      }
+      if (featureResultsList.length == 0) {
+        return null;
+      }
+      featureResultsList.sort((a, b) => {
+        const distance =
+          parseFloat(a.distance) *
+          (String(a.distance).indexOf("k") > -1 ? 1000 : 1);
+        const distance1 =
+          parseFloat(b.distance) *
+          (String(b.distance).indexOf("k") > -1 ? 1000 : 1);
+        return distance - distance1;
+      });
+      return `距${type}(${featureResultsList[0].name})${featureResultsList[0].distance}`;
+    },
     locationByGeojson(geojson, name) {
       if (this.cyyqLayer) {
         this.map.removeLayer(this.cyyqLayer);
@@ -1754,7 +1928,7 @@ export default {
 
                   T.getDetailByIdList(dk, (data) => {
                     T.clearMark();
-                    T.addGdLayer(data);
+                    // T.addGdLayer(data);
                     T.xgdk = data;
                     T.showXgdkCenterPoint();
                   });
@@ -2065,11 +2239,11 @@ export default {
         padding: 20px;
         display: flex;
         flex-direction: column;
-        >.box {
+        > .box {
           flex: 1;
           display: flex;
           align-items: flex-start;
-          >div {
+          > div {
             &.summary-icon {
               width: 38px;
               height: 38px;
@@ -2078,42 +2252,48 @@ export default {
               border-radius: 50%;
               margin-right: 5px;
               flex-shrink: 0;
-              >img {
+              > img {
                 width: 100%;
                 height: 100%;
               }
             }
             &.content_box {
-              >div {
+              > div {
                 &.one_box {
-                  >div {
+                  > div {
                     &:first-child {
                       font-size: 30px;
                       font-weight: bold;
                       color: transparent;
-                      background: linear-gradient( 270deg, #2E3CF5 0%, #2E74F8 47%, #258FF8 100%);
+                      background: linear-gradient(
+                        270deg,
+                        #2e3cf5 0%,
+                        #2e74f8 47%,
+                        #258ff8 100%
+                      );
                       -webkit-background-clip: text;
                     }
                   }
                 }
                 &.two_box {
-                  >.title {
+                  > .title {
                     margin: 10px 0px;
                   }
-                  >ul {
+                  > ul {
                     list-style: none;
-                    >li {
+                    > li {
                       padding: 15px;
                       margin-bottom: 10px;
-                      background: #F5F9FF;
+                      background: #f5f9ff;
                       border-radius: 6px 6px 6px 6px;
                       display: flex;
                       align-items: flex-start;
                       cursor: pointer;
-                      >span {
+                      > span {
                         &.icon {
                           display: block;
-                          background: url(~@/assets/image/staticImage/location_light.png) no-repeat;
+                          background: url(~@/assets/image/staticImage/location_light.png)
+                            no-repeat;
                           background-size: 70% 70%;
                           background-position: center;
                           width: 28px;

+ 2 - 29
web_ui/src/views/industrial-land/ZnxzDetail.vue

@@ -405,6 +405,7 @@
 import landMethods from "@/api/land";
 import { getMilliSeconds } from "@/util/date";
 import axios from "axios";
+import { distance } from "@turf/turf";
 export default {
   components: {},
   props: {
@@ -1477,6 +1478,7 @@ export default {
       });
     },
 
+
     getDataFromTianditu(name, targetList) {
       let query = { title: name };
       let text = [query.title];
@@ -1520,7 +1522,6 @@ export default {
           break;
       }
       let promiseList = this.sendQueryList(text, unit, this.markercenter);
-      console.log(promiseList);
       Promise.all(promiseList).then(function (posts) {
         const featureResultsList = [];
         let tindex = 0;
@@ -1565,33 +1566,6 @@ export default {
       });
     },
 
-    aaa(wkt) {
-      wkt =
-        "POLYGON((119.84164207 28.94396709,119.84145319 28.94408398,119.8405613 28.94469764,119.84047893 28.94472,119.8397249 28.94385862,119.83971844 28.94385124,119.83963416 28.94375317,119.83940952 28.94349834,119.83940318 28.94349109,119.83936822 28.94345082,119.84042896 28.94273167,119.83963696 28.94182755,119.83974238 28.9417985,119.84164207 28.94396709))";
-      console.log(wkt);
-      const url = window.ApplicationConfig.geoserverUrl;
-      const typeName =
-        window.ApplicationConfig.layerTreeConfig[2].layers[0].layername;
-      let cqlFilter = `INTERSECTS(shape,${wkt})`;
-      let parmas = {
-        service: "WFS",
-        version: "1.0",
-        request: "GetFeature",
-        typeName: typeName,
-        maxFeatures: 50,
-        outputFormat: "application/json",
-        cql_filter: cqlFilter,
-      };
-      axios.get(url, { params: parmas }).then((d) => {
-        if (d && d.data && d.data.features) {
-          let features = d.data.features;
-          features.forEach((f) => {
-            console.log(f);
-          });
-        }
-      });
-    },
-
     initXzfx(wktStr) {
       this.xzfxList[0].value = 0;
       this.xzfxList[1].value = 0;
@@ -1688,7 +1662,6 @@ export default {
       });
     },
     analysis() {
-      // this.aaa(this.item.geom);
       this.initXzfx(this.item.geom);
       this.initGhfx(this.item.geom);
       this.initSqsx(this.item.geom);

+ 3 - 3
web_ui/src/views/znzt-land/AiZtzsDetail.vue

@@ -106,7 +106,7 @@
               autofocus=""
             >
             </textarea>
-            <AIBtn @send="hotQuestionReset()" />
+            <AIBtn @send="hotQuestionReset(inputText)" />
           </div>
         </div>
         <vue-perfect-scrollbar
@@ -611,7 +611,7 @@ export default {
       // // this.hzData.push(item);
       // this.toggleTab(0);
       this.inputText = this.input;
-      this.hotQuestionReset();
+      this.hotQuestionReset(this.inputText);
     },
     hotQuestionReset (text = '') {
       this.inputText = text;
@@ -645,7 +645,7 @@ export default {
       // this.toggleInfoTab();
       // this.send();
       this.inputText = this.zwinputText;
-      this.hotQuestionReset();
+      this.hotQuestionReset(this.inputText);
     },
     //ai超时超过3.5分钟 或者报错处理,结束请求提示未查询到信息
     checkTimeOut() {