Browse Source

修改租户台账

haojianlong 5 years ago
parent
commit
2bf9cc2c09

+ 3 - 3
package.json

@@ -26,9 +26,9 @@
         "vuex": "^3.1.0",
         "cad-engine": "2.0.250",
         "@saga-web/base": "2.1.9",
-        "@saga-web/draw": "2.1.58",
-        "@saga-web/graphy": "2.1.30",
-        "@saga-web/cad-engine": "2.0.406"
+        "@saga-web/draw": "2.1.60",
+        "@saga-web/graphy": "2.1.33",
+        "@saga-web/cad-engine": "2.0.415"
     },
     "devDependencies": {
         "ajv": "^6.9.1",

+ 11 - 0
src/api/scan/request.js

@@ -850,6 +850,17 @@ export function deleteRentTableData(param, success) {
     http.postJson(url, param, success)
 }
 
+//租户关联租户业务空间,租户一对多,覆盖
+export function tnRelateTenantZone(param, success) {
+    let url = `${baseUrl}/datacenter/tn-in-sp-zone-Tenant/link-sp`
+    http.postJson(url, param, success)
+}
+
+//租户关联默认业务空间,租户一对多,覆盖
+export function tnRelateGeneralZone(param, success) {
+    let url = `${baseUrl}/datacenter/tn-in-sp-zone-general/link-sp`
+    http.postJson(url, param, success)
+}
 //关联分区空间
 export function saveRentRelateSpace(param, success) {
     let url = `${baseUrl}/datacenter/tenant/relate-space`

+ 102 - 13
src/components/ledger/rentList/roomCountDrawer.vue

@@ -7,9 +7,9 @@
           {{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>
+        <el-cascader placeholder="请选择" v-model="GeneralVal" :options="option.GeneralZone" :props="props" filterable @expand-change="expandChange"
+          @change="change">
+        </el-cascader>
       </div>
       <div class="tenant-zone zone" v-show="1">
         <p>租户业务空间</p>
@@ -28,21 +28,28 @@
   </el-drawer>
 </template>
 <script>
+import {
+  tnRelateTenantZone, //关联租户空间
+  tnRelateGeneralZone, //关联默认空间
+  buildingQuery, //建筑查询
+  queryZone, //业务空间查询GeneralZone-TenantZone
+} from '@/api/scan/request'
 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: "哈哈哈哈军军" },
-      ]
+      defaultZoneList: [],
+      tenantZoneList: [],
+      option: {
+        GeneralZone: [],
+        TenantZone: []
+      },
+      props: {
+        children: 'Floor'
+      },
+      GeneralVal: [],
+      TenantVal: []
     }
   },
   props: {
@@ -50,7 +57,88 @@ export default {
       default: true
     }
   },
+  created() {
+    this.init();
+  },
   methods: {
+    init() {
+      this.getBuilding()
+    },
+    getBuilding() {
+      let pa = {
+        Cascade: [{ Name: 'floor', Orders: 'FloorSequenceID desc' }],
+        Order: 'BuildLocalName asc'
+      }
+      buildingQuery(pa, res => {
+        this.option.GeneralZone = res.Content.map(build => {
+          build.value = build.BuildID;
+          build.label = build.BuildLocalName;
+          build.Floor = build.Floor.map(floor => {
+            floor.value = floor.FloorID;
+            floor.label = floor.FloorLocalName;
+            floor.Floor = [];
+            return floor;
+          });
+          build.Floor.unshift({ value: 'noknowFloor', label: '未明确楼层', Floor: [] })
+          return build;
+        })
+        this.option.GeneralZone.unshift({ value: 'noknowBuild', label: '未明确建筑', Floor: [] });
+        this.option.TenantZone = JSON.parse(JSON.stringify(this.option.GeneralZone));
+      })
+    },
+    expandChange(val) {
+      this.middleware(val, "GeneralZone")
+    },
+    middleware(val, type) {
+      let filters = '';
+      if (val[0] == 'noknowBuild') { //未明确建筑
+        filters = `buildingId isNull`
+        this.getZone(filters, type, val)
+      } else if (val[1]) {
+        if (val[1] == "noknowFloor") {
+          filters = `buildingId='${val[0]}';floorId isNull`
+        } else {
+          filters = `buildingId='${val[0]}';floorId='${val[1]}'`
+        }
+        this.getZone(filters, type, val)
+      }
+    },
+    getZone(filters, type, selected) {
+      if (!filters) return;
+      let params = {
+        zone: type,
+        data: {
+          Filters: filters,
+          Orders: "createTime desc, RoomID asc",
+          PageSize: 1000
+        }
+      }
+      queryZone(params, res => {
+        if (res.Content.length) {
+          let tempArr = res.Content.map(t => {
+            t.value = JSON.parse(JSON.stringify(t));
+            t.label = t.RoomLocalName || t.RoomName;
+            return t;
+          })
+          if (selected.length == 1) {
+            this.option[type][0].Floor = tempArr;
+          } else {
+            for (let i = 0; i < this.option[type].length; i++) {
+              if (this.option[type][i].value == selected[0]) {
+                for (let j = 0; j < this.option[type][i].Floor.length; j++) {
+                  if (this.option[type][i].Floor[j].value == selected[1]) {
+                    this.option[type][i].Floor[j].Floor = tempArr;
+                  }
+                }
+              }
+            }
+          }
+        }
+      })
+    },
+    change(val) {
+      console.log(val)
+    },
     showDrawer() {
       this.drawer = true;
     },
@@ -65,6 +153,7 @@ export default {
     addZoneItem(type) {
       console.log(type)
     },
+    addZone() { },
     save() { }
   }
 }

+ 2 - 2
src/views/ledger/rentlist/index.vue

@@ -23,7 +23,7 @@
       <el-button v-show="!onlyRead" @click="undo">撤销</el-button>
     </el-row>
     <div class="tableBox">
-      <div class="center middle_sty" v-show="tableData && !tableData.length">
+      <div class="center middle_sty" style="flex:1;" v-show="tableData && !tableData.length">
         <p>
           <i class="icon-wushuju iconfont"></i>
           暂无数据
@@ -112,7 +112,7 @@ export default {
     showTypes() {
       return this.onlyRead ?
         [{ value: "Visible", label: '只看采集信息' }, { value: "all", label: '全部' }] :
-        [{ value: "Visible", label: '只看采集信息' }, { value: "all", label: '全部' }]
+        [{ value: "partInfo", label: '隐藏信息点' }, { value: "all", label: '全部' }, { value: "Visible", label: '只看采集信息' }]
     }
   },
   created() {