Browse Source

modify canvas businessspace

haojianlong 5 years ago
parent
commit
afacdd666e

+ 10 - 5
src/api/scan/request.js

@@ -1297,11 +1297,6 @@ export function notSyInSpaceQuery(param, success) {
     let url = `${baseUrl}/equip-component/space/unspace-in-sys?type=${param.type}&spaceId=${param.spaceId}`;
     http.postJson(url, param.data, success)
 }
-//关系-----业务空间和元空间关系(业务空间一对多,并且会覆盖之前记录)
-export function createRelateInZoneAndISp(param, success) {
-    let url = `${baseUrl}/datacenter/sp-in-si-zone-general/link-sp`;
-    http.postJson(url, param, success)
-}
 //关系-----空间内没有和空间关联的设备 根据坐标计算(专用接口)
 export function getEqNotInSpace(param, success) {
     let url = `${baseUrl}/equip-component/space/unspace-fIn-eq-point?spaceId=${param.spaceId}&type=${param.type}`;
@@ -1311,4 +1306,14 @@ export function getEqNotInSpace(param, success) {
 export function getEqNotForSpace(param, success) {
     let url = `${baseUrl}/equip-component/space/unspace-for-eq-point?spaceId=${param.spaceId}&type=${param.type}`;
     http.postJson(url, param.data, success)
+}
+//关系-----未关联业务空间的元空间
+export function getIspNotInSpace(param, success) {
+    let url = `${baseUrl}/equip-component/space/unspace-ispace?objectType=${param.objectType}`;
+    http.postJson(url, param.data, success)
+}
+//关系-----业务空间内的元空间,业务空间一对多,累计添加不会覆盖以前记录
+export function createRelateInZoneAndISp(param, success) {
+    let url = `${baseUrl}/datacenter/si-in-sp-base/link-si-sp?type=${param.type}`;
+    http.postJson(url, param.data, success)
 }

+ 7 - 2
src/components/business_space/business/handsontable.vue

@@ -335,10 +335,15 @@ export default {
         },
         zone: this.zoneCode
       };
+      let keyList = [];
       //生成要修改字段列表
       change.map((item) => {
-        if (item[1] && param.data.Projection.indexOf(item[1]) == -1) {
-          param.data.Projection.push(item[1])
+        let key = item[1].split(".")[0]
+        if (item[1] && keyList.indexOf(key) == -1) {
+          keyList.push(key)
+        }
+        if (item[1] && item[3] == "" && param.data.Projection.indexOf(key) == -1) {
+          param.data.Projection.push(key)
         }
       })
       //生成对应修改数据

+ 16 - 2
src/components/business_space/newAddDialogs/addEquipDialog.vue

@@ -119,9 +119,10 @@ export default {
           } else {
             t.Floor = []
           }
-          t.Floor.unshift({ BuildID: 'isNull', BuildLocalName: '未明确楼层' })
+          t.Floor.unshift({ BuildID: 'all', BuildLocalName: '全部' }, { BuildID: 'isNull', BuildLocalName: '未明确楼层' })
           return t;
         })
+        this.options.unshift({ BuildID: 'all', BuildLocalName: '全部' }, { BuildID: 'isNull', BuildLocalName: '未明确楼层' })
       })
     },
     // 显示弹窗
