Bladeren bron

修改租户台账

haojianlong 5 jaren geleden
bovenliggende
commit
189c892cc7
2 gewijzigde bestanden met toevoegingen van 162 en 80 verwijderingen
  1. 112 0
      src/components/ledger/rentList/roomCountDrawer.vue
  2. 50 80
      src/views/ledger/rentlist/index.vue

+ 112 - 0
src/components/ledger/rentList/roomCountDrawer.vue

@@ -0,0 +1,112 @@
+<template>
+  <el-drawer title="关联的业务空间" :visible.sync="drawer" :direction="direction" :before-close="handleClose" size="20%" custom-class="room-count">
+    <div class="drawer-body">
+      <div class="default-zone zone" v-show="1">
+        <p>默认业务空间</p>
+        <div v-for="item in defaultZoneList" :key="item.RoomID" class="zoneItem">
+          {{item.Name}}
+          <i size="mini" class="el-icon-delete" title="删除" @click="deleteZoneItem('default')" v-if="!readonly"></i>
+        </div>
+        <div class="zoneItem" style="text-align:center;" @click="addZoneItem('default')" v-if="!readonly">
+          <i class="iconfont icon-add-control" style="position:static"></i>
+        </div>
+      </div>
+      <div class="tenant-zone zone" v-show="1">
+        <p>租户业务空间</p>
+        <div v-for="item in tenantZoneList" :key="item.RoomID" class="zoneItem">
+          {{item.Name}}
+          <i size="mini" class="el-icon-delete" title="删除" @click="deleteZoneItem('tenant')" v-if="!readonly"></i>
+        </div>
+        <div class="zoneItem" style="text-align:center;" @click="addZoneItem('tenant')" v-if="!readonly">
+          <i class="iconfont icon-add-control" style="position:static"></i>
+        </div>
+      </div>
+      <div class="btn" v-if="!readonly">
+        <el-button type="primary" @click="save">保存</el-button>
+      </div>
+    </div>
+  </el-drawer>
+</template>
+<script>
+export default {
+  data() {
+    return {
+      drawer: false,
+      direction: 'rtl',
+      defaultZoneList: [
+        { RoomID: 1, Name: "哈哈哈哈军军" },
+        { RoomID: 2, Name: "哈哈哈哈军军" },
+        { RoomID: 3, Name: "哈哈哈哈军军" },
+      ],
+      tenantZoneList: [
+        { RoomID: 1, Name: "哈哈哈哈军军" },
+        { RoomID: 2, Name: "哈哈哈哈军军" },
+        { RoomID: 3, Name: "哈哈哈哈军军" },
+      ]
+    }
+  },
+  props: {
+    readonly: {
+      default: true
+    }
+  },
+  methods: {
+    showDrawer() {
+      this.drawer = true;
+    },
+    handleClose(done) {
+      done();
+    },
+    // 删除
+    deleteZoneItem(type) {
+      console.log(type)
+    },
+    // 添加
+    addZoneItem(type) {
+      console.log(type)
+    },
+    save() { }
+  }
+}
+</script>
+<style lang="less" scoped>
+.room-count {
+  .drawer-body {
+    position: relative;
+    padding: 0 10px;
+    height: 100%;
+    .zone {
+      padding: 6px 14px 22px;
+      box-shadow: 0 0 3px #cacaca;
+      p {
+        margin-bottom: 4px;
+      }
+      .zoneItem {
+        position: relative;
+        padding: 2px 10px;
+        border: 1px solid #ccc;
+        border-radius: 4px;
+        i {
+          position: absolute;
+          right: 10px;
+          top: 50%;
+          transform: translateY(-50%);
+        }
+      }
+      .zoneItem + .zoneItem {
+        margin-top: 6px;
+      }
+    }
+    .zone + .zone {
+      margin-top: 10px;
+    }
+    .btn {
+      position: absolute;
+      width: calc(100% - 20px);
+      bottom: 20px;
+      right: 20px;
+      text-align: right;
+    }
+  }
+}
+</style>

+ 50 - 80
src/views/ledger/rentlist/index.vue

@@ -6,19 +6,11 @@
     <el-row class="left">
       <span style="float:right;">当前筛选条件下共{{page.total || '--'}}租户</span>
       <el-select v-model="onlyRead" @change="getTableHeader" style="width:100px;margin-right:10px;vertical-align:bottom;">
-        <el-option
-          v-for="item in options"
-          :key="item.value"
-          :label="item.label"
-          :value="item.value">
+        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
         </el-option>
       </el-select>
       <el-select v-model="showType" @change="initTable" style="width:100px;margin-right:10px;vertical-align:bottom;">
