Procházet zdrojové kódy

扫楼资产异常

zhulizhen před 6 roky
rodič
revize
81243260bd

+ 4 - 1
src/router/sagacloud.js

@@ -12,6 +12,9 @@ import pointSteps from '@/views/point/config_point/steps'
 /**项目化配置 */
 import collectsetting from "@/views/project_setting/collection_setting"
 
+/** 扫楼数据整理 */
+import buildAssets from "@/views/data_admin/buildAssets"
+
 export default [
     { path: '/auth', name: 'Auth', component: Auth },
     // 系统相关
@@ -121,7 +124,7 @@ export default [
             { path: '', name: 'Dasboard', component: Dasboard },
             { path: 'data', name: 'Dasboard', component: Dasboard },
             { path: 'plan', name: 'Dasboard', component: Dasboard },
-            { path: 'abnormalprop', name: 'Dasboard', component: Dasboard },
+            { path: 'abnormalprop', name: 'buildAssets', component: buildAssets },
             { path: 'log', name: 'Dasboard', component: Dasboard },
             { path: 'appuser', name: 'Dasboard', component: Dasboard },
         ]

+ 463 - 0
src/utils/scan/tools.js

@@ -0,0 +1,463 @@
+const tools = {}
+
+let arrX = []
+let arrY = []
+
+tools.getPointDetails = (arr) => {
+        arr.map(item => {
+            if (item.PointList && item.PointList.length) {
+                item.PointList.map(em => {
+                    arrX.push(em.X)
+                    arrY.push(em.Y)
+                })
+            }
+        })
+    }
+    /**
+     * 
+     * @param {*} obj 将point标签的x,y进行比对
+     * @return object 返回数组,其中包括最大值最小值X,Y 
+     */
+tools.getPoint = function(obj) {
+    arrX = []
+    arrY = []
+    for (let i in obj) {
+        tools.getPointDetails(obj[i])
+    }
+    let maxX = Math.max.apply(null, arrX)
+    let minX = Math.min.apply(null, arrX)
+    let maxY = Math.max.apply(null, arrY)
+    let minY = Math.min.apply(null, arrY)
+    let data = {
+        maxX,
+        minX,
+        maxY,
+        minY
+    }
+    return data
+}
+
+/**
+ * 
+ * @param {*} array  比较数组1
+ * @param {*} array2 比较数组2
+ * 
+ * 返回两个数组中不同的元素
+ */
+tools.compareArr = function(array, array2) {
+    var arr3 = [];
+    for (key in array) {
+        var stra = array[key];
+        var count = 0;
+        for (var j = 0; j < array2.length; j++) {
+            var strb = array2[j];
+            if (stra == strb) {
+                count++;
+            }
+        }
+        if (count === 0) { //表示数组1的这个值没有重复的,放到arr3列表中  
+            arr3.push(stra);
+        }
+    }
+    return arr3;
+}
+
+/**
+ * 
+ * @param {*} arr 需要改变的数组
+ * @param {*} k   其中Y值需要变换的倍数
+ * @param {*} name arr中的key值
+ * 
+ * 返回arr map 后arr[mapIndex]name * k 的数组
+ */
+tools.changeMap = function(arr, k, name) {
+    let data = arr.map(items => {
+        if (items[name] && items[name].length) {
+            items[name].map(children => {
+                if (Array.isArray(children)) {
+                    return children.map(res => {
+                        res.Y = res.Y * k
+                        return res
+                    })
+                } else {
+                    children.Y = children.Y * k
+                    return children
+                }
+            })
+        }
+    })
+    return data
+}
+
+tools.getMouseCanvas = function(view, e) {
+    let bbox = view.canvasView.getBoundingClientRect();
+    let x = e.clientX - bbox.left,
+        y = e.clientY - bbox.top;
+    return view.mapToScene({
+        x: x,
+        y: y
+    });
+}
+
+/**
+ * 
+ * @param {*} view graphy class
+ * @param {*} e    mouse元素e
+ */
+tools.mouseInElement = function(view, e, type) {
+    let mouse = tools.getMouseCanvas(view, e),
+        falg = false,
+        items = view.scene.root.children,
+        i = 0,
+        t = type || 3;
+    for (; i < items.length; i++) {
+        if (items[i].type == t) {
+            if (items[i].contains(mouse)) {
+                falg = true
+                break
+            }
+        }
+    }
+    return {
+        falg,
+        item: items[i] || [],
+        index: i
+    }
+}
+
+/**
+ * 
+ * @param {graphy中的所有children} items 
+ * @param {类型} type 
+ * @param {list} codes 
+ * @param {item中的code} code 
+ */
+tools.clear = function(items, type, codes, code) {
+    let indexArr = [];
+    if (items && items.length) {
+        let i = 0;
+        for (i; i < items.length; i++) {
+            let j = 0;
+            for (j; j < codes.length; j++) {
+                if (items[i][type] = type && items[i][code] == codes[j][code]) {
+                    indexArr.push(i)
+                }
+            }
+        }
+    }
+    return indexArr
+}
+
+tools.getText = function(arr, name) {
+    let text = '';
+    if (arr && arr.length) {
+        arr.map(item => {
+            text += (!!text ? '、' : '') + item[name]
+        })
+    }
+    return text
+}
+
+tools.cutString = function(string, num, text) {
+    return string.substring(0, num) + '...' + text
+}
+
+tools.deepCopy = function(obj) {
+    var out = [],
+        i = 0,
+        len = obj.length;
+    for (; i < len; i++) {
+        if (obj[i] instanceof Array) {
+            out[i] = tools.deepCopy(obj[i]);
+        } else out[i] = obj[i];
+    }
+    return out;
+}
+
+tools.copyArr = (source) => {
+    if (!source || typeof source !== 'object') {
+        throw new Error('error arguments', 'shallowClone');
+    }
+    var targetObj = source.constructor === Array ? [] : {};
+    for (var keys in source) {
+        if (source.hasOwnProperty(keys)) {
+            if (source[keys] && typeof source[keys] === 'object') {
+                targetObj[keys] = source[keys].constructor === Array ? [] : {};
+                targetObj[keys] = tools.copyArr(source[keys]);
+            } else {
+                targetObj[keys] = source[keys];
+            }
+        }
+    }
+    return targetObj;
+}
+
+tools.deepCopyObj = function(v) {
+    var o = v.constructor === Array ? [] : {};
+    for (var key in v) {
+        o[key] = typeof v[key] === 'Object' ? tools.deepCopyObj(v[key]) : v[key];
+    }
+
+    return o;
+}
+
+tools.deepClone = (obj) => {
+    var proto = Object.getPrototypeOf(obj);
+    return Object.assign({}, Object.create(proto), obj);
+}
+
+//hansontable插件的修改
+tools.customDropdownRenderer = function(
+    instance,
+    td,
+    row,
+    col,
+    prop,
+    value,
+    cellProperties
+) {
+    var selectedId;
+    var optionsList = cellProperties.chosenOptions.data;
+    if (
+        typeof optionsList === "undefined" ||
+        typeof optionsList.length === "undefined" ||
+        !optionsList.length
+    ) {
+        Handsontable.renderers.TextRenderer(
+            instance,
+            td,
+            row,
+            col,
+            prop,
+            value,
+            cellProperties
+        );
+        return td;
+    }
+    var values = (value + "").split(",");
+    value = [];
+    for (var index = 0; index < optionsList.length; index++) {
+        if (optionsList[index].content && optionsList[index].content.length) {
+            for (let i = 0; i < optionsList[index].content.length; i++) {
+                if (
+                    optionsList[index].content[i] &&
+                    optionsList[index].content[i].length
+                ) {
+                    for (let j = 0; j < optionsList[index].content[i].length; j++) {
+                        if (
+                            values.indexOf(
+                                optionsList[index].content[i].content[j].Code + ""
+                            ) > -1
+                        ) {
+                            selectedId = optionsList[index].content[i].content[j].Code;
+                            value.push(optionsList[index].content[i].content[j].Name);
+                        }
+                    }
+                } else {
+                    if (
+                        values.indexOf(optionsList[index].content[i].Code + "") > -1
+                    ) {
+                        selectedId = optionsList[index].content[i].Code;
+                        value.push(optionsList[index].content[i].Name);
+                    }
+                }
+            }
+        } else {
+            if (values.indexOf(optionsList[index].Code + "") > -1) {
+                selectedId = optionsList[index].Code;
+                value.push(optionsList[index].Name);
+            }
+        }
+    }
+    value = value.join(", ");
+    Handsontable.renderers.TextRenderer(
+        instance,
+        td,
+        row,
+        col,
+        prop,
+        value,
+        cellProperties
+    );
+    return td;
+}
+
+
+//hansontable插件查看详情
+tools.lookDetails = function(instance, td, row, col, prop, value, cellProperties) {
+    td.style.color = "#409EFF";
+    td.style.cursor = "pointer";
+    if (!!value) {
+        if (typeof(value) == 'object') {
+            td.innerHTML = "已有值,查看";
+        } else {
+            td.innerHTML = value
+        }
+    } else {
+        td.innerHTML = "查看详情";
+    }
+    return td;
+}
+
+//是否关联
+tools.hasRelation = function(instance, td, row, col, prop, value, cellProperties) {
+    if (value) {
+        td.innerHTML = "已关联";
+    } else {
+        td.innerHTML = "未关联";
+    }
+    return td;
+}
+
+tools.num = function(instance, td, row, col, prop, value, cellProperties) {
+    td.style.color = "#409EFF";
+    td.style.cursor = "pointer";
+    td.innerHTML = value;
+    return td;
+}
+
+tools.setItem = (key, value) => {
+    if (typeof value == 'string') {
+        localStorage.setItem(key, value);
+    } else {
+        localStorage.setItem(key, JSON.stringify(value));
+    }
+}
+
+tools.getItem = (key) => {
+    const re = /^\[|\{|\}|\]$/g //判断字符中是否有[]{}
+    let getIt = localStorage.getItem(key)
+    if (re.test(getIt)) {
+        return JSON.parse(getIt)
+    } else {
+        return getIt
+    }
+}
+
+tools.removeItem = (key) => {
+    localStorage.removeItem(key)
+}
+
+//取两个数组的差值
+tools.differenceArr = (a, b) => {
+    return a.concat(b).filter(v => !a.includes(v) || !b.includes(v))
+}
+
+//取两个数组的相同值
+tools.sameArr = (a, b) => {
+    return a.filter(v => b.includes(v))
+}
+
+tools.sortArr = (arr, key, sequence) => {
+    function compare(property) {
+        return function(a, b) {
+            var value1 = a[property];
+            var value2 = b[property];
+            if (sequence) {
+                return value1 - value2;
+            } else {
+                return value2 - value1
+            }
+        }
+    }
+
+    return arr.sort(compare(key))
+}
+
+tools.pagination = (pageNo, pageSize, array) => {
+    let offset = (pageNo - 1) * pageSize;
+    return offset + pageSize >= array.length ?
+        array.slice(offset, array.length) :
+        array.slice(offset, offset + pageSize);
+}
+
+tools.getSameItems = (arr1, key1, arr2, key2) => {
+    let data = []
+    arr1.map(item => {
+        arr2.map(child => {
+            if (item[key1] == child[key2]) {
+                data.push(item)
+            }
+        })
+    })
+    return data
+}
+
+tools.isIn = (x, y, json) => {
+    let nCross = 0,
+        point = typeof(x) == 'object' ? [x.x, x.y] : [x, y],
+        APoints = json,
+        length = APoints.length,
+        p1, p2, i, xinters;
+    p1 = APoints[0];
+    for (i = 1; i <= length; i++) {
+        p2 = APoints[i % length];
+        if (
+            point[0] > Math.min(p1[0], p2[0]) &&
+            point[0] <= Math.max(p1[0], p2[0])
+        ) {
+            if (point[1] <= Math.max(p1[1], p2[1])) {
+                if (p1[0] != p2[0]) {
+                    //计算位置信息
+                    xinters = (point[0] - p1[0]) * (p2[1] - p1[1]) / (p2[0] - p1[0]) + p1[1];
+                    if (p1[1] == p2[1] || point[1] <= xinters) {
+                        nCross++
+                    }
+                }
+            }
+        }
+        p1 = p2;
+    }
+    if (nCross % 2 == 0) {
+        return false
+    } else {
+        return true
+    }
+
+}
+
+tools.arrayUnique = (arr, name) => {
+    var hash = {};
+    return arr.reduce(function(item, next) {
+        hash[next[name]] ? '' : hash[next[name]] = true && item.push(next);
+        return item;
+    }, []);
+}
+
+tools.dateAddYear = function(date, yearCount) {
+    var tempDate = dateToDate(date);
+    var count = parseInt(yearCount);
+    var oldYear = tempDate.getFullYear();
+    var oldMonth = tempDate.getMonth();
+    var oldDate = tempDate.getDate();
+    var newYear = oldYear + count;
+    var newDate = new Date(newYear, oldMonth, oldDate);
+    //防止月份数不一致,进行微调
+    while (newDate.getMonth() != oldMonth) {
+        oldDate--;
+        newDate = new Date(newYear, oldMonth, oldDate);
+    }
+    var month = newDate.getMonth() + 1;
+    var day = newDate.getDate();
+    month = (month.toString().length == 1) ? ("0" + month) : month;
+    day = (day.toString().length == 1) ? ("0" + day) : day;
+
+    var result = newDate.getFullYear() + '-' + month + '-' + day; //当前日期
+
+    return result;
+}
+
+function dateToDate(date) {
+    var sDate = new Date();
+    if (typeof date == 'object' && typeof new Date().getMonth == "function") {
+        sDate = date;
+    } else if (typeof date == "string") {
+        var arr = date.split('-');
+        if (arr.length == 3) {
+            sDate = new Date(arr[0] + '-' + arr[1] + '-' + arr[2]);
+        }
+    }
+    return sDate;
+}
+
+export default tools

+ 957 - 0
src/views/data_admin/buildAssets/index.vue

@@ -0,0 +1,957 @@
+<!--
+  revit一次资产清单
+ -->
+<template>
+  <div id="build_assets">
+    <div class="select_header">
+      <!-- <button @click="download"></button> -->
+      <i>建筑名称:</i>
+      <!-- <select name="" id="" v-model="select" @change="changeSelect">
+            <option :value="item.BuildId" v-for="item in BuildList">{{item.BuildName}}</option>
+      </select>-->
+      <el-select v-model="select" placeholder="请选择" @change="changeSelect">
+        <el-option
+          v-for="item in BuildList"
+          :key="item.BuildId"
+          :label="item.BuildLocalName"
+          :value="item.BuildId"
+        ></el-option>
+      </el-select>
+    </div>
+    <div class="main">
+      <div class="left_main">
+        <el-tabs type="border-card" @tab-click="createHotBtn">
+          <el-tab-pane v-for="(item,index) in textArr" :label="item" v-loading="loading" :key="index">
+            <div style="padding: .2rem;width:100%;">
+              <!-- 这里不能使用if判断,因为可能存在vue实例渲染时document先进行查找 -->
+              <div :id="'assets' + index" v-show="noData[index]"></div>
+              <div v-show="!noData[index]">暂无数据</div>
+            </div>
+            <div class="assets_page">
+              <el-pagination
+                @size-change="handleSizeChange"
+                @current-change="handleCurrentChange"
+                :current-page.sync="currentPage[tabCheck]"
+                :page-sizes="pageSizeArrs"
+                :page-size="pageSizeArr[tabCheck]"
+                layout="total, sizes, prev, pager, next, jumper"
+                :total="pageCount[tabCheck]"
+              ></el-pagination>
+            </div>
+          </el-tab-pane>
+        </el-tabs>
+      </div>
+    </div>
+    <el-dialog title="确定设备类" :visible.sync="familyDialog" :width="'30%'">
+      <el-select v-model="checkFamily" placeholder="与资产设备族对应的设备类">
+        <el-option
+          v-for="item in showFamily"
+          :key="item.code"
+          :label="item.name"
+          :value="item.code"
+        ></el-option>
+      </el-select>
+      <span slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="correlation">确定创建对应岗位</el-button>
+        <el-button @click="familyDialog = false">取 消</el-button>
+      </span>
+    </el-dialog>
+    <!-- 请求提示弹窗 -->
+    <el-dialog title="提示" :visible.sync="dialogVisible">
+      <span>{{ajaxMsg}}</span>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
+      </span>
+    </el-dialog>
+    <!-- 详情弹窗 -->
+    <el-dialog title="详情" class="iframe" v-if="iframeShow" :visible.sync="iframeShow">
+      <iframe
+        id="google_ads_frame2"
+        name="google_ads_frame2"
+        frameborder="0"
+        :src="iframeSrc"
+        marginwidth="0"
+        marginheight="0"
+        vspace="0"
+        hspace="0"
+        allowtransparency="true"
+        scrolling="no"
+        allowfullscreen="true"
+      ></iframe>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="iframeShow = false">关 闭</el-button>
+        <!-- <el-button type="danger" @click="isDelAsset">删 除 该 资 产</el-button> -->
+        <el-button @click="isDelAsset">删 除 该 资 产</el-button>
+      </span>
+    </el-dialog>
+    <!-- 确定删除资产弹窗 -->
+    <el-dialog title="删除资产" :visible.sync="del">
+      <span>你确定删除该资产吗?</span>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="del = false">关 闭</el-button>
+        <el-button @click="delAsset">删 除</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {
+  getBuildSelect, //根据项目ID获得建筑列表
+  getErrAssets, //获取异常资产type不同不同tab
+  delErrAssets, //删除异常资产
+  getAllFamily, //获取所有设备族
+  createPost, //新建岗位
+  upDateTableMain, //关联资产
+  getSpaceId, //获取空间id
+  getSpaceName, //获取空间名称
+  createComponent, //新建岗位(部件)
+  getAllbusiness,//获取楼层信息
+} from "@/api/scan/request";
+
+import tools from '@/utils/scan/tools.js'
+import Handsontable from "handsontable-pro"
+import 'handsontable-pro/dist/handsontable.full.css'
+import zhCN from 'handsontable-pro/languages/zh-CN';
+
+export default {
+  data() {
+    return {
+      BuildList: [], //下拉列表
+      textArr: [
+        "现场无法找到的资产",
+        "未画入模型的资产",
+        "无对应岗位的资产",
+        "未扫楼验证的资产"
+      ], //tab内容
+      select: "all", //下拉选中数据
+      data: [], //假数据
+      idArr: ["notFound", "noModel", "noJob", "noVerify"], //选中tab
+      myHotObj: [], //Handsontable实例数组
+      dialogVisible: false, //请求错误弹窗
+      ajaxMsg: "", //请求错误提示
+      currentPageArr: [1, 1, 1, 1], //当前选中页数数组
+      pageCount: [10, 10, 10, 10], //总共数据条数
+      pageSizeArrs: [10, 30, 50, 100], //下拉页数个数
+      pageSizeArr: [10, 10, 10, 10], //数组当前页个数
+      currentPage: [1, 1, 1, 1], //当前页数
+      tabCheck: 0, //当前选中的check
+      loading: true,
+      noData: [true, true, true, true],
+      iframeShow: false, //资产详情页弹窗
+      del: false,
+      FmList: [],
+      ProjId: this.$route.query.projId, //url获取项目id this.$route.query.projId
+      UserId: this.$route.query.userId, //url获取用户id this.$route.query.userId
+      secret: this.$route.query.secret, //uel获取项目密码 this.$route.query.secret
+      iframeSrc: "", //iframe的地址
+      allFamily: [], //所有的设备族
+      showFamily: [], //弹窗显示的设备类
+      familyDialog: false, //选择设备族弹窗
+      checkFamily: "", //选中的设备类
+      temporaryData: [], //暂时的数据
+      filtersArr: [],
+      copyData: null,//深拷贝数据
+      floors: [],//楼层信息
+    };
+  },
+  created() {
+    this.getBuilding();
+    this.myHotObj.length = this.textArr.length;
+    //获取所有所有的设备族
+    this.getAllFamily();
+  },
+  mounted() {
+    this.getFloors()
+
+  },
+  methods: {
+
+    download() {
+      this.myHotObj[this.tabCheck].getPlugin('exportFile').downloadFile("csv", { filename: "嘉铭项目无对应岗位的资产", columnHeaders: true, exportHiddenRows: true, exportHiddenColumns: true, rowHeaders: true })
+    },
+    //建筑选择事件
+    changeSelect() {
+      this.getErrAssets();
+    },
+
+    //获取所有楼层
+    getFloors() {
+      let param = {
+        ProjId: this.ProjId,
+        secret: this.secret,
+        id: this.ProjId,
+        type: ["Fl"]
+      }
+      getAllbusiness(param).then(res => {
+        if (res.data.Result == "success") {
+          this.floors = res.data.Content.map(item => {
+            return {
+              FloorLocalName: item.infos.FloorLocalName,
+              FloorID: item.infos.FloorID
+            }
+          })
+        } else {
+          this.$message.error("请求出错" + res.data.ResultMsg)
+        }
+        this.getErrAssets();
+      })
+    },
+
+    //获取设备族
+    getAllFamily() {
+      getAllFamily().then(result => {
+        if (result.data.Result == "success") {
+          this.allFamily = result.data.Content;
+        } else {
+          this.dialogVisible = true;
+          this.ajaxMsg = "请求出错";
+        }
+      });
+    },
+
+    //新建岗位设备类
+    createPost() {
+      let param = {
+        BuildId: this.temporaryData.BuildId,
+        category: this.checkFamily,
+        secret: this.secret,
+        perjectId: this.ProjId,
+        BIMID: this.temporaryData.FloorId,
+        BIMLocation: (this.temporaryData.X || 0) + "," + (this.temporaryData.Y || 0) + "," + (this.temporaryData.Z || 0)
+      };
+      if (param.category.length == 6) {
+        createComponent(param).then(res => {
+          if (res.data.Result == "success") {
+            this.upDateTableMain(res.data.id);
+          } else {
+            this.$message({
+              message: res.data.ResultMsg,
+              type: "warning"
+            });
+          }
+        });
+      } else {
+        createPost(param).then(res => {
+          if (res.data.Result == "success") {
+            this.upDateTableMain(res.data.id);
+          } else {
+            this.$message({
+              message: res.data.ResultMsg,
+              type: "warning"
+            });
+          }
+        });
+      }
+    },
+
+    //获取元空间名称
+    getSpaceName(arr) {
+      let param = {
+        perjectId: this.ProjId,
+        secret: this.secret,
+        list: arr
+      };
+      getSpaceName(param).then(res => {
+        if (res.data.Result == "success") {
+          let data = res.data.Content;
+          for (let i = 0; i < this.data[3].length; i++) {
+            let findData = data.find(
+              item =>
+                item.id == this.data[3][i].spaceId &&
+                this.data[3][i].spaceName == undefined
+            );
+            if (findData != undefined) {
+              this.data[3][i].spaceName = findData.infos.RoomLocalName;
+            }
+          }
+          this.myHotObj[3].loadData(this.data[3]);
+        } else {
+        }
+      });
+    },
+
+    //获取元空间id
+    getSpaceId() {
+      let param = {},
+        idArr = [],
+        i = 0,
+        dataArr = this.data[this.tabCheck];
+      for (; i < dataArr.length; i++) {
+        if (dataArr[i].EquipmentId) {
+          idArr.push({
+            from_id: dataArr[i].EquipmentId,
+            graph_id: "GtEquipinSpace001",
+            rel_type: "1"
+          });
+        }
+      }
+      param = {
+        perjectId: this.ProjId,
+        secret: this.secret,
+        list: idArr
+      };
+      getSpaceId(param).then(res => {
+        let data = res.data,
+          spaceArr = [],
+          j = 0;
+        if (data.Result == "success") {
+          for (; j < data.Content.length; j++) {
+            console.log(data.Content)
+            if (data.Content[j].Count != 0) {
+              spaceArr.push({
+                id: data.Content[j].Content[0].to_id
+              });
+              dataArr.map(item => {
+                if (item.EquipmentId == data.Content[j].Content[0].from_id) {
+                  item.spaceId = data.Content[j].Content[0].to_id;
+                }
+                return item
+              })
+            }
+          }
+          console.log(dataArr, "dataArr")
+          this.getSpaceName(spaceArr);
+        } else {
+        }
+      });
+    },
+
+    //获取资产设备类
+    getEquipmentName() {
+      let param = {},
+        idArr = [],
+        i = 0,
+        dataArr = this.data[this.tabCheck];
+      for (; i < dataArr.length; i++) {
+        if (dataArr[i].EquipmentId) {
+          idArr.push({
+            id: dataArr[i].EquipmentId
+          });
+        }
+      }
+      param = {
+        perjectId: this.ProjId,
+        secret: this.secret,
+        list: idArr
+      };
+      getSpaceName(param).then(res => {
+        if (res.data.Result == "success") {
+          let data = res.data.Content;
+          for (let i = 0; i < this.data[this.tabCheck].length; i++) {
+            let findData = data.find(
+              item => item.id == this.data[this.tabCheck][i].EquipmentId
+            );
+            if (findData != undefined) {
+              let findFamily = this.allFamily.find(
+                item => item.code == this.data[this.tabCheck][i].Family
+              ).content;
+              this.data[this.tabCheck][i].familyArr = findFamily;
+              this.data[this.tabCheck][i].assetType = findData.category.substr(
+                2,
+                6
+              );
+              this.data[this.tabCheck][i].assetName = findFamily.find(
+                item => item.code == findData.category.substr(2, 6)
+              ).name;
+              this.data[this.tabCheck][i].bimXY = findData.infos.BIMLocation || "--"
+              this.data[this.tabCheck][i].html =
+                '<p style="color:#409EFF;cursor: pointer;">查看岗位详情</p>';
+            }
+          }
+          this.myHotObj[this.tabCheck].loadData(this.data[this.tabCheck]);
+        } else {
+        }
+      });
+    },
+
+    //关联资产
+    upDateTableMain(id) {
+      let param = {
+        ProjId: this.ProjId,
+        UserId: this.UserId
+      },
+        paramList = {};
+      paramList.EquipmentId = id;
+      paramList.FmId = this.temporaryData.FmId;
+      paramList.Family = this.temporaryData.Family;
+      upDateTableMain(param, [paramList]).then(res => {
+        if (res.data.Result == "success") {
+          this.$message({
+            message: "绑定成功",
+            type: "success"
+          });
+          this.familyDialog = false;
+          this.createHotBtn({ index: this.tabCheck })
+        } else {
+          this.$message.error("请求失败");
+        }
+      });
+    },
+
+    //获取异常资产
+    getErrAssets() {
+      let param = {
+        BuildId: this.select,
+        PageNum: this.currentPage[this.tabCheck],
+        PageSize: this.pageSizeArr[this.tabCheck],
+        Type: this.tabCheck + 1,
+        ProjId: this.ProjId,
+        UserId: this.UserId
+      };
+      if (this.tabCheck == 3) {
+        param.CodeType = 1
+      } else {
+        delete param.CodeType
+      }
+      let headerArr = [],
+        columnsArr = [];
+      if (this.tabCheck != 3) {
+        headerArr = [
+          "建筑",
+          "楼层",
+          "点位标签名称",
+          "设备族",
+          "本地编码",
+          "本地名称"
+        ];
+        columnsArr = [
+          {
+            data: "BuildName"
+          },
+          {
+            data: "FloorName"
+          },
+          {
+            data: "PointName"
+          },
+          {
+            data: "FamilyName"
+          },
+          {
+            data: "FmId"
+          },
+          {
+            data: "FmName"
+          }
+        ];
+      } else {
+        headerArr = [
+          "建筑",
+          "楼层",
+          "设备族",
+          "本地编码",
+          "本地名称",
+          "所在元空间",
+          "对应设备类",
+          "BIM模型中坐标",
+          "对应的岗位",
+          "查看资产详情"
+        ];
+        columnsArr = [
+          {
+            data: "BuildName"
+          },
+          {
+            data: "FloorName"
+          },
+          {
+            data: "FamilyName"
+          },
+          {
+            data: "FmId"
+          },
+          {
+            data: "FmName"
+          },
+          {
+            data: "spaceName"
+          },
+          {
+            data: "assetName"
+          },
+          {
+            data: "bimXY",
+          },
+          {
+            renderer: "html",
+            data: "html"
+          }, {
+            renderer: tools.lookDetails,
+            data: "details"
+          }
+        ];
+      }
+      if (this.tabCheck == 2) {
+        headerArr.push("查看详情")
+        columnsArr.push({
+          renderer: tools.lookDetails,
+          data: "details"
+        })
+      }
+      //发起请求
+      getErrAssets(param).then(result => {
+        if (result.data.Result == "success") {
+          let id = "assets" + this.tabCheck;
+          let dom = document.getElementById(id).innerText;
+          if (result.data.Count) {
+            this.noData[this.tabCheck] = true;
+            //给数据添加楼层
+            this.data[this.tabCheck] = result.data.FmList.map(item => {
+              this.floors.map(floor => {
+                if (floor.FloorID == item.FloorId) {
+                  item.FloorName = floor.FloorLocalName
+                }
+              })
+              return item
+            });
+            //拷贝一份数据以供删除
+            this.copyData = tools.deepCopy(this.data[this.tabCheck])
+            if (this.tabCheck == 3) {
+              this.data[this.tabCheck] = result.data.FmList.map(item => {
+                item.bimXY = (item.X || '空') + "," + (item.Y || '空')
+                return item
+              }).filter(d => d);
+              this.getSpaceId();
+              this.getEquipmentName();
+            }
+            if (dom) {
+              this.loading = false;
+              this.myHotObj[this.tabCheck].loadData(result.data.FmList);
+            } else {
+              this.$nextTick(() => {
+                this.createHot(
+                  id,
+                  this.tabCheck,
+                  result.data.FmList,
+                  headerArr,
+                  columnsArr
+                );
+              });
+            }
+            this.pageCount[this.tabCheck] = result.data.Count;
+
+          } else {
+            this.loading = false;
+            this.noData[this.tabCheck] = false;
+          }
+        } else {
+          this.dialogVisible = true;
+          this.ajaxMsg = "请求出错";
+        }
+      });
+    },
+
+    //删除资产
+    delAss() {
+      let param = {
+        ProjId: this.ProjId,
+        UserId: this.UserId
+      };
+      let paramList = [this.FmList.FmId];
+      delErrAssets(param, paramList).then(result => {
+        if (result.data.Result == "success") {
+          this.getErrAssets();
+          return;
+        } else {
+          this.dialogVisible = true;
+          this.ajaxMsg = "请求出错";
+        }
+      });
+    },
+
+    //获取建筑列表
+    getBuilding() {
+      let param = {
+        ProjId: this.ProjId,
+        UserId: this.UserId
+      };
+      getBuildSelect(param).then(result => {
+        if (result.data.Result == "success") {
+          this.BuildList = result.data.BuildList;
+          this.BuildList.unshift({
+            BuildId: "all",
+            BuildLocalId: "全部",
+            BuildLocalName: "全部",
+            BuildName: "全部"
+          });
+          this.select = this.BuildList[0].BuildId;
+        } else {
+          this.dialogVisible = true;
+          this.ajaxMsg = "接口请求错误";
+        }
+      });
+    },
+
+    //改变页面个数
+    handleSizeChange(val) {
+      this.pageSizeArr[this.tabCheck] = val;
+      this.getErrAssets();
+    },
+
+    //改变页面页数
+    handleCurrentChange(val) {
+      this.currentPage[this.tabCheck] = val;
+      this.getErrAssets();
+    },
+
+    //点击tab创建对应的表格
+    createHotBtn(tab, event) {
+      let id = "assets" + this.tabCheck;
+      let dom = document.getElementById(id).innerText;
+      this.tabCheck = Number(tab.index);
+      this.loading = true;
+      this.getErrAssets();
+    },
+
+    //弹窗点击删除事件
+    isDelAsset() {
+      this.iframeShow = false;
+      this.del = true;
+    },
+
+    //确定删除事件
+    delAsset() {
+      this.del = false;
+      this.delAss();
+    },
+
+    //关联资产确定
+    correlation() {
+      if (this.checkFamily == "") {
+        this.$message({
+          message: "请选择设备类后再进行关联",
+          type: "warning"
+        });
+      } else {
+        this.createPost();
+      }
+    },
+
+    //Handsontable表格单击事件
+    tableDown(val, key) {
+      //是否是岗位
+      let isAsset = false;
+      this.FmList = this.data[this.tabCheck][key.row];
+      if (this.tabCheck == 3 || (this.tabCheck == 2 && key.col == 6)) {
+        this.clickTab3(val, key)
+        return
+      }
+      if (key.row < 0 || this.tabCheck == 2 || isAsset) {
+        return;
+      } else {
+        this.iframeSrc =
+          process.env.BASE_URL +
+          ":8889/#/details?perjectId=" +
+          this.ProjId +
+          "&secret=" +
+          this.secret +
+          "&FmId=" +
+          this.FmList.FmId +
+          "&type=1&code=" +
+          this.FmList.Family;
+        this.iframeShow = true;
+      }
+    },
+
+    clickTab3(val, rowArr) {
+      let trimmedArr = this.trimmedRows();
+      //是否启用了排序
+      let isSort = this.myHotObj[this.tabCheck]
+        .getPlugin("columnSorting")
+        .isSorted();
+      // debugger
+      let infos = null
+      if (trimmedArr.length && isSort) {
+        let sortArr = this.myHotObj[this.tabCheck].getPlugin("columnSorting")
+          .rowsMapper.__arrayMap;
+        infos = this.data[this.tabCheck][
+          trimmedArr[sortArr[rowArr.row]]
+        ];
+      } else if (isSort) {
+        //排序后的数组
+        let sortArr = this.myHotObj[this.tabCheck].getPlugin("columnSorting")
+          .rowsMapper.__arrayMap;
+        infos = this.data[this.tabCheck][sortArr[rowArr.row]]
+          ;
+      } else if (trimmedArr.length) {
+        infos = this.data[this.tabCheck][trimmedArr[rowArr.row]];
+      } else {
+        infos = this.data[this.tabCheck][rowArr.row];
+      }
+      if (rowArr.col == 8 || rowArr.col == 9) {
+        this.lookTab3Details(infos, rowArr);
+      }
+      this.FmList = infos
+      if (this.tabCheck == 2 && rowArr.col == 6) {
+        this.iframeSrc =
+          process.env.BASE_URL +
+          ":8889/#/details?perjectId=" +
+          this.ProjId +
+          "&secret=" +
+          this.secret +
+          "&FmId=" +
+          infos.FmId +
+          "&type=0&code=" +
+          infos.Family;
+        this.iframeShow = true;
+        return
+      }
+      if (this.tabCheck == 3) {
+        return
+      }
+    },
+    lookTab3Details(infos, rowArr) {
+      if (rowArr.col == 8) {
+        if (!!infos.html) {
+          this.iframeSrc =
+            process.env.BASE_URL +
+            ":8889/#/details?perjectId=" +
+            this.ProjId +
+            "&secret=" +
+            this.secret +
+            "&FmId=" +
+            infos.EquipmentId +
+            "&type=0&code=" +
+            infos.assetType;
+          this.iframeShow = true;
+        }
+      }
+      if (rowArr.col == 9) {
+        this.iframeSrc =
+          process.env.BASE_URL +
+          ":8889/#/details?perjectId=" +
+          this.ProjId +
+          "&secret=" +
+          this.secret +
+          "&FmId=" +
+          infos.FmId +
+          "&type=0&code=" +
+          infos.Family;
+        this.iframeShow = true;
+      }
+    },
+
+    //自定义菜单被点击触发事件
+    menuCallback(key, selection, clickEvent) {
+      if (selection) {
+        let index = selection[0].start.row;
+        this.temporaryData = this.data[this.tabCheck][index];
+        this.showFamily = this.findFamily(this.temporaryData.Family).content;
+        this.checkFamily = ""; //清空设备类
+        this.familyDialog = true;
+      }
+    },
+
+    getDetails(key, selection, clickEvent) {
+      if (selection) {
+        this.tableDown("", selection);
+      }
+    },
+
+    //数组查询族
+    findFamily(str) {
+      return this.allFamily.find(item => item.code == str);
+    },
+
+    //自定义右键菜单
+    customMenu(val) {
+      if (this.tabCheck == 2) {
+        return {
+          callback: function (key, selection, clickEvent) { },
+          items: {
+            about: {
+              name: "自动创建对应资产",
+              callback: this.menuCallback
+            }
+            // about: {
+            //   name: "查看资产详情",
+            //   callback: this.getDetails
+            // }
+          }
+        };
+      } else {
+        return "";
+      }
+    },
+    //创建表格实例
+    createHot(id, variableNum, data, headerArr, columnsArr) {
+      let that = this;
+      let containter = document.getElementById(id);
+      let options = {
+        data: data,
+        colHeaders: headerArr,
+        manualColumnResize: true,
+        manualColumnMove: true,
+        height: 750,
+        stretchH: "all",
+        // maxRows: this.pageSizeArr[variableNum],
+        renderAllRows: true,
+        readOnly: true,
+        autoColumnSize: true,
+        columns: columnsArr,
+        afterOnCellMouseDown: this.tableDown,
+        contextMenu: this.customMenu()
+      };
+      if (this.tabCheck == 3) {
+        options.contextMenu = {
+          items: {
+            remove_row: {
+              name: "删除资产"
+            }
+          }
+        }
+        options.columnSorting = true //添加排序
+        options.sortIndicator = true //添加排序
+        options.dropdownMenu = [
+          "filter_by_condition",
+          "filter_by_value",
+          "filter_action_bar"
+        ]
+        options.filters = true
+        options.afterFilter = this.trimmedRows
+        options.afterRemoveRow = this.romoveFm //右键删除
+      }
+      this.myHotObj[variableNum] = new Handsontable(containter, options);
+      //存在点击tab后分页不正确的问题,使用0转换
+      this.tabCheck = 0;
+      this.tabCheck = variableNum;
+      this.loading = false;
+      let pro = document.getElementById("hot-display-license-info");
+      pro.parentNode.removeChild(pro);
+    },
+
+    //删除资产
+    romoveFm(index, rowArr) {
+      let a = this.data[this.tabCheck]
+      let b = this.copyData
+      //获取相同的值
+      // let intersection = a.filter(v => b.includes(v))
+      //取差值
+      let difference = a.concat(b).filter(v => !a.includes(v) || !b.includes(v))
+      let param = {
+        ProjId: this.ProjId,
+        UserId: this.UserId
+      };
+      let paramList = difference.map(item => {
+        return item.FmId
+      })
+      this.$confirm('确认删除?')
+        .then(_ => {
+          delErrAssets(param, paramList).then(result => {
+            if (result.data.Result == "success") {
+              this.createHotBtn({ index: this.tabCheck })
+              return;
+            } else {
+              this.dialogVisible = true;
+              this.ajaxMsg = "请求出错";
+            }
+          });
+        })
+        .catch(_ => {
+          this.createHotBtn({ index: this.tabCheck })
+        });
+
+    },
+
+    //获取被筛选掉的行号
+    trimmedRows() {
+      // var plugin = hot.getPlugin('trimRows').trimmedRows;//获取被筛选掉的行号
+      var plugin = this.myHotObj[this.tabCheck].getPlugin("trimRows")
+        .trimmedRows;
+      let dataLength = this.pageSizeArr[this.tabCheck];
+      let dataArr = new Array();
+      for (let i = 0; i < dataLength; i++) {
+        dataArr.push(i);
+      }
+      if (plugin.length <= 0) {
+        dataArr = undefined;
+      } else {
+        dataArr = this.array_diff(dataArr, plugin);
+      }
+      this.filtersArr[this.tabCheck] = dataArr;
+      return dataArr || [];
+      // var DataArray = new Array();
+
+      // for (var i = 0; i < plugin.length; i++) {
+      //     // 通过行号获取数据
+      //     DataArray.push(this.myHotObj[this.tabCheck].getSourceDataAtRow(plugin[i]));
+      // }
+    },
+
+    //去除数组中相同的元素
+    array_diff(a, b) {
+      for (var i = 0; i < b.length; i++) {
+        for (var j = 0; j < a.length; j++) {
+          if (a[j] == b[i]) {
+            a.splice(j, 1);
+            j = j - 1;
+          }
+        }
+      }
+      return a;
+    },
+  }
+};
+</script>
+
+<style lang="less" scoped>
+#app {
+  min-width: 1098px;
+  min-height: 767px;
+  position: relative;
+  overflow-x: auto;
+}
+#build_assets {
+  height: 100%;
+  width: 100%;
+  overflow: hidden;
+  #assets0,
+  #assets1,
+  #assets2 {
+    height: 45rem;
+    overflow-y: auto;
+  }
+  .select_header {
+    font-size: 0.8rem;
+    height: 3rem;
+    width: 100%;
+    min-width: 1098px;
+    line-height: 3rem;
+    background-color: #eee;
+    border-bottom: 1px solid #000;
+    padding-left: 0.5rem;
+    position: absolute;
+    top: 0;
+    box-sizing: border-box;
+  }
+  .main {
+    width: 100%;
+    position: absolute;
+    top: 3.5rem;
+    bottom: 0;
+    overflow: hidden;
+    .left_main {
+      height: 100%;
+      box-sizing: border-box;
+      float: left;
+      width: 100%;
+      position: relative;
+      .el-tabs--border-card {
+        position: absolute;
+        left: 0.4rem;
+        right: 0;
+        top: 0;
+        bottom: 0.4rem;
+      }
+    }
+  }
+  .iframe {
+    iframe {
+      width: 760px;
+      height: 100%;
+    }
+  }
+}
+</style>