@@ -134,16 +135,29 @@ export default {
       let pa = {
         data: {
           Cascade: [{ Name: "equipCategory" }],
-          Filters: `BuildingId='${this.floor[0]}';FloorId='${this.floor[1]}'`,
+          Filters: '',
           PageNumber: this.page.pageNumber,
           PageSize: this.page.pageSize,
         },
         type: this.zone,
         spaceId: this.spaceId
       }
+      if (this.floor[0] == 'isNull') {
+        pa.data.Filters += `BuildingId isNull`
+      } else if (this.floor[0] && this.floor[0] != 'all') {
+        pa.data.Filters += `BuildingId='${this.floor[0]}'`
+      }
+      if (this.floor[1] == 'isNull') {
+        pa.data.Filters += `;FloorId isNull`
+      } else if (this.floor[1] && this.floor[1] != 'all') {
+        pa.data.Filters += `;FloorId='${this.floor[1]}'`
+      }
       if (this.keycode != '') {
         pa.data.Filters += `;EquipName contain "${this.keycode}" or EquipLocalName contain "${this.keycode}" or EquipLocalID contain "${this.keycode}"`
       }
+      if (pa.data.Filters == '') {
+        delete pa.data.Filters
+      }
       console.log(this.showType)
       if (this.showType) {
         if (this.type == "Equipment") {

+ 31 - 7
src/components/business_space/newGraphy/graphy.vue

@@ -77,6 +77,7 @@ import {
   queryZone,
   updateZone,
   createZone,
+  getIspNotInSpace,
   createRelateInZoneAndISp
 } from "@/api/scan/request"
 const colorArr = [
@@ -142,6 +143,8 @@ export default {
       this.getUnrelateCount();
       // 获取当前楼层的元空间
       this.getFloorISpace();
+      // 查询未关联业务空间的元空间
+      this.getISPSPUnrelaBSP()
     },
     // 获取当前楼层的元空间
     getFloorISpace() {
@@ -200,7 +203,16 @@ export default {
     },
     // 获取未绑定业务空间的元空间
     getISPSPUnrelaBSP() {
-
+      let pa = {
+        data: {
+          Filters: `FloorId='${this.buildFloor[1]}'`,
+          PageSize: 1000
+        },
+        objectType: this.tab.code
+      }
+      getIspNotInSpace(pa, res => {
+        console.log(res)
+      })
     },
     // 获取底图
     getGraphy() {
@@ -223,6 +235,9 @@ export default {
         that.scene.addZoneList(tempArr);
         that.scene.click(that, that.canvasClick)
         that.view.fitSceneToView();
+        that.view.maxScale = that.view.scale * 10;
+        that.view.minScale = that.view.scale;
+        that.$refs.canvasFun.everyScale = that.view.scale;
       })
     },
     // 获取当前分区下的业务空间
@@ -260,7 +275,6 @@ export default {
     },
     // canvas点击事件
     canvasClick(item, event) {
-      console.log(arguments)
       this.scene.setSpaceSelectable(true);
       this.scene.setZoneSelectable(true);
       if (this.type == 4) {
@@ -435,7 +449,10 @@ export default {
     },
     // 更新业务空间和元空间的关系
     relationInBSPandISP(SpaceId, IspaceIdList) {
-      let pa = { SpaceId: SpaceId, IspaceIdList: IspaceIdList }
+      let pa = {
+        data: { SpaceId: SpaceId, IspaceIdList: IspaceIdList },
+        type: this.tab.code
+      }
       createRelateInZoneAndISp(pa, res => {
         this.$message.success('创建成功');
         this.init();
@@ -470,11 +487,11 @@ export default {
     },
     // 保存为png
     savePng() {
-      this.view.saveImage(`${this.floor}.png`, 'png');
+      this.view.saveImage(`${this.buildFloor[1]}.png`, 'png');
     },
     // 保存为svg
     saveSvg() {
-      this.view.saveSceneSvg(`${this.floor}.png`, 6400, 4800);
+      this.view.saveSceneSvg(`${this.buildFloor[1]}.svg`, 6400, 4800);
     },
     // 切割划分
     divide() {
@@ -492,8 +509,8 @@ export default {
     redo() { },
     // 缩放
     scale(val) {
-      // let scale = this.view.scale
-      // this.view.scaleByPoint(val / scale, this.cadWidth / 2, this.cadHeight / 2)
+      let scale = this.view.scale;
+      this.view.scaleByPoint(val / scale, this.canvasWidth / 2, this.canvasHeight / 2);
     },
   },
   filters: {
@@ -510,6 +527,13 @@ export default {
     projectId() {
       this.FloorMap = '';
       this.tab = {};
+    },
+    "view.scale": {
+      handler(n) {
+        if (this.$refs.canvasFun) {
+          this.$refs.canvasFun.sliderVal = n * 10 / this.view.minScale;
+        }
+      }
     }
   }
 }

+ 43 - 67
src/components/model/file/floorTable.vue

@@ -1,72 +1,50 @@
 <template>
-  <el-table
-    ref="filterTable"
-    :data="tableData"
-    style="width: 100%"
-    :height="maxHeight"
-    :header-cell-style="{background:'#d9d9d9',color:'#2b2b2b'}"
-  >
-    <el-table-column prop="FloorName" label="模型文件" width="180">
-      <template slot-scope="scope">
-        <i class="el-icon-document-checked icon_font"></i>
-        <span style="margin-left: 10px">{{ scope.row.FloorName }}</span>
-      </template>
-    </el-table-column>
-    <el-table-column prop="Note" label="备注" width="180"></el-table-column>
-    <el-table-column prop="Version" label="版本号"></el-table-column>
-    <el-table-column prop="AcceptTime" label="上传时间"></el-table-column>
-    <el-table-column prop="UserName" label="上传人"></el-table-column>
-    <el-table-column prop="address" align="center" label="操作"  width="240">
-      <template slot-scope="scope">
-        <div class="operate" v-show="!scope.row.isDown">
-          <el-button
-            type="primary"
-            size="mini"
-            class="iconfont icon-download"
-            @click="downloadModel(scope.row)"
-          ></el-button>
-          <el-button
-            type="primary"
-            size="mini"
-            class="iconfont icon-replace"
-            @click="repliaceModel(scope.row)"
-          ></el-button>
-          <el-button
-            type="primary"
-            size="mini"
-            class="iconfont icon-Log"
-            @click="queryModelLog(scope.row)"
-          ></el-button>
-        </div>
-        <div
-          :class="[scope.row.Status == 1 || scope.row.Status == 10 || scope.row.Status == 11 || (!scope.row.Status && scope.row.precent == 100)? 'upLoad-loading':'','upLoad']"
-          v-show="scope.row.isDown"
-        >
-          <div class="progress">
-            <el-progress
-              :text-inside="scope.row.Status == 1 || scope.row.Status == 10 || scope.row.Status == 11 || (!scope.row.Status && scope.row.precent == 100)?false:true"
-              :stroke-width="20"
-              :percentage="scope.row.precent"
-              :color="scope.row.Status == 1 || scope.row.Status == 10 || scope.row.Status == 11?'#909399':'#67C23A'"
-            ></el-progress>
+  <div class="filterTable-container">
+    <el-table ref="filterTable" :data="tableData" style="width: 100%" height="100%" :header-cell-style="{background:'#d9d9d9',color:'#2b2b2b'}">
+      <el-table-column prop="FloorName" label="模型文件" width="180">
+        <template slot-scope="scope">
+          <i class="el-icon-document-checked icon_font"></i>
+          <span style="margin-left: 10px">{{ scope.row.FloorName }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column prop="Note" label="备注" width="180"></el-table-column>
+      <el-table-column prop="Version" label="版本号"></el-table-column>
+      <el-table-column prop="AcceptTime" label="上传时间"></el-table-column>
+      <el-table-column prop="UserName" label="上传人"></el-table-column>
+      <el-table-column prop="address" align="center" label="操作" width="240">
+        <template slot-scope="scope">
+          <div class="operate" v-show="!scope.row.isDown">
+            <el-button type="primary" size="mini" class="iconfont icon-download" @click="downloadModel(scope.row)"></el-button>
+            <el-button type="primary" size="mini" class="iconfont icon-replace" @click="repliaceModel(scope.row)"></el-button>
+            <el-button type="primary" size="mini" class="iconfont icon-Log" @click="queryModelLog(scope.row)"></el-button>
           </div>
-          <div class="progress-right">
-            <!-- <el-button
+          <div
+            :class="[scope.row.Status == 1 || scope.row.Status == 10 || scope.row.Status == 11 || (!scope.row.Status && scope.row.precent == 100)? 'upLoad-loading':'','upLoad']"
+            v-show="scope.row.isDown">
+            <div class="progress">
+              <el-progress
+                :text-inside="scope.row.Status == 1 || scope.row.Status == 10 || scope.row.Status == 11 || (!scope.row.Status && scope.row.precent == 100)?false:true"
+                :stroke-width="20" :percentage="scope.row.precent"
+                :color="scope.row.Status == 1 || scope.row.Status == 10 || scope.row.Status == 11?'#909399':'#67C23A'"></el-progress>
+            </div>
+            <div class="progress-right">
+              <!-- <el-button
               v-show="!scope.row.Status"
               type="danger"
               class="iconfont icon-termination"
               @click="closeUpdate(scope.row)"
               circle
             ></el-button>-->
-            <span v-show="!scope.row.Status && scope.row.precent == 100">上传中</span>
-            <span v-show="scope.row.Status == 1">等待检查...</span>
-            <span v-show="scope.row.Status == 10">模型检查中</span>
-            <span v-show="scope.row.Status == 11">未通过检查</span>
+              <span v-show="!scope.row.Status && scope.row.precent == 100">上传中</span>
+              <span v-show="scope.row.Status == 1">等待检查...</span>
+              <span v-show="scope.row.Status == 10">模型检查中</span>
+              <span v-show="scope.row.Status == 11">未通过检查</span>
+            </div>
           </div>
-        </div>
-      </template>
-    </el-table-column>
-  </el-table>
+        </template>
+      </el-table-column>
+    </el-table>
+  </div>
 </template>
 <script>
 import { mapGetters } from "vuex";
@@ -126,7 +104,7 @@ export default {
       if (item.Url) {
         let a = document.createElement("a");
         a.href = item.Url;
-        a.download =`${this.modelFolderName}${item.FloorName}模型文件v${item.Version}.rvt`;
+        a.download = `${this.modelFolderName}${item.FloorName}模型文件v${item.Version}.rvt`;
         a.click();
       } else {
         this.$message({
@@ -151,7 +129,7 @@ export default {
     persentList: {
       immediate: true,
       deep: true,
-      handler: function(val, oldVal) {
+      handler: function (val, oldVal) {
         if (val.length != 0) {
           val.map(item => {
             if (item.precent != 0) {
@@ -161,17 +139,15 @@ export default {
         }
       }
     }
-  },
-  mounted() {
-    this.$nextTick(function() {
-      this.maxHeight = $("#file_moddle_manage").height() - 60; // 获取最外层的高度
-    });
   }
 };
 </script>
 <style scoped lang="less">
 .box-card {
   height: 100%;
+  .filterTable-container {
+    height: calc(100% - 80px);
+  }
   .operate {
     .iconfont {
       font-size: 12px;

+ 4 - 2
src/framework/layout/layout-store.js

@@ -18,7 +18,7 @@ export default {
         projects: [],
         breadcrumb: [],
         secret: "", //密码
-        userId: "test", //用户id
+        userId: "", //用户id
     },
     getters: {
         sidebarClosed: state => state.sidebarClosed,
@@ -110,8 +110,10 @@ export default {
                     //     }
                     // } else {
                     if (resp.Result == 'success') {
-                        state.userInfo = { username: resp.Username }
+                        state.userInfo = { username: resp.Username, userId: resp.Userid }
+                        state.userId = resp.Userid
                         storage.set('user_name', resp.Username)
+                        storage.set('user_id', resp.Userid)
                         state.permissions = {}
                         if (resp.Permissions) {
                             resp.Permissions.forEach(p => (state.permissions[p] = true))

+ 21 - 60
src/views/model/file/index.vue

@@ -23,17 +23,9 @@
             <div class="head">模型文件夹</div>
             <ul class="lists">
               <el-scrollbar style="height:100%;">
-                <li
-                  @click="openFolder(index,item)"
-                  v-for="(item,index) in navigationModel"
-                  :key="index"
-                  :class="[choiceIndex == index + 1 ? 'li-active' : '']"
-                >
-                  <i
-                    :class="[choiceIndex == index + 1 ?  'el-icon-folder-opened':'el-icon-folder','icon_font']"
-                    width="40"
-                    height="40"
-                  ></i>
+                <li @click="openFolder(index,item)" v-for="(item,index) in navigationModel" :key="index"
+                  :class="[choiceIndex == index + 1 ? 'li-active' : '']">
+                  <i :class="[choiceIndex == index + 1 ?  'el-icon-folder-opened':'el-icon-folder','icon_font']" width="40" height="40"></i>
                   <span>{{item.Name}}</span>
                 </li>
               </el-scrollbar>
@@ -44,66 +36,35 @@
     </el-col>
     <!-- 右边文件表格 -->
     <el-col class="col_left" :span="19">
-      <el-card class="box-card" :body-style="{ padding: '0px' }">
+      <el-card class="box-card" :body-style="{ padding: '0px', height:'100%' }">
         <!-- 顶部操作栏 -->
         <div class="top_hand right_top_hand">
           <el-button @click="addFloorFile">添加楼层文件</el-button>
           <el-button @click="queryFloorFile(currentFolderId)">刷新</el-button>
         </div>
         <!-- 列表 -->
-        <floorTable
-          ref="floorTable"
-          :tableData="tableData"
-          :modelFolderName="currentFolderName"
-          @openModelLog="queryModelLog"
-          @replaceModel="repliaceModel"
-          @closeUpdateFile="removePersentList"
-          @percentFinish="queryFloorFile(currentFolderId)"
-          :persentList="persentList"
-        ></floorTable>
+        <floorTable ref="floorTable" :tableData="tableData" :modelFolderName="currentFolderName" @openModelLog="queryModelLog"
+          @replaceModel="repliaceModel" @closeUpdateFile="removePersentList" @percentFinish="queryFloorFile(currentFolderId)"
+          :persentList="persentList"></floorTable>
       </el-card>
     </el-col>
     <!-- 弹窗 开始-->
 
     <!-- 模型日志弹窗 -->
-    <modelLog
-      :modelLogVisible="modelLogVisible"
-      :modelFolderName="currentFolderName"
-      @deleteFinish="updataLog"
-      @CloseModelLogDia="modelLogVisible=false"
-      :logData="logData"
-    ></modelLog>
+    <modelLog :modelLogVisible="modelLogVisible" :modelFolderName="currentFolderName" @deleteFinish="updataLog"
+      @CloseModelLogDia="modelLogVisible=false" :logData="logData"></modelLog>
     <!-- 替换模型弹窗 -->
-    <repliceModel
-      :repliceModelVisible="repliceModelVisible"
-      @closeReplaceModelDia="repliceModelVisible=false"
-      :replaceModelItem="replaceModelItem"
-      @updataModel="updateModelFile"
-    ></repliceModel>
+    <repliceModel :repliceModelVisible="repliceModelVisible" @closeReplaceModelDia="repliceModelVisible=false" :replaceModelItem="replaceModelItem"
+      @updataModel="updateModelFile"></repliceModel>
     <!-- 新增楼层 -->
-    <addFloorDialog
-      :addFloorFileVisible="addFloorFileVisible"
-      :floorList="tableData"
-      :FolderName="currentFolderName"
-      :FolderId="currentFolderId"
-      @closeAddFloorDia="addFloorFileVisible=false"
-      @finishCreateFloor="uploadModelFIle"
-    ></addFloorDialog>
+    <addFloorDialog :addFloorFileVisible="addFloorFileVisible" :floorList="tableData" :FolderName="currentFolderName" :FolderId="currentFolderId"
+      @closeAddFloorDia="addFloorFileVisible=false" @finishCreateFloor="uploadModelFIle"></addFloorDialog>
     <!-- 新增文件夹名称 -->
-    <addFolder
-      :addFolderVisible="addFolderVisible"
-      @closeAddFolderVisible="addFolderVisible=false;folderName=''"
-      :folderName="folderName"
-      @getfolderModel="queryModel"
-    ></addFolder>
+    <addFolder :addFolderVisible="addFolderVisible" @closeAddFolderVisible="addFolderVisible=false;folderName=''" :folderName="folderName"
+      @getfolderModel="queryModel"></addFolder>
     <!-- 编辑文件夹名字 -->
-    <changeFolderName
-      :currentFolderId="currentFolderId"
-      :changeFolderNameVisible="changeFolderNameVisible"
-      :folderName="folderName"
-      @finishChangeFolderName="queryModel"
-      @closeChangeFolderVisible="changeFolderNameVisible=false;folderName=''"
-    ></changeFolderName>
+    <changeFolderName :currentFolderId="currentFolderId" :changeFolderNameVisible="changeFolderNameVisible" :folderName="folderName"
+      @finishChangeFolderName="queryModel" @closeChangeFolderVisible="changeFolderNameVisible=false;folderName=''"></changeFolderName>
     <!-- 弹窗 结束-->
   </div>
 </template>
@@ -119,7 +80,7 @@ import changeFolderName from "@/components/model/file/changeFolderName"; //编
 import floorTable from "@/components/model/file/floorTable"; //右侧list表
 export default {
   // 离开此页面前要判断是是否有下载
-  beforeRouteLeave: function(to, from, next) {
+  beforeRouteLeave: function (to, from, next) {
     console.log(this.uploadClassList);
     if (this.uploadClassList.length) {
       this.$alert(
@@ -247,7 +208,7 @@ export default {
       request.queryModel("", res => {
         this.navigationModel = res.Content;
         this.loading = false;
-        if(this.navigationModel.length){
+        if (this.navigationModel.length) {
           //默认选择第一个文件夹
           this.choiceIndex = 1;
           this.currentFolderName = this.navigationModel[0].Name;
@@ -289,7 +250,7 @@ export default {
               if (this.persentList.length != 0) {
                 this.persentList.forEach(pItem => {
                   if (item.Id == pItem.Id) {
-                    Object.assign(item, { isDown: true, precent: pItem.precent?pItem.precent:0 });
+                    Object.assign(item, { isDown: true, precent: pItem.precent ? pItem.precent : 0 });
                   }
                 });
               }
@@ -551,7 +512,7 @@ export default {
   watch: {
     uploadClassList: {
       deep: true,
-      handler: function(val) {
+      handler: function (val) {
         console.log(val);
       }
     },

+ 1 - 1
src/views/ready/buildfloor/addFloor/index.vue

@@ -4,7 +4,7 @@
       <formItems :type="'Floor'" ref="formItems"></formItems>
     </div>
     <span slot="footer" class="dialog-footer">
-      <el-button size="small">取消</el-button>
+      <el-button size="small" @click="dialogVisible=false">取消</el-button>
       <el-button size="small" type="primary" @click="confirm">确认</el-button>
     </span>
   </el-dialog>

+ 1 - 1
src/views/ready/buildfloor/drawGraphy/drawFloor.vue

@@ -126,7 +126,7 @@ export default {
     },
     // 保存为svg
     saveSvg() {
-      this.view.saveSceneSvg(`${this.floor}.png`, 6400, 4800);
+      this.view.saveSceneSvg(`${this.floor}.svg`, 6400, 4800);
     },
     // 切割划分
     divide() {