Kaynağa Gözat

modify businessspace add sys and add equip

haojianlong 5 yıl önce
ebeveyn
işleme
6289d89e81

+ 43 - 72
src/components/business_space/newAddDialogs/addEquipDialog.vue

@@ -1,72 +1,4 @@
 <template>
-  <!-- <div>
-    <div class="search" style="margin-bottom:10px;">
-      <div>
-        <el-input placeholder="输入设备名称或设备本地编码查询进行查询" style="width:300px;float:left;margin-right:10px;" v-model="search.filter" clearable></el-input>
-        <el-button @click="filterBox" plain>查 找</el-button>
-      </div>
-      <div style="margin-top:10px;">
-        <span>所属楼层</span>
-        <el-cascader @change="filterBox" v-model="search.floor" :options="optionsWithDisabled"></el-cascader>
-        <el-checkbox style="margin-left:20px;" @change="filterBox" :checked="search.checkbox" label="只显示在当前业务空间中的设备"></el-checkbox>
-      </div>
-    </div>
-    <el-table ref="multipleTable" :data="tableData" v-loading="isLoading" tooltip-effect="dark" class="data-table border" height="300"
-      style="width: 100%" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55"></el-table-column>
-      <el-table-column width="180" label="设备名称">
-        <template slot-scope="scope">
-          <span>
-            <el-tooltip :content="scope.row.infos.EquipLocalName ||scope.row.infos.EquipName" placement="top">
-              <span>{{scope.row.infos.EquipLocalName || scope.row.infos.EquipName | cutString(15)}}</span>
-            </el-tooltip>
-          </span>
-        </template>
-      </el-table-column>
-      <el-table-column width="180" label="设备本地编码">
-        <template slot-scope="scope">
-          <span>
-            <el-tooltip :content="scope.row.infos.EquipLocalID || '--'" placement="top">
-              <span>{{scope.row.infos.EquipLocalID || "--" | cutString(15)}}</span>
-            </el-tooltip>
-          </span>
-        </template>
-      </el-table-column>
-      <el-table-column width="160" label="设备类">
-        <template slot-scope="scope">
-          <span>
-            <span>{{getName(scope.row.category)}}</span>
-          </span>
-        </template>
-      </el-table-column>
-      <el-table-column width="160" label="已关联其他业务空间">
-        <template slot-scope="scope">
-          <span>
-            <el-tooltip :content="changeArray(scope.row.spaceName)" placement="top">
-              <span>{{changeArray(scope.row.spaceName) | cutString(6)}}</span>
-            </el-tooltip>
-          </span>
-        </template>
-      </el-table-column>
-      <el-table-column label="操作">
-        <template slot-scope="scope">
-          <el-button plain @click="lockDetails(scope.row)">设备详情</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-    <el-dialog width="40%" title="设备详情" :visible.sync="innerVisible" append-to-body>
-      <iframe height="400px" width="100%" :src="iframeSrc"></iframe>
-    </el-dialog>
-    <div class="right" v-if="tableData.length">
-      <my-pagination :page="page" @change="pageChange"></my-pagination>
-    </div>
-    <div class="el-dialog__footer">
-      <span class="dialog-footer">
-        <el-button@click="clearBox">取 消</el-button>
-          <el-button type="primary" @click="addReal">确 定</el-button>
-      </span>
-    </div>
-  </div> -->
   <el-dialog :title="title" :visible.sync="dialogVisible" width="900px" id="addEqDialog">
     <el-row class="filters">
       <el-col :span="9">
@@ -115,6 +47,10 @@
 import {
   getSpaceEquip,
   buildingQuery, //数据中心-建筑查询
+  notEqInSpaceQuery, //没有和当前空间绑定的设备
+  notEqForSpaceQuery, //未服务当前空间的设备
+  eqInSpaceCreate, //设备所在业务空间--创建关系
+  eqForSpaceCreate, //设备服务业务空间--创建关系
 } from "@/api/scan/request";
 import { mapGetters } from "vuex";
 export default {
@@ -154,8 +90,13 @@ export default {
       },
     };
   },