-        <el-option
-          v-for="item in showTypes"
-          :key="item.value"
-          :label="item.label"
-          :value="item.value">
+        <el-option v-for="item in showTypes" :key="item.value" :label="item.label" :value="item.value">
         </el-option>
       </el-select>
       <!-- <div v-show="onlyRead" style="width:200px;display:inline-block;text-align:left;color:gray;font-size:12px;">
@@ -27,10 +19,11 @@
       </div> -->
       <el-button @click="handleCreateTableData">添加租户</el-button>
       <el-button @click="getTableHeader">刷新</el-button>
+      <el-button >管理租赁空间</el-button>
       <el-button v-show="!onlyRead" @click="undo">撤销</el-button>
     </el-row>
     <div class="tableBox">
-      <div class="center middle_sty" style="flex:2;" v-show="tableData && !tableData.length">
+      <div class="center middle_sty" v-show="tableData && !tableData.length">
         <p>
           <i class="icon-wushuju iconfont"></i>
           暂无数据
@@ -39,34 +32,9 @@
       <div class="tableLeft" v-show="tableData && tableData.length">
         <handson-table ref="table"></handson-table>
       </div>
-      <div class="tableRight">
-        <div v-show="isTableRightShow">
-          <div class="table_right_box"><span class="iconfont close_right" @click="handleCloseRight">&#xe66b;</span></div>
-          <h5>管理租赁空间</h5>
-          <p style="margin-bottom: 10px;">以下为关联的业务空间id</p>
-          <el-input
-            type="textarea"
-            :autosize="{ minRows: 6, maxRows: 10}"
-            :disabled="onlyRead"
-            placeholder="请输入业务空间id,以“,”分割"
-            v-model="roomId">
-          </el-input>
-          <el-row class="right" v-show="!onlyRead">
-            <el-button @click="handleCloseRight">取消</el-button>
-            <el-button type="primary" @click="saveSpaceList">保存</el-button>
-          </el-row>
-        </div>
-      </div>
     </div>
-    <el-pagination
-      class="right"
-      v-show="tableData && tableData.length"
-      @size-change="handleSizeChange"
-      @current-change="handleCurrentChange"
-      :current-page="page.pageNumber"
-      :page-sizes="page.pageSizes"
-      :page-size="page.pageSize"
-      layout="total, sizes, prev, pager, next, jumper"
+    <el-pagination class="right" v-show="tableData && tableData.length" @size-change="handleSizeChange" @current-change="handleCurrentChange"
+      :current-page="page.pageNumber" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper"
       :total="page.total">
     </el-pagination>
     <!-- 不支持的输入方式 -->
@@ -82,6 +50,8 @@
         <el-button type="primary" @click="handleClickUpdate">确 认</el-button>
       </span>
     </el-dialog>
+    <!-- 右侧关联的业务空间抽屉 -->
+    <roomCountDrawer ref="roomCountDrawer" :readonly="onlyRead"></roomCountDrawer>
   </div>
 </template>
 <script>
@@ -89,7 +59,7 @@ import tools from "@/utils/scan/tools"
 import handsonUtils from "@/utils/hasontableUtils"
 import showTools from "@/utils/handsontable/notShow"
 import text from "@/utils/handsontable/mainText"
-
+import roomCountDrawer from "@/components/ledger/rentList/roomCountDrawer"
 import floorCascader from "@/components/ledger/lib/floorCascader"
 import handsonTable from "@/components/common/handsontable"
 import { getDataDictionary, getRentTableHeader, getRentTableData, updataRentTableData, deleteRentTableData, saveRentRelateSpace, BeatchQueryParam } from "@/api/scan/request"
