管道基础大数据平台系统开发-【前端】-新系統界面
TreeWish
2023-03-03 b6c8e7c61f0270598ba7fdbc44f79512e010d0fe
src/components/MapView/mapMenuPop.vue
@@ -6,10 +6,7 @@
        v-if="$store.state.download"
      >
        <div @click="getDownloadDep">
          <el-link
            style="color:white"
            icon="el-icon-download"
          > </el-link>
          <el-link icon="el-icon-download"> </el-link>
        </div>
      </div>
      <ul>
@@ -27,8 +24,9 @@
        <el-table
          :data="tableData"
          ref="dialogPayChannel"
          height="300px"
          height="100%"
          style="width: 100%"
          border
        >
          <el-table-column
            align="center"
@@ -59,7 +57,10 @@
          ></el-table-column>
        </el-table>
      </div>
      <div class="pagination_box">
      <div
        class="pagination_box"
        style="margin-top:10px"
      >
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
@@ -131,7 +132,7 @@
      :modal="false"
      :before-close="handleInsertClose"
    >
      <div style="width:100%; max-height:450px;overflow-y:auto">
      <div style="width: 100%; max-height: 450px; overflow-y: auto">
        <el-form
          ref="form"
          :model="ruleForm"
@@ -141,7 +142,7 @@
            <div>
              <ul>
                <li v-for="item in ruleForm.depid">
                  {{item.name}}
                  {{ item.name }}
                </li>
              </ul>
            </div>
@@ -150,7 +151,7 @@
            <div>
              <ul>
                <li v-for="item in ruleForm.tabs">
                  {{item.tabDesc}}
                  {{ item.tabDesc }}
                </li>
              </ul>
            </div>
@@ -158,7 +159,7 @@
          <el-form-item label="条件">
            <el-input
              :title="ruleForm.wkt"
              v-model=" ruleForm.wkt"
              v-model="ruleForm.wkt"
              disabled
            ></el-input>
          </el-form-item>
@@ -177,14 +178,16 @@
              class="primary"
              size="small"
              @click="getInsertDown"
            >{{ $t("common.confirm") }}</el-button>
            >{{
              $t("common.confirm")
            }}</el-button>
            <el-button
              type="info"
              size="small"
              @click="closeInsertDown"
            >{{
            $t("common.cancel")
          }}</el-button>
              $t("common.cancel")
            }}</el-button>
          </el-form-item>
        </el-form>
      </div>
@@ -196,7 +199,7 @@
    ></iframe>
  </div>
