Browse Source

Merge branch 'master' of http://192.168.2.241:3000/zx/kxc_web

13408401276 3 years ago
parent
commit
c626b194b9

+ 230 - 127
src/views/kxcSystem/functionManage/spatialDataImport/style.scss

@@ -1,133 +1,236 @@
-.spatialContainer {
-  width: 100%;
-  height: 100%;
-  padding: 4px 0 !important;
-  margin: 0 !important;
-  position: relative;
-  font-size: 1rem !important;
-  .box-container {
-    font-size: 1rem;
-    .box-hander {
-      height: 30px;
-      line-height: 30px;
-      font-size: 1rem;
-      background: #e4e6ea;
-      .box-icon {
-        width: 4px;
-        height: 18px;
-        margin: 6px;
-        background-color: #2a77f7;
-        float: left;
-      }
-
-      .box-title {
-        height: 30px;
-        line-height: 30px;
-        font-weight: 500;
-        text-align: left;
-        float: left;
-      }
-
-      .btnRefrash {
-        font-size: 1rem;
-        font-weight: bold;
-        height: 30px;
-        line-height: 30px;
-        color: #2a77f7;
-        float: right;
-        margin-right: 6px;
-      }
-      .btnRefrash:hover {
-        cursor: pointer;
-        color: #fff;
-      }
+// .spatialContainer {
+//     width: 100%;
+//     height: 100%;
+//     padding: 4px 0 !important;
+//     margin: 0 !important;
+//     position: relative;
+//     font-size: 1rem !important;
+//     .box-container {
+//         font-size: 1rem;
+//         .box-hander {
+//             height: 30px;
+//             line-height: 30px;
+//             font-size: 1rem;
+//             background: #e4e6ea;
+//             .box-icon {
+//                 width: 4px;
+//                 height: 18px;
+//                 margin: 6px;
+//                 background-color: #2a77f7;
+//                 float: left;
+//             }
+//             .box-title {
+//                 height: 30px;
+//                 line-height: 30px;
+//                 font-weight: 500;
+//                 text-align: left;
+//                 float: left;
+//             }
+//             .btnRefrash {
+//                 font-size: 1rem;
+//                 font-weight: bold;
+//                 height: 30px;
+//                 line-height: 30px;
+//                 color: #2a77f7;
+//                 float: right;
+//                 margin-right: 6px;
+//             }
+//             .btnRefrash:hover {
+//                 cursor: pointer;
+//                 color: #fff;
+//             }
+//         }
+//         .box-content {
+//             height: calc(100% - 30px);
+//             padding-left: 6px;
+//             .box-row {
+//                 min-height: 24px;
+//                 width: 100%;
+//                 margin: 4px 0px 4px 0px;
+//             }
+//             .box-null {
+//                 min-width: 100%;
+//                 min-height: 300px;
+//                 display: flex;
+//                 /*重要*/
+//                 /*横向排列*/
+//                 align-items: center;
+//                 /*重要*/
+//                 /*子类居中*/
+//                 .null-info {
+//                     width: 195px;
+//                     height: 135px;
+//                     margin: 0px auto;
+//                     /*重要*/
+//                     /*子类居中*/
+//                     .imgbg {
+//                         background: url("/images/null.png") no-repeat;
+//                         background-position: center center;
+//                         width: 195px;
+//                         height: 115px;
+//                     }
+//                     .nullmsg {
+//                         color: #ababab;
+//                         width: 195px;
+//                         font-size: 1rem;
+//                         margin-top: 6px;
+//                         text-align: center;
+//                     }
+//                 }
+//             }
+//         }
+//     }
+//     .box-container-top {
+//         height: calc(100% - 440px);
+//     }
+//     .box-container-center {
+//         height: 200px;
+//     }
+//     .box-container-bottom {
+//         height: 240px;
+//     }
+//     .tempContainer {
+//         .btnGroub {
+//             height: 30px;
+//             line-height: 30px;
+//             width: 60px;
+//             float: left;
+//             margin: 0px 2px;
+//             background: #5790ec;
+//             text-align: center;
+//             color: #fff;
+//             border-radius: 4px;
+//             cursor: pointer;
+//         }
+//     }
+//     .btnSelectFile,
+//     .fileSubmitBtn {
+//         width: 62px;
+//         height: 30px;
+//         line-height: 30px;
+//         text-align: center;
+//         padding: 0;
+//         background: #5790ec;
+//         border-radius: 4px;
+//         border: 1px solid #5790ec;
+//         color: #fff;
+//     }
+//     .fileSubmitBtn:hover {
+//         cursor: pointer;
+//     }
+//     .layerNameGroup {
+//         padding-left: 10px;
+//         max-height: 320px;
+//         overflow-x: hidden;
+//         .layerRadio {
+//             width: 100%;
+//             margin-bottom: 10px;
+//         }
+//     }
+//     .layerNameContainer {
+//         min-height: 200px;
+//         width: 100%;
+//     }
+// }
+.panel-container {
+    margin-bottom: 20px;
+    .item-head {
+        font-size: 14px;
+        font-family: Source Han Sans CN;
+        color: #333333;
+        line-height: 18px;
+        margin: 10px 0;
+        font-weight: 600;
+        &::before {
+            content: '';
+            display: inline-block;
+            width: 3px;
+            height: 12px;
+            background: #2a77f7;
+            vertical-align: middle;
+            margin-right: 5px;
+        }
+    }
+    .op-box {
+        width: 100%;
+        box-sizing: border-box;
+        padding: 10px;
+        .item-close {
+            cursor: pointer;
+            &:hover {
+                color: #f40;
+            }
+        }
+        .form-label {
+            padding-top: 2px;
+            /deep/.el-form-item__label {
+                height: 32px;
+                line-height: 32px;
+            }
+        }
+        .el-input {
+            /deep/.el-input-group__append {
+                background-color: #2d74e7;
+                color: #ffffff;
+                border: 1px solid #2d74e7;
+                &:hover {
+                    background-color: #367cec;
+                }
+            }
+        }
     }
-
-    .box-content {
-      height: calc(100% - 30px);
-      padding-left: 6px;
-      .box-row {
-        min-height: 24px;
+    .result-box {
         width: 100%;
-        margin: 4px 0px 4px 0px;
-      }
-      .box-null {
-        min-width: 100%;
-        min-height: 300px;
-        display: flex; /*重要*/ /*横向排列*/
-        align-items: center; /*重要*/ /*子类居中*/
-        .null-info {
-          width: 195px;
-          height: 135px;
-          margin: 0px auto; /*重要*/ /*子类居中*/
-          .imgbg {
-            background: url("/images/null.png") no-repeat;
-            background-position: center center;
-            width: 195px;
-            height: 115px;
-          }
-          .nullmsg {
-            color: #ababab;
-            width: 195px;
-            font-size: 1rem;
-            margin-top: 6px;
-            text-align: center;
-          }
+        box-sizing: border-box;
+        padding: 10px;
+        .result-description {
+            width: 100%;
+            height: 64px;
+            background: #f6f6f6;
+            border-radius: 4px;
+            >div {
+                width: 100%;
+                height: 32px;
+                line-height: 32px;
+                font-size: 14px;
+            }
+            .result-title {
+                font-weight: 600;
+            }
         }
-      }
     }
-  }
-  .box-container-top {
-    height: calc(100% - 440px);
-  }
-  .box-container-center {
-    height: 200px;
-  }
-  .box-container-bottom {
-    height: 240px;
-  }
-  .tempContainer {
-    .btnGroub {
-      height: 30px;
-      line-height: 30px;
-      width: 60px;
-      float: left;
-      margin: 0px 2px;
-      background: #5790ec;
-      text-align: center;
-      color: #fff;
-      border-radius: 4px;
-      cursor: pointer;
+    .table-chart {
+        width: 100%;
+        box-sizing: border-box;
+        padding: 10px;
+        .item-head {
+            font-weight: 600;
+        }
+        .chart-container {
+            width: 100%;
+            height: 300px;
+        }
+        .table-container {
+            >>>.el-table td,
+            >>>.el-table th {
+                padding: 6px 0 !important;
+            }
+            >>>.el-table {
+                .cell .el-table__expand-icon {
+                    display: none;
+                }
+                .el-button {
+                    padding: 0 !important;
+                }
+                .chart-box {
+                    width: 100%;
+                    height: 300px;
+                    background-color: #f7fcff;
+                }
+            }
+        }
     }
-  }
-
-  .btnSelectFile,
-  .fileSubmitBtn {
-    width: 62px;
-    height: 30px;
-    line-height: 30px;
-    text-align: center;
-    padding: 0;
-    background: #5790ec;
-    border-radius: 4px;
-    border: 1px solid #5790ec;
-    color: #fff;
-  }
-  .fileSubmitBtn:hover {
-    cursor: pointer;
-  }
-
-  .layerNameGroup {
-    padding-left: 10px;
-    max-height: 320px;
-    overflow-x: hidden;
-    .layerRadio {
-      width: 100%;
-      margin-bottom: 10px;
+    .query-result {
+        padding: 10px;
     }
-  }
-  .layerNameContainer {
-    min-height: 200px;
-    width: 100%;
-  }
-}
+}

+ 485 - 325
src/views/kxcSystem/functionManage/spatialDataImport/template.js

@@ -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.clearSource();
+        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.getLayerInfo();
+            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)
+                // let type = this.layerName.item.systemName // 服务类型
+                //     // 获取图层中文字段
+                // if (type = '3') // 公房
+                //     this.fields = this.$store.state.common.buildingFields
+                // else if (type = '6') // 宗地
+                //     this.fields = this.$store.state.common.groundFields
+                // else if (type = '2') //管线 
+                //     this.fields = this.$store.state.common.PipeLineFields
+                // else if (type = '4') // 管点
+                //     this.fields = this.$store.state.common.PipePointFields
+                // else {
+                //     this.fields = []
+                // }
+        },
 
-    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);   //导入数据类型。1、管线;2:公房;3、地理
-      uploadForm.append('uploadFileType', this.fileType);    //传入shape或者dwg
-      uploadForm.append('', this.uploadFile);                //传入文件
-      // addShape(uploadForm).then(response => {
-      //   if (response !== undefined) {
-      //     console.log('上传成功!', response);
-      //     this.$message('info','上传成功!')
-      //     this.showImportSpatial(response.result);
-      //   }
-      // });
-      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;
-      }
-      //this.layerName
-      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];  //datasetName: "kxcgw:pipeline",
-      let IDs = [];
-      if (id != null) IDs.push(parseInt(id));
-      //数据集ID查询服务参数
-      var idsParam = new SuperMap.GetFeaturesByIDsParameters({
-        IDs: IDs,
-        datasetNames: datasetNames
-      });
+        handleExceed(files, fileList) {
+            this.$message.warning("当前已存在一个文件!")
+        },
 
