liutao 1 тиждень тому
батько
коміт
5f42f6a025

+ 1 - 1
CYZZ-master/cyzz/web_cyzz/public/config.js

@@ -3,7 +3,7 @@
     system: {
       // name: '产业空间智治云',
       name: '地价预测',
-      copyright: '版权所有© 2024 浙江万维空间信息技术有限公司',
+      copyright: '版权所有© 2025 浙江万维空间信息技术有限公司',
     },
     authToken: 'ZJUGIS-Authorization',
     tk: 'f7c3163e305d6b2a4b6a14938b1932ae',

+ 0 - 14
CYZZ-master/cyzz/web_cyzz/src/router/routes-djyc.js

@@ -1,14 +0,0 @@
-export default [
-  {
-    path: '/',
-    // name: 'home',
-    // component: HomeView,
-    redirect: '/home'
-  },
-  {
-    path: '/home',
-    name: 'home',
-    component: () => import('@/views/land-use/PolicyCoordination.vue')
-  },
-
-]

+ 0 - 14
CYZZ-master/cyzz/web_cyzz/src/router/routes.js

@@ -1,14 +0,0 @@
-export default [
-  {
-    path: '/',
-    // name: 'home',
-    // component: HomeView,
-    redirect: '/home'
-  },
-  {
-    path: '/home',
-    name: 'home',
-    component: () => import('@/views/land-use/PolicyCoordination.vue')
-  },
-
-]

+ 4 - 2
CYZZ-master/cyzz/web_cyzz/src/utils/llm-request.js

