浏览代码

动参接口替换p1删除提示页接口

haojianlong 5 年之前
父节点
当前提交
53950577c4

+ 248 - 2
src/components/point/dynamicdata/delRelationDialog.vue

@@ -76,7 +76,18 @@
   </el-dialog>
 </template>
 <script>
-import { dynamicDeleteRelation, dynamicQueryPrompt } from "@/api/scan/request";
+import {
+  dynamicDeleteRelation,
+  dynamicQueryPrompt,
+  queryEquip, //数据中心设备查询
+  floorQuery, //数据中心查询楼层
+  buildingQuery, //数据中心建筑查询
+  projectQuery, //数据中心查询项目信息
+  queryAllZone, //数据中心所有空间实例
+  queryLinkSys, //数据中心系统查询
+  queryTenant, //数据中心查询租户
+  partsQuery, //数据中心部件查询
+} from "@/api/scan/request";
 export default {
   data() {
     return {
@@ -186,7 +197,242 @@ export default {
       //通过标识查询对象实例
       let promise1 = new Promise((resolve, reject) => {
         dynamicQueryPrompt(p1, res => {
-          resolve(res)
+          let dyData = res.Content;
+          let name = this.typeName;
+          if (name == 'equip') {
+            let tempArr = dyData.map(t => {
+              if (t.Related == 'True') {
+                t.EquipID = t.TypeCode + t.ProjectId + t.ObjectID;
+                return t.EquipID;
+              }
+              return undefined;
+            }).filter(item => item);
+            if (tempArr.length) {
+              queryEquip({
+                PageSize: 500,
+                Filters: `EquipID in ${JSON.stringify(tempArr)}`,
+                Cascade: [{ Name: "zoneSpaceInBase" }, { Name: 'building' }, { Name: 'floor' }]
+              }, response => {
+                let Data = response.Content;
+                dyData.forEach(item => {
+                  Data.forEach(t => {
+                    if (t.EquipID == item.EquipID) {
+                      item.ObjectLocalName = t.EquipLocalName;
+                      item.FloorLocalName = t.Floor ? t.Floor.FloorLocalName : '';
+                      item.BuildLocalName = t.Building ? t.Building.BuildLocalName : '';
+                      item.RoomLocalName = '';
+                      if (t.ZoneSpaceBaseIn) {
+                        t.ZoneSpaceBaseIn.forEach(it => {
+                          item.RoomLocalName += it.RoomLocalName + ',';
+                        })
+                        item.RoomLocalName = item.RoomLocalName.substring(0, item.RoomLocalName.length - 1);
+                      }
+                    }
+                  })
+                })
+                resolve(res);
+              })
+            } else {
+              resolve(res);
+            }
+          } else if (name == 'parts') {
+            let tempArr = dyData.map(t => {
+              if (t.Related == 'True') {
+                t.EquipID = t.TypeCode + t.ProjectId + t.ObjectID;
+                return t.EquipID;
+              }
+              return undefined;
+            }).filter(item => item);
+            if (tempArr.length) {
+              partsQuery({
+                PageSize: 500,
+                Filters: `EquipID in ${JSON.stringify(tempArr)}`
+              }, response => {
+                let Data = response.Content;
+                dyData.forEach(item => {
+                  Data.forEach(t => {
+                    if (t.EquipID == item.EquipID) {
+                      item.ObjectLocalName = t.EquipLocalName;
+                    }
+                  })
+                })
+                resolve(res);
+              })
+            } else {
+              resolve(res);
+            }
+          } else if (name == 'system') {
+            let tempArr = dyData.map(t => {
+              if (t.Related == 'True') {
+                t.SysID = t.TypeCode + t.ProjectId + t.ObjectID;
+                return t.SysID;
+              }
+              return undefined;
+            }).filter(item => item);
+            if (tempArr.length) {
+              queryLinkSys({
+                PageSize: 500,
+                Filters: `SysID in ${JSON.stringify(tempArr)}`
+              }, response => {
+                let Data = response.Content;
+                dyData.forEach(item => {
+                  Data.forEach(t => {
+                    if (t.SysID == item.SysID) {
+                      item.ObjectLocalName = t.SysLocalName;
+                    }
+                  })
+                })
+                resolve(res);
+              })
+            } else {
+              resolve(res);
+            }
+          } else if (name == 'space') {
+            let tempArr = dyData.map(t => {
+              if (t.Related == 'True') {
+                t.RoomID = t.TypeCode + t.ProjectId + t.ObjectID;
+                return t.RoomID;
+              }
+              return undefined;
+            }).filter(item => item);
+            if (tempArr.length) {
+              queryAllZone({
+                PageSize: 500,
+                Filters: `RoomID in ${JSON.stringify(tempArr)}`,
+                Cascade: [{ Name: 'building' }, { Name: 'floor' }],
+              }, response => {
+                let Data = response.Content;
+                dyData.forEach(item => {
+                  Data.forEach(t => {
+                    if (t.RoomID == item.RoomID) {
+                      item.ObjectLocalName = t.RoomLocalName;
+                      item.BuildLocalName = t.Building ? t.Building.BuildLocalName : '';
+                      item.FloorLocalName = t.Floor ? t.Floor.FloorLocalName : '';
+                    }
+                  })
+                })
+                resolve(res);
+              })
+            } else {
+              resolve(res);
+            }
+          } else if (name == 'build') {
+            let tempArr = dyData.map(t => {
+              if (t.Related == 'True') {
+                t.BuildID = t.TypeCode + t.ProjectId + t.ObjectID;
+                return t.BuildID;
+              }
+              return undefined;
+            }).filter(item => item);
+            if (tempArr.length) {
+              buildingQuery({
+                PageSize: 500,
+                Filters: `BuildID in ${JSON.stringify(tempArr)}`
+              }, response => {
+                let Data = response.Content;
+                dyData.forEach(item => {
+                  Data.forEach(t => {
+                    if (t.BuildID == item.BuildID) {
+                      item.ObjectLocalName = t.BuildLocalName;
+                    }
+                  })
+                })
+                resolve(res);
+              })
+            } else {
+              this.loading = false;
+              this.tableData = dyData;
+            }
+          } else if (name == 'floor') {
+            let tempArr = dyData.map(t => {
+              if (t.Related == 'True') {
+                t.FloorID = t.TypeCode + t.ProjectId + t.ObjectID;
+                return t.FloorID;
+              }
+              return undefined;
+            }).filter(item => item);
+            if (tempArr.length) {
+              floorQuery({
+                PageSize: 500,
+                Cascade: [{ Name: 'building' }],
+                Filters: `FloorID in ${JSON.stringify(tempArr)}`
+              }, response => {
+                let Data = response.Content;
+                dyData.forEach(item => {
+                  Data.forEach(t => {
+                    if (t.FloorID == item.FloorID) {
+                      item.ObjectLocalName = t.FloorLocalName;
+                      item.ObjectSequenceID = t.FloorSequenceID;
+                      item.BuildLocalName = t.Building ? t.Building.BuildLocalName : '';
+                    }
+                  })
+                })
+                resolve(res)
+              })
+            } else {
+              resolve(res)
+            }
+          } else if (name == 'tenant') {
+            let tempArr = dyData.map(t => {
+              if (t.Related == 'True') {
+                t.TenantID = t.TypeCode + t.ProjectId + t.ObjectID;
+                return t.TenantID;
+              }
+              return undefined;
+            }).filter(item => item);
+            if (tempArr.length) {
+              queryTenant({
+                PageSize: 500,
+                Cascade: [{ Name: 'zoneTenantList' }],
+                Filters: `TenantID in ${JSON.stringify(tempArr)}`
+              }, response => {
+                let Data = response.Content;
+                dyData.forEach(item => {
+                  Data.forEach(t => {
+                    if (t.TenantID == item.TenantID) {
+                      item.ObjectLocalName = t.TenantLocalName;
+                      item.RoomLocalName = '';
+                      if (t.ZoneTenantList) {
+                        t.ZoneTenantList.forEach(it => {
+                          item.RoomLocalName += it.RoomLocalName + ',';
+                        });
+                        item.RoomLocalName = item.RoomLocalName.substring(0, item.RoomLocalName.length - 1);
+                      }
+                    }
+                  })
+                })
+                resolve(res);
+              })
+            } else {
+              resolve(res);
+            }
+          } else if (name == 'project') {
+            let tempArr = dyData.map(t => {
+              if (t.Related == 'True') {
+                t.ProjID = t.TypeCode + t.ProjectId;
+                return t.ProjID;
+              }
+              return undefined;
+            }).filter(item => item);
+            if (tempArr.length) {
+              projectQuery({
+                PageSize: 500,
+                Filters: `ProjID in ${JSON.stringify(tempArr)}`
+              }, response => {
+                let Data = response.Content;
+                dyData.forEach(item => {
+                  Data.forEach(t => {
+                    if (t.ProjID == item.ProjID) {
+                      item.ObjectLocalName = t.ProjLocalName;
+                    }
+                  })
+                })
+                resolve(res)
+              })
+            } else {
+              resolve(res)
+            }
+          }
         })
       })
       let p2 = {

+ 1 - 1
src/components/point/dynamicdata/equipRules.vue

@@ -217,7 +217,7 @@ export default {
             dyData.forEach(item => {
               Data.forEach(t => {
                 if (t.EquipID == item.EquipID) {
-                  item.ObjectLocalName = t.FloorLocalName;
+                  item.ObjectLocalName = t.EquipLocalName;
                   item.FloorLocalName = t.Floor ? t.Floor.FloorLocalName : '';
                   item.BuildLocalName = t.Building ? t.Building.BuildLocalName : '';
                   item.RoomLocalName = '';

+ 1 - 1
src/components/point/dynamicdata/projectRules.vue

@@ -84,7 +84,7 @@
       :current-page="page.pageNumber" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper"
       :total="page.total"></el-pagination>
     <!-- 清除对应关系弹窗 -->
-    <del-relation-dialog ref="del" @refresh="refresh" :typeName="'space'"></del-relation-dialog>
+    <del-relation-dialog ref="del" @refresh="refresh" :typeName="'project'"></del-relation-dialog>
   </div>
 </template>
 <script>