</template>
<script>
import {
  dataQuery_selectByPage,
@@ -207,7 +210,8 @@
  dataLib_selectDownloadFile,
  dataQuery_selectDbOverflowDep,
  apply_insertApply,
  decr, encr,
  decr,
  encr,
  dataLib_selectDepsByIds,
} from "../../api/api.js";
import { getToken } from "@/utils/auth";
@@ -266,7 +270,6 @@
        entity: [],
        wkt: null,
        descr: null,
      },
      listPage: {
        pageSize: 10,
@@ -299,11 +302,11 @@
      this.dialogVisible = true;
    },
    handleInsertClose() {
      this.$confirm('确认关闭?')
        .then(_ => {
      this.$confirm("确认关闭?")
        .then((_) => {
          this.closeInsertDown();
        })
        .catch(_ => { });
        .catch((_) => { });
    },
    closeInsertDown() {
      this.ruleForm = {
@@ -313,27 +316,25 @@
        repwd: null,
        wkt: null,
        descr: null,
      }
      this.dialogInsertVisible = false
      };
      this.dialogInsertVisible = false;
    },
    async getDownloadDep() {
      var std = [];
      for (var i in this.option) {
        std.push(this.option[i].entity
        )
        std.push(this.option[i].entity);
      }
      var obj = {
        entities: std,
        wkt: this.listdata.wkt
      }
      const data = await dataQuery_selectDbOverflowDep(JSON.stringify(obj))
        wkt: this.listdata.wkt,
      };
      const data = await dataQuery_selectDbOverflowDep(JSON.stringify(obj));
      if (data.code != 200) {
        this.$message.error("数据请求失败");
        return;
      }
      if (data.result.length == 0 || data.result == null) {
        this.insertFlag = 1;
        this.dialogVisible = true;
      } else {
@@ -343,24 +344,23 @@
        var val = "";
        for (var i in data.result) {
          if (val == "") {
            val += "ids=" + data.result[i]
            val += "codes=" + data.result[i];
          } else {
            val += "&ids=" + data.result[i]
            val += "&codes=" + data.result[i];
          }
          std.push({
            name: data.result[i]
          })
            name: data.result[i],
          });
        }
        const data1 = await dataLib_selectDepsByIds(val);
        this.ruleForm.depid = data1.result;
        this.ruleForm.depname = std;
        this.ruleForm.wkt = decr(this.listdata.wkt)
        this.ruleForm.wkt = decr(this.listdata.wkt);
        this.ruleForm.tabs = this.option;
        this.dialogInsertVisible = true;
      }
    },
    async signGetPublicKey() {
      const res = await sign_getPublicKey();
@@ -400,31 +400,29 @@
        var std = [];
        var std1 = [];
        for (var i in this.option) {
          std.push(this.option[i].tabDesc)
          std1.push(this.option[i].entity)
          std.push(this.option[i].tabDesc);
          std1.push(this.option[i].entity);
        }
        var obj = {
          ids: this.insertOption.ids,
          depcodes: this.insertOption.ids,
          pwd: encr(this.codeForm.password),
          tabs: std,
          entities: std1,
          wkt: this.listdata.wkt,
          descr: this.ruleForm.descr,
        }
        const data1 = await apply_insertApply(JSON.stringify(obj))
        };
        const data1 = await apply_insertApply(JSON.stringify(obj));
        if (data1.code != 200) {
          this.$message.error("数据申请失败");
          return
          return;
        }
        this.$message({
          message: '数据申请成功',
          type: 'success'
          message: "数据申请成功",
          type: "success",
        });
        this.closeDown();
      }
    },
    async selectDownloadFile(rsid, rspwd) {
      var downObj = {
@@ -467,7 +465,22 @@
      this.listdata.name = null;
      this.option = [];
    },
    clearQuerInfo() {
      if (this.$store.state.queryInfo.length != 0) {
        sgworld.Creator.SimpleGraphic.clear();
        for (var i in this.$store.state.queryInfo) {
          sgworld.Viewer.entities.remove(this.$store.state.queryInfo[i]);
        }
        this.$store.state.queryInfo = [];
        if (this.$store.state.primitLayer != null) {
          sgworld.Viewer.entities.remove(this.$store.state.primitLayer);
          sgworld.Creator.DeleteObject(this.$store.state.primitLayer);
          this.$store.state.primitLayer = null;
        }
      }
    },
    setTableAll() {
      this.clearQuerInfo();
      this.signGetPublicKey();
      this.startTableMssage();
      this.listdata.wkt = this.$store.state.mapMenuShpFile;
@@ -533,7 +546,7 @@
          this.imagePoint = null;
        }
        var wkt = this.$wkt.parse(val1);
        this.setMapLoaction(wkt);
        this.setMapLoaction(wkt, row);
      }
    },
    setMapLoaction(res) {
@@ -591,6 +604,7 @@
      this.listdata.pageIndex = 1;
      this.listdata.pageSize = 10;
      this.listdata.name = res.entity;
      this.$store.state.propertiesName = res;
      this.getTableDateHidder();
    },
    handleSizeChange(val) {
@@ -628,14 +642,8 @@
      this.showAllImage(data.result);
    },
    async showAllImage(res) {
      if (window.Viewer.scene.primitives.length != null) {
        window.Viewer.scene.primitives.removeAll();
      }
      if (this.$store.state.primitLayer != null) {
        sgworld.Creator.DeleteObject(this.$store.state.primitLayer);
        this.$store.state.primitLayer = null;
      }
      for (var i in res) {
        let properties = res[i];
        var param = {
          gid: res[i].gid,
          name: this.listdata.name,
@@ -647,8 +655,8 @@
        var val1 = decr(data.result);
        if (val1) {
          var wkt = this.$wkt.parse(val1);
          this.getprimitiLayer(wkt);
          this.primitivesAddLayer(wkt);
          // this.getprimitiLayer(wkt);
          this.primitivesAddLayer(wkt, properties);
        }
      }
    },
@@ -661,42 +669,75 @@
          break;
      }
    },
    primitivesAddLayer(res) {
    primitivesAddLayer(res, properties) {
      switch (res.type) {
        case "Point":
          var val = Cesium.Cartesian3.fromDegrees(
            res.coordinates[0],
            res.coordinates[1],
            200
            res.coordinates[1]
          );
          this.$store.state.primitLayer.add({
          var point = Viewer.entities.add({
            position: val,
            image: SmartEarthRootUrl + "Workers/image/mark.png",
            properties: properties,
            tag: "properties_point",
            billboard: {
              // 图像地址,URI或Canvas的属性
              image: SmartEarthRootUrl + "Workers/image/mark.png",
              heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
              // 大小是否以米为单位
              sizeInMeters: false,
              // 相对于坐标的垂直位置
              verticalOrigin: Cesium.VerticalOrigin.CENTER,
              // 相对于坐标的水平位置
              horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
              // 应用于图像的统一比例。比例大于会1.0放大标签,而比例小于会1.0缩小标签。
              scale: 1.0,
              // 是否显示
              show: true,
            },
          });
          point.billboard.disableDepthTestDistance = Number.POSITIVE_INFINITY;
          this.$store.state.queryInfo.push(point);
          //点击事件
          window.propertieshandler = new Cesium.ScreenSpaceEventHandler(
            sgworld.Viewer.scene.canvas
          );
          window.propertieshandler.setInputAction(event => {
            let pick = sgworld.Viewer.scene.pick(event.position);
            // ;
            if (pick && pick.id && pick.id.tag == "properties_point") {
              this.$store.state.propertiesFlag = '1';
              let properties = pick.id.properties;
              let propertyNames = pick.id.properties.propertyNames;
              let obj = {};
              obj["eventid"] = properties['_eventid']._value;
              this.attributeData.forEach(item => {
                propertyNames.forEach(itemElement => {
                  if (itemElement == item.field) {
                    obj[item.alias] = properties[itemElement]._value
                  }
                })
              })
              this.$store.state.propertiesInfo = obj;
            }
          }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
          break;
        case "LineString":
        case "MultiLineString":
          var line = res.coordinates[0];
          var std = [];
          for (var i in line) {
            std.push(line[i][0], line[i][1]);
          }
          var instance = new Cesium.GeometryInstance({
            geometry: new Cesium.GroundPolylineGeometry({
          var polyline = Viewer.entities.add({
            polyline: {
              positions: Cesium.Cartesian3.fromDegreesArray(std),
              width: 4.0,
            }),
            attributes: {
              color: Cesium.ColorGeometryInstanceAttribute.fromColor(
                new Cesium.Color(1.0, 0.0, 0.0, 0.3)
              ),
              width: 5,
              material: new Cesium.Color(1.0, 0.0, 0.0, 0.3),
              clampToGround: true,
            },
          });
          window.Viewer.scene.primitives.add(
            new Cesium.GroundPolylinePrimitive({
              geometryInstances: instance,
              appearance: new Cesium.PolylineColorAppearance(),
            })
          );
          this.$store.state.queryInfo.push(polyline);
          break;
        case "MultiPolygon":
          var val = res.coordinates[0][0];
@@ -704,24 +745,16 @@
          for (var i in val) {
            std.push(val[i][0], val[i][1]);
          }
          var primitive = new Cesium.GroundPrimitive({
            //贴地的primitive
            geometryInstances: new Cesium.GeometryInstance({
              geometry: new Cesium.PolygonGeometry({
                //支持CircleGeometry,CorridorGeometry,EllipseGeometry,RectangleGeometry
                polygonHierarchy: new Cesium.PolygonHierarchy(
                  Cesium.Cartesian3.fromDegreesArray(std)
                ),
              }),
              attributes: {
                color: Cesium.ColorGeometryInstanceAttribute.fromColor(
                  new Cesium.Color(1.0, 0.0, 0.0, 0.3)
                ),
              },
            }),
            appearance: Cesium.EllipsoidSurfaceAppearance(),
          var entity = Viewer.entities.add({
            polygon: {
              hierarchy: Cesium.Cartesian3.fromDegreesArray(std),
              //height : 100000,
              material: new Cesium.Color(1.0, 0.0, 0.0, 0.3),
              outline: true,
              outlineColor: new Cesium.Color(1.0, 0.0, 0.0, 0.3),
            },
          });
          window.Viewer.scene.primitives.add(primitive);
          this.$store.state.queryInfo.push(entity);
          break;
      }
    },
@@ -746,9 +779,12 @@
      }
    });
  },
  destroyed() {
    this.$store.state.propertiesFlag = null;
  }
};
</script>
<style scoped lang="less">
.menuPop {
  width: 100%;
@@ -792,7 +828,8 @@
      width: 100%;
    }
    .tableBox {
      height: 327px;
      position: relative;
      height: 89%;
    }
    .rightPage {
      margin-left: 50px;
@@ -812,4 +849,3 @@
  padding: 5px;
}
</style>