Bladeren bron

add relation in equip and space

haojianlong 5 jaren geleden
bovenliggende
commit
0953639ef3

+ 46 - 13
src/components/business_space/newAddDialogs/addEquipDialog.vue

@@ -15,6 +15,7 @@
     <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>
@@ -23,11 +24,11 @@
           </template>
         </el-table-column>
         <el-table-column prop="EquipLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
-        <el-table-column prop="EquipLocalID" :label="`${inSpaceType}类`" show-overflow-tooltip min-width="100"></el-table-column>
+        <el-table-column prop="EquipCategory.EquipName" :label="`${inSpaceType}类`" show-overflow-tooltip min-width="100"></el-table-column>
         <el-table-column prop="EquipLocalID" label="已关联其他业务空间" 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>
+            <el-button size="mini" @click="toDetail(scope.$index, scope.row)" type="primary" plain>查看详情</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -91,7 +92,7 @@ export default {
     };
   },
   props: {
-    type: {}, //equipment--equipmentFor
+    type: {}, //Equipment--EquipmentFor
     spaceId: {},
     zone: {}, //分区类型 
   },
@@ -126,42 +127,74 @@ export default {
       this.dialogVisible = true;
       this.getTableData();
     },
+    // 获取列表数据
     getTableData() {
       let pa = {
         data: {
-          Filters:`BuildingId="${this.floor[0]}";FloorId="${this.floor[1]}"`,
+          Cascade: [{ Name: "equipCategory" }],
+          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!=''){
+      if (this.keycode != '') {
         pa.data.Filters += `;EquipName contain "${this.keycode}" or EquipLocalName contain "${this.keycode}" or EquipLocalID contain "${this.keycode}"`
       }
-      if (this.type == "equipment") {
+      if (this.type == "Equipment") {
         notEqInSpaceQuery(pa, res => {
-          this.tableData = res.Content;
-          this.page.total = res.Total;
+          this.getDataSuc(res)
         })
       } else {
         notEqForSpaceQuery(pa, res => {
-          this.tableData = res.Content;
-          this.page.total = res.Total;
+          this.getDataSuc(res)
         })
       }
     },
+    // 获取列表成功回调
+    getDataSuc(res) {
+      this.tableData = res.Content;
+      this.page.total = res.Total;
+    },
     //选中项修改
     handleSelectionChange(val) {
       this.selections = val;
     },
-    savaRelation() { },
-    //改变pagesize
+    // 确认 保存关系
+    savaRelation() {
+      let pa = {
+        data: {
+          SpaceId: this.spaceId,
+          EquipIdList: []
+        },
+        type: this.zone
+      }
+      this.selections.map(t => {
+        pa.data.EquipIdList.push(t.EquipID)
+      })
+      if (this.type == "Equipment") {
+        eqInSpaceCreate(pa, res => {
+          this.successCallback()
+        })
+      } else {
+        eqForSpaceCreate(pa, res => {
+          this.successCallback()
+        })
+      }
+    },
+    // 关联成功回调
+    successCallback() {
+      this.$message.success('关联成功');
+      this.$emit('refresh');
+      this.dialogVisible = false;
+    },
+    // 改变pagesize
     handleSizeChange(pageSize) {
       this.page.pageSize = pageSize;
       this.getTableData();
     },
-    //改变pageno
+    // 改变pageno
     handleCurrentChange(pageNo) {
       this.page.pageNumber = pageNo;
       this.getTableData();

+ 24 - 4
src/components/business_space/newGraphy/graphy.vue

@@ -44,14 +44,20 @@
     </div>
     <!-- 底部操作按钮 -->
     <el-row class="canvas-actions-box">
-      <div>
+      <div class="active">
         <i class="el-icon-rank"></i>
       </div>
       <div>
         <i class="el-icon-rank"></i>
       </div>
       <div>
-        <i class="el-icon-download"></i>
+        <el-dropdown size="mini" placement="top-start">
+          <i class="el-icon-download" style="font-size:20px;color:#fff;"></i>
+          <el-dropdown-menu slot='dropdown'>
+            <el-dropdown-item>保存为png</el-dropdown-item>
+            <el-dropdown-item>保存为svg</el-dropdown-item>
+          </el-dropdown-menu>
+        </el-dropdown>
       </div>
       <div>
         <i class="el-icon-remove-outline"></i>
@@ -63,6 +69,7 @@
         <i class="el-icon-circle-plus-outline"></i>
       </div>
     </el-row>
+    <!--  -->
   </div>
 </template>
 <script>
@@ -127,9 +134,22 @@ export default {
   }
   .canvas-actions-box {
     position: absolute;
-    bottom:20px;
-    &>div{
+    bottom: 20px;
+    left: 50%;
+    transform: translateX(-50%);
+    & > div {
       float: left;
+      font-size: 20px;
+      padding: 0 10px;
+      color: #fff;
+      background-color: #6da60f;
+    }
+    & > div.active {
+      background-color: #4b7902;
+    }
+    & > div.line {
+      width: 200px;
+      height: 40px;
     }
   }
 }

+ 7 - 7
src/components/business_space/newTables/eqToSpaceTable.vue

@@ -39,7 +39,7 @@
       </el-table>
     </div>
     <!-- 添加设备弹窗 -->
-    <addEquipDialog ref="addEqDialog" :type="type" :spaceId="params.RoomID" :zone="params.zone"></addEquipDialog>
+    <addEquipDialog ref="addEqDialog" :type="type" :spaceId="params.RoomID" :zone="params.zone" @refresh='getTableData'></addEquipDialog>
   </div>
 </template>
 
@@ -69,8 +69,8 @@ export default {
       loading: false, // loading
       tableData: [], //列表数据
       typeToTips: {
-        equipment: '空间内的设备',
-        equipmentFor: '服务于空间的设备',
+        Equipment: '空间内的设备',
+        EquipmentFor: '服务于空间的设备',
       }
     };
   },
@@ -93,7 +93,7 @@ export default {
           data: [row],
           type: this.params.zone
         }
-        if (this.type == 'equipment') {
+        if (this.type == 'Equipment') {
           this.deleteEqInSpace(pa);
         } else {
           this.deleteEqForSpace(pa);
@@ -130,10 +130,10 @@ export default {
     getTableData() {
       let pa = {
         data: {
-          Filters: `RoomID="${this.params.RoomID}"`,
+          Filters: `RoomID='${this.params.RoomID}'`,
           Cascade: [
             {
-              Name: this.type,
+              Name: this.type.toLowerCase(),
               Cascade: [{ Name: 'equipCategory' }]
             }
           ]
@@ -141,7 +141,7 @@ export default {
         zone: this.params.zone
       }
       queryZone(pa, res => {
-        this.tableData = res.Content[0].Equipment || []
+        this.tableData = res.Content[0][this.type] || []
         this.tableData.map(t => {
           t.SpaceId = res.Content[0].RoomID
           return t;

+ 3 - 3
src/views/ledger/spacelist/spaceDetail/index.vue

@@ -21,7 +21,7 @@
         <iframe height="100%" width="100%" :src="iframeSrc"></iframe>
       </div>
       <!-- 空间内设备列表--服务于空间的设备 -->
-      <eqToSpaceTable v-else-if="activeTab=='equipment' || activeTab=='equipmentFor'" :params="params" :type="activeTab"></eqToSpaceTable>
+      <eqToSpaceTable v-else-if="activeTab=='Equipment' || activeTab=='EquipmentFor'" :params="params" :type="activeTab"></eqToSpaceTable>
       <!-- 空间内系统 -->
       <syInSpaceTable v-else-if="activeTab=='generalSystem'" :params="params" :type="activeTab"></syInSpaceTable>
 
@@ -40,8 +40,8 @@ export default {
       params: {}, //参数-包含空间id 分区类型 进入方式(1-平面图 2-列表)
       tabsList: [
         { Code: 'detail', Name: '空间详情' },
-        { Code: 'equipment', Name: '空间内设备' },
-        { Code: 'equipmentFor', Name: '服务于空间的设备' },
+        { Code: 'Equipment', Name: '空间内设备' },
+        { Code: 'EquipmentFor', Name: '服务于空间的设备' },
         { Code: 'generalSystem', Name: '空间内系统' },
       ], //tab页
       activeTab: 'detail', //当前选中的tab