+  props: {
+    type: {}, //equipment--equipmentFor
+    spaceId: {},
+    zone: {}, //分区类型 
+  },
   created() {
-    this.getBuilding()
+    this.getBuilding();
   },
   methods: {
     // 获取项目下建筑
@@ -182,11 +123,37 @@ export default {
     },
     // 显示弹窗
     showDialog() {
-      this.dialogVisible = true
+      this.dialogVisible = true;
+      this.getTableData();
     },
-    getTableData() { },
+    getTableData() {
+      let pa = {
+        data: {
+          Filters:`BuildingId="${this.floor[0]}";FloorId="${this.floor[1]}"`,
+          PageNumber: this.page.pageNumber,
+          PageSize: this.page.pageSize,
+        },
+        type: this.zone,
+        spaceId: this.spaceId
+      }
+      if(this.keycode!=''){
+        pa.data.Filters += `;EquipName contain "${this.keycode}" or EquipLocalName contain "${this.keycode}" or EquipLocalID contain "${this.keycode}"`
+      }
+      if (this.type == "equipment") {
+        notEqInSpaceQuery(pa, res => {
+          this.tableData = res.Content;
+          this.page.total = res.Total;
+        })
+      } else {
+        notEqForSpaceQuery(pa, res => {
+          this.tableData = res.Content;
+          this.page.total = res.Total;
+        })
+      }
+    },
+    //选中项修改
     handleSelectionChange(val) {
-      thi.selections = val;
+      this.selections = val;
     },
     savaRelation() { },
     //改变pagesize
@@ -199,6 +166,10 @@ export default {
       this.page.pageNumber = pageNo;
       this.getTableData();
     },
+    // 查看详情
+    toDetail() {
+      this.$message('开发中')
+    }
   },
 };
 </script>

+ 42 - 4
src/components/business_space/newAddDialogs/addSystemDialog.vue

@@ -3,14 +3,15 @@
     <div class="table-box">
       <el-table :data="tableData" style="width: 100%" height="100%" v-loading="loading" :header-cell-style="headerStyle" ref="multipleTable"
         @selection-change="handleSelectionChange">
+        <el-table-column type="selection" width="55"></el-table-column>
         <el-table-column :label="`${inSpaceType}名称`" show-overflow-tooltip min-width="100">
           <template slot-scope="scope">
             <div>
-              {{scope.row.EquipLocalName||scope.row.EquipName||''}}
+              {{scope.row.SysLocalName||scope.row.SysName||''}}
             </div>
           </template>
         </el-table-column>
-        <el-table-column prop="EquipLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
+        <el-table-column prop="SysLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
         <el-table-column prop="action" label="操作" min-width="100">
           <template slot-scope="scope">
             <el-button size="mini" @click="toDetail(scope.$index, scope.row)" type="danger" plain icon="el-icon-delete"></el-button>
@@ -27,6 +28,10 @@
 
 
 <script>
+import {
+  notSyInSpaceQuery, //没有和当前空间绑定的系统
+  syInSpaceCreate, //系统所在业务空间--创建关系
+} from "@/api/scan/request";
 export default {
   data() {
     return {
@@ -43,19 +48,52 @@ export default {
       selections: [], // 选中项
     }
   },
+  props: {
+    type: {}, //equipment--equipmentFor
+    spaceId: {},
+    zone: {}, //分区类型 
+  },
   methods: {
     // 显示
     showDialog() {
       this.dialogVisible = true;
+      this.getTableData();
     },
     // 选中项修改
     handleSelectionChange(val) {
       this.selections = val;
     },
     // 确认
-    savaRelation() { },
+    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;
+      })
+    },
     // 获取表格数据
