Browse Source

修改平面图和业务空间

chuwu 5 years ago
parent
commit
3d06c3630b

+ 1 - 0
src/api/scan/httpUtil.js

@@ -26,6 +26,7 @@ function errorResponse(vm, response, err) {
     if (err) {
         Message.error({ message: '接口:' + json.config.url + '请求错误' })
     } else {
+        console.error(vm, response, err)
         Message.error({ message: '请求错误' });
     }
 }

+ 129 - 26
src/views/business_space/business_list/index.vue

@@ -4,19 +4,28 @@
 <template>
     <div id="businessSpace">
         <!------------------------    头部弹窗,选择楼层信息     -------------->
-        <no-model-dialog :param="param" title="选择要进行空间管理的楼层" :isShow="floor" @close="close"></no-model-dialog>
+        <!-- <no-model-dialog :param="param" title="选择要进行空间管理的楼层" :isShow="floor" @close="close"></no-model-dialog> -->
         <influence-dialog ref="influence" :param="param" :tabsList="tabsList" title="受元空间变化影响的业务空间" :isShow="floor"></influence-dialog>
         <details-dialog ref="details" @del="delSuccess" :param="param" :tabsList="tabsList" title="业务空间详情" :isShow="floor" :activeTabType="activeTabType"></details-dialog>
         <not-related ref="notRelated" @createSuccess="createSuccess" :isShow="floor"></not-related>
         <facility-dialog ref="facility" :activeTabType="activeTabType" :isShow="floor"></facility-dialog>
         <!--------- 页面头部   -------------->
         <div class="saga-title">
-            <div class="saga-build-mess">
+            <!-- <div class="saga-build-mess">
                 <p>
                     <i class="iconfont icon-jianzhu"></i> {{buildMess.buildName}} - {{buildMess.name}}
                 </p>
                 <el-button class="saga-btn" type="text" @click="changeShow">切换楼层</el-button>
-            </div>
+            </div> -->
+            <div class="saga-build-mess">
+                    建筑楼层:
+                    <el-cascader
+                        :options="options"
+                        v-model="buildMess.selectd"
+                        :props="props"
+                        @change="close">
+                    </el-cascader>
+                </div>
             <div class="saga-build-tab">
                 <div class="tab-main" @click="tabList(1)" :class="isMyTab == 1 ? 'tab-active' : ''">
                     <i class="iconfont icon-tupian"></i>
@@ -31,28 +40,28 @@
         <div v-show="isMyTab == 1" class="saga-business-sapce-main">
             <el-tabs v-model="activeName" @tab-click="tab1Click">
                 <template v-for="(item,index) in tabsList">
-              <el-tab-pane :name="item.code" :key="index" :disabled="item.code > 3">
-                <span slot="label">{{item.name}}</span>
-                <graphy
-                  @getSp="checkSpace"
-                  @dimension="checkSpace"
-                  @businessDetails="getBuinessDetails"
-                  :ref="'graphy' + item.code"
-                  :canvasId="item.code"
-                ></graphy>
-              </el-tab-pane>
-            </template>
+                  <el-tab-pane :name="item.code" :key="index" :disabled="item.code > 3">
+                    <span slot="label">{{item.name}}</span>
+                    <graphy
+                      @getSp="checkSpace"
+                      @dimension="checkSpace"
+                      @businessDetails="getBuinessDetails"
+                      :ref="'graphy' + item.code"
+                      :canvasId="item.code"
+                    ></graphy>
+                  </el-tab-pane>
+</template>
                 </el-tabs>
                 <!-- <space-graphy @dimension="checkSpace" :tabsList="tabsList" ref="graphy" :param="param"></space-graphy> -->
                 </div>
                 <div v-show="isMyTab == 2" class="saga-business-sapce-main">
                 <el-tabs v-model="activeName" @tab-click="handleClick">