-      //此处写调用接口
-      setTimeout( ()=>{
-        //向服务器发送请求,并获取结果
-        new FeatureService(url).getFeaturesByIDs(idsParam, (serviceResult) =>{
-          //获取返回的features数据
-          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); //导入数据类型。1、管线;2:公房;3、地理
+            uploadForm.append('uploadFileType', this.fileType); //传入shape或者dwg
+            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(() => {
+                // if (!this.checked)
+                //     this.uploading = false;
+            });
+        },
+        /**
+         * 获取字段信息,获取图层中文字段
+         */
+        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];
+            //指定SQL查询服务参数
+            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,  //提交要素ID
-        comfirmType:'Y' //comfirmType(Integer):1-Y-确定,2-N-回退
-      }
-      this.confirmImport(data);
-    },
-    
-    /**
-     * 取消事件 
-    */
-    btnConnalHandler() {
-      let data = {
-        uploadId: this.impFeaturesId,  //提交要素ID
-        comfirmType:'N' //comfirmType(Integer):1-Y-确定,2-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;
+            }
+            //this.layerName
+            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]; //datasetName: "kxcgw:pipeline",
+            let IDs = [];
+            if (id != null) IDs.push(parseInt(id));
+            //数据集ID查询服务参数
+            var idsParam = new SuperMap.GetFeaturesByIDsParameters({
+                IDs: IDs,
+                datasetNames: datasetNames
+            });
 
