Explorar o código

遥感检测数据新增修改

lkk hai 1 mes
pai
achega
f1060841fd

+ 7 - 1
src/api/supervise/pcsj.js

@@ -24,7 +24,7 @@ export function listPcsj(query) {
 // 获取下载地址
 export function downloadPcsjUrl(id) {
   return request({
-    url: '/apply/supervise/pcsj/download/url/'+ id,
+    url: '/apply/supervise/pcsj/download/url/' + id,
     method: 'get'
   })
 }
@@ -197,4 +197,10 @@ export function getReadFoldert(query) {
     method: 'get',
     params: query
   })
+}
+export function getYwlxName(id) {
+  return request({
+    url: '/apply/supervise/ywlx/name/' + id,
+    method: 'get',
+  })
 }

+ 96 - 40
src/views/remote/farmland/index.vue

@@ -2,8 +2,8 @@
   <div id="mapApp">
     <div class="btn" v-if="nowObj['前时相']">
       <!-- <el-button @click="drawer = true">打开抽屉</el-button> -->
-      <span class="sx qsx">前时相:{{ nowObj['前时相']}}</span>
-      <span class="sx hsx">后时相:{{ nowObj['后时相'] }}</span>
+      <span class="sx qsx">前时相:{{ nowObj["前时相"] }}</span>
+      <span class="sx hsx">后时相:{{ nowObj["后时相"] }}</span>
     </div>
     <MapView :maptype="maptype" ref="MapView" />
 
@@ -137,6 +137,7 @@ import {
   getXqListKey,
   getXqIdMap,
   getXqIdKey,
+  getYwlxName,
 } from "@/api/supervise/pcsj";
 import { detailInfos } from "./config";
 import "ol/ol.css";