@@ -18,8 +18,10 @@ axios.interceptors.request.use(
   config => {
     // 每次发送请求之前判断是否存在token,如果存在,则统一在http请求的header都加上token,不用每次请求都手动添加了
     // 即使本地存在token,也有可能token是过期的,所以在响应拦截器中要对返回状态进行判断
-    const token = Storage.getCache('Token')
-    token && (config.headers.Authorization = token)
+    const token = Storage.getCache('Token');
+    if (token) {
+      config.headers.Authorization = token;
+    }
     if(config.method.toUpperCase() === 'POST') {
       config.headers['Content-Type'] = 'application/json;charset=utf-8'
     }

+ 1 - 1
CYZZ-master/cyzz/web_cyzz/src/utils/request.js

@@ -26,7 +26,7 @@ axios.interceptors.request.use(
     return config
   },
   error => {
-    return Promise.error(error)
+    return Promise.reject(error)
   })
 const errorHandler = (error) => {
   if (error.response) {

+ 1 - 0
CYZZ-master/cyzz/web_cyzz/src/utils/storage.js

@@ -50,6 +50,7 @@ export const setCache = (key, value, $storage = _storage) => {
 
 export const getCache = (key, $storage = _storage) => {
   const v = $storage.getItem(key);
+  if (!v) return null;
   return encryption ? crypto.decrypt(v) : v;
 }
 

+ 107 - 61
CYZZ-master/cyzz/web_cyzz/src/views/land-use/PolicyCoordination.vue

@@ -2005,95 +2005,125 @@ const resetLandPanel = () => {
 };
 //供地geoserver
 const queryGDByGeoServerFeature = (geo) => {
-  var cksj = null;
-  const currentYear = new Date().getFullYear();
-  //string格式
-  // for (var i = 0; i < form.value.formItem.cksj; i++) {
-  //   var year = currentYear - i;
-  //   if (i == 0) {
-  //     cksj = `(qdrq like '%${year}%'`;
-  //   } else {
-  //     cksj += ` or qdrq like '%${year}%'`;
-  //   }
-  // }
-  // cksj += ')';
-  // timestamp 时间格式
-  const preYear = currentYear - form.value.formItem.cksj;
-  var start = preYear + '-01-01';
-  var end = currentYear + '-12-31';
-  cksj = `(qdrq >= '%${start}%' and qdrq <='%${end}%')`;
+  // 1. 构造 GML Polygon
+  const rings = geo.rings[0];
+  const posList = rings.map(pt => pt.join(' ')).join(' ');
 
-  var tdyt = `tdytmc like '%${form.value.formItem.tdyt}%'`;
-  if (form.value.formItem.tdyt == '商服') {
-    tdyt = `tdytmc like '%商%'and tdytmc not like '%住%'`;
-  }
-  if (form.value.formItem.tdyt == '工业') {
-    tdyt = `(tdytmc like '%工%' or tdytmc like '%仓%' or tdytmc like '%矿%')`;
-  }
-  if (form.value.formItem.tdyt == '住宅') {
-    tdyt = `tdytmc like '%住%'`;
-  }
-  if (form.value.formItem.tdyt == '其他') {
-    tdyt = `tdytmc not like '%住%' and tdytmc not like '%商%' and tdytmc not like '%工%' and tdytmc not like '%矿%' and tdytmc not like '%仓%'`;
+  // 2. 构造 XML Filter
+  const tdytmc = form.value.formItem.tdyt;
+  let tdytLike = '%';
+  if (tdytmc === '商服') tdytLike = '%商%';
+  else if (tdytmc === '工业') tdytLike = '%工%';
+  else if (tdytmc === '住宅') tdytLike = '%住%';
+  else if (tdytmc === '其他') tdytLike = '%其他%';
+
+  const xml = `
+<wfs:GetFeature
+    service="WFS"
+    version="1.1.0"
+    outputFormat="application/json"
+  xmlns:wfs="http://www.opengis.net/wfs"
+  xmlns:ogc="http://www.opengis.net/ogc"
+  xmlns:gml="http://www.opengis.net/gml"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
+    <wfs:Query typeName="cyzz:gdxminfo_all">
+    <ogc:Filter>
+      <ogc:And>
+        <ogc:Intersects>
+                    <ogc:PropertyName>shape</ogc:PropertyName>
+                    <gml:Polygon srsName="EPSG:4490">
+                        <gml:exterior>
+                            <gml:LinearRing>
+                                <gml:posList>
+                                    ${posList}
+                                </gml:posList>
+                            </gml:LinearRing>
+                        </gml:exterior>
+                    </gml:Polygon>
+        </ogc:Intersects>
+                <ogc:PropertyIsLike wildCard="%" singleChar="_" escape="!">
+                <ogc:PropertyName>tdytmc</ogc:PropertyName>
+                    <ogc:Literal>${tdytLike}</ogc:Literal>
+              </ogc:PropertyIsLike>
+      </ogc:And>
+    </ogc:Filter>
+  </wfs:Query>
+</wfs:GetFeature>`;
+
+  // 3. 发送 POST 请求
+  let url = window.AppGlobalConfig.owsLandUrl;
+  // 保证url带有outputFormat参数,确保响应为json
+  if (url.indexOf('?') === -1) {
+    url += '?outputFormat=application%2Fjson';
+  } else if (!/outputFormat=/.test(url)) {
+    url += '&outputFormat=application%2Fjson';
   }
-  var sql = cksj + ` and ` + tdyt;
-  var query = encodeURI(sql);
-  var origGeo = arcgisToGeoJSON(geo);
-  var wktString = wkt.convert(origGeo);
-  var landUrl = window.AppGlobalConfig.landGeoserverUrl;
-  var ows = window.AppGlobalConfig.owsLandUrl;
-  var geoField = window.AppGlobalConfig.landGeoField;
-  var geoServerUrl = `${ows}?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&typeName=${landUrl}&SRS=EPSG%3A4490&outputFormat=application%2Fjson`;
-  var cql = `&cql_filter=INTERSECTS(${geoField},${wktString}) and (${query})`;
-  geoServerUrl += cql;
-  GetApi.getData(geoServerUrl).then((data) => {
-    console.log(data);
-    if (data.features.length < 1) {
+  axios.post(url, xml, {
+    headers: {
+      'Content-Type': 'text/xml'
+    },
+    transformRequest: [(data) => data]
+  })
+    .then(res => {
+    const data = res.data;
+      if (!data.features || data.features.length < 1) {
       message.info('未叠加到符合条件的供地数据');
-      if (markersLayers) {
-        markersLayers.clearLayers();
-      }
+        if (markersLayers) markersLayers.clearLayers();
       form.value.formItem.ycdj = '';
       return;
     }
-    var attrs = [];
 
+      // 调用 algorithm 进行后续处理
+        var attrs = [];
     var origGeo = arcgisToGeoJSON(geo);
     var center = turf.center(origGeo);
     let pt = center.geometry.coordinates;
     var orign = { geojson: origGeo, center: pt };
+
     data.features.forEach((item) => {
       var geojson = item.geometry;
       if (geojson.geometries) {
         geojson.geometries.forEach((it) => {
-          var origGeo = arcgisToGeoJSON(geo);
-          var center = turf.center(it);
-          let pt = center.geometry.coordinates;
           try {
             var interGeo = turf.intersect(origGeo, it);
             if (interGeo) {
               var area = turf.area(turf.getGeom(interGeo)).toFixed(2);
-              console.log(area);
-              attrs.push({ area: area, attributes: item.properties, geo: interGeo, center: pt });
+                attrs.push({ 
+                  area: area, 
+                  attributes: item.properties, 
+                  geo: interGeo, 
+                  center: turf.center(it).geometry.coordinates 
+                });
             }
           } catch (e) {
-            console.log(e);
+              console.error(e);
           }
         });
       } else {
-        var origGeo = arcgisToGeoJSON(geo);
-        var center = turf.center(geojson);
-        let pt = center.geometry.coordinates;
+          try {
         var interGeo = turf.intersect(origGeo, geojson);
         if (interGeo) {
           var area = turf.area(turf.getGeom(interGeo)).toFixed(2);
-          console.log(area);
-          attrs.push({ area: area, attributes: item.properties, geo: interGeo, center: pt });
+              attrs.push({ 
+                area: area, 
+                attributes: item.properties, 
+                geo: interGeo, 
+                center: turf.center(geojson).geometry.coordinates 
+              });
+            }
+          } catch (e) {
+            console.error(e);
         }
       }
     });
-    //克里金差值
+
+      //克里金插值
     algorithm(orign, attrs);
+    })
+    .catch(error => {
+      message.error('供地数据查询失败');
+      console.error(error);
   });
 };
 const queryGDByGeoServerFeature1 = (geo) => {
@@ -2150,6 +2180,23 @@ const queryGDByGeoServerFeature1 = (geo) => {
     var orign = { geojson: origGeo, center: pt };
     data.features.forEach((item) => {
       var geojson = item.geometry;
+      if (geojson.geometries) {
+        geojson.geometries.forEach((it) => {
+          var origGeo = arcgisToGeoJSON(geo);
+          var center = turf.center(it);
+          let pt = center.geometry.coordinates;
+          try {
+            var interGeo = turf.intersect(origGeo, it);
+            if (interGeo) {
+              var area = turf.area(turf.getGeom(interGeo)).toFixed(2);
+              console.log(area);
+              attrs.push({ area: area, attributes: item.properties, geo: interGeo, center: pt });
+            }
+          } catch (e) {
+            console.log(e);
+          }
+        });
+      } else {
       var origGeo = arcgisToGeoJSON(geo);
       var center = turf.center(geojson);
       let pt = center.geometry.coordinates;
@@ -2157,7 +2204,8 @@ const queryGDByGeoServerFeature1 = (geo) => {
       if (interGeo) {
         var area = turf.area(turf.getGeom(interGeo)).toFixed(2);
         console.log(area);
-        attrs.push({ area: area, attributes: item.properties, geo: geojson, center: pt });
+          attrs.push({ area: area, attributes: item.properties, geo: interGeo, center: pt });
+        }
       }
     });
     //克里金差值
@@ -2497,14 +2545,12 @@ const handleAnalysisData = (data) => {
           for (var i = 0; i < item.result.length; i++) {
             var t = item.result[i];
             if (t.unit == 'km') {
-              if (t.distance < 3000) {
                 if (t.center && t.center.indexOf(',') > -1) {
                   zgdFlag = true;
                   var pt = [];
                   pt.push(t.center.split(',')[0]);
                   pt.push(t.center.split(',')[1]);
                   attrs.push({ attributes: t, center: pt });
-                }
               }
             }
           }