-    handleRemove(file, fileList) {
-     // console.log(file, fileList,"删除");
-    },
-    handlePreview(file) {
-     //  console.log(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) => {
+                    //获取返回的features数据
+                    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, //提交要素ID
+                comfirmType: 'Y' //comfirmType(Integer):1-Y-确定,2-N-回退
+            }
+            this.confirmImport(data);
+        },
+
+        /**
+         * 取消事件 
+         */
+        btnConnalHandler() {
+            let data = {
+                uploadId: this.impFeaturesId, //提交要素ID
+                comfirmType: 'N' //comfirmType(Integer):1-Y-确定,2-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) {
+            // console.log(file, fileList,"删除");
+        },
+        handlePreview(file) {
+            //  console.log(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();
+            }
+        }
     }
-  }
 }

+ 70 - 113
src/views/kxcSystem/functionManage/spatialDataImport/widget.vue

@@ -1,114 +1,71 @@
-<template>
-  <div class="spatialContainer">
-    <div class="box-container box-container-top">
-      <div class="box-hander">
-        <div class="box-icon" />
-        <div class="box-title">目标图层</div>
-        <div class="btnRefrash el-icon-refresh" @click="refrashLayer"></div>
-      </div>
-      <div class="box-content">
-        <el-row>
-          <el-col :span="24">
-            <el-form label-width="100px">
-              <el-form-item label="导入数据类型:">
-                <el-radio-group v-model="layerType">
-                  <!-- 1、gis 2、管线 3、公房  基础地理(gis)、管线(pipeline)公房:(building) -->
-                  <el-radio label="pipeline">管线</el-radio> 
-                  <el-radio label="building">公房</el-radio>
-                  <el-radio label="gis">地理</el-radio>
-                </el-radio-group>
-              </el-form-item>
-            </el-form>
-          </el-col>
-        </el-row>
-        <el-row style="height: calc(100% - 40px);overflow: auto;">
-          <el-col :span="24">
-            <el-radio-group v-model="layerName" class="layerNameGroup layerNameContainer" v-loading="loading" element-loading-text="加载中...">
-              <el-radio class="layerRadio" v-for="item in layerNames" :key="item.key" :label="item.value"></el-radio>
-            </el-radio-group>
-          </el-col>
-        </el-row>
-      </div>
-    </div>
-    <div class="box-container box-container-center">
-      <div class="box-hander">
-        <div class="box-icon" />
-        <div class="box-title">上传空间数据</div>
-      </div>
-      <div class="box-content">
-        <el-row>
-          <el-col :span="24">
-            <el-form label-width="100px">
-              <el-form-item label="上传文件类型:">
-                <el-radio-group v-model="fileType">  
-                  <!-- 1:shape 2:dwg -->
-                  <el-radio label="1">shape</el-radio>
-                  <!-- <el-radio label="dwg">dwg</el-radio> -->
-                </el-radio-group>
-              </el-form-item>
-            </el-form>
-          </el-col>
-        </el-row>
-        <el-row style='height:calc(100% - 40px)'>
-          <!-- multiple -->
-          <el-upload
-            class="upload-spatialData"
-            ref="classZip"
-            action="action"
-            :data="{taskId:helloTaskId}"
-            :on-preview="handlePreview"
-            name="classZip"
-            :on-remove="handleRemove"
-            :on-error="handleError"
-            :on-success="handleSuccess"
-            :on-exceed="handleExceed"
-            :before-upload="beforeAvatarUpload"
-            :limit="1"
-            :on-change="handleChange"
-            :auto-upload="false"
-            style="height: calc(100% - 32px);"
-            >
-            <el-button slot="trigger" size="small" type="primary" class="btnSelectFile">选择文件</el-button>
-            <!-- <button class="fileSubmitBtn" 
-              @click="submitUpload" :class="helloTaskId!=''&&wordFlag==true?'subMitError':'subMitSuccess'"
-            >提交</button> -->
-            <div slot="tip" class="el-upload__tip" style="color: red;" v-loading="uploading" element-loading-text="导入中,请稍等...">{{message}}</div>
-          </el-upload>										
-          <button class="fileSubmitBtn" 
-            @click="submitUpload" :class="helloTaskId!=''&&wordFlag==true?'subMitError':'subMitSuccess'"
-          >提交</button>
-        </el-row>
-      </div>
-    </div>
-
-    <div class="box-container tempContainer box-container-bottom">
-      <div class="box-hander">
-        <div class="box-icon" />
-        <div class="box-title">临时图层数据列表</div>
-      </div>
-      <div class="box-content">
-        <el-row style="height:calc(100% - 32px);padding: 10px 0;" v-loading="uploading" element-loading-text="导入中,请稍等...">
-          <el-col :span="24">
-            <el-radio-group v-model="impFeaturesId" class="layerNameGroup">
-              <el-radio class="layerRadio" v-for="item in importedFeatureIds" :key="item.id" :label="item.id"></el-radio>
-            </el-radio-group>
-          </el-col>
-        </el-row>
-        <el-row style="height:30px">
-          <el-col :span="24">
-            <div class="btnCommit btnGroub" @click="btnCommitHandler">确定</div>
-            <div class="btnConnal btnGroub" @click="btnConnalHandler">取消</div>
-          </el-col>
-        </el-row>
-      </div>
-    </div>
-  </div>
-</template>
-
-<script>
-import template from "./template.js";
-export default template;
-</script>
-<style lang="scss" scoped>
-@import './style.scss';
+<template>
+  <div class="panel-container">
+    <div class="op-box">
+      <div class="item-head" style="margin-top:0">目标图层</div>
+      <el-form label-width="70px">
+        <el-form-item label="选取图层" style="margin:0">
+          <el-select v-model="layerName" value-key="value" placeholder="请选择图层" style="width:100%" size="small" @change="selectLayerChange">
+            <!-- <el-option v-for="item in datasetOptions" :key="item.value" :label="item.label" :value="item"> </el-option> -->
+            <el-option-group v-for="group in layersOptions" :key="group.label" :label="group.label">
+              <el-option v-for="item in group.options" :key="item.key" :label="item.value" :value="item"></el-option>
+            </el-option-group>
+          </el-select>
+        </el-form-item>
+      </el-form>
+    </div>
+    <div class="op-box">
+      <div class="item-head" style="margin-top:0">上传空间数据
+        <el-checkbox v-model="checked" @change="showTempData" style="margin-left:15px">显示导入数据</el-checkbox>
+      </div>
+      <el-form label-width="70px">
+        <el-form-item label="空间数据" class="form-label">
+          <el-input v-model="fileName" placeholder="请选择文件" size="small">
+            <template slot="append">
+              <el-upload class="upload-spatialData" ref="classZip" action="action" :on-preview="handlePreview" accept=".zip,.ZIP,.rar,.RAR"
+                         name="classZip" :on-remove="handleRemove" :on-error="handleError" :on-success="handleSuccess"
+                         :on-exceed="handleExceed" :limit="1" :on-change="handleChange" :show-file-list="false" :auto-upload="false"
+                         style="height: calc(100% - 32px);">
+                <el-button type="primary">选择文件</el-button>
+              </el-upload>
+            </template>
+          </el-input>
+        </el-form-item>
+      </el-form>
+    </div>
+    <div class="op-box">
+      <el-button type="primary" size="small" style="width:100%" @click="submitUpload" v-loading.fullscreen.lock="uploading"
+                 :element-loading-text="loadingtext" element-loading-background="rgba(0, 0, 0, 0.6)">开始上传
+      </el-button>
+    </div>
+    <!-- 属性表 -->
+    <div class="table-chart">
+      <div class="item-head" style="margin-top:0">属性表</div>
+      <div class="table-container">
+        <el-table ref="valvesTable" :data="featuresTable" stripe max-height="300" :border="featuresTable.length==0"
+                  :header-cell-style="{fontSize: '14px', fontWeight:'600', background:'#eaf1fd',color:'#909399'}" style="width: 100%">
+          <el-table-column v-for="(item,index) in fields" :key="index" :label="item.pipelineVal" align="center" show-overflow-tooltip>
+            <template slot-scope="scope">
+              {{scope.row.properties[item.pipelineKey]}}
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+    </div>
+    <div class="op-box">
+      <el-button type="success" size="small" style="width:100%" @click="btnCommitHandler">确认导入
+      </el-button>
+    </div>
+    <div class="op-box">
+      <el-button type="danger" size="small" style="width:100%" @click="btnConnalHandler">取消导入
+      </el-button>
+    </div>
+  </div>
+</template>
+
+<script>
+import template from "./template.js";
+export default template;
+</script>
+<style lang="scss" scoped>
+@import './style.scss';
 </style>

