Browse Source

在线入库前端优化

李顺 2 years ago
parent
commit
7d01ff49f4

+ 18 - 30
src/views/OnlineImport/widgets/DataImport/components/PbsTree.vue

@@ -8,50 +8,38 @@
   </div>
 </template>
 <script>
-import {pbsTreeListwithPublish} from '@/api/APIs'
+import { pbsTreeListwithPublish } from '@/api/APIs'
 export default {
   name: "commonTree",//显示工程树
+  props: ['structures'],
   data() {
     return {
       treeSelectText: '',
       treeValue: {},
-      datas: [],
       defaultProps: {
         children: 'children',
         label: 'name'
       }
     }
   },
-  created() {
-    this.getPbsTree()
+  computed: {
+    datas() {
+      function formatTree(obj) {
+        const copyedObj = JSON.parse(JSON.stringify(obj)); // 深拷贝源数据
+        return copyedObj.filter((parent) => {
+          const findChildren = copyedObj.filter(
+            (child) => (parent.id === child.pid && child.levelname != "部件类型")
+          );
+          findChildren.length > 0
+            ? (parent.children = findChildren)
+            : delete (parent.children = []);
+          return parent.pid === null; // 返回顶层,依据实际情况判断这里的返回值
+        });
+      }
+      return formatTree(this.structures);
+    }
   },
   methods: {
-    getPbsTree() {
-      pbsTreeListwithPublish({}).then(res => {
-        const { code, result } = res;
-        if (code === 1) {
-          function formatTree(obj) {
-            const copyedObj = JSON.parse(JSON.stringify(obj)); // 深拷贝源数据
-            return copyedObj.filter((parent) => {
-              const findChildren = copyedObj.filter(
-                (child) => (parent.id === child.pid && child.levelname != "部件类型")
-              );
-              findChildren.length > 0
-                ? (parent.children = findChildren)
-                : delete (parent.children = []);
-              return parent.pid === null; // 返回顶层,依据实际情况判断这里的返回值
-            });
-          }
-          if (result[0]){
-            let data=formatTree(result[0].structures);
-            this.datas = data
-            this.$emit('getTreeList',data);
-          }
-        } else {
-          this.$message.error("信息获取失败");
-        }
-      })
-    },
     // 点击tree节点
     nodeClick(item) {
       const { id, name, code } = item

+ 63 - 10
src/views/OnlineImport/widgets/PipeOnlineImport/widget.vue

@@ -10,7 +10,7 @@
             </el-row>
             <span></span>
             <span>工程名称</span>
-            <pbs-tree @changeProjectName="treeNodeClick" style="width:50%;display:inline-block;"></pbs-tree>
+            <pbs-tree :structures='structures' @changeProjectName="treeNodeClick" style="width:50%;display:inline-block;"></pbs-tree>
             <el-button type="primary" size="mini" @click="getPbsTree">查询</el-button>
           </el-col>
           <el-col :span="6" :offset="6">
@@ -186,8 +186,8 @@
           <el-tabs class="pipetable">
             <el-tab-pane label="表格">
               <el-row>
-                <!-- <el-col :span="8">导入情况:{{importInfo}}</el-col>
-                <el-col :span="8">预览情况:{{priviewInfo}}</el-col> -->
+                <el-col :span="8">源数据情况:{{importInfo}}</el-col>
+                <el-col :span="8">预览情况:{{priviewInfo}}</el-col>
                 <el-col :span="8">
                   <el-button type="primary" size="small" @click="buildDatasets">预览</el-button>
                   <el-button type="primary" size="small" @click="zsbuildDatasets">提交</el-button>
@@ -241,7 +241,6 @@ import { Vue, Prop, Watch, Component } from 'vue-property-decorator'
 import request, { IP } from '@/utils/request'
 import { getDefaultPagination } from '@/utils/constant'
 import {
-  pbsTreeList_api,
   pbsTreeListwithPublish,
   getStructureDetailByID,
   getPbsLevelByID,
@@ -375,6 +374,8 @@ export default class PipeOnlineImprt extends Vue {
    * 在线文件列表数据
    */
   onlineRecords = []
+  /**树结构 */
+  structures=[]
   /**
    * 上传文件
    */
@@ -438,7 +439,7 @@ export default class PipeOnlineImprt extends Vue {
   /**未过滤发布状态的 */
   getPbsTree() {
     const params={structDetailId:this.searchStructureId}
-    pbsTreeListwithPublish({}).then((res) => {
+    pbsTreeListwithPublish(params ).then((res) => {
       const { code, result } = res
       if (code === 1) {
         function formatTree(obj) {
@@ -451,6 +452,7 @@ export default class PipeOnlineImprt extends Vue {
           })
         }
         if (result[0]) {
+          this.structures=result[0].structures
           let data = formatTree(result[0].structures)
           this.tableData = data
         }
@@ -529,6 +531,7 @@ export default class PipeOnlineImprt extends Vue {
           this.$message.error('添加失败')
           return
         }
+        this.$message.success('添加成功')
         this.newNodeDialogShow = false
         this.getPbsTree()
       })
@@ -555,6 +558,13 @@ export default class PipeOnlineImprt extends Vue {
         console.log(err)
       })
     this.importDialogShow = true
+    this.fileList=[];
+    this.impForm.pointColumns=[]
+    this.impForm.lineColumns=[]
+    this.impForm.pointData=[]
+    this.impForm.lineData=[]
+    this.importInfo=''
+    this.priviewInfo=''
     this.$nextTick(() => {
       this.addToMap()
     })
@@ -571,13 +581,19 @@ export default class PipeOnlineImprt extends Vue {
       this.$message.warning('请选择导入层级')
       return
     }
+    const loading=this.$loading({
+      text:"后台处理中",
+      lock: true,
+      spinner: 'el-icon-loading',
+      background: 'rgba(0, 0, 0, 0.7)'
+    })
     const formdata = new FormData()
     this.files.forEach((item) => {
       formdata.append('files', item)
     })
     formdata.append('importType', '0')
     formdata.append('id', '' + this.impForm.id)
-
+    formdata.append('wkid', '4546')
     request({
       url: '/tofly-lzd-data/data/import/' + this.impForm.id,
       method: 'post',
@@ -586,12 +602,16 @@ export default class PipeOnlineImprt extends Vue {
       .then((result) => {
         if (result.code === 1) {
           this.$message.success('临时库数据集生成成功')
-          this.buildNetwork()
+          console.log(result.result);
+          this.priviewInfo='管点:'+result.result["管点数量"]+',管线'+result.result["管线数量"]+'条';
+          //this.buildNetwork()
         }
       })
       .catch((err) => {
         this.$message.error('临时数据集生成失败')
         console.log(err)
+      }).finally(()=>{
+        loading.close();
       })
   }
   /**
@@ -606,6 +626,12 @@ export default class PipeOnlineImprt extends Vue {
       this.$message.warning('请选择导入层级')
       return
     }
+     const loading=this.$loading({
+      text:"后台处理中",
+      lock: true,
+      spinner: 'el-icon-loading',
+      background: 'rgba(0, 0, 0, 0.7)'
+    })
     const id = this.impForm.id
     const formdata = new FormData()
     this.files.forEach((item) => {
@@ -642,12 +668,13 @@ export default class PipeOnlineImprt extends Vue {
             lineinfo = ',管线' + result.result['线表'].length + '条'
           }
           this.importInfo += lineinfo
-          //this.buildNetwork()
         }
       })
       .catch((err) => {
         this.$message.error('导入excel出错')
         console.log(err)
+      }).finally(()=>{
+        loading.close();
       })
   }
 
@@ -663,13 +690,19 @@ export default class PipeOnlineImprt extends Vue {
       this.$message.warning('请选择导入层级')
       return
     }
+     const loading=this.$loading({
+      text:"后台处理中",
+      lock: true,
+      spinner: 'el-icon-loading',
+      background: 'rgba(0, 0, 0, 0.7)'
+    })
     const formdata = new FormData()
     this.files.forEach((item) => {
       formdata.append('files', item)
     })
     formdata.append('importType', '1')
     formdata.append('id', '' + this.impForm.id)
-
+    formdata.append('wkid', '4546')
     request({
       url: '/tofly-lzd-data/data/import/' + this.impForm.id,
       method: 'POST',
@@ -682,6 +715,8 @@ export default class PipeOnlineImprt extends Vue {
       .catch((err) => {
         this.$message.error('正式库数据集生成失败')
         console.log(err)
+      }).finally(()=>{
+        loading.close();
       })
   }
   /**
@@ -835,6 +870,12 @@ export default class PipeOnlineImprt extends Vue {
     const id = row.id
     this.$confirm('是否删除该节点')
       .then(() => {
+        const loading=this.$loading({
+      text:"后台处理中",
+      lock: true,
+      spinner: 'el-icon-loading',
+      background: 'rgba(0, 0, 0, 0.7)'
+    })
         request({
           url: '/tofly-lzd-data/data/deleteData/' + id + '?importType=1&id=' + id,
           method: 'POST'
@@ -848,6 +889,8 @@ export default class PipeOnlineImprt extends Vue {
           .catch((err) => {
             this.$message.error('数据删除失败')
             console.log(err)
+          }).finally(()=>{
+            loading.close();
           })
       })
       .catch(() => {
@@ -1213,7 +1256,7 @@ export default class PipeOnlineImprt extends Vue {
     //设置地球表面颜色
     window.impViewer.scene.globe.baseColor = new Cesium.Color(0, 0, 0, 1)
     //帧率工具
-    window.impViewer.scene.debugShowFramesPerSecond = true
+    window.impViewer.scene.debugShowFramesPerSecond = false
     const nowDate = new Date(Date.now())
     nowDate.setHours(16) //设置系统时间为12点,时差12小时
     nowDate.setMinutes(0)
@@ -1288,9 +1331,14 @@ export default class PipeOnlineImprt extends Vue {
 
     imagelayers.addImageryProvider(poilayer)
   }
+  /**刷新地图 */
+  refreshViewer(){
+    window.impViewer.render();
+  }
   /**服务发布按钮点击事件 */
   publicService() {
     this.isPublicDialogShow = true
+    this.publicConfig=[]
   }
   /**发布服务 */
   submitPublicService() {
@@ -1384,4 +1432,9 @@ export default class PipeOnlineImprt extends Vue {
     left: 0 !important;
   }
 }
+.refresjBtn{
+  position: absolute;
+  top: 10px;
+  left: 10px;
+}
 </style>

+ 3 - 1
src/views/groupPage/baseMap/components/ProjectMap.vue

@@ -282,7 +282,9 @@ export default {
             this.viewer.imageryLayers.addImageryProvider(
               new Cesium.SuperMapImageryProvider({
                 url: url,
-                credit: item.name
+                credit: item.name,
+                transparent:true,
+                maximumLevel:18
               })
             )
           } else if ((item.type = 'mvt')) {