|
@@ -1,356 +1,516 @@
|
|
|
|
|
|
+import { iServerBaseUrl } from '@/views/MapView/map.config'
|
|
|
import 'viewerjs/dist/viewer.css';
|
|
|
-import { Style,Fill,Stroke,Circle,Text } from "ol/style";
|
|
|
+import { Style, Fill, Stroke, Circle, Text } from "ol/style";
|
|
|
import { GeoJSON } from "ol/format";
|
|
|
-import { Point,Polygon,LineString } from "ol/geom";
|
|
|
+import { Point, Polygon, LineString } from "ol/geom";
|
|
|
import { Feature } from "ol";
|
|
|
-import { Select,Pointer,Draw,Modify,Snap,Translate} from "ol/interaction";
|
|
|
-import { createRegularPolygon,createBox } from "ol/interaction/Draw";
|
|
|
-import { Range,TileSuperMapRest as olTileSuperMapRest,TileWMS,Vector as SourceVector} from "ol/source";
|
|
|
-import { Image, Vector as LayerVector, Tile as TileLayer } from 'ol/layer';
|
|
|
+import { Select, Pointer, Draw, Modify, Snap, Translate } from "ol/interaction";
|
|
|
+import { createRegularPolygon, createBox } from "ol/interaction/Draw";
|
|
|
+import { Range, TileSuperMapRest as olTileSuperMapRest, TileWMS, Vector as SourceVector } from "ol/source";
|
|
|
+import { Image, Vector as LayerVector, Tile as TileLayer } from 'ol/layer';
|
|
|
+import { Vector as VectorSource } from 'ol/source';
|
|
|
+import { Vector as VectorLayer } from 'ol/layer';
|
|
|
import { altKeyOnly, click, pointerMove } from "ol/events/condition";
|
|
|
-import { Logo, TileSuperMapRest,FeatureService,QueryService,MapboxStyles, SuperMap} from '@supermap/iclient-ol';
|
|
|
-import { pipelineMaintain,pipelineMaintainPage } from '@/api/kxc/pipelineSystem';
|
|
|
-import { parseTime,getDateFormat } from '@/utils/index';
|
|
|
-import { addShape,addGisData, getDataSets, confirmDatasetImport } from '@/api/kxc/spatialDataMng';
|
|
|
+import { Logo, TileSuperMapRest, FeatureService, QueryService, MapboxStyles, SuperMap } from '@supermap/iclient-ol';
|
|
|
+import { pipelineMaintain, pipelineMaintainPage } from '@/api/kxc/pipelineSystem';
|
|
|
+import { parseTime, getDateFormat } from '@/utils/index';
|
|
|
+import { addShape, addGisData, getDataSets, confirmDatasetImport } from '@/api/kxc/spatialDataMng';
|
|
|
import { init } from 'echarts';
|
|
|
-export default {
|
|
|
- components:{},
|
|
|
- props: ['data'],
|
|
|
- data() {
|
|
|
- return {
|
|
|
- map: null,
|
|
|
- config: null,
|
|
|
- url:'',
|
|
|
- layerNames: [],
|
|
|
- sunmitShow:false,
|
|
|
- helloTaskId:'',
|
|
|
- imgFlag: false,
|
|
|
- message:'',
|
|
|
- Wordmessage:'',
|
|
|
- fileNmae:'',
|
|
|
- wordFlag: false,
|
|
|
- uploadFile: null,
|
|
|
- layerType: 'pipeline',
|
|
|
- fileType:'1',
|
|
|
- layerName: '',
|
|
|
- queryVectorSource: '',
|
|
|
- importedFeatureIds: [],
|
|
|
- impFeaturesId: null,
|
|
|
- iserverPath: [],
|
|
|
- loading:true,
|
|
|
- uploading:false,
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
|
|
|
- },
|
|
|
- watch: {
|
|
|
- layerType(next, prv) {
|
|
|
- this.layerType = next;
|
|
|
- this.getLayerInfo();
|
|
|
+import { getSourceLists } from '@/api/base'
|
|
|
+export default {
|
|
|
+ components: {},
|
|
|
+ props: ['data'],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ vectorLayer: null,
|
|
|
+ layersOptions: [],
|
|
|
+ map: null,
|
|
|
+ config: null,
|
|
|
+ url: '',
|
|
|
+ layerNames: [],
|
|
|
+ sunmitShow: false,
|
|
|
+ message: '',
|
|
|
+ Wordmessage: '',
|
|
|
+ fileName: '',
|
|
|
+ wordFlag: false,
|
|
|
+ uploadFile: null,
|
|
|
+ layerType: 'pipeline',
|
|
|
+ fileType: '1',
|
|
|
+ checked: true,
|
|
|
+ layerName: '',
|
|
|
+ queryVectorSource: '',
|
|
|
+ importedFeatureIds: [],
|
|
|
+ impFeaturesId: null,
|
|
|
+ iserverPath: [],
|
|
|
+ loading: true,
|
|
|
+ uploading: false,
|
|
|
+ loadingtext: '数据上传中……',
|
|
|
+ fields: [],
|
|
|
+ featuresTable: []
|
|
|
+ }
|
|
|
},
|
|
|
+ computed: {
|
|
|
|
|
|
-
|
|
|
- * 监听导入要素Id的变化
|
|
|
- */
|
|
|
- impFeaturesId(next, prve) {
|
|
|
- console.log(next, prve);
|
|
|
- this.queryFeatureById(next);
|
|
|
},
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.config = this.data.that.config;
|
|
|
- this.map = this.data.that.map;
|
|
|
- if (this.$store.state.permission.hasOwnProperty('sysDics')) {
|
|
|
- if (this.$store.state.permission.sysDics.hasOwnProperty('iserverPath')) {
|
|
|
- this.iserverPath = this.$store.state.permission.sysDics.iserverPath;
|
|
|
- } else {
|
|
|
- this.$message.error('未获取到iserver地址字典信息,通知管理员检查问题!');
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- mounted() {
|
|
|
- this.init();
|
|
|
- },
|
|
|
+ watch: {
|
|
|
+
|
|
|
+ '$store.state.map.P_editableTabsValue': function(val, oldVal) {
|
|
|
+ if (val == 'spatialDataImport')
|
|
|
+ this.vectorLayer.setVisible(this.checked)
|
|
|
+ else
|
|
|
+ this.vectorLayer.setVisible(false)
|
|
|
+ },
|
|
|
+ layerType(next, prv) {
|
|
|
+ this.layerType = next;
|
|
|
+ this.getLayerInfo();
|
|
|
+ },
|
|
|
|
|
|
- destroyed() {
|
|
|
- console.log('---销毁窗体---')
|
|
|
- this.clearSource();
|
|
|
- },
|
|
|
-
|
|
|
- methods: {
|
|
|
-
|
|
|
- * 初始化
|
|
|
- */
|
|
|
- init() {
|
|
|
- if (this.iserverPath.length > 0)
|
|
|
- this.url = this.iserverPath[0].value;
|
|
|
- this.getLayerInfo();
|
|
|
+
|
|
|
+ * 监听导入要素Id的变化
|
|
|
+ */
|
|
|
+ impFeaturesId(next, prve) {
|
|
|
+ console.log(next, prve);
|
|
|
+ this.queryFeatureById(next);
|
|
|
+ },
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
- * 获取数据集信息
|
|
|
- */
|
|
|
- getLayerInfo() {
|
|
|
- this.layerNames = [];
|
|
|
- this.loading = true;
|
|
|
- let param = {
|
|
|
- targetDataSourceType:this.layerType
|
|
|
- }
|
|
|
- getDataSets(param).then(res => {
|
|
|
- if (res.code == 1) {
|
|
|
- if (res.result.hasOwnProperty('TargetDataSet')) {
|
|
|
- this.layerNames = [];
|
|
|
- this.loading = false;
|
|
|
- res.result.TargetDataSet.forEach(item => {
|
|
|
- if(item.hasOwnProperty('dataSource') && item.hasOwnProperty('dataSets') && item.hasOwnProperty('dataUrl'))
|
|
|
- this.layerNames.push({
|
|
|
- key: item.dataSource + ':' + item.dataSets,
|
|
|
- value: item.hasOwnProperty('name') ? item.name : '',
|
|
|
- url: item.dataUrl,
|
|
|
- dataSource:item.dataSource
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
+ created() {
|
|
|
+ this.config = this.data.that.config;
|
|
|
+ this.map = this.data.that.map;
|
|
|
+ if (this.$store.state.permission.hasOwnProperty('sysDics')) {
|
|
|
+ if (this.$store.state.permission.sysDics.hasOwnProperty('iserverPath')) {
|
|
|
+ this.iserverPath = this.$store.state.permission.sysDics.iserverPath;
|
|
|
+ } else {
|
|
|
+ this.$message.error('未获取到iserver地址字典信息,通知管理员检查问题!');
|
|
|
+ }
|
|
|
}
|
|
|
- else {
|
|
|
- this.$message('查询失败,失败原因:' + res.message);
|
|
|
- }
|
|
|
- }).catch(msg => {
|
|
|
-
|
|
|
- }).finally(() => {
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
},
|
|
|
-
|
|
|
- refrashLayer() {
|
|
|
- this.getLayerInfo();
|
|
|
+ mounted() {
|
|
|
+ this.init();
|
|
|
+
|
|
|
+ this.vectorLayer = new VectorLayer({
|
|
|
+ source: new VectorSource(),
|
|
|
+ style: new Style({
|
|
|
+ stroke: new Stroke({
|
|
|
+ width: 5,
|
|
|
+ color: '#00ffff'
|
|
|
+ }),
|
|
|
+ fill: new Fill({
|
|
|
+ color: 'rgba(255,255,255,0.8)'
|
|
|
+ }),
|
|
|
+ image: new Circle({
|
|
|
+ radius: 6,
|
|
|
+ stroke: new Stroke({
|
|
|
+ width: 2,
|
|
|
+ color: '#ed1941'
|
|
|
+ }),
|
|
|
+ fill: new Fill({
|
|
|
+ color: '#00ffff'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.data.that.map.addLayer(this.vectorLayer)
|
|
|
},
|
|
|
|
|
|
- handleChange(file, fileList) {
|
|
|
- const name = file.name.split('.')[1];
|
|
|
- this.uploadFile = file.raw;
|
|
|
+ destroyed() {
|
|
|
+ console.log('---销毁窗体---')
|
|
|
+
|
|
|
+ this.data.that.map.removeLayer(this.vectorLayer)
|
|
|
},
|
|
|
|
|
|
- handleExceed(files,fileList){
|
|
|
- this.message="只允许上传一个文件";
|
|
|
- },
|
|
|
+ methods: {
|
|
|
+
|
|
|
+ * 初始化
|
|
|
+ */
|
|
|
+ init() {
|
|
|
+ if (this.iserverPath.length > 0)
|
|
|
+ this.url = this.iserverPath[0].value;
|
|
|
+
|
|
|
+ this.getSouceList()
|
|
|
+ },
|
|
|
+
|
|
|
+ * 获取数据集信息
|
|
|
+ */
|
|
|
+ async getSouceList() {
|
|
|
+ await getSourceLists().then(res => {
|
|
|
+ console.log('查询数据集选项', res)
|
|
|
+ let gis = { label: "基础GIS", options: [] }
|
|
|
+ let pipeline = { label: "综合管线", options: [] }
|
|
|
+ let building = { label: "公房宗地", options: [] }
|
|
|
+ res.result.forEach(item => {
|
|
|
+ if (!item.dataUrl) return
|
|
|
+ let row = {
|
|
|
+ key: item.dataSource + ':' + item.dataSets,
|
|
|
+ dataSets: item.dataSets,
|
|
|
+ value: item.hasOwnProperty('name') ? item.name : '',
|
|
|
+ url: item.dataUrl,
|
|
|
+ dataSource: item.dataSource,
|
|
|
+ item: item
|
|
|
+ }
|
|
|
+ switch (item.systemName) {
|
|
|
+ case '1':
|
|
|
+ gis.options.push(row)
|
|
|
+ break;
|
|
|
+ case '2':
|
|
|
+ case '4':
|
|
|
+ pipeline.options.push(row)
|
|
|
+ break;
|
|
|
+ case '3':
|
|
|
+ case '6':
|
|
|
+ building.options.push(row)
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- beforeAvatarUpload(file){
|
|
|
- var FileExt = file.name.replace(/.+\./, "");
|
|
|
- if (['zip', 'rar'].indexOf(FileExt.toLowerCase()) === -1){
|
|
|
- this.message="文件格式有误,请重新上传"
|
|
|
- return false;
|
|
|
- }
|
|
|
- this.message="上传中,请稍等"
|
|
|
- },
|
|
|
+ });
|
|
|
+ this.layersOptions = [pipeline, building, gis]
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ * 获取数据集信息
|
|
|
+ */
|
|
|
+ async getLayerInfo() {
|
|
|
+ const dataSourceTypeArr = [
|
|
|
+ { name: 'pipeline', label: '综合管线' },
|
|
|
+ { name: 'building', label: '公房系统' },
|
|
|
+ { name: 'gis', label: '基础地理信息' }
|
|
|
+ ]
|
|
|
+ let arrRes = []
|
|
|
+ for (let i = 0; i < dataSourceTypeArr.length; i++) {
|
|
|
+ let param = { targetDataSourceType: dataSourceTypeArr[i].name }
|
|
|
+ await getDataSets(param).then(res => {
|
|
|
+ if (res.code == 1) {
|
|
|
+ if (res.result.hasOwnProperty('TargetDataSet') && res.result.TargetDataSet.length > 0) {
|
|
|
+ let layerNames = [];
|
|
|
+ res.result.TargetDataSet.forEach(item => {
|
|
|
+ if (item.hasOwnProperty('dataSource') && item.hasOwnProperty('dataSets') && item.hasOwnProperty('dataUrl'))
|
|
|
+ layerNames.push({
|
|
|
+ key: item.dataSource + ':' + item.dataSets,
|
|
|
+ dataSets: item.dataSets,
|
|
|
+ value: item.hasOwnProperty('name') ? item.name : '',
|
|
|
+ url: item.dataUrl,
|
|
|
+ dataSource: item.dataSource,
|
|
|
+ item: item
|
|
|
+ });
|
|
|
+ });
|
|
|
+ arrRes.push({
|
|
|
+ label: dataSourceTypeArr[i].label,
|
|
|
+ options: layerNames
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message.error('查询失败,失败原因:' + res.message);
|
|
|
+ }
|
|
|
+ }).catch(msg => {
|
|
|
|
|
|
- handleError(err, file, fileList){
|
|
|
- this.message="上传失败";
|
|
|
- },
|
|
|
+ }).finally(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.layersOptions = arrRes
|
|
|
+ },
|
|
|
+ selectLayerChange() {
|
|
|
+ console.log('目标图层:', this.layerName)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
|
|
|
- handleSuccess(response, file, fileList){
|
|
|
- this.message="上传成功";
|
|
|
- },
|
|
|
+ refrashLayer() {
|
|
|
+ this.getLayerInfo();
|
|
|
+ },
|
|
|
|
|
|
- submitUpload() {
|
|
|
- if (this.layerName == '') {
|
|
|
- this.$message('请选择目标要素');
|
|
|
- return;
|
|
|
- }
|
|
|
- if (this.uploadFile == null) {
|
|
|
- this.$message('请选择需要上传的文件');
|
|
|
- return;
|
|
|
- }
|
|
|
- let uploadForm = new FormData();
|
|
|
- uploadForm.append('targetDataSetName', this.layerName);
|
|
|
- uploadForm.append('uploadDataType', this.layerType);
|
|
|
- uploadForm.append('uploadFileType', this.fileType);
|
|
|
- uploadForm.append('', this.uploadFile);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- this.uploading = true;
|
|
|
- addGisData(uploadForm).then(response => {
|
|
|
- if (response !== undefined) {
|
|
|
- this.$message('info', '上传成功!');
|
|
|
- this.showImportSpatial(response.result);
|
|
|
- }
|
|
|
- }).catch(msg=>{
|
|
|
-
|
|
|
- }).finally(()=>{
|
|
|
- this.uploading = false;
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- * 显示导入数据列表
|
|
|
- */
|
|
|
- showImportSpatial(data) {
|
|
|
-
|
|
|
- if (Object.prototype.toString.call(data) === "[object Array]") {
|
|
|
- this.importedFeatureIds = data;
|
|
|
- this.impFeaturesId = this.importedFeatureIds[0].id;
|
|
|
- }
|
|
|
- else if (Object.prototype.toString.call(data) === '[object Object]') {
|
|
|
- this.importedFeatureIds = [];
|
|
|
- this.importedFeatureIds.push(data);
|
|
|
- this.impFeaturesId = data.hasOwnProperty('id') ? data.id : '';
|
|
|
- }
|
|
|
- },
|
|
|
+ handleChange(file, fileList) {
|
|
|
+ this.fileName = file.name
|
|
|
+ this.uploadFile = file.raw;
|
|
|
+ },
|
|
|
|
|
|
-
|
|
|
- * 根据ID查询要素
|
|
|
- * @id 正式数据ID 不能为空
|
|
|
- * */
|
|
|
- queryFeatureById(id) {
|
|
|
- if (id == null) return;
|
|
|
- if (this.importedFeatureIds.length < 1) return;
|
|
|
- let feaInfo = this.importedFeatureIds.find(fea => fea.id == id);
|
|
|
- if (!feaInfo) return;
|
|
|
- let datasetName = feaInfo.hasOwnProperty('tempDataSetName') ? feaInfo.tempDataSetName : (feaInfo.hasOwnProperty('tempDatasetName') ? feaInfo.tempDatasetName : '');
|
|
|
- if (datasetName == null || datasetName == '') {
|
|
|
- this.$message.error('为获取到数据集,请联系管理员检查!');
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (this.layerNames.length < 1) return;
|
|
|
- let layer = this.layerNames.find(layer => layer.value == this.layerName);
|
|
|
- if(!layer) return
|
|
|
- let dataSource = layer.dataSource;
|
|
|
- let url = layer.url;
|
|
|
- let datasetNames = [dataSource+':'+datasetName];
|
|
|
- let IDs = [];
|
|
|
- if (id != null) IDs.push(parseInt(id));
|
|
|
-
|
|
|
- var idsParam = new SuperMap.GetFeaturesByIDsParameters({
|
|
|
- IDs: IDs,
|
|
|
- datasetNames: datasetNames
|
|
|
- });
|
|
|
+ handleExceed(files, fileList) {
|
|
|
+ this.$message.warning("当前已存在一个文件!")
|
|
|
+ },
|
|
|
|
|
|
-
|
|
|
- setTimeout( ()=>{
|
|
|
-
|
|
|
- new FeatureService(url).getFeaturesByIDs(idsParam, (serviceResult) =>{
|
|
|
-
|
|
|
- if (serviceResult.hasOwnProperty("error")) {
|
|
|
- this.$message({ type: 'error', message: '导入功能,查询临时数据集数据失败,失败原因' + serviceResult.error.errorMsg });
|
|
|
- }
|
|
|
- else {
|
|
|
- let features = serviceResult.result.features;
|
|
|
- this.highLightFeature(features);
|
|
|
- }
|
|
|
- });
|
|
|
- }, 1500);
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- * 高亮显示
|
|
|
- * @features 要素
|
|
|
- */
|
|
|
- highLightFeature(features) {
|
|
|
- let geometry = features.features[0].geometry;
|
|
|
- let feature = new Feature({
|
|
|
- geometry: new GeoJSON().readGeometry(geometry)
|
|
|
- });
|
|
|
- this.clearSource();
|
|
|
- this.queryVectorSource = new SourceVector({
|
|
|
- features: (new GeoJSON()).readFeatures(features),
|
|
|
- wrapX: false
|
|
|
- });
|
|
|
- let queryResultLayer = new LayerVector({
|
|
|
- source: this.queryVectorSource,
|
|
|
- style: new Style({
|
|
|
-
|
|
|
- fill: new Fill({
|
|
|
- color: 'rgba(255, 255, 255, 0.2)'
|
|
|
- }),
|
|
|
-
|
|
|
- stroke: new Stroke({
|
|
|
- color: '#1E90FF',
|
|
|
- width: 5
|
|
|
- }),
|
|
|
-
|
|
|
- image: new Circle({
|
|
|
- radius: 7,
|
|
|
- fill: new Fill({
|
|
|
- color: '#ffcc33'
|
|
|
- })
|
|
|
+ beforeUpload(file) {
|
|
|
+ var FileExt = file.name.replace(/.+\./, "");
|
|
|
+ if (['zip', 'rar'].indexOf(FileExt.toLowerCase()) === -1) {
|
|
|
+ this.$message.error("文件格式不支持!")
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ handleError(err, file, fileList) {
|
|
|
+ this.message = "上传失败";
|
|
|
+ },
|
|
|
+
|
|
|
+ handleSuccess(response, file, fileList) {
|
|
|
+ this.message = "上传成功";
|
|
|
+ },
|
|
|
+
|
|
|
+ submitUpload() {
|
|
|
+ if (this.layerName == '') {
|
|
|
+ this.$message.warning('请选择目标要素');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.uploadFile == null) {
|
|
|
+ this.$message.warning('请选择需要上传的文件');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let uploadForm = new FormData();
|
|
|
+
|
|
|
+ uploadForm.append('targetDataSetName', this.layerName.dataSets);
|
|
|
+ uploadForm.append('uploadDataType', this.layerType);
|
|
|
+ uploadForm.append('uploadFileType', this.fileType);
|
|
|
+ uploadForm.append('', this.uploadFile);
|
|
|
+ this.uploading = true;
|
|
|
+ addGisData(uploadForm).then(res => {
|
|
|
+ this.loadingtext = "上传成功,正在获取数据……"
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ this.getTempData(res.result)
|
|
|
+ }, 1000);
|
|
|
+ }).catch(msg => {
|
|
|
+ this.uploading = false;
|
|
|
+ }).finally(() => {
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ * 获取字段信息,获取图层中文字段
|
|
|
+ */
|
|
|
+ getFields(feature) {
|
|
|
+ let type = this.layerName.item.systemName
|
|
|
+ if (type == '3')
|
|
|
+ return this.$store.state.common.buildingFields
|
|
|
+ else if (type == '6')
|
|
|
+ return this.$store.state.common.groundFields
|
|
|
+ else if (type == '2')
|
|
|
+ return this.$store.state.common.PipeLineFields
|
|
|
+ else if (type == '4')
|
|
|
+ return this.$store.state.common.PipePointFields
|
|
|
+ else {
|
|
|
+ let properties = JSON.parse(JSON.stringify(feature.properties))
|
|
|
+ let rFields = Object.keys(properties).map(item => {
|
|
|
+ return { pipelineKey: item, pipelineVal: item }
|
|
|
+ })
|
|
|
+ return rFields
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ * 获取全部临时数据
|
|
|
+ */
|
|
|
+ getTempData(res) {
|
|
|
+ let dataSource = this.layerName.dataSource;
|
|
|
+ let url = iServerBaseUrl + this.layerName.url;
|
|
|
+ let datasetNames = [dataSource + ':' + res.tempDatasetName];
|
|
|
+
|
|
|
+ let sqlParam = new SuperMap.GetFeaturesBySQLParameters({
|
|
|
+ toIndex: -1,
|
|
|
+ maxFeatures: 10000000,
|
|
|
+ datasetNames: datasetNames,
|
|
|
+ queryParameter: { attributeFilter: '' }
|
|
|
+ });
|
|
|
+
|
|
|
+ new FeatureService(url).getFeaturesBySQL(sqlParam, serviceResult => {
|
|
|
+ if (serviceResult.type == "processFailed") {
|
|
|
+ this.$message.error(`获取临时数据失败,${serviceResult.error.errorMsg}!`);
|
|
|
+ this.uploading = false;
|
|
|
+ return
|
|
|
+ }
|
|
|
+ console.log('结果', serviceResult)
|
|
|
+ let features = serviceResult.result.features
|
|
|
+ if (features.features.length > 0) {
|
|
|
+ this.fields = this.getFields(features.features[0])
|
|
|
+ this.featuresTable = features.features
|
|
|
+ this.vectorLayer.getSource().clear()
|
|
|
+ this.vectorLayer.getSource().addFeatures(new GeoJSON().readFeatures(features))
|
|
|
+ this.featuresTable = JSON.parse(JSON.stringify(features.features))
|
|
|
+ if (this.checked)
|
|
|
+ setTimeout(() => {
|
|
|
+ this.map.getView().fit(this.vectorLayer.getSource().getExtent(), { duration: 600 })
|
|
|
+ }, 200);
|
|
|
+ } else {
|
|
|
+ this.$message.warning("获取的临时数据集为查询到要素!")
|
|
|
+ }
|
|
|
+ this.uploading = false;
|
|
|
})
|
|
|
- })
|
|
|
- });
|
|
|
- this.map.addLayer(queryResultLayer);
|
|
|
- setTimeout(() => {
|
|
|
- this.map.getView().fit(feature.getGeometry().getExtent(), { duration: 600 })
|
|
|
- }, 200);
|
|
|
- },
|
|
|
+ },
|
|
|
+
|
|
|
+ * 是否显示临时数据集图层
|
|
|
+ */
|
|
|
+ showTempData(val) {
|
|
|
+ this.vectorLayer.setVisible(val)
|
|
|
+ },
|
|
|
|
|
|
-
|
|
|
- * 提交事件
|
|
|
- */
|
|
|
- btnCommitHandler() {
|
|
|
- let data = {
|
|
|
- uploadId: this.impFeaturesId,
|
|
|
- comfirmType:'Y'
|
|
|
- }
|
|
|
- this.confirmImport(data);
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- * 取消事件
|
|
|
- */
|
|
|
- btnConnalHandler() {
|
|
|
- let data = {
|
|
|
- uploadId: this.impFeaturesId,
|
|
|
- comfirmType:'N'
|
|
|
- }
|
|
|
- this.confirmImport(data);
|
|
|
- },
|
|
|
- confirmImport(data) {
|
|
|
- this.uploading = true;
|
|
|
- confirmDatasetImport(data).then(res => {
|
|
|
- if (res.code == 1) {
|
|
|
- this.$message({ type: 'success', message: '操作成功' });
|
|
|
-
|
|
|
- this.clearSource();
|
|
|
- }
|
|
|
- else {
|
|
|
- this.$message({
|
|
|
- type: 'error',
|
|
|
- message:'操作失败,失败原因' + res.message
|
|
|
- });
|
|
|
- }
|
|
|
- }).catch(msg => {
|
|
|
- this.$message.error('操作出错,错误原因:' + msg);
|
|
|
- }).finally(() => {
|
|
|
- console.log('导入数据提交,操作结束');
|
|
|
- this.uploading = false;
|
|
|
- });
|
|
|
- },
|
|
|
+
|
|
|
+ * 显示导入数据列表
|
|
|
+ */
|
|
|
+ showImportSpatial(data) {
|
|
|
+
|
|
|
+ if (Object.prototype.toString.call(data) === "[object Array]") {
|
|
|
+ this.importedFeatureIds = data;
|
|
|
+ this.impFeaturesId = this.importedFeatureIds[0].id;
|
|
|
+ }
|
|
|
+ else if (Object.prototype.toString.call(data) === '[object Object]') {
|
|
|
+ this.importedFeatureIds = [];
|
|
|
+ this.importedFeatureIds.push(data);
|
|
|
+ this.impFeaturesId = data.hasOwnProperty('id') ? data.id : '';
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
+
|
|
|
+ * 根据ID查询要素
|
|
|
+ * @id 正式数据ID 不能为空
|
|
|
+ * */
|
|
|
+ queryFeatureById(id) {
|
|
|
+ if (id == null) return;
|
|
|
+ if (this.importedFeatureIds.length < 1) return;
|
|
|
+ let feaInfo = this.importedFeatureIds.find(fea => fea.id == id);
|
|
|
+ if (!feaInfo) return;
|
|
|
+ let datasetName = feaInfo.hasOwnProperty('tempDataSetName') ? feaInfo.tempDataSetName : (feaInfo.hasOwnProperty('tempDatasetName') ? feaInfo.tempDatasetName : '');
|
|
|
+ if (datasetName == null || datasetName == '') {
|
|
|
+ this.$message.error('未获取到数据集,请联系管理员检查!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.layerNames.length < 1) return;
|
|
|
+ let layer = this.layerNames.find(layer => layer.value == this.layerName);
|
|
|
+ if (!layer) return
|
|
|
+ let dataSource = layer.dataSource;
|
|
|
+ let url = layer.url;
|
|
|
+ let datasetNames = [dataSource + ':' + datasetName];
|
|
|
+ let IDs = [];
|
|
|
+ if (id != null) IDs.push(parseInt(id));
|
|
|
+
|
|
|
+ var idsParam = new SuperMap.GetFeaturesByIDsParameters({
|
|
|
+ IDs: IDs,
|
|
|
+ datasetNames: datasetNames
|
|
|
+ });
|
|
|
|
|
|
- handleRemove(file, fileList) {
|
|
|
-
|
|
|
- },
|
|
|
- handlePreview(file) {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- * 日志
|
|
|
- */
|
|
|
- log(str){
|
|
|
- console.log((new Date()).Format('yyyy-MM-dd hh:mm:ss.S') + JSON.stringify(str))
|
|
|
- },
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+
|
|
|
+ new FeatureService(url).getFeaturesByIDs(idsParam, (serviceResult) => {
|
|
|
+
|
|
|
+ if (serviceResult.hasOwnProperty("error")) {
|
|
|
+ this.$message.error('导入功能,查询临时数据集数据失败,失败原因' + serviceResult.error.errorMsg);
|
|
|
+ } else {
|
|
|
+ let features = serviceResult.result.features;
|
|
|
+ this.highLightFeature(features);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }, 1500);
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ * 高亮显示
|
|
|
+ * @features 要素
|
|
|
+ */
|
|
|
+ highLightFeature(features) {
|
|
|
+ let geometry = features.features[0].geometry;
|
|
|
+ let feature = new Feature({
|
|
|
+ geometry: new GeoJSON().readGeometry(geometry)
|
|
|
+ });
|
|
|
+ this.clearSource();
|
|
|
+ this.queryVectorSource = new SourceVector({
|
|
|
+ features: (new GeoJSON()).readFeatures(features),
|
|
|
+ wrapX: false
|
|
|
+ });
|
|
|
+ let queryResultLayer = new LayerVector({
|
|
|
+ source: this.queryVectorSource,
|
|
|
+ style: new Style({
|
|
|
+
|
|
|
+ fill: new Fill({
|
|
|
+ color: 'rgba(255, 255, 255, 0.2)'
|
|
|
+ }),
|
|
|
+
|
|
|
+ stroke: new Stroke({
|
|
|
+ color: '#1E90FF',
|
|
|
+ width: 5
|
|
|
+ }),
|
|
|
+
|
|
|
+ image: new Circle({
|
|
|
+ radius: 7,
|
|
|
+ fill: new Fill({
|
|
|
+ color: '#ffcc33'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ });
|
|
|
+ this.map.addLayer(queryResultLayer);
|
|
|
+ setTimeout(() => {
|
|
|
+ this.map.getView().fit(feature.getGeometry().getExtent(), { duration: 600 })
|
|
|
+ }, 200);
|
|
|
+ },
|
|
|
|
|
|
- clearSource() {
|
|
|
- if(this.queryVectorSource){
|
|
|
- this.queryVectorSource.clear();
|
|
|
- }
|
|
|
+
|
|
|
+ * 提交事件
|
|
|
+ */
|
|
|
+ btnCommitHandler() {
|
|
|
+ let data = {
|
|
|
+ uploadId: this.impFeaturesId,
|
|
|
+ comfirmType: 'Y'
|
|
|
+ }
|
|
|
+ this.confirmImport(data);
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ * 取消事件
|
|
|
+ */
|
|
|
+ btnConnalHandler() {
|
|
|
+ let data = {
|
|
|
+ uploadId: this.impFeaturesId,
|
|
|
+ comfirmType: 'N'
|
|
|
+ }
|
|
|
+ this.confirmImport(data);
|
|
|
+ },
|
|
|
+ confirmImport(data) {
|
|
|
+ this.uploading = true;
|
|
|
+ confirmDatasetImport(data).then(res => {
|
|
|
+ if (res.code == 1) {
|
|
|
+ this.$message.success('操作成功');
|
|
|
+
|
|
|
+ this.clearSource();
|
|
|
+ } else {
|
|
|
+ this.$message.error('操作失败,失败原因' + res.message);
|
|
|
+ }
|
|
|
+ }).catch(msg => {
|
|
|
+ this.$message.error('操作出错,错误原因:' + msg);
|
|
|
+ }).finally(() => {
|
|
|
+ console.log('导入数据提交,操作结束');
|
|
|
+ this.uploading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ handleRemove(file, fileList) {
|
|
|
+
|
|
|
+ },
|
|
|
+ handlePreview(file) {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ * 日志
|
|
|
+ */
|
|
|
+ log(str) {
|
|
|
+ console.log((new Date()).Format('yyyy-MM-dd hh:mm:ss.S') + JSON.stringify(str))
|
|
|
+ },
|
|
|
+
|
|
|
+ clearSource() {
|
|
|
+ if (this.queryVectorSource) {
|
|
|
+ this.queryVectorSource.clear();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
}
|