Browse Source

point config

haojianlong 5 years ago
parent
commit
f027e59b34

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

@@ -1011,6 +1011,18 @@ export function countGeneralSys(param, success) {
     http.postJson(url, param, success)
 }
 
+//头部信息查询(查询所有设备类型-所有部件类型-所有系统类型-所有专业类型)
+export function queryPhysicsAllType(param, success) {
+    let url = `${baseUrl}/datacenter/class-def/category?type=${param}`;
+    http.postJson(url, {}, success)
+}
+
+//字典头部信息查询接口
+export function queryDictionaryHead(param, success) {
+    let url = `${baseUrl}/datacenter/class-def/query`;
+    http.postJson(url, param, success)
+}
+
 //动态数据关联-冲突选择确认
 export function dynamicClashConfirm(param, success) {
     let url = `${baseUrl}/pointconfig/dynamic/clashconfirm`;

+ 163 - 0
src/components/config_point/dictionaryCascader.vue

@@ -0,0 +1,163 @@
+<template>
+  <el-cascader style='width: 100%;' :options='options' v-model='dict' @active-item-change='handleChange' :props='props' filterable
+    @change="changeSelect"></el-cascader>
+</template>
+<script>
+import {
+  getDataDictionary,//查询信息点
+  queryPhysicsAllType,//查询所有部件类型
+  queryDictionaryHead,//查询所有空间类型
+} from "@/api/scan/request"
+import { mapGetters, mapActions } from "vuex";
+import tools from "@/utils/scan/tools";
+export default {
+  data() {
+    return {
+      options: [
+        {
+          Code: 'Project',
+          Name: '项目',
+          children: []
+        }, {
+          Code: 'Building',
+          Name: '建筑',
+          children: []
+        }, {
+          Code: 'Floor',
+          Name: '楼层',
+          children: []
+        }, {
+          Code: 'Equipment',
+          Name: '设备',
+          children: []
+        }, {
+          Code: 'Component',
+          Name: '部件',
+          children: []
+        }, {
+          Code: 'System',
+          Name: '系统',
+          children: []
+        }, {
+          Code: 'Space',
+          Name: '空间',
+          children: []
+        }, {
+          Code: 'Tenant',
+          Name: '租户',
+          children: []
+        },
+      ],
+      dict: [],
+      props: {
+        value: 'Code',
+        label: 'Name',
+        children: 'children'
+      },
+    }
+  },
+  created() {
+    this.getAllData()
+    let val = ["Equipment", "SICU", "OnlineStatus"]
+    this.setCascaderVal(val)
+  },
+  methods: {
+    //选择
+    handleChange(val) {
+      let type = val[0];
+      let singleStr = "ProjectBuildingFloorTenant";
+      console.log(val)
+      if (type == "Equipment" && val.length == 2) {
+        this.getDataPoint(val[1])
+      } else if (type == "Component" && val.length == 2) {
+        this.getDataPoint(val[1])
+      } else if (type == "System" && val.length == 2) {
+        this.getDataPoint(val[1])
+      } else if (type == "Space" && val.length == 2) {
+        this.getDataPoint(val[1])
+      } else if (singleStr.indexOf(type) > -1) {
+        this.hasChildren(type) && this.getDataPoint(type)
+      }
+    },
+    //获取物理世界所有设备类型
+    getAllData() {
+      queryPhysicsAllType('Equipment', res => {
+        this.options[3].children = this.formatOptions(res.Content)
+      })
+      queryPhysicsAllType('Component', res => {
+        this.options[4].children = this.formatOptions(res.Content)
+      })
+      let param1 = {
+        Distinct: true,
+        Filters: "ParentId='Space'"
+      }
+      queryDictionaryHead(param1, res => {
+        this.options[6].children = this.formatOptions(res.Content)
+      })
+    },
+    //格式化options数据
+    formatOptions(arr) {
+      return arr.map(item => {
+        return {
+          Code: item.Code,
+          Name: item.Name,
+          children: item.children && item.children.length ? this.formatOptions(item.children) : []
+        }
+      })
+    },
+    //请求信息点
+    getDataPoint(type) {
+      let param = {
+        data: {
+          Filters: "InputMode='M' or InputMode='L'",
+          PageNumber: 1,
+          PageSize: 500
+        },
+        type: type
+      }
+      getDataDictionary(param, res => {
+        let tempArr = res.Content.map(item => {
+          return {
+            Code: item.InfoPointCode,
+            Name: item.InfoPointName
+          }
+        })
+        this.pushPoints(this.options, tempArr, type);
+      })
+    },
+    //根据返回数据拼接options
+    pushPoints(options, arr, Code) {
+      options.map(option => {
+        if (option.Code == Code) {
+          option.children = arr;
+        } else {
+          if (option.children) {
+            this.pushPoints(option.children, arr, Code)
+          }
+        }
+      })
+    },
+    changeSelect(val) {
+      console.log(val)
+    },
+    //减少请求次数
+    hasChildren(Code) {
+      let flag = true;
+      this.options.map(option => {
+        if (option.Code == Code && option.children.length) {
+          flag = false;
+        }
+      })
+      return flag;
+    },
+    //设置值
+    setCascaderVal(value) {
+      this.dict = tools.deepCopy(value)
+      value.splice(value.length - 1, 1)
+      this.handleChange(value)
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+</style>

+ 1 - 2
src/components/ledger/handsontables/device.vue

@@ -77,7 +77,6 @@ import {
   getBillEquipList,//获取表数据
   BeatchQueryParam,//通过标号功能号获取值
   delBatchList,//删除选中设备
-  updateBusiness,//更新设备
   updateEquip,//更新设备
   getDataDictionary,//新表头
   getEquipTableCon,//获取表数据
@@ -560,7 +559,7 @@ export default {
       };
       //生成要修改字段列表
       change.map(item => {
-        if (item[1] && param.Projection.indexOf(item[1]) == -1) {
+        if (item[1] && param.Projection.indexOf(item[1]) == -1 && item[1] != 'PropertyId') {
           param.Projection.push(item[1].split(".")[0]);
         }
       });