瀏覽代碼

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

LAPTOP-BJJ3IV5R\SIWEI 10 月之前
父節點
當前提交
e0d04d4d52

+ 34 - 12
src/views/cockpit/common/VectorSpace/BoxCommonVector.vue

@@ -185,6 +185,7 @@ export default {
     },
     goLayer(geom, lid) {
       if (tdsy.layer) tdsy.layer.show = false;
+      // tdsy.removelayer();
       let layer = viewer.imageryLayers.addImageryProvider(
         new Cesium.SuperMapImageryProvider({
           url: this.layersData.url,
@@ -194,18 +195,25 @@ export default {
       tdsy.layersObj[lid] = layer;
       this.loadGeoJSON(geom, lid);
     },
-    loadGeoJSON(geojson, id) {
+    loadGeoJSON(geojson, id, yanse, isfly = true) {
       let polygon = Cesium.GeoJsonDataSource.load(geojson, {
         clampToGround: true,
-        stroke: Cesium.Color.RED.withAlpha(0),
-        fill: Cesium.Color.WHITE.withAlpha(0),
+        stroke: yanse
+          ? Cesium.Color.fromCssColorString(yanse)
+          : Cesium.Color.RED.withAlpha(0),
+        fill: yanse
+          ? Cesium.Color.fromCssColorString(yanse).withAlpha(0.3)
+          : Cesium.Color.WHITE.withAlpha(0),
+        strokeWidth: isfly ? 5 : 2,
+        zIndex: isfly ? 10 : 5,
       });
       polygon.then(function (dataSource) {
         viewer.dataSources.add(dataSource);
         layerSources[id] = dataSource;
-        viewer.flyTo(dataSource, {
-          offset: new Cesium.HeadingPitchRange(0, -45),
-        });
+        if (isfly)
+          viewer.flyTo(dataSource, {
+            offset: new Cesium.HeadingPitchRange(0, -45),
+          });
       });
     },
     multiPolygonToPolygons(multiPolygon) {
@@ -361,7 +369,11 @@ export default {
       } else {
         if (this.cockpit_vector.mapType) {
           this.setLayerStatus(item);
-        } else this.addpolygon(item);
+        } else {
+          // this.addpolygon(item);
+          this.tempdataLayerId = "h_" + item.index;
+          this.loadGeoJSON(item.geom, "h_" + item.index, "#ff0000");
+        }
       }
       store.setVectordataid(item.dataid);
       let arr = [];
@@ -579,7 +591,13 @@ export default {
     active_dableData(newVal, oldVal) {
       if (this.cockpit_vector.mapType)
         this.draw_vector_server(this.cockpit_vector.mapType);
-      else this.draw_vector_tdgy_gy_jd(newVal);
+      // else this.draw_vector_tdgy_gy_jd(newVal);
+      else {
+        newVal.forEach((res, index) => {
+          res.index = index;
+          if (res.geom) this.loadGeoJSON(res.geom, index, "#55A1E3", false);
+        });
+      }
     },
     tempdataLayerId(newVal, oldVal) {
       if (oldVal && tdsy.layersObj[oldVal]) {
@@ -587,6 +605,10 @@ export default {
       } else if (tdsy.layersObj[newVal]) {
         // tdsy.layersObj[newVal].show = true;
       }
+      if (oldVal && layerSources[oldVal]) {
+        viewer.dataSources.remove(layerSources[oldVal]);
+        layerSources[oldVal] = null;
+      }
       console.log(newVal, oldVal, "----");
     },
     computed_vectorData(newVal, oldVal) {
@@ -693,9 +715,9 @@ div::-webkit-scrollbar {
     line-height: 23px;
     padding: 0 5px;
     border-radius: 4px;
-    top: -1.9rem !important;
-    position: relative;
-    right: -24rem;
+    top: 10px !important;
+    position: absolute;
+    right: 10px;
   }
 
   .PangetitleVector {
@@ -707,7 +729,7 @@ div::-webkit-scrollbar {
     line-height: 35px;
     font-size: 14px;
     padding-left: 15px;
-    display: flex;
+    // display: flex;
     position: relative;
     overflow: hidden;
   }

+ 11 - 0
src/views/cockpit/js/tdsy.js

@@ -53,6 +53,8 @@ export const remove = (isreset) => {
         viewer.dataSources.remove(gy_jd_entity);
         gy_jd_entity = null
     }
+    viewer.entities.removeAll();
+    viewer.dataSources.removeAll();
     if (layer && isreset) {
         viewer.imageryLayers.remove(layer);
         layer = null
@@ -77,6 +79,15 @@ export const remove = (isreset) => {
     //     })
     // }
 
+}
+export const removelayer = () => {
+    console.log("---aa", viewer.imageryLayers)
+    if (layer) {
+        console.log("----", layer)
+        viewer.imageryLayers.remove(layer);
+        layer = null
+    }
+
 }
 
 export const hidden = (flag) => {

+ 14 - 34
src/views/farmlandProtection/components/fzjcyp.vue

@@ -32,10 +32,7 @@
           <el-table-column width="50">
             <template slot-scope="scope">
               <!-- <span>编辑</span> -->
-              <el-button
-                size="mini"
-                type="text"
-                @click="handleEdit(scope.row)"
+              <el-button size="mini" type="text" @click="handleEdit(scope.row)"
                 >编辑</el-button
               >
             </template>
@@ -47,7 +44,7 @@
       <span class="clearBtn" @click="reset">取消</span>
       <span class="sureBtn" @click="submitData">确定</span>
     </div>
-    <zdyModelPop :tableData="anaModels" ref="zdyPop"></zdyModelPop>
+    <zdyModelPop :tableData="templateYZ" :editData="editData" ref="zdyPop"></zdyModelPop>
   </div>
 </template>
 
@@ -81,24 +78,9 @@ export default {
       },
       //分析模型列表
       anaModels: [
-        {
-          id: 1,
-          name: "耕地监测分析模型",
-        },
-        {
-          id: 2,
-          name: "基本农田保护模型",
-        },
-        {
-          id: 3,
-          name: "生态保护分析模型",
-        },
-        {
-          id: 4,
-          name: "矿产监测分析模型",
-        },
       ],
       templateYZ: [], //用地性质模版因子
+      editData:{},//编辑的对象
     };
   },
   methods: {
@@ -130,8 +112,6 @@ export default {
         },
       ];
       this.templateYZ.forEach((item) => {
-        // let JSONItem = JSON.parse(item.conditionInfo);
-        // item.conditionInfo = JSONItem;
         item.children = [];
       });
       this.anaModels = this.templateYZ;
@@ -155,21 +135,21 @@ export default {
     //自定义模型按钮
     zdyModel() {
       this.$refs.zdyPop.dialogVisible = true;
+      this.editData={}
+      this.$refs.zdyPop.reset()
+      this.$refs.zdyPop.yzTableData = [];
     },
     handleEdit(item) {
+      this.editData = item
       this.$refs.zdyPop.dialogVisible = true;
-      this.$refs.zdyPop.yzTableData = item.gdbhMxYz;
+      this.templateYZ = item.gdbhMxYzRet;
+      this.templateYZ.forEach((item) => {
+        item.children = [];
+      });
+      this.$refs.zdyPop.yzTableData = this.templateYZ;
       this.$refs.zdyPop.fxmxmc = item.bsmmc;
-      // console.log(item, "暂时使用");
-      // item.gdbhMxYz.forEach((item) => {
-      //   // let JSONItem = JSON.parse(item.conditionInfo);
-      //   // item.conditionInfo = JSONItem;
-      //   item.children = [];
-      // });
-      // this.anaModels = item.gdbhMxYz;
-      // this.$refs.zdyPop.yzTableData = item.gdbhMxYz;
-      // // this.zdyModel();
-      
+
+      // this.zdyModel();
     },
     reset() {
       this.ruleForm = {

+ 32 - 31
src/views/farmlandProtection/components/zdyModelPop.vue

@@ -51,6 +51,7 @@
         <el-col :span="11">
           <div class="yztitle">已选数据</div>
           <el-table
+            ref="multipleTable"
             :data="dialogData"
             border
             class="right-table scroll-style"
@@ -60,7 +61,7 @@
           >
             <el-table-column type="selection" width="55" align="center">
             </el-table-column>
-            <el-table-column prop="bsmmc" label="数据名称"> </el-table-column>
+            <el-table-column prop="name" label="数据名称"> </el-table-column>
           </el-table>
         </el-col>
       </el-row>
@@ -80,6 +81,10 @@ export default {
     tableData: {
       type: Array,
     },
+    editData: {
+      //editData用来存储编辑的数据,用bsm判断是否为编辑,全部存储是为了防止以后新增需求
+      type: Object,
+    },
   },
 
   data() {
@@ -112,10 +117,14 @@ export default {
       return data.name.indexOf(value) !== -1;
     },
     reset() {
-      this.dialogData = []; //清空已选数据表单
+      console.log(898888);
+      this.$parent.templateYZ = [];
       this.filterText = ""; //还原分析数据搜索框
       this.fxmxmc = ""; //清空分析模型名称输入框
-      this.getTreeList(); //重新获取分析数据
+      this.yzTableData = [];
+      this.GetFactorList(); //重新获取分析数据
+      this.dialogData = []; //清空已选数据表单
+      console.log(this.dialogData, "到货时间肯定会撒");
     },
     testInput(val) {
       val = Number(val);
@@ -156,11 +165,9 @@ export default {
     setTable(selectdata) {
       let tableList = [];
       selectdata.forEach((item) => {
-        console.log(item, "itemitemitem---");
-        // let JSONItem = JSON.parse(item.conditionInfo);
         tableList.push({
           id: item.id,
-          bsmmc: item.name,
+          name: item.name,
           bsm: item.bsm,
           // conditionInfo: JSONItem,
         });
@@ -236,31 +243,21 @@ export default {
       let saveData = {
         bsm: new Date().getTime(),
         bsmmc: this.fxmxmc,
-        gdbhMxYz: this.dialogData,
+        gdbhMxYzRet: this.dialogData,
       };
-      console.log(saveData, ":this.dialogData");
-      this.$parent.anaModels.push(saveData);
-      this.dialogVisible = false;
-      // var sign = true;
-      // let saveData = [];
-      // this.dialogData.forEach((item) => {
-      //   item.type && item.value == "" && (sign = false);
-      //   issave &&
-      //     saveData.push({
-      //       ...item,
-      //       conditionInfo: JSON.stringify(item.conditionInfo),
-      //     });
-      // });
-      // if (sign) {
-      //   if (issave) {
-      //     this.save(saveData);
-      //   } else {
-      //     this.$parent.tableData = this.dialogData;
-      //     this.dialogVisible = false;
-      //   }
-      // } else {
-      //   this.$message.warning("请将信息补充完整!");
-      // }
+      if (this.editData.bsm) {
+        //判断是否为编辑状态
+        this.$parent.anaModels.forEach((item) => {
+          if (item.bsm == this.editData.bsm) {
+            this.$parent.anaModels[item] = saveData; //替换数据
+          }
+        });
+        this.dialogVisible = false;
+      } else {
+        this.$parent.anaModels.push(saveData);
+        this.dialogVisible = false;
+      }
+      this.$refs.multipleTable.clearSelection();//清空勾选
     },
     setData(data) {
       data.filter((item) => {
@@ -282,11 +279,15 @@ export default {
         : (this.options[1].disabled = false);
     },
     resetDialogData() {
-      if (this.tableData.length == []) {
+      if (!this.tableData.length) {
         // 重置时,树的数据恢复
         this.dialogData = [];
         this.options = JSON.parse(JSON.stringify(this.optionsTemp));
         this.selectdialogData = [];
+      } else {
+        // 选择模板时,生成新的树
+        this.dialogData = JSON.parse(JSON.stringify(this.tableData));
+        this.options = JSON.parse(JSON.stringify(this.optionsTemp));
       }
       this.dialogData.forEach((item) => {
         this.resetTree(this.options, item);