@@ -202,6 +203,7 @@ export default {
       templateList: [],
       descriptionsList: [], //详情描述列表存储字段
       envelopegeomObj: {}, //用于存储进入页面飞入视角的对象
+      sjlx: 0,
     };
   },
   mounted() {
@@ -209,7 +211,12 @@ export default {
     this.$nextTick(() => {
       getPcsj(this.$route.query.id).then((response) => {
         this.newObj = response.data;
-
+        getYwlxName(this.newObj.name).then((res) => {
+          if (res.code == 200) {
+            this.sjlx = res.data.sjlx;
+            console.log(this.sjlx, "this.sjlx ");
+          }
+        });
         // if (this.newObj.envelopegeom && this.newObj.envelopegeom != "") {
         //   if (typeof this.newObj.envelopegeom === "string") {
         //     let geom = this.newObj.envelopegeom;
@@ -239,6 +246,7 @@ export default {
         //   window.map["mapDiv"].addLayer(this.envelopegeomObj);
         // }
       });
+
       this.getTemplate();
     });
   },
@@ -323,19 +331,34 @@ export default {
       window.open(`${zipfile}`);
     },
     tableClick(row) {
-      removeWebGLTile("mapCon1");
-      removeWebGLTile("mapCon2");
-      let urlQsx = this.newObj.proxypath + row["前时相对应影像数据"];
-      let urlHsx = this.newObj.proxypath + row["后时相对应影像数据"];
-      if (this.nowObj.id != row.id) {
-        this.maptype = "split";
-        this.nowObj = row;
-        addTiff("mapCon1", urlQsx);
-        addTiff("mapCon2", urlHsx);
-        this.test(row);
+      if (this.sjlx == 1) {
+        removeWebGLTile("mapDiv");
+        let urlQsx = this.newObj.proxypath + row["相对应影像数据"];
+        console.log(urlQsx);
+        // 判断是否点击了新的行数据(避免重复加载)
+        if (this.nowObj.id != row.id) {
+          this.maptype = "normal"; // 切换为单屏模式
+          this.nowObj = {}; // 清空当前选中对象
+          addTiff("mapDiv", urlQsx);
+          // 定位到当前行数据的地理范围并高亮显示
+          this.test(row);
+        }
       } else {
-        this.maptype = "normal";
-        this.nowObj = {};
+        removeWebGLTile("mapCon1");
+        removeWebGLTile("mapCon2");
+        let urlQsx = this.newObj.proxypath + row["前时相对应影像数据"];
+        let urlHsx = this.newObj.proxypath + row["后时相对应影像数据"];
+        if (this.nowObj.id != row.id) {
+          this.maptype = "split";
+          this.nowObj = row;
+          addTiff("mapCon1", urlQsx);
+          addTiff("mapCon2", urlHsx);
+          this.test(row);
+        }
+        // else {
+        //   this.maptype = "normal";
+        //   this.nowObj = {};
+        // }
       }
     },
 
@@ -364,36 +387,69 @@ export default {
       this.drawer = false;
     },
     test(item) {
-      window.map["mapCon1"].removeLayer(this.itemObj);
-      window.map["mapCon2"].removeLayer(this.itemObj);
-      if (item.geom && item.geom != "") {
-        if (typeof item.geom === "string") {
-          let geom = this.tableData[i].geom;
-          item.geom = parse(geom);
+      // 1. 提取公共样式配置,避免重复定义
+      let highlightStyle = new Style({
+        stroke: new Stroke({
+          color: "rgba(255, 0, 0, 1)",
+          width: 2,
+        }),
+      });
+
+      // 2. 确定当前操作的地图容器列表
+      let mapNames = this.sjlx === 1 ? ["mapDiv"] : ["mapCon1", "mapCon2"];
+
+      // 3. 清除所有相关地图容器中的旧高亮图层
+      mapNames.forEach((mapName) => {
+        if (this.itemObj && window.map[mapName]) {
+          window.map[mapName].removeLayer(this.itemObj);
+        }
+      });
+
+      // 4. 验证geom数据有效性
+      if (!item.geom || item.geom === "") return;
+
+      try {
+        // 5. 统一处理geom格式转换
+        let geomData = item.geom;
+        if (typeof geomData === "string") {
+          geomData = parse(geomData);
         }
-        let features = new GeoJSON().readFeatures(item.geom);
+
+        // 6. 创建矢量图层
+        let features = new GeoJSON().readFeatures(geomData);
         this.itemObj = new VectorLayer({
-          source: new VectorSource({
-            features: features,
-          }),
-          style: function (feature) {
-            return new Style({
-              stroke: new Stroke({
-                //边界样式
-                color: "rgba(255, 0, 0, 1)",
-                width: 2,
-              }),
-            });
-          },
+          source: new VectorSource({ features }),
+          style: highlightStyle,
           zIndex: 9999,
         });
-        window.map["mapCon1"].getView().animate({
-          center: [item["中心点经度"], item["中心点纬度"]],
-          zoom: 16.5,
-          duration: 2000, // 动画持续时间,单位毫秒
+
+        // 7. 获取中心点坐标并验证
+        let center = [item["中心点经度"], item["中心点纬度"]];
+        if (!Array.isArray(center) || center.length !== 2) {
+          console.warn("无效的中心点坐标:", center);
+          return;
+        }
+
+        // 8. 对所有相关地图执行添加图层和视角动画
+        mapNames.forEach((mapName) => {
+          let map = window.map[mapName];
+          if (map) {
+            // 添加新图层
+            map.addLayer(this.itemObj);
+            // 视角动画(仅在第一个地图执行一次,避免多地图重复动画)
+            if (mapName === mapNames[0]) {
+              map.getView().animate({
+                center,
+                zoom: 16.5,
+                duration: 2000,
+              });
+            }
+          } else {
+            console.warn(`地图容器${mapName}不存在`);
+          }
         });
-        window.map["mapCon1"].addLayer(this.itemObj);
-        window.map["mapCon2"].addLayer(this.itemObj);
+      } catch (error) {
+        console.error("处理高亮图层失败:", error);
       }
     },
     //创建监测图斑列表实体

+ 41 - 26
src/views/remote/satellite/index.vue

@@ -411,8 +411,8 @@ export default {
         beginTime: "", //录入时间
         endTime: "", //处理时间
       },
-      fileReadFolderForm:{
-        folder:"d:/上传下载文件包"
+      fileReadFolderForm: {
+        folder: "d:/上传下载文件包",
       },
       // 表单参数
       form: {
@@ -439,8 +439,8 @@ export default {
       loading2: null,
       uploadFileUrl: process.env.VUE_APP_BASE_API + "/file/uploadSpotZip",
       uploadingCount: 0, // 正在上传的文件数量
-      uploadingFileSUccess: [], 
-      uploadingFileFail: [], 
+      uploadingFileSUccess: [],
+      uploadingFileFail: [],
       // 部门树选项
       deptOptions: [],
       selectedValues: [],
@@ -475,10 +475,10 @@ export default {
       this.selectedValues = value.district;
       this.queryParams.xzqdm = value.district;
     },
-      // 文件状态改变时触发
+    // 文件状态改变时触发
     handleChange(file, fileList) {
       this.fileList = fileList;
-      if (file.status === 'ready') {
+      if (file.status === "ready") {
         this.uploadingCount++; // 增加上传计数
       }
     },
@@ -497,29 +497,29 @@ export default {
       console.log(this.uploadFileUrl);
       this.uploadFileUrl = this.uploadFileUrl;
       this.fileList = [];
-      this.uploadingCount=0; // 正在上传的文件数量
-      this.uploadingFileSUccess=[]; 
-      this.uploadingFileFail=[]; 
+      this.uploadingCount = 0; // 正在上传的文件数量
+      this.uploadingFileSUccess = [];
+      this.uploadingFileFail = [];
       this.fileUploadDiv = true;
     },
     fileReadFolder() {
       this.fileReadFolderForm = {
-        folder:"d:/上传下载文件包"
+        folder: "d:/上传下载文件包",
       };
       this.fileReadFolderDiv = true;
     },
-    fileReadFolderClick(){
+    fileReadFolderClick() {
       let queryParams = {
         folder: this.fileReadFolderForm.folder,
       };
       getReadFoldert(queryParams).then((response) => {
-        if (response.statuscode==200){
-            this.fileReadFolderDiv = false;
-            this.$message({
-              type: "success",
-              message: response.message,
-            });
-            this.getList();
+        if (response.statuscode == 200) {
+          this.fileReadFolderDiv = false;
+          this.$message({
+            type: "success",
+            message: response.message,
+          });
+          this.getList();
         }
       });
     },
@@ -543,9 +543,8 @@ export default {
       console.log(this.uploadingCount);
       this.uploadingFileSUccess.push(file.name);
       if (this.uploadingCount === 0) {
-         this.handleUploadClose(res);
+        this.handleUploadClose(res);
       }
-      
     },
     // 上传成功关闭
     handleUploadClose(res) {
@@ -553,18 +552,34 @@ export default {
         this.fileList = [];
         this.fileUploadDiv = false;
         this.$modal.closeLoading();
-        this.$modal.msgSuccess(" 执行完成。上传成功:"+this.uploadingFileSUccess +"上传失败:"+this.uploadingFileFail);
+        this.$modal.msgSuccess(
+          " 执行完成。上传成功:" +
+            this.uploadingFileSUccess +
+            "上传失败:" +
+            this.uploadingFileFail
+        );
         this.getList();
       }
     },
     handleDownload(row) {
       downloadPcsjUrl(row.id).then((response) => {
         const p_len = row.proxypath.indexOf("spotfile");
-        const p_str = row.proxypath.slice(0,p_len);
-        const p_url = process.env.VUE_APP_BASE_API + "/file/spot/download/shp/file/"+row.id+"/"+response.data;
+        const p_str = row.proxypath.slice(0, p_len);
+        const p_url =
+          process.env.VUE_APP_BASE_API +
+          "/file/spot/download/shp/file/" +
+          row.id +
+          "/" +
+          response.data;
         const port = window.location.port || this.getDefaultPort();
-        const p_url_str  = window.location.protocol + "//"+window.location.hostname + ":"+port+ p_url;
-        console.log("url:",p_url_str)
+        const p_url_str =
+          window.location.protocol +
+          "//" +
+          window.location.hostname +
+          ":" +
+          port +
+          p_url;
+        console.log("url:", p_url_str);
         window.open(`${p_url_str}`);
       });
     },
@@ -672,7 +687,7 @@ export default {
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      console.log(row)
+      console.log(row);
       const ids = row.id || this.ids;
       const idname = row.name;
       this.$modal

+ 21 - 4
src/views/remote/template/index.vue

@@ -57,7 +57,12 @@
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="业务类型" align="center">
         <template slot-scope="scope">
-          <span style="color: #337ab7;cursor: pointer;" @click="goYzpz(scope.row)"> {{ scope.row.ywlx }}</span>
+          <span
+            style="color: #337ab7; cursor: pointer"
+            @click="goYzpz(scope.row)"
+          >
+            {{ scope.row.ywlx }}</span
+          >
         </template>
       </el-table-column>
       <el-table-column label="业务类型名称" align="center" prop="ywlxmc" />
@@ -122,6 +127,12 @@
             label="最小值为1"
           ></el-input-number>
         </el-form-item>
+        <el-form-item label="时间类型" prop="sjlx">
+          <el-select v-model="form.sjlx" placeholder="请选择">
+            <el-option label="年度类型" :value="Number(1)"> </el-option>
+            <el-option label="其他类型" :value="Number(0)"> </el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item label="数据源" prop="sjy">
           <el-input v-model="form.sjy"></el-input>
         </el-form-item>
@@ -161,6 +172,7 @@ export default {
         ywlxmc: "",
         sort: 1,
         sjy: "",
+        sjlx: 0,
       },
       rules: {
         // { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
@@ -170,6 +182,9 @@ export default {
         ],
         sort: [{ required: true, message: "请输入排序", trigger: "blur" }],
         sjy: [{ required: true, message: "请输入数据源", trigger: "blur" }],
+        sjlx: [
+          { required: true, message: "请x选择时间类型", trigger: "change" },
+        ],
       },
     };
   },
@@ -183,7 +198,7 @@ export default {
         this.loading = false;
       });
     },
-    goYzpz(row){
+    goYzpz(row) {
       this.$router.push({ path: "/remote/mbyz", query: { id: row.ywlx } });
     },
     handleQuery() {},
@@ -194,8 +209,9 @@ export default {
         pageSize: 10,
         ywlx: "", //业务类型
         ywlxmc: "", //业务类型名称
+        sjlx: 0,
       };
-      this.getList()
+      this.getList();
     },
     handleSelectionChange() {},
     // handleView(row) {},
@@ -231,7 +247,7 @@ export default {
     //新增业务类型数据
     addYwlx() {
       this.dialogVisible = true;
-      this.title = "新增"
+      this.title = "新增";
       this.reset();
     },
     handleClose() {
@@ -280,6 +296,7 @@ export default {
         ywlxmc: "",
         sort: 1,
         sjy: "",
+        sjlx: 0,
       };
     },
   },