@@ -97,7 +67,8 @@ import { mapGetters, mapActions } from "vuex";
 export default {
   components: {
     floorCascader,
-    handsonTable
+    handsonTable,
+    roomCountDrawer
   },
   data() {
     return {
@@ -137,35 +108,31 @@ export default {
     };
   },
   computed: {
-    ...mapGetters("layout", [
-        "projectId",
-        "secret",
-        "userId"
-    ]),
-    showTypes () {
-      return this.onlyRead?
-        [{value: "Visible", label: '只看采集信息'}, {value: "all", label: '全部'}]: 
-        [{value: "Visible", label: '只看采集信息'}, {value: "all", label: '全部'}]
+    ...mapGetters("layout", ["projectId", "secret", "userId"]),
+    showTypes() {
+      return this.onlyRead ?
+        [{ value: "Visible", label: '只看采集信息' }, { value: "all", label: '全部' }] :
+        [{ value: "Visible", label: '只看采集信息' }, { value: "all", label: '全部' }]
     }
   },
   created() {
     this.getTableHeader()
   },
   watch: {
-      projectId() {
-        this.getTableHeader()
+    projectId() {
+      this.getTableHeader()
+    },
+    showTypes: {
+      handler(newName, oldName) {
+        if (newName && newName[0] && newName[0].value) {
+          this.showType = newName[0].value
+        } else {
+          this.showType = ""
+        }
       },
-      showTypes: {
-        handler(newName, oldName) {
-          if (newName && newName[0] && newName[0].value) {
-            this.showType = newName[0].value
-          } else {
-            this.showType = ""
-          }
-        },
-        immediate: true,
-        deep: true
-      }
+      immediate: true,
+      deep: true
+    }
   },
   methods: {
     // 获取表头数据(初始化表格)
@@ -181,7 +148,7 @@ export default {
       await getDataDictionary(param, res => {
         this.tableHeader = res.Content;
         this.tableHeader.forEach(item => {
-          if(item.Path && item.InputMode){
+          if (item.Path && item.InputMode) {
             this.inputMap[item.Path] = item.InputMode
           }
         })
@@ -199,7 +166,7 @@ export default {
         this.copyTableData = tools.deepCopy(res.Content)
         this.page.pageNumber = res.PageNumber
         this.page.total = res.Total
-        if(this.tableData && this.tableData.length){
+        if (this.tableData && this.tableData.length) {
           if (this.onlyRead) {
             this.getBatch(res.Content)
           }
@@ -213,7 +180,7 @@ export default {
         Content: [],
         Projection: []
       }, keyList = [];
-       //生成要修改字段列表
+      //生成要修改字段列表
       change.map(item => {
         let key = item[1].split(".")[0]
         if (item[1] && keyList.indexOf(key) == -1) {
@@ -238,7 +205,7 @@ export default {
         param.Content.push(item);
       });
       await updataRentTableData(param, (res) => {
-        
+
       })
     },
     //保存元空间关联
@@ -271,7 +238,7 @@ export default {
       }
       let param = []
       params.map(item => {
-        param.push({TenantID: item.TenantID})
+        param.push({ TenantID: item.TenantID })
       })
       this.$confirm("此操作将删除租户,是否继续?", "提示", {
         confirmButtonText: '确定',
@@ -339,7 +306,7 @@ export default {
     formatHeaderData(list) {//格式化表头显示的数据
       let arr = tools.copyArr(list)
       let data = showTools.headerTextFilter(arr, "tenant", this.onlyRead, this.showType)
-      data.unshift("操作","所属楼层","租赁空间");
+      data.unshift("操作", "所属楼层", "租赁空间");
       return data;
     },
     formatHeaderType(list) {//格式化表头头映射的数据
@@ -400,12 +367,14 @@ export default {
       }
       //点击关联的元空间
       if (val === "RoomCount") {
-        if(infos && infos.RoomID) {
-          this.roomId = infos.RoomID
-        } else {
-          this.roomId = ""
-        }
-        this.isTableRightShow = true;
+        // if (infos && infos.RoomID) {
+        //   this.roomId = infos.RoomID
+        // } else {
+        //   this.roomId = ""
+        // }
+        // this.isTableRightShow = true;
+        console.log(infos)
+        this.$refs.roomCountDrawer.showDrawer()
         return false
       }
       if (!this.onlyRead && showTools.InputModeArr.indexOf(inputMode) == '-1') {
@@ -421,7 +390,7 @@ export default {
       this.updateInput = ''
     },
     //更新临时维护信息点
-    handleClickUpdate(){
+    handleClickUpdate() {
       tools.setDataForKey(this.tableData[this.row], this.updateInfoPoint, this.updateInput)
       this.handleUpdataTable([[this.row, this.updateInfoPoint, null, this.updateInput]], "edit")
       this.updateInputShow = false
@@ -535,7 +504,7 @@ export default {
                         item,
                         head.Path,
                         // child.error ? "表号功能号格式错误" : "表号功能号不存在"
-                        child.error ? child.value? "表号功能号格式错误" : "表号功能号不存在" : "暂未采集到实时数据"
+                        child.error ? child.value ? "表号功能号格式错误" : "表号功能号不存在" : "暂未采集到实时数据"
                       );
                     }
                   });
@@ -563,7 +532,7 @@ export default {
   }
   .search-header {
     overflow: hidden;
-    padding:0 10px 10px 10px;
+    padding: 0 10px 10px 10px;
     border-bottom: 1px solid #bcbcbc;
   }
   .tableBox {
@@ -581,7 +550,7 @@ export default {
       padding: 5px 15px;
       margin-right: 5px;
       box-shadow: 0px 1px 5px 0px rgba(59, 66, 84, 0.15);
-      .table_right_box::after{
+      .table_right_box::after {
         display: block;
         content: "";
         clear: both;
@@ -593,7 +562,8 @@ export default {
     }
   }
 }
-.el-pagination button, .el-pagination span:not([class*=suffix]) {
-    vertical-align: middle;
+.el-pagination button,
+.el-pagination span:not([class*="suffix"]) {
+  vertical-align: middle;
 }
 </style>