Преглед на файлове

modify buildfloor add relations

haojianlong преди 5 години
родител
ревизия
f9dc332775

+ 6 - 0
src/api/scan/request.js

@@ -1210,4 +1210,10 @@ export function manageDeleteFloor(param, success) {
 export function manageUpdateFloor(param, success) {
     let url = `${baseUrl}/datacenter/floor/update`;
     http.postJson(url, param, success)
+}
+
+//建筑楼层管理-创建楼层关联关系
+export function createRelationInFloor(param, success) {
+    let url = `${baseUrl}/datacenter/fl-through-fl/link-or`;
+    http.postJson(url, param, success)
 }

+ 24 - 4
src/components/ready/buildfloor/addConnectivity.vue

@@ -3,7 +3,7 @@
     <el-row>
       <div>添加与{{floor.FloorLocalName}}层有贯通关系的楼层 : </div>
       <div :span="16">
-        <bfCascader ref="bfCascader"></bfCascader>
+        <bfCascader ref="bfCascader" :FloorID="floor.FloorID"></bfCascader>
       </div>
     </el-row>
     <span slot="footer" class="dialog-footer">
@@ -14,6 +14,7 @@
 </template>
 <script>
 import bfCascader from '@/components/ready/buildfloor/buildfloorCascader'
+import { createRelationInFloor } from "@/api/scan/request";
 export default {
   data() {
     return {
@@ -29,12 +30,31 @@ export default {
     showDialog() {
       this.connectDialogVis = true
       this.$nextTick(() => {
-        console.log(this.$refs.bfCascader)
-        this.$refs.bfCascader.value = [[1, 2, 3], [1, 2, 4], [1, 2, 5], [1, 7, 8], [1, 7, 9]]
+        this.$refs.bfCascader.getCascader()
+        let arr = this.floor.FloorThroughList || [];
+        let value = []
+        if (arr.length) {
+          arr.map(t => {
+            value.push([t.BuildID, t.FloorID])
+          })
+        }
+        this.$refs.bfCascader.value = value
       })
     },
     save() {
-      console.log(this.$refs.bfCascader)
+      let arr = this.$refs.bfCascader.value;
+      let param = {
+        FloorId: this.floor.FloorID,
+        FloorOtherIdList: []
+      }
+      arr.map(t => {
+        param.FloorOtherIdList.push(t[1])
+      })
+      createRelationInFloor(param, res => {
+        this.connectDialogVis = false;
+        this.$message.success('关联成功');
+        this.$emit('refresh')
+      })
     }
   }
 }

+ 32 - 55
src/components/ready/buildfloor/buildfloorCascader.vue

@@ -2,72 +2,49 @@
   <el-cascader v-model="value" :options="options" :props="props" clearable></el-cascader>
 </template>
 <script>
+import { buildingQuery } from "@/api/scan/request";
 export default {
   data() {
     return {
       value: [],
-      props: { multiple: true },
+      props: {
+        multiple: true,
+        value: 'BuildID',
+        label: 'BuildLocalName',
+        children: 'Floor'
+      },
       options: []
     }
   },
   props: {
-    floorName: {
-      default: ""
+    FloorID: {
+      default: ''
     }
   },
-  created() {
-    setTimeout(() => {
-      this.options = [{
-        value: 1,
-        label: '东南',
-        children: [{
-          value: 2,
-          label: '上海',
-          children: [
-            { value: 3, label: '普陀' },
-            { value: 4, label: '黄埔' },
-            { value: 5, label: '徐汇' }
-          ]
-        }, {
-          value: 7,
-          label: '江苏',
-          children: [
-            { value: 8, label: '南京' },
-            { value: 9, label: '苏州' },
-            { value: 10, label: '无锡' }
-          ]
-        }, {
-          value: 12,
-          label: '浙江',
-          children: [
-            { value: 13, label: '杭州' },
-            { value: 14, label: '宁波' },
-            { value: 15, label: '嘉兴' }
-          ]
-        }]
-      }, {
-        value: 17,
-        label: '西北',
-        children: [{
-          value: 18,
-          label: '陕西',
-          children: [
-            { value: 19, label: '西安' },
-            { value: 20, label: '延安' }
-          ]
-        }, {
-          value: 21,
-          label: '新疆维吾尔族自治区',
-          children: [
-            { value: 22, label: '乌鲁木齐' },
-            { value: 23, label: '克拉玛依' }
-          ]
-        }]
-      }]
-    },600)
-  },
+  created() { },
   methods: {
-
+    getCascader() {
+      let param = {
+        Cascade: [
+          { Name: "floor" }
+        ],
+        PageNumber: 1,
+        PageSize: 50
+      }
+      buildingQuery(param, res => {
+        res.Content.map(t => {
+          if (t.Floor && t.Floor.length) {
+            t.Floor = t.Floor.map(item => {
+              if (item.FloorID == this.FloorID) return
+              item.BuildID = item.FloorID
+              item.BuildLocalName = item.FloorLocalName || item.FloorName
+              return item
+            }).filter(it => it)
+          }
+        })
+        this.options = res.Content
+      })
+    },
   }
 }
 </script>

+ 8 - 0
src/views/ready/buildfloor/addFloor/index.vue

@@ -65,6 +65,14 @@ export default {
       let Param = {
         Content: [newform]
       }
+      if(!newform.FloorLocalName){
+        this.$message.warning('请填写楼层本地名')
+        return
+      }
+      if(!newform.FloorSequenceID){
+        this.$message.warning('请填写楼层顺序号')
+        return
+      }
       if (newform.FloorID) {
         manageUpdateFloor(Param, res => {
           this.$message.success('更新成功')

+ 8 - 8
src/views/ready/buildfloor/index.vue

@@ -36,7 +36,7 @@
             </el-table-column>
             <el-table-column prop="Datasource" label="平面图">
               <template slot-scope="scope">
-                <p v-if="scope.row.type==1">
+                <p v-if="scope.row.StructureInfo&&scope.row.StructureInfo.FloorMap">
                   <i class="iconfont icon-floorplan"></i>
                   查看平面图
                 </p>
@@ -54,7 +54,7 @@
             </el-table-column>
             <el-table-column prop="SubTypeName" label="楼层贯通关系">
               <template slot-scope="scope">
-                <span style="margin-right:20px">{{scope.row.EquipmentMark}}</span>
+                <span style="margin-right:20px">{{scope.row.FloorThroughList?scope.row.FloorThroughList.length:0}}</span>
                 <el-button size="mini" @click="changeConnection(scope.row)" plain icon="el-icon-edit-outline"></el-button>
               </template>
             </el-table-column>
@@ -84,7 +84,7 @@
       </span>
     </el-dialog>
     <!-- 添加贯通关系弹窗 -->
-    <addConnectivity ref="addConnectivity"></addConnectivity>
+    <addConnectivity ref="addConnectivity" @refresh="refresh"></addConnectivity>
   </div>
 </template>
 
@@ -184,6 +184,7 @@ export default {
     // 获取列表
     getFloorTableData() {
       let floorParam = {
+        Cascade: [{ Name: 'floorThroughList' }],
         Orders: "FloorSequenceID desc",
         PageNumber: this.page.pageNumber,
         PageSize: this.page.pageSize,
@@ -194,8 +195,8 @@ export default {
         this.page.total = res.Total
       })
     },
-    // 创建楼层成功
-    refresh(){
+    // 创建楼层成功-修改关系成功
+    refresh() {
       this.getFloorTableData()
     },
     // 确认删除(删除建筑-楼层公用)
@@ -210,15 +211,14 @@ export default {
       } else {
         //todo
       }
-    
     },
     // 修改楼层信息
-    editFloorData(floor){
+    editFloorData(floor) {
       this.curFloorId = floor.FloorID;
       this.$refs.addFloorDialog.showDialog(floor)
     },
     // 修改楼层贯通关系
-    changeConnection(row){
+    changeConnection(row) {
       this.$refs.addConnectivity.showDialog()
       this.$refs.addConnectivity.floor = row
     }