Browse Source

业务空间与建筑楼层关系修改,添加接口及页面

haojianlong 4 years ago
parent
commit
8e3d1f4c9b

+ 12 - 9
src/api/scan/request.js

@@ -1313,20 +1313,13 @@ export function buildingQueryAndCount(param, success) {
     http.postJson(url, param, success)
 }
 
-//创建分区信息
+// 创建分区信息
 export function createZone(param, success) {
     let data = param.data
-    let url = `${baseUrl}/datacenter/${zone[param.zone]}/create`;
+    let url = `${baseUrl}/datacenter/${zone[param.zone]}/create-bd-fl`;
     http.postJson(url, data, success)
 }
 
-//创建分区信息
-// export function createZone(param, success) {
-//     let data = param.data
-//     let url = `${baseUrl}/datacenter/${zone[param.zone]}/create-bd-fl`;
-//     http.postJson(url, data, success)
-// }
-
 //删除分区信息
 export function deleteZone(param, success) {
     let data = param.data
@@ -1575,6 +1568,16 @@ export function getIspNotInSpace(param, success) {
     let url = `${baseUrl}/equip-component/space/unspace-ispace?objectType=${param.objectType}`;
     http.postJson(url, param.data, success)
 }
+//关系-----统计 属于多建筑楼层的空间数据
+export function getSpaceBdFlCount(param, success) {
+	let url = `${baseUrl}/equip-component/space/space-bd-fl`;
+	http.postJson(url, param, success)
+}
+//关系-----统计 属于多建筑楼层的空间数据
+export function getSpaceBdFlData(param, success) {
+	let url = `${baseUrl}/equip-component/space/space-bd-fl-data`;
+	http.postJson(url, param, success)
+}
 //关系-----业务空间内的元空间,业务空间一对多,累计添加会覆盖以前记录
 export function createRelateInZoneAndISp(param, success) {
     let url = `${baseUrl}/datacenter/si-in-sp-base/link-sp?type=${param.type}`;

+ 64 - 39
src/components/business_space/newAddDialogs/roomInFloorDialog.vue

@@ -1,19 +1,39 @@
 <template>
   <el-dialog :title="title" :visible.sync="dialogVisible" width="800px" id="addSyDialog">
     <div class="table-box">
-      <el-table :data="tableData" style="width: 100%" height="100%" v-loading="loading" :header-cell-style="headerStyle" ref="multipleTable">
+      <el-table :data="tableData" style="width: 100%" height="100%" v-loading="loading" :header-cell-style="headerStyle" ref="multipleTable" border>
         <el-table-column label="业务空间名称" show-overflow-tooltip min-width="100">
           <template slot-scope="scope">
             <div>
-              {{scope.row.SysLocalName||scope.row.SysName||''}}
+              {{scope.row.RoomLocalName||scope.row.RoomName||''}}
             </div>
           </template>
         </el-table-column>
-        <el-table-column prop="SysLocalID" label="所属建筑" show-overflow-tooltip min-width="100"></el-table-column>
-        <el-table-column prop="SysLocalID" label="所属楼层" show-overflow-tooltip min-width="100"></el-table-column>
-        <el-table-column prop="action" label="操作" min-width="100">
+        <el-table-column label="所属建筑" show-overflow-tooltip min-width="100" class-name="mutiCol">
           <template slot-scope="scope">
-            <el-button size="mini" @click="toDetail(scope.$index, scope.row)" type="primary" plain>查看详情</el-button>
+            <div>
+              <div v-for="(t,i) in scope.row.FloorList" :key="i" class="muti">
+                {{t.Building.BuildLocalName||t.Building.BuildName}}
+              </div>
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="SysLocalID" label="所属楼层" show-overflow-tooltip min-width="100" class-name="mutiCol">
+          <template slot-scope="scope">
+            <div>
+              <div v-for="t in scope.row.FloorList" :key="t.FloorID" class="muti">
+                {{t.FloorLocalName||t.FloorName}}
+              </div>
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="action" label="操作" min-width="50" align='center' class-name="mutiCol">
+          <template slot-scope="scope">
+            <div>
+              <div v-for="t in scope.row.FloorList" :key="t.FloorID" class="muti">
+                <el-radio v-model="scope.row.selected" :label="t">{{''}}</el-radio>
+              </div>
+            </div>
           </template>
         </el-table-column>
       </el-table>
@@ -24,12 +44,10 @@
     </span>
   </el-dialog>
 </template>
-
-
 <script>
 import {
-  notSyInSpaceQuery, //没有和当前空间绑定的系统
-  syInSpaceCreate, //系统所在业务空间--创建关系
+  getSpaceBdFlData, // 属于多建筑楼层的空间数据
+  updateRelateInSpAndBuild, //保存业务空间与建筑楼层关系
 } from "@/api/scan/request";
 export default {
   data() {
@@ -59,45 +77,39 @@ export default {
       this.tableData = [];
       this.getTableData();
     },
-    // 选中项修改
-    handleSelectionChange(val) {
-      this.selections = val;
-    },
     // 确认
     savaRelation() {
-      let pa = {
-        data: {
-          SpaceId: this.spaceId,
-          SysIdList: []
-        },
-        type: this.zone
-      }
-      this.selections.map(t => {
-        pa.data.SysIdList.push(t.SysID)
-      })
-      syInSpaceCreate(pa, res => {
-        this.$message.success('关联成功');
-        this.$emit('refresh');
-        this.dialogVisible = false;
+      let arr = [];
+      this.tableData.forEach(t => {
+        if (t.selected) {
+          arr.push({
+            spaceId: t.RoomID,
+            id: t.selected.FloorID,
+            type: t.ObjectType
+          })
+        }
       })
+      if (arr.length) {
+        updateRelateInSpAndBuild(arr, res => {
+          this.$emit('relaSuc');
+          this.$message.success('关联成功');
+          this.dialogVisible = false;
+        })
+      } else {
+        this.$message.warning('请选择关联建筑楼层');
+      }
     },
     // 获取表格数据
     getTableData() {
       let pa = {
-        data: {
-          PageSize: 200,
-          Orders: 'SysID asc'
-        },
-        type: this.zone,
-        spaceId: this.spaceId
+        Cascade: [
+          { Name: "floorlList", Cascade: [{ Name: 'building' }] }
+        ],
+        PageSize: 1000
       }
-      notSyInSpaceQuery(pa, res => {
+      getSpaceBdFlData(pa, res => {
         this.tableData = res.Content;
       })
-    },
-    // 查看详情
-    toDetail() {
-      this.$message('开发中')
     }
   }
 }
@@ -106,6 +118,19 @@ export default {
 #addSyDialog {
   .table-box {
     height: 350px;
+    /deep/ .mutiCol {
+      padding: 0;
+      & > div {
+        padding: 0;
+      }
+    }
+    .muti {
+      line-height: 32px;
+      padding: 0 10px;
+      & + .muti {
+        border-top: 1px solid #ebeef5;
+      }
+    }
   }
 }
 </style>

+ 14 - 2
src/views/ledger/spacelist/index.vue

@@ -4,7 +4,7 @@
 <template>
   <div id="businessSpace">
     <!-- 空间属于多个建筑楼层 -->
-    <!-- <roomInFloorDialog ref="roomInFloorDialog"></roomInFloorDialog> -->
+    <roomInFloorDialog ref="roomInFloorDialog" @relaSuc="relaSuc"></roomInFloorDialog>
     <!--------- 页面头部   -------------->
     <div class="saga-title" v-show="!needCalculate">
       <div class="saga-build-mess">
@@ -16,7 +16,7 @@
           <el-radio-button label="2" class="space-own-radio" style="width: 68px;">列表</el-radio-button>
         </el-radio-group>
       </div>
-      <!-- <div class="saga-build-tips" v-if="1" @click="getTips">有25个空间同时属于多个建筑楼层,点击处理</div> -->
+      <div class="saga-build-tips" v-if="mutiCount>0" @click="getTips">有{{mutiCount}}个空间同时属于多个建筑楼层,点击处理</div>
     </div>
     <div class="saga-business-sapce-main" v-show="!needCalculate">
       <el-row class="spaceTypes">
@@ -61,6 +61,7 @@ import {
   buildingQuery, //数据中心-建筑查询
   queryDictionaryHead, //数据中心-字典头部信息查询接口
   getrelationTypeProject, //数据中心-当该项目中的"建筑体下的业务空间"“楼层下的业务空间”关系的状态为需更新时,业务空间台账功能不可用
+  getSpaceBdFlCount, // 属于多建筑楼层的空间数据统计
 } from "@/api/scan/request";
 import tools from '@/utils/scan/tools'
 import floorCascader from "@/components/ledger/lib/floorCascader";
@@ -116,6 +117,7 @@ export default {
       buildFloorSelectd: [''], //当前所选的建筑楼层
       childBackParam: {},
       needCalculate: false, // 关系是否需要计算
+      mutiCount: 0
     };
   },
   created() {
@@ -129,6 +131,7 @@ export default {
     init() {
       this.getTypes()
       this.getBuilding()
+      this.getMutiCount()
     },
     // 获取项目下建筑
     getBuilding() {
@@ -183,6 +186,12 @@ export default {
         }
       })
     },
+    // 获取多建筑楼层统计
+    getMutiCount() {
+      getSpaceBdFlCount({}, res => {
+        this.mutiCount = res.Count;
+      })
+    },
     // 获取关系是否需要计算
     getRelations() {
       let pa = {
@@ -294,6 +303,9 @@ export default {
     // 跳转至关系总览
     jumpToAllRelation() {
       this.$router.push({ name: 'overView' })
+    },
+    relaSuc() {
+      this.init();
     }
   },
   watch: {