|
@@ -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>
|