-    getTableData() { },
+    getTableData() {
+      let pa = {
+        data: {
+          PageSize: 200,
+        },
+        type: this.zone,
+        spaceId: this.spaceId
+      }
+      notSyInSpaceQuery(pa, res => {
+        this.tableData = res.Content;
+      })
+    },
     // 查看详情
     toDetail() {
       this.$message('开发中')

+ 42 - 4
src/components/business_space/newTables/eqToSpaceTable.vue

@@ -39,13 +39,15 @@
       </el-table>
     </div>
     <!-- 添加设备弹窗 -->
-    <addEquipDialog ref="addEqDialog"></addEquipDialog>
+    <addEquipDialog ref="addEqDialog" :type="type" :spaceId="params.RoomID" :zone="params.zone"></addEquipDialog>
   </div>
 </template>
 
 <script>
 import {
-  queryZone
+  queryZone,
+  eqInSpaceDelete, //设备所在业务空间--删除关系
+  eqForSpaceDelete, //设备服务业务空间--删除关系
 } from "@/api/scan/request";
 import { mapGetters } from "vuex";
 import addEquipDialog from "@/components/business_space/newAddDialogs/addEquipDialog"
@@ -81,7 +83,39 @@ export default {
   },
   methods: {
     // 删除关系
-    handleDelete() { },
+    handleDelete(index, row) {
+      this.$confirm("确认删除该关系?", "提示", {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        let pa = {
+          data: [row],
+          type: this.params.zone
+        }
+        if (this.type == 'equipment') {
+          this.deleteEqInSpace(pa);
+        } else {
+          this.deleteEqForSpace(pa);
+        }
+      }).catch(() => {
+        this.$message("取消删除")
+      })
+    },
+    // 删除设备所在空间关系
+    deleteEqInSpace(pa) {
+      eqInSpaceDelete(pa, res => {
+        this.$message.success('删除成功')
+        this.getTableData()
+      })
+    },
+    // 删除设备服务空间关系
+    deleteEqForSpace(pa) {
+      eqForSpaceDelete(pa, res => {
+        this.$message.success('删除成功')
+        this.getTableData()
+      })
+    },
     // 改变pagesize
     handleSizeChange(pageSize) {
       this.page.pageSize = pageSize;
@@ -108,12 +142,16 @@ export default {
       }
       queryZone(pa, res => {
         this.tableData = res.Content[0].Equipment || []
+        this.tableData.map(t => {
+          t.SpaceId = res.Content[0].RoomID
+          return t;
+        })
       })
     },
     // 添加设备
     add() {
+      this.$refs.addEqDialog.floor = [this.params.BuildingId, this.params.FloorId];
       this.$refs.addEqDialog.showDialog()
-      this.$refs.addEqDialog.floor = [this.params.BuildingId, this.params.FloorId]
     }
   },
   watch: {

+ 33 - 6
src/components/business_space/newTables/syInSpaceTable.vue

@@ -11,11 +11,11 @@
         <el-table-column :label="`${inSpaceType}名称`" show-overflow-tooltip min-width="100">
           <template slot-scope="scope">
             <div>
-              {{scope.row.EquipLocalName||scope.row.EquipName||''}}
+              {{scope.row.SysLocalName||scope.row.SysName}}
             </div>
           </template>
         </el-table-column>
-        <el-table-column prop="EquipLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
+        <el-table-column prop="SysLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
         <el-table-column prop="action" label="操作" min-width="100">
           <template slot-scope="scope">
             <el-tooltip class="item" effect="dark" content="删除关系" placement="left">
@@ -31,13 +31,14 @@
         </template>
       </el-table>
     </div>
-    <addSystemDialog ref="addSyDialog"></addSystemDialog>
+    <addSystemDialog ref="addSyDialog" :type="type" :spaceId="params.RoomID" :zone="params.zone" @refresh='getTableData'></addSystemDialog>
   </div>
 </template>
 
 <script>
 import {
-  queryZone
+  queryZone,
+  syInSpaceDelete
 } from "@/api/scan/request";
 import { mapGetters } from "vuex";
 import addSystemDialog from "@/components/business_space/newAddDialogs/addSystemDialog";
@@ -72,17 +73,43 @@ export default {
   },
   methods: {
     // 删除关系
-    handleDelete() { },
+    handleDelete(index, row) {
+      this.$confirm("确认删除该关系?", "提示", {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        let pa = {
+          data: [row],
+          type: this.params.zone
+        }
+        this.deleteSyInSpace(pa)
+      }).catch(() => {
+        this.$message("取消删除")
+      })
+    },
+    // 删除关系
+    deleteSyInSpace(pa){
+      syInSpaceDelete(pa, res => {
+        this.$message.success('删除成功');
+        this.getTableData();
+      })
+    },
     // 获取列表数据
     getTableData() {
       let pa = {
         data: {
+          Cascade: [{ Name: "generalSystem" }],
           Filters: `RoomID="${this.params.RoomID}"`,
         },
         zone: this.params.zone
       }
       queryZone(pa, res => {
-        this.tableData = res.Content[0].Equipment || []
+        this.tableData = res.Content[0].GeneralSystem || [];
+        this.tableData.map(t => {
+          t.SpaceId = res.Content[0].RoomID;
+          return t;
+        })
       })
     },
     // 添加系统

+ 18 - 9
src/views/ledger/spacelist/spaceDetail/index.vue

@@ -94,15 +94,24 @@ export default {
     },
     // 删除业务空间
     deleteSpace() {
-      let pa = {
-        data: [{
-          RoomID: this.spaceDetails.RoomID
-        }],
-        zone: this.params.zone
-      }
-      deleteZone(pa, res => {
-        this.$message.success('删除成功')
-        this.goBack()
+      this.$confirm("此操作将删除业务空间,是否继续?", "提示", {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        let pa = {
+          data: [{
+            RoomID: this.spaceDetails.RoomID
+          }],
+          zone: this.params.zone
+        }
+        deleteZone(pa, res => {
+          this.$message.success('删除成功')
+          this.goBack()
+        })
+      }).catch(() => {
+        this.getData()
+        this.$message("取消删除")
       })
     }
   }