+ 1 - 3
src/views/kxcSystem/pipelineSystem/specialtyAnalysis/burstAnalysis/widget.vue

@@ -81,7 +81,7 @@
 </template>
 
 <script>
-import { mapConfig, tiandituWebSevice } from '@/views/MapView/map.config'
+import { mapConfig } from '@/views/MapView/map.config'
 import { SuperMap, FeatureService } from '@supermap/iclient-ol';
 import { MultiPolygon, Point } from 'ol/geom';
 import { GeoJSON } from 'ol/format';
@@ -89,10 +89,8 @@ import Feature from 'ol/Feature';
 import { Vector as VectorSource } from 'ol/source';
 import { Vector as VectorLayer } from 'ol/layer';
 import { Style, Circle, Icon, Fill, Stroke, Text } from 'ol/style';
-import { unByKey } from 'ol/Observable';
 import * as turf from '@turf/turf'
 import { getCenter } from 'ol/extent';
-
 export default {
   props: ['data'],
   data() {

+ 1 - 4
src/views/kxcSystem/pipelineSystem/specialtyAnalysis/connectivityAnalysis/widget.vue

@@ -60,7 +60,7 @@
 </template>
 
 <script>
-import { mapConfig, tiandituWebSevice } from '@/views/MapView/map.config'
+import { mapConfig} from '@/views/MapView/map.config'
 import { SuperMap, FeatureService } from '@supermap/iclient-ol';
 import { MultiPolygon, Point } from 'ol/geom';
 import { GeoJSON } from 'ol/format';
@@ -68,11 +68,8 @@ import Feature from 'ol/Feature';
 import { Vector as VectorSource } from 'ol/source';
 import { Vector as VectorLayer } from 'ol/layer';
 import { Style, Circle, Icon, Fill, RegularShape, Stroke, Text } from 'ol/style';
-import { unByKey } from 'ol/Observable';
 import * as turf from '@turf/turf'
 import { getCenter } from 'ol/extent';
-import { async } from 'q';
-
 export default {
   props: ["data"],
   data() {