Browse Source

更换接口

shaun-sheep 5 years ago
parent
commit
d4228190da
2 changed files with 66 additions and 19 deletions
  1. 16 1
      src/api/scan/request.js
  2. 50 18
      src/components/business_space/business/handsontable.vue

+ 16 - 1
src/api/scan/request.js

@@ -1893,7 +1893,7 @@ export function getAllEqPaType(param, success) {
   let url = `${baseUrl}/datacenter/class-def/query-equip-comm-type`
   http.postJson(url, param, success)
 }
-
+/********************更换接口**************************/
 // 查询空间信息
 export function getZoneQuery(param,success) {
 let url = `${baseUrl}/datacenter/class-def/query-equip-comm-type`
@@ -1926,3 +1926,18 @@ export function searchZoneQuery(param,success) {
   let url = `${baseUrl}/datacenter/object/zone/query`
   http.postJson(url,param,success)
 }
+// 根据id删除分区对象
+export function handleZoneDelete(param,success) {
+  let url = `${baseUrl}/datacenter/object/zone/delete`
+  http.postJson(url,param,success)
+}
+//更新分区对象信息
+export function handleZoneObjectUpdate(param,success) {
+  let url = `${baseUrl}/datacenter/object/zone/update`
+  http.postJson(url,param,success)
+}
+//修改业务空间对象和建筑楼层的关系
+export function handleZoneUpdateBd(param,success) {
+  let url = `${baseUrl}/datacenter/object/zone/update-fl-bd`
+  http.postJson(url,param,success)
+}

+ 50 - 18
src/components/business_space/business/handsontable.vue

@@ -60,11 +60,11 @@
   import qrcode from "@/components/ledger/lib/qrcode";
   import {
     BeatchQueryParam,
-    deleteZone,
+    handleZoneDelete,
+    handleZoneObjectUpdate,
+    handleZoneUpdateBd,
     queryAllZoneType,
     searchZoneQuery,
-    updateRelateInSpAndBuild,
-    updateZone,
     zoneCreate
   } from "@/api/scan/request";
   import {mapGetters} from "vuex";
@@ -193,6 +193,13 @@
         this.getZoneMessage(this.zoneParam)
       } else {
         // 其他分区类型查询表数据接口
+        if (this.OtherValue) {
+          this.zoneParam.ZoneType = this.OtherValue;
+          this.getZoneMessage(this.zoneParam)
+        } else {
+          this.main = []
+
+        }
         this.isLoading = false
         this.getOtherType();
       }
@@ -426,20 +433,27 @@
       if (params.length < 1 || this.main > this.copyMain) {
         return
       }
-      let param = {
-        data: [],
-        zone: this.zoneCode
-      }
-      params.map(item => {
-        if (item.RoomID)
-          param.data.push({ RoomID: item.RoomID })
-      })
+      // let param = {
+      //   data: [],
+      //   zone: this.zoneCode
+      // }
+      // params.map(item => {
+      //
+      //   if (item.RoomID)
+      //     param.data.push({ RoomID: item.RoomID })
+      //
+      // })
+      params.map(i => i.ObjectType = this.zoneParam.ZoneType ? this.zoneParam.ZoneType : i.ObjectType);
       this.$confirm("此操作将删除业务空间,是否继续?", "提示", {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        deleteZone(param, res => {
+        // deleteZone(params, res => {
+        //   this.$message.success("删除成功!")
+        //   this.getData()
+        // })
+        handleZoneDelete(params, res => {
           this.$message.success("删除成功!")
           this.getData()
         })
@@ -495,9 +509,12 @@
       //   this.$message.success("添加成功!")
       //   this.getData()
       // })
-      zoneCreate(params, res => {
+      let {ObjectType, ...msg} = param;
+      msg.ZoneType = ObjectType;
+      zoneCreate(msg, res => {
         this.$message.success("添加成功!")
         this.getData()
+        this.getZoneMessage(params)
       })
     },
     // 修改
@@ -553,16 +570,31 @@
       if (param.data.Projection.indexOf('BuildingId') > -1) {
         let pa = param.data.Content.map(t => {
           return {
-            type: this.zoneCode,
-            spaceId: t.RoomID,
-            id: t.FloorId || t.BuildingId || null,
+            Type: this.zoneCode,
+            SpaceId: t.RoomID,
+            Id: t.FloorId || t.BuildingId || null,
           }
         })
-        updateRelateInSpAndBuild(pa, res => {
+        handleZoneUpdateBd(pa, res => {
           this.$message.success('修改成功')
         })
+        // updateRelateInSpAndBuild(pa, res => {
+        //   this.$message.success('修改成功')
+        // })
       } else {
-        updateZone(param, (res) => {
+        // updateZone(param, (res) => {
+        // })
+        let obj = param.data.Content.map(i => {
+          return {
+            ...i,
+            ObjectType: this.zoneParam.ZoneType || i.ObjectType
+          }
+        })
+        let updateParam = {
+          Content: obj
+        };
+        handleZoneObjectUpdate(updateParam, res => {
+          this.$message.success('更新成功')
         })
       }
     },