管道基础大数据平台系统开发-【前端】-新系統界面
Surpriseplus
2023-02-16 c2a1e5ca8c702739ac0753accd65004926867bed
用户管理批量修改用户密码,数据上传附件上传
已修改5个文件
328 ■■■■■ 文件已修改
src/assets/lang/en.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/lang/zh.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/Synthesis/LeftMenu.vue 279 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/datamanage/dataUpdata.vue 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/maintenance/userManagement.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/lang/en.js
@@ -427,8 +427,8 @@
  },
  synthesis: {
    DownloadList: 'Download List',
    import: 'Import',
    export: 'Export',
    import: 'Import KML',
    export: 'Export KML',
    pipelineAnalysis: 'Pipeline analysis',
    sceneExtraction: 'Scene extraction',
    synthesis: 'Comprehensive Display',
src/assets/lang/zh.js
@@ -422,8 +422,10 @@
    },
  },
  synthesis: {
    import: '导入',
    export: '导出',
    import: '导入KML',
    export: '导出KML',
    import1:'导入SHP',
    export1: '导出SHP',
    pipelineAnalysis: '管道分析',
    synthesis: '综合展示',
    DownloadList: '下载列表',
src/views/Synthesis/LeftMenu.vue
@@ -21,6 +21,16 @@
      class="file"
      style="display: none"
    />
    <input
      :accept="'.shp, .shx, .dbf, .prj'"
      style="display: none"
      ref="pathClear"
      type="file"
      name="file"
      id="shpFile"
      multiple="multiple"
      @change="handleOpenShp()"
    />
  </div>
</template>
@@ -29,6 +39,8 @@
import mapinfo from '../Tools/mapinfo.vue';
import maplayer from '../Tools/maplayer.vue';
import queryinfo from '../Tools/queryinfo.vue';
import $ from 'jquery'
import { getToken } from '@/utils/auth';
import {
  OverviewMap,
  defaults as defaultControls,
@@ -36,6 +48,9 @@
  ScaleLine,
  Rotate,
} from "ol/control.js"
import * as turf from '@turf/turf';
import { geometry } from '@turf/turf';
export default {
  components: { mapinfo, maplayer, queryinfo },
  data() {
@@ -303,10 +318,10 @@
            css: 'twoMenu_imge81',
          },
          {
            id: "h8",
            label: "synthesis.textLabel",
            name: "文本点",
            css: "twoMenu_imge81",
            id: 'h8',
            label: 'synthesis.addlabel',
            name: '文字',
            css: 'twoMenu_imge88',
          },
          {
            id: 'h2',
@@ -329,21 +344,30 @@
          {
            id: 'h5',
            label: 'synthesis.import',
            name: '导入',
            name: '导入KML',
            css: 'twoMenu_imge85',
          },
          {
            id: 'h6',
            label: 'synthesis.export',
            name: '导出',
            name: '导出KML',
            css: 'twoMenu_imge86',
          },
          {
            id: 'h8',
            label: 'synthesis.addlabel',
            name: '文字',
            css: 'twoMenu_imge88',
          },
          // {
          //   id: 'h9',
          //   label: 'synthesis.import1',
          //   name: '导入SHP',
          //   css: 'twoMenu_imge85',
          // },
          // {
          //   id: 'h10',
          //   label: 'synthesis.export1',
          //   name: '导出SHP',
          //   css: 'twoMenu_imge86',
          // },
          {
            id: 'h7',
            label: 'synthesis.removepaint',
@@ -378,13 +402,14 @@
      UndergroundMode: false,
      scaleLine: null,
      Excavation: false,
      entityaLayers: [],
    };
  },
  methods: {
    //二級菜单点击切换
    setChangeTwoMenu(res) {
      //清除绘制图形对象
      sgworld.Creator.SimpleGraphic.clear();
      // sgworld.Creator.SimpleGraphic.clear();
      if (window.Viewer.scene.primitives.length != null) {
        window.Viewer.scene.primitives.removeAll();
      }
@@ -476,8 +501,19 @@
        case 'h6':
          this.handleSaveClick();
          break;
        case 'h9':
          // this.handleOpenShp();
          $("#shpFile").click();
          break;
        case 'h10':
          this.handleSaveShp();
          break;
        case 'h7':
          sgworld.Creator.SimpleGraphic.clear();
          for (var i in this.entityaLayers) {
            sgworld.Viewer.entities.remove(this.entityaLayers[i]);
          }
          this.entityaLayers = [];
          break;
        case 'h8':
          sgworld.Creator.createSimpleGraphic('label', {}, function (entity) {
@@ -524,8 +560,222 @@
        alert('当前场景没有entities实体');
      }
    },
    handleSaveShp() {
      var entities = sgworld.Viewer.entities.values;
      if (entities.length == 0) {
        return;
      }
      var std = [];
      for (var i in entities) {
        var type, fillColor, alpha, wkt, name;
        var bak = {}
        if (entities[i].name) {
          name = entities[i].name
        }
        if (entities[i].properties) {
          var properties = entities[i].properties.propertyNames;
          for (var j in properties) {
            bak[properties[j]] = entities[i].properties[properties[j]]._value;
          }
        } else {
          bak = {
            "name": entities[i].name
          }
        }
        if (entities[i].rectangle) {//矩形
          type = 'rectangle'
          var east = Cesium.Math.toDegrees(entities[i].rectangle.coordinates.getValue().east);
          var north = Cesium.Math.toDegrees(entities[i].rectangle.coordinates.getValue().north);
          var west = Cesium.Math.toDegrees(entities[i].rectangle.coordinates.getValue().west);
          var south = Cesium.Math.toDegrees(entities[i].rectangle.coordinates.getValue().south);
          var line = turf.lineString([[east, north], [west, south]])
          wkt = this.$wkt.convert(line.geometry)
          var fill = entities[i].rectangle._material._color._value;
          fillColor = fill.red + ',' + fill.green + ',' + fill.blue;
          alpha = fill.alpha;
        } else if (entities[i].point) {//点
          type = 'point'
          let ellipsoid = Viewer.scene.globe.ellipsoid;
          let cartographic = ellipsoid.cartesianToCartographic(entities[i].position.getValue());
          let lat = Cesium.Math.toDegrees(cartographic.latitude);
          let lng = Cesium.Math.toDegrees(cartographic.longitude);
          let alt = cartographic.height;
          let point = turf.point([lng, lat, alt])
          wkt = this.$wkt.convert(point.geometry)
          var fill = entities[i].point._color._value;
          fillColor = fill.red + ',' + fill.green + ',' + fill.blue;
          alpha = fill.alpha;
        } else if (entities[i].polygon) {
          type = 'polygon';
          var fill = entities[i].polygon._material._color._value;
          fillColor = fill.red + ',' + fill.green + ',' + fill.blue;
          alpha = fill.alpha;
          var geometry = entities[i].polygon.hierarchy.getValue().positions;
          var coordinates = [];
          for (var k in geometry) {
            coordinates.push(this.setCartesianToEightFour(geometry[k]))
          }
          if (coordinates[0] != coordinates[1]) {
            coordinates.push(coordinates[0])
          }
          var polygon = turf.polygon([coordinates])
          wkt = this.$wkt.convert(polygon.geometry)
        } else if (entities[i].polyline) {
          type = "polyline";
          var coordinates = [];
          var geometry = entities[i].polyline.positions.getValue();
          for (var k in geometry) {
            coordinates.push(this.setCartesianToEightFour(geometry[k]))
          }
          var polyline = turf.lineString(coordinates)
          wkt = this.$wkt.convert(polyline.geometry)
          var fill = entities[i].polyline._material._color._value;
          fillColor = fill.red + ',' + fill.green + ',' + fill.blue;
          alpha = fill.alpha;
        } else if (entities[i].label) {
          type = "label";
          let ellipsoid = Viewer.scene.globe.ellipsoid;
          let cartographic = ellipsoid.cartesianToCartographic(entities[i].position.getValue());
          let lat = Cesium.Math.toDegrees(cartographic.latitude);
          let lng = Cesium.Math.toDegrees(cartographic.longitude);
          let alt = cartographic.height;
          let point = turf.point([lng, lat, alt])
          wkt = this.$wkt.convert(point.geometry)
          var fill = entities[i].label.backgroundColor._value;
          fillColor = fill.red + ',' + fill.green + ',' + fill.blue;
          alpha = fill.alpha;
        }
        std.push({
          id: parseInt(i) + 1,
          type: type,
          fillColor: fillColor,
          opacity: alpha,
          name: name,
          bak: JSON.stringify(bak),
          wkt: wkt
        })
      }
      $.ajax({
        url: BASE_URL + "/comprehensive/downloadShp?token=" + getToken(),
        type: "POST",
        data: JSON.stringify(std),
        dataType: 'json', // html、json、jsonp、script、text
        contentType: "application/json", // "application/x-www-form-urlencoded"
        success: (rs) => {
          if (rs && rs.code == 200) {
            var a = document.createElement('a'); // 创建一个a标签元素
            a.style.display = 'none'; // 设置元素不可见
            a.href = BASE_URL + "/comprehensive/downloadFile?token=" + getToken() + "&guid=" + rs.result;
            document.body.appendChild(a); // 加入
            a.click(); // 触发点击,下载
            document.body.removeChild(a); // 释放
          }
        },
        error: function (e) {
        }
      });
    },
    handleOpenShp() {
      var formData = new FormData();
      var fs = document.getElementById("shpFile");
      var exts = [".shp", ".shx", ".dbf", ".prj"];
      var count = 0;
      for (var i = 0, c = fs.files.length; i < c; i++) {
        var name = fs.files[i].name.toLocaleLowerCase();
        var ext = name.substring(name.lastIndexOf("."));
        if (exts.indexOf(ext) > -1) {
          count++;
          formData.append(fs.files[i].name, fs.files[i]); // fs.files[i].name,file
        }
      }
      if (count != 4) {
        alert("ShapeFile文件选择不全!");
        return;
      }
      var that = this;
      $.ajax(BASE_URL + "/comprehensive/uploadShp?token=" + getToken(), {
        type: "post",
        data: formData,
        async: true,
        cache: false,
        processData: false,
        contentType: false,
        success: function (rs) {
          if (rs.code == 200) {
            that.showShpEntity(rs.result);
          }
        },
        error: function (e) {
          console.error(e);
        }
      });
    },
    showShpEntity(res) {
      for (var i in res) {
        var wkt = this.$wkt.parse(res[i].wkt);
        var fillColor = res[i].fillColor.split(",");
       var color = new Cesium.Color(fillColor[0], fillColor[1], fillColor[2], res[i].opacity)
        switch (res[i].type) {
          case 'rectangle':
            debugger
            break;
          case 'point':
            debugger
            break;
          case 'polygon':
            var std = [];
            var geo = wkt.coordinates[0];
            for (var i in geo) {
              std.push(geo[i][0])
              std.push(geo[i][1])
            }
            const entity = Viewer.entities.add({
              name: 'Wyoming',
              polygon: {
                hierarchy: Cesium.Cartesian3.fromDegreesArray(std),
                //height : 100000,
                material:color,
                outline: true,
                outlineColor: color,
              }
            })
            this.entityaLayers.push(entity)
            break;
          case 'polyline':
            debugger
            break;
          case 'label':
            debugger
            break;
        }
      }
    },
    setCartesianToEightFour(res) {
      var std = [];
      let ellipsoid = Viewer.scene.globe.ellipsoid;
      let cartographic = ellipsoid.cartesianToCartographic(res);
      let lat = Cesium.Math.toDegrees(cartographic.latitude);
      let lng = Cesium.Math.toDegrees(cartographic.longitude);
      let alt = cartographic.height;
      std = [lng, lat, alt]
      return std;
    },
    handleOpenClick() {
      var that = this;
      sgworld.Creator.SimpleGraphic.edit(true, { editProp: true });
      let fileInput = document.querySelector('.file');
      fileInput.onchange = function (evt) {
@@ -544,9 +794,10 @@
              fileReader.result,
              kmlOptions
            );
            geocachePromise.then(function (dataSource) {
              var geocacheEntities = dataSource.entities.values;
              that.entityaLayers = geocacheEntities;
              for (var i = 0; i < geocacheEntities.length; i++) {
                var entity = geocacheEntities[i];
src/views/datamanage/dataUpdata.vue
@@ -25,7 +25,10 @@
            class="demo-form-inline"
          >
            <!-- 入库类型 -->
            <el-form-item :label="$t('dataManage.dataUpObj.UploadType')" style="margin-right: 2%">
            <el-form-item
              :label="$t('dataManage.dataUpObj.UploadType')"
              style="margin-right: 2%"
            >
              <el-select
                :disabled="tableData.length == 0 ? false : true"
                v-model="formInline.uploadType"
@@ -97,7 +100,10 @@
              </el-select>
            </el-form-item>
            <!-- 数据版本 -->
            <el-form-item :label="$t('dataManage.dataUpObj.dataVersion')" style="margin-right: 2%">
            <el-form-item
              :label="$t('dataManage.dataUpObj.dataVersion')"
              style="margin-right: 2%"
            >
              <el-select
                :popper-append-to-body="false"
                :disabled="tableData.length == 0 ? false : true"
@@ -114,7 +120,10 @@
              </el-select>
            </el-form-item>
            <!-- 数据专业 -->
            <el-form-item :label="$t('dataManage.dataUpObj.dataSpecialty')" style="margin-right: 2%">
            <el-form-item
              :label="$t('dataManage.dataUpObj.dataSpecialty')"
              style="margin-right: 2%"
            >
              <el-select
                :popper-append-to-body="false"
                :disabled="tableData.length == 0 ? false : true"
@@ -131,7 +140,10 @@
              </el-select>
            </el-form-item>
            <!-- 坐标系 -->
            <el-form-item :label="$t('dataManage.dataUpObj.coordinateSystem')" style="margin-right: 3%">
            <el-form-item
              :label="$t('dataManage.dataUpObj.coordinateSystem')"
              style="margin-right: 3%"
            >
              <el-select
                :popper-append-to-body="false"
                :disabled="tableData.length == 0 ? false : true"
@@ -207,7 +219,10 @@
                @change="handleMetaFileChange"
              ></input>
            </el-form-item>
            <el-form-item v-show="uploadFlag" style="margin-left: 0.7%;">
            <el-form-item
              v-show="uploadFlag"
              style="margin-left: 0.7%;"
            >
              <el-input
                placeholder="请输入内容"
                v-model="formInline.metaData"
@@ -417,7 +432,9 @@
            ref="filterTable"
            :data="waretableData"
            style="width: 100%"
            height="99%">
                height="99%"
                @selection-change="handleDelteChange"
              >
            <el-table-column
                type="selection"
                width="55"
@@ -498,9 +515,7 @@
              />
      </el-table>
        </div>
        <div
          class="pagination_box"
        >
            <div class="pagination_box">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
@@ -2457,5 +2472,4 @@
      }
    }
  }
</style>
src/views/maintenance/userManagement.vue
@@ -93,6 +93,8 @@
            :data="tableData"
            style="width: 100%"
            height="90%"
              @selection-change="handleSelectionChange"
          >
          <el-table-column
          type="selection"
@@ -1041,10 +1043,13 @@
    },
    //重置密码
    editPwd() {
      var std = [];
      for (var i in this.multipleSelection) {
        std.push(this.multipleSelection[i].id);
      }
      if (std.length == 0) {
        alert('请先选择用户');
        return;