-            <template v-for="(item,index) in tabsList">
-                <el-tab-pane :name="item.code" :key="index" :disabled="item.code > 3">
-                    <span slot="label">{{item.name}}</span>
-                    <handsontable-main @lookEqu="lookEqu" :ref="'handsontable' + item.code" :id="'handsontable' + item.code" :param="param"></handsontable-main>
-                </el-tab-pane>
-            </template>
+<template v-for="(item,index) in tabsList">
+    <el-tab-pane :name="item.code" :key="index" :disabled="item.code > 3">
+        <span slot="label">{{item.name}}</span>
+        <handsontable-main @lookEqu="lookEqu" :ref="'handsontable' + item.code" :id="'handsontable' + item.code" :param="param"></handsontable-main>
+    </el-tab-pane>
+</template>
       </el-tabs>
       <!-- <space-handsontable :tabsList="tabsList" ref="spaceTable" :param="param"></space-handsontable> -->
     </div>
@@ -71,8 +80,10 @@
     import {
         getTableHeader,
         getAllbusiness,
-        getBussTypes
+        getBussTypes,
+        getSpaceFloor
     } from "@/api/scan/request";
+    import tools from '@/utils/scan/tools'
     import {
         mapGetters,
         mapActions
@@ -98,7 +109,7 @@
         data() {
             return {
                 floor: {
-                    dialogVisible: true, //选择楼层弹窗
+                    // dialogVisible: true, //选择楼层弹窗
                     influence: false, //受影响的业务空间弹窗
                     details: false, //详情弹窗
                     notRelated: false,
@@ -111,11 +122,12 @@
                 },
                 buildMess: {
                     name: "--",
-                    code: "Fl110108000327d8f006c39f49feb40e24a7ef223232",
+                    code: "",
+                    selectd: [],
                     map: "Fl110108000327d8f006c39f49feb40e24a7ef223232181009102258bim.json",
                     isChild: true,
                     buildName: "--",
-                    buildCode: "Bd11010800032251ebd43a3e430385cf679e90015385"
+                    buildCode: ""
                 },
                 isMyTab: 1,
                 activeName: "GeneralZone",
@@ -124,6 +136,12 @@
                     "code": "GeneralZone",
                     "name": "默认分区",
                     "rel_type": "99"
+                },
+                options: [],
+                props:{
+                    value: "code",
+                    label: "name",
+                    children: "children"
                 }
             };
         },
@@ -131,10 +149,79 @@
             this.param.ProjId = this.projectId
             this.param.UserId = this.userId
             this.param.secret = this.secret
+            this.getFloor()
             this.getTypes()
         },
         mounted() {},
         methods: {
+            //获取楼层
+            getFloor() {
+                let param = {
+                    ProjId: this.projectId,
+                    UserId: this.UserId,
+                    secret: this.secret
+                };
+                getSpaceFloor(param).then(res => {
+                    console.log(res, 'res')
+                    if (res.data.Result == 'success') {
+                        let data = this.changeArr(res.data.Content).map(item => {
+                            if (item.children && item.children.length) {
+                                item.children = tools.sortArr(item.children, "shunxu", false)
+                            }
+                            return item
+                        })
+                        console.log(data, 'res.data')
+                        this.options = data
+                    } else {
+                        this.$message.error(res.data.ResultMsg)
+                    }
+                }).catch(() => {
+                    this.$message.error("请求出错")
+                })
+            },
+
+            //修改已有数组
+            changeArr(arr) {
+                return arr.map(item => {
+                    console.log(item.floors)
+                    if (item.floors && item.floors.length) {
+                        return {
+                            code: item.id,
+                            name: item.infos.BuildLocalName,
+                            children: item.floors.map(i => {
+                                return {
+                                    code: i.id,
+                                    name: (i.infos.FloorLocalName || i.infos.FloorName || "未知") + this.myMess(i),
+                                    map: i.infos.FloorMap || null,
+                                    affected: i.affected,
+                                    isChilren: 2,
+                                    buildCode: item.id,
+                                    buildName: item.infos.BuildLocalName,
+                                    shunxu: i.infos.FloorSequenceID || 0
+                                }
+                            })
+                        }
+                    } else {
+                        return {
+                            code: item.id,
+                            name: item.infos.BuildLocalName,
+                            children: null,
+                            isChilren: 1,
+                        }
+                    }
+                })
+            },
+            myMess(i) {
+                if (i.affected) {
+                    return "(该业务空间受元空间变化影响)"
+                } else {
+                    if (i.infos.FloorMap) {
+                        return ''
+                    } else {
+                        return "(请初始化平面图)"
+                    }
+                }
+            },
             //获取tabs的列表
             getTypes() {
                 getBussTypes(res => {
@@ -171,6 +258,7 @@
             },
             changeShow() {
                 this.floor.dialogVisible = true;
+                console.log(this.buildMess, 'buildMess')
             },
             //成功关联平面图
             createSuccess() {
@@ -184,8 +272,8 @@
                 this.$refs["graphy" + this.activeName][0].getHasSpace();
                 this.$refs["graphy" + this.activeName][0].clearDimension();
             },
-            close(data) {
-                this.buildMess = data;
+            close() {
+                this.buildMess = this.changeBuildMess(this.buildMess,this.options)
                 if (this.buildMess.affected) {
                     this.floor.influence = true;
                     this.$nextTick(() => {
@@ -202,6 +290,21 @@
                     this.$refs["graphy" + this.activeName][0].getData(this.buildMess.map, this.buildMess, this.activeTabType);
                 }
             },
+
+            //通过code查询options中的其他参数
+            changeBuildMess(mess,options){
+                options.map(item => {
+                    if(!!item.children && item.children.length){
+                        item.children.map(child => {
+                            if(child.code == mess.selectd[1]){
+                                console.log(child,mess)
+                                mess = Object.assign(mess,child)
+                            }
+                        })
+                    }
+                })
+                return mess
+            },
             //查看业务空间详情
             getBuinessDetails(list) {
                 this.floor.details = true;

+ 3 - 2
src/views/data_admin/buildGraphy/graphyCanvas.vue

@@ -1,5 +1,5 @@
 <template>
-  <div ref="graphyMain" class="canvasGraphy" style="width:100%;">
+  <div ref="graphyMain" class="canvasGraphy">
     <div class="saga-message" v-if="type != 3">{{type == 1 ? '请选择楼层' : '当前楼层尚无平面图,请去空间管理根据模型生成'}}</div>
     <div style="width:100%;" v-else>
       <canvas id="canvas" :width="canvasW" :height="canvasH"></canvas>
@@ -119,7 +119,7 @@ export default {
       list: "",
       buildMess: {},
       imageUrl:
-        "http://prod.dp.sagacloud.cn:28888/image-service/common/image_get?systemId=dev&key=graphy.png"
+        "/image-service/common/image_get?systemId=dev&key=graphy.png"
     };
   },
   computed: {
@@ -897,6 +897,7 @@ export default {
 <style lang="less" scoped>
 .canvasGraphy {
   position: relative;
+  height: 100%;
   canvas {
     border: 1px solid #ccc;
   }

+ 9 - 3
src/views/data_admin/buildGraphy/graphyTabs.vue

@@ -4,7 +4,7 @@ getLocation 定位
 -->
 <template>
   <div id="graphy-tabs">
-    <el-tabs v-model="activeName2" type="card" @tab-click="handleClick">
+    <el-tabs style="height:100%;" v-model="activeName2" type="card" @tab-click="handleClick">
       <el-tab-pane label="本层的点位标签" name="point">
         <div
           v-if="pointData.length"
@@ -415,10 +415,16 @@ export default {
 };
 </script>
 
-<style lang="less" scoped>
+<style lang="scss" scoped>
 #graphy-tabs {
+  height: 100%;
+  border-left: 1px solid #E4E7ED;
+  .el-tabs__content{
+      height: calc(100% - 60px) !important;
+      background: red;
+  }
   .saga-message {
-    height: 400px;
+    height: calc(100vh - 200px);
     line-height: 400px;
     color: #ccc;
     font-size: 24px;

+ 210 - 214
src/views/data_admin/buildGraphy/index.vue

@@ -2,240 +2,236 @@
   revit空间管理
  -->
 <template>
-  <div id="graphy">
-    <!-- <div class="graphy-left">
-      <graphy-tree v-if="show" :param="param" @change="getPoint"></graphy-tree>
-    </div> -->
-    <div class='condition'>
-        <p>
-            <span>建筑楼层</span>
-                <el-cascader
-                    placeholder='请选择'
-                   :options="options"
-                    @active-item-change="handleItemChange"
-                    @change="changeFloor"
-                    filterable
-                ></el-cascader>
-        </p>
-    </div>
-    <div class="graphy-view">
-        <div class="graphy-main">
-            <graphy-canvas v-if="show" :param="param" @getDetails="getDetails" @resetPoint="resetPoint" ref="canvas"></graphy-canvas>
+    <div id="graphy">
+        <!-- <div class="graphy-left">
+          <graphy-tree v-if="show" :param="param" @change="getPoint"></graphy-tree>
+        </div> -->
+        <div class='condition'>
+            <p>
+                <span>建筑楼层</span>
+                <el-cascader placeholder='请选择' :options="options" @active-item-change="handleItemChange" @change="changeFloor" filterable></el-cascader>
+            </p>
         </div>
-        <div class="graphy-right">
-        <graphy-tabs v-show="show"
-            ref="tabs"
-            :pointParam="pointParam"
-            @setFalg="setFalg"
-            @getLocation="getLocation"
-            @getPointList="sendPointList"
-        ></graphy-tabs>
+        <div class="graphy-view">
+            <div class="graphy-main">
+                <graphy-canvas v-if="show" :param="param" @getDetails="getDetails" @resetPoint="resetPoint" ref="canvas"></graphy-canvas>
+            </div>
+            <div class="graphy-right">
+                <graphy-tabs v-show="show" ref="tabs" :pointParam="pointParam" @setFalg="setFalg" @getLocation="getLocation" @getPointList="sendPointList"></graphy-tabs>
+            </div>
         </div>
     </div>
-  </div>
 </template>
 
 <script>
-//接口
-import graphyTree from "./graphyTree";
-import graphyTabs from "./graphyTabs";
-import graphyCanvas from "./graphyCanvas";
-import {mapGetters, mapActions} from 'vuex';
-import {getPT,getBuildSelect,getFloor} from "@/api/scan/request"; //获取点位坐标
-import Handsontable from "handsontable-pro"
-import 'handsontable-pro/dist/handsontable.full.css'
-import zhCN from 'handsontable-pro/languages/zh-CN';
-export default {
-  components: {
-    graphyTree,
-    graphyTabs,
-    graphyCanvas
-  },
-  data() {
-    return {
-      param: {
-        ProjId: this.projectId, //项目id
-        UserId: this.userId //用户id
-      },
-      pointParam: {
-        //point请求参数
-        ProjId: this.projectId, //项目id
-        UserId: this.userId, //用户id
-        fllorName: ""
-      },
-      options: [],
-      map: null,
-      pointId: null,
-      show:false,
-      buildVlaue: []
-    };
-  },
-  mounted() { 
-    this.changeValue()
-    this.getList()
-  },
-  computed: {
-    ...mapGetters("peojMess", [
-        "projectId",
-        "userId",
-        "secret"
-    ])
-  },
-  methods: {
-      //修改楼层
-      changeFloor(val){
-          console.log(val)
-          let floorMap = "",name = ""
-          this.options.map(item => {
-              if(!!item.children && item.children.length){
-                  if(item.value == val[0]){
-                      item.children.map(child => {
-                          if(child.value == val[1]){
-                              console.log(child,'child')
-                              floorMap = child.map
-                              name = child.label
-                          }
-                      })
-                  }
-              }
-          })
-          let obj = {
-              code: val[1],
-              map: floorMap,
-              name: name
-          }
-          this.getPoint(obj)
-          console.log(floorMap)
-      },
-      //获取建筑列表
-      getList(){
-          getBuildSelect(this.param).then(res => {
-              console.log(res)
-              this.options = res.data.BuildList.map(item => {
-                  return {
-                      value: item.BuildId,
-                      label: item.BuildLocalName,
-                      children: []
-                  }
-              })
-          })
-      },
-      //点击事件
-      handleItemChange(val){
-          if(val.length == 1){
-              let obj = Object.assign({BuildId: val[0]},this.param)
-                getFloor(obj).then(res => {
-                    console.log(res)
-                    this.options = this.options.map(item => {
-                        if(item.value == val[0]){
-                            item.children = res.data.FloorList.map(child => {
-                                return {
-                                    value: child.FloorId,
-                                    label: child.FloorLocalName + (child.FloorMap ? '' : '(需初始化数据)'),
-                                    map: child.FloorMap
+    //接口
+    import graphyTree from "./graphyTree";
+    import graphyTabs from "./graphyTabs";
+    import graphyCanvas from "./graphyCanvas";
+    import {
+        mapGetters,
+        mapActions
+    } from 'vuex';
+    import {
+        getPT,
+        getBuildSelect,
+        getFloor
+    } from "@/api/scan/request"; //获取点位坐标
+    import Handsontable from "handsontable-pro"
+    import 'handsontable-pro/dist/handsontable.full.css'
+    import zhCN from 'handsontable-pro/languages/zh-CN';
+    export default {
+        components: {
+            graphyTree,
+            graphyTabs,
+            graphyCanvas
+        },
+        data() {
+            return {
+                param: {
+                    ProjId: this.projectId, //项目id
+                    UserId: this.userId //用户id
+                },
+                pointParam: {
+                    //point请求参数
+                    ProjId: this.projectId, //项目id
+                    UserId: this.userId, //用户id
+                    fllorName: ""
+                },
+                options: [],
+                map: null,
+                pointId: null,
+                show: false,
+                buildVlaue: []
+            };
+        },
+        mounted() {
+            this.changeValue()
+            this.getList()
+        },
+        computed: {
+            ...mapGetters("peojMess", [
+                "projectId",
+                "userId",
+                "secret"
+            ])
+        },
+        methods: {
+            //修改楼层
+            changeFloor(val) {
+                console.log(val)
+                let floorMap = "",
+                    name = ""
+                this.options.map(item => {
+                    if (!!item.children && item.children.length) {
+                        if (item.value == val[0]) {
+                            item.children.map(child => {
+                                if (child.value == val[1]) {
+                                    console.log(child, 'child')
+                                    floorMap = child.map
+                                    name = child.label
                                 }
                             })
                         }
-                        return item
+                    }
+                })
+                let obj = {
+                    code: val[1],
+                    map: floorMap,
+                    name: name
+                }
+                this.getPoint(obj)
+                console.log(floorMap)
+            },
+            //获取建筑列表
+            getList() {
+                getBuildSelect(this.param).then(res => {
+                    console.log(res)
+                    this.options = res.data.BuildList.map(item => {
+                        return {
+                            value: item.BuildId,
+                            label: item.BuildLocalName,
+                            children: []
+                        }
                     })
-                    console.log(this.options)
                 })
-          }else if(val.length == 2){
-
-          }
-      },
-    changeValue(){
-      this.$set(this.param,'ProjId',this.projectId)
-      this.$set(this.param,'UserId',this.userId)
-      this.$set(this.pointParam,'ProjId',this.projectId)
-      this.$set(this.pointParam,'UserId',this.userId)
-      this.show = true
-    },
-
-    //渲染
-    getPoint(data) {
-      this.pointParam.FloorId = data.code;
-      this.pointParam.fllorName = data.name;
-      this.$refs.tabs.reset(this.pointParam, data.map);
-      if (this.map != data.map) {
-        this.map = data.map;
-        this.$refs.canvas.getData(data);
-      } else {
-        return;
-      }
-    },
-
-    //获取到点位标签坐标
-    sendPointList(list) {
-      if (list && list.length && list[0].Id == this.pointId) {
-        this.$refs.canvas.doPoint(list);
-      } else {
-        if (list.length) {
-          this.pointId = list[0].Id;
-          this.$refs.canvas.doPoint(list);
-        } else {
-          this.$refs.canvas.doPoint([]);
+            },
+            //点击事件
+            handleItemChange(val) {
+                if (val.length == 1) {
+                    let obj = Object.assign({
+                        BuildId: val[0]
+                    }, this.param)
+                    getFloor(obj).then(res => {
+                        console.log(res)
+                        this.options = this.options.map(item => {
+                            if (item.value == val[0]) {
+                                item.children = res.data.FloorList.map(child => {
+                                    return {
+                                        value: child.FloorId,
+                                        label: child.FloorLocalName + (child.FloorMap ? '' : '(需初始化数据)'),
+                                        map: child.FloorMap
+                                    }
+                                })
+                            }
+                            return item
+                        })
+                        console.log(this.options)
+                    })
+                } else if (val.length == 2) {
+                }
+            },
+            changeValue() {
+                this.$set(this.param, 'ProjId', this.projectId)
+                this.$set(this.param, 'UserId', this.userId)
+                this.$set(this.pointParam, 'ProjId', this.projectId)
+                this.$set(this.pointParam, 'UserId', this.userId)
+                this.show = true
+            },
+            //渲染
+            getPoint(data) {
+                this.pointParam.FloorId = data.code;
+                this.pointParam.fllorName = data.name;
+                this.$refs.tabs.reset(this.pointParam, data.map);
+                if (this.map != data.map) {
+                    this.map = data.map;
+                    this.$refs.canvas.getData(data);
+                } else {
+                    return;
+                }
+            },
+            //获取到点位标签坐标
+            sendPointList(list) {
+                if (list && list.length && list[0].Id == this.pointId) {
+                    this.$refs.canvas.doPoint(list);
+                } else {
+                    if (list.length) {
+                        this.pointId = list[0].Id;
+                        this.$refs.canvas.doPoint(list);
+                    } else {
+                        this.$refs.canvas.doPoint([]);
+                    }
+                }
+            },
+            //插旗setFalg
+            setFalg(item) {
+                this.$refs.canvas.addPoint(item);
+            },
+            //定位getLocation
+            getLocation(item) {
+                this.$refs.canvas.locationGraphy({
+                    X: item.X,
+                    Y: item.Y * -1
+                });
+            },
+            //重新获取点位信息resetPoint
+            resetPoint() {
+                this.$refs.tabs.reset(this.pointParam, true);
+            },
+            //查看详情
+            getDetails(item) {
+                this.$refs.tabs.getDetails(item);
+            }
         }
-      }
-    },
-
-    //插旗setFalg
-    setFalg(item) {
-      this.$refs.canvas.addPoint(item);
-    },
-
-    //定位getLocation
-    getLocation(item) {
-      this.$refs.canvas.locationGraphy({ X: item.X, Y: item.Y * -1 });
-    },
-
-    //重新获取点位信息resetPoint
-    resetPoint() {
-      this.$refs.tabs.reset(this.pointParam, true);
-    },
-
-    //查看详情
-    getDetails(item) {
-      this.$refs.tabs.getDetails(item);
-    }
-  }
-};
+    };
 </script>
 
 <style lang="less" scoped>
-#graphy {
-    // position: relative;
-    display: flex;
-    .graphy-view{
+    #graphy {
+        // position: relative;
         display: flex;
-        .graphy-main {
-            flex: 1;
-            // position: absolute;
-            // left: 200px;
-            // top: 0;
-            // right: 400px;
-            // bottom: 0;
-            // overflow: auto;
+        flex-direction: column;
+        background-color: #fff;
+        .graphy-view {
+            display: flex;
+            flex: 1; 
+            .graphy-main {
+                flex: 1;
+                // position: absolute;
+                // left: 200px;
+                // top: 0;
+                // right: 400px;
+                // bottom: 0;
+                // overflow: auto;
+            }
+            .graphy-right {
+                // position: absolute;
+                // right: 0;
+                width: 400px; // top: 0;
+                // bottom: 0;
+                // border-left: 1px solid #ccc;
+                // overflow: hidden;
+            }
         }
-        .graphy-right {
+        .graphy-left {
+            // width: 200px;
+            // height: 100%;
             // position: absolute;
-            // right: 0;
-            width: 400px;
+            // overflow-y: auto;
+            // left: 0;
             // top: 0;
             // bottom: 0;
-            // border-left: 1px solid #ccc;
-            // overflow: hidden;
+            // border-right: 1px solid #ccc;
         }
     }
-  .graphy-left {
-    // width: 200px;
-    // height: 100%;
-    // position: absolute;
-    // overflow-y: auto;
-    // left: 0;
-    // top: 0;
-    // bottom: 0;
-    // border-right: 1px solid #ccc;
-  }
-}
 </style>