From 8c25c8d18a2f628315a4923bc4fc76e0baba4b22 Mon Sep 17 00:00:00 2001 From: "lj7788@126.com" Date: Wed, 2 Jul 2025 14:35:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A8=A1=E5=9E=8B=E7=9A=84?= =?UTF-8?q?=E6=87=92=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yanzhu-bigscreen/src/views/bimBriefing.vue | 180 +++++++++++----- yanzhu-bigscreen/src/views/bimManage.vue | 68 +++++- yanzhu-bigscreen/src/views/bimRoaming.vue | 193 +++++++++++++----- yanzhu-bigscreen/src/views/projectDetail.vue | 7 +- .../views/bim/bimSetting/ModelFloorTree.vue | 99 +++++---- .../src/views/manage/plan/bimSelectTools2.js | 83 +++++--- .../views/manage/plan/bimSelectionDialog2.vue | 11 +- .../src/views/manage/plan/index.vue | 2 +- 8 files changed, 462 insertions(+), 181 deletions(-) diff --git a/yanzhu-bigscreen/src/views/bimBriefing.vue b/yanzhu-bigscreen/src/views/bimBriefing.vue index 01a59bd0..770a007b 100644 --- a/yanzhu-bigscreen/src/views/bimBriefing.vue +++ b/yanzhu-bigscreen/src/views/bimBriefing.vue @@ -22,7 +22,8 @@ }" node-key="key" @check="onCheckTree" - :data="modelTrees" + :load="loadNode" + lazy show-checkbox> @@ -261,6 +262,72 @@ export default { this.initEngine(); }, methods: { + loadNode(node, resolve) { + let that = this; + if (node.level == 0) { + let nd = [ + { + title: "项目模型", + level: 0, + type: "root", + key: "root", + children: [], + hadLoad: true, + }, + ]; + + resolve(nd); + setTimeout(() => { + document.querySelectorAll(".bim-briefing .model-tree .el-tree-node")[0].click(); + }, 1000); + } else if (node.level == 1) { + let nd = []; + that.models.forEach((d) => { + let mnd = { + title: d.modelName, + level: 1, + type: "model", + hasLoad: false, + modelId: d.lightweightName, + key: d.lightweightName, + externalId: "0", + glid: "", + children: [], + data: d, + }; + nd.push(mnd); + }); + resolve(nd); + } else { + this.getTreeChildren(node, resolve); + } + }, + getTreeChildren(node, resolve) { + let that = this; + let data = node.data; + this.$api.bim.getModelTree(data.modelId, data.glid).then((d) => { + let tmps = (d.data || []).map((it) => { + let title = it.externalId == 0 ? it.name : it.externalId; + title = title.replaceAll('"', "").replaceAll("'", "").replaceAll("\\", ""); + it.title = title; + it.key = it.glid; + it.modelId = data.modelId; + it.type = "data"; + it.leaf = +it.externalId != 0; + let o = this.convertFeatureInfo(it, data.modelId); + return o; + }); + resolve(tmps); + }); + }, + convertFeatureInfo(o, modelId) { + o.modelId = modelId; + o.featureId = o.modelId + "^" + o.externalId; + o.name = o.name || ""; + o.name = o.name.replaceAll('"', "").replaceAll("'", "").replaceAll("\\", ""); + o.info = `[${o.externalId}]${o.groupname}-${o.name}`; + return o; + }, doSelectMenu(index) { this.selectMenu = index; briefingTools.clearEvent(this); @@ -301,69 +368,77 @@ export default { break; } }, - onCheckTree(node, event) { + async onCheckTree(node, event) { + let api = bimBriefingApi; + let that = this; if (!this.modelLoaded) { this.$message.error("模型未加载完成,请稍后重试"); return; } - this.playCancle(); let checked = event.checkedNodes.includes(node); - console.log(node, event, checked); if (node.type == "root") { - //bimBriefingApi - node.children.forEach((m) => { - if (bimBriefingApi.m_model.has(m.modelId)) { - bimBriefingApi.Model.remove(m.modelId); - } - if (checked) { - this.addModel(m.modelId); - } - }); - } else if (node.type == "model") { - if (bimBriefingApi.m_model.has(node.modelId)) { - bimBriefingApi.Model.remove(node.modelId); - } if (checked) { - this.addModel(node.modelId); - } - } else { - if (bimBriefingApi.m_model.size == 0) { - let modelId = checkNode.modelId; - this.addModel(modelId, () => { - this.showItem(node, event, checked); + that.models.forEach((it) => { + api.Model.setVisible(it.modelId, true); + api.Model.original(it.modelId); }); } else { - this.showItem(node, event, checked); + that.models.forEach((it) => { + api.Model.setVisible(it.modelId, false); + }); + } + } else if (node.type == "model") { + if (checked) { + api.Model.setVisible(node.modelId, true); + api.Model.original(node.modelId); + } else { + api.Model.setVisible(node.modelId, false); + } + } else { + let isPartLoad = false; + if (event.checkedKeys.length == 1 && checked) { + isPartLoad = true; + } + let selFeatureIds = []; + if (node.leaf) { + selFeatureIds = [node.featureId]; + } else { + if (!node.leafs) { + let leafs = await this.getNodeLeafs(node); + node.leafs = leafs; + } + selFeatureIds = node.leafs.map((f) => f.featureId); + } + let tmps = selFeatureIds; + if (!checked) { + this.setFeatueVisible(tmps, false); + } else { + if (isPartLoad) { + api.Model.setVisible(node.modelId, true); + api.Model.original(node.modelId); + let tmpsIds2 = tmps.splice(0, 1000); + api.Feature.showFeatures(tmpsIds2.join("#")); + this.setFeatueVisible(tmps, true); + } else { + this.setFeatueVisible(tmps, true); + } } } }, - async showItem(checkNode, event, checked) { + setFeatueVisible(featureIds, show) { + let len = 1000; let api = bimBriefingApi; - api.Model.setVisible(checkNode.modelId, true); - let externalId = checkNode.externalId; - if (externalId != 0) { - if (checked) { - this.visibleList.push(externalId); - api.Feature.setVisible(this.visibleList.join("#"), true, checkNode.modelId, false); - } else { - this.visibleList = this.visibleList.filter((item) => item !== externalId); - api.Feature.setVisible(externalId, false, checkNode.modelId); - } - } else { - const res = await this.$api.bim.getTreeAllLeafChild(checkNode.modelId, checkNode.glid); - let nodes = res.data || []; - if (nodes.length > 0) { - if (checked) { - this.visibleList = MergeArray(nodes, this.visibleList); - api.Model.setVisible(checkNode.modelId, true); - api.Feature.setVisible(this.visibleList.join("#"), true, checkNode.modelId, false); - } else { - this.visibleList = DelArray(this.visibleList, nodes); - api.Feature.setVisible(nodes.join("#"), false, checkNode.modelId); - } - } + let cnt = featureIds.length; + for (let i = 0; i < cnt; i += len) { + api.Feature.setVisible(featureIds.slice(i, i + len).join("#"), show); } }, + async getNodeLeafs(node) { + const res = await this.$api.bim.getTreeAllLeafChild(node.modelId, node.glid); + return (res.data || []).map((f) => { + return this.convertFeatureInfo(f, node.modelId); + }); + }, arrowRetract() { if (this.leftShow == true) { this.rightSrc = "./images/arrow_right_open.png"; @@ -458,10 +533,15 @@ export default { this.$message.error("暂无模型,请先关联模型"); } else { this.models.forEach((item) => { + item.modelId = item.lightweightName; + item.gis = JSON.parse(item.gisJson); this.addModel(item.lightweightName); - this.loadModelTree(); this.doSelectMenu(7); + setTimeout(() => { + this.$refs.tree.setChecked(item.lightweightName, true, true); + }, 3000); }); + this.treeKey++; } }); this.init(); diff --git a/yanzhu-bigscreen/src/views/bimManage.vue b/yanzhu-bigscreen/src/views/bimManage.vue index 99c33d11..16071f7a 100644 --- a/yanzhu-bigscreen/src/views/bimManage.vue +++ b/yanzhu-bigscreen/src/views/bimManage.vue @@ -472,7 +472,8 @@ export default { } this.getProjectInfo(); this.costOutputSelectYearAndMonth(); - this.groupByCraftType(); + //this.groupByCraftType(); + this.loadAttendanceData(); this.getRootScheduleNode(); this.getFinishRate(); this.selectLastPhotography(); @@ -553,6 +554,60 @@ export default { this.prj.accumulatedCost = d.totalMonth || 0; }); }, + loadAttendanceData() { + if (this.selProject.vendorsCode != "uni") { + this.loadJhAttendanceData(); + } else { + this.loadUniAttendanceData(); + } + }, + loadJhAttendanceData() { + let data = { + id: 0, + projectId: this.selProject.id, + attendanceTime: this.$dt(new Date()).format("YYYY-MM-DD"), + }; + let ajax = this.$api.detail.groupAllByComany; + + ajax(data).then((d) => { + let tmps = d.data || []; + const func = (ids) => { + let sum = 0; + tmps + .filter((it) => ids.includes(it.companyTypeId)) + .map((it) => it.id) + .forEach((it) => { + sum += it * 1; + }); + return sum; + }; + + + this.workerInfo = [ + { text: "劳务人员", value: func(["4", "5"]) }, + { text: "监理人员", value: func(["2"]) }, + { text: "总包人员", value: func(["1"]) }, + ]; + console.log(this.attendanceData) + }); + }, + loadUniAttendanceData() { + let ajax = this.$api.detail.groupByCraftType; + let posData = { + comId: this.selProject.comId, + projectId: this.selProject.id, + }; + + ajax(posData).then((d) => { + this.workerInfo = (d.data || []).map((it) => { + return { + text: it.createBy, + value: it.id || 0, + id: it.craftType, + }; + }); + }); + }, groupByCraftType() { let ajax = this.$api.detail.groupByCraftType; let posData = { @@ -1019,7 +1074,7 @@ export default { position: absolute; top: calc(80vh - 50px); left: 50%; - margin-left:-170px; + margin-left: -170px; display: flex; background: #00000080; border-radius: 10px; @@ -1078,7 +1133,8 @@ export default { td, th { border: solid 1px #6ea9ab68; - padding: 4px; + padding: 7px 4px; + font-size: 12px; } th { color: #b0cfff; @@ -1380,7 +1436,7 @@ export default { th { border: solid 1px #6ea9ab68; padding: 4px; - font-size: 12px; + font-size: 10px; } } } @@ -1560,8 +1616,8 @@ export default { td, th { border: solid 1px #6ea9ab68; - padding: 8px; - font-size: 24px; + padding: 10px; + font-size: 20px; } } } diff --git a/yanzhu-bigscreen/src/views/bimRoaming.vue b/yanzhu-bigscreen/src/views/bimRoaming.vue index 779a7981..9b5cc605 100644 --- a/yanzhu-bigscreen/src/views/bimRoaming.vue +++ b/yanzhu-bigscreen/src/views/bimRoaming.vue @@ -19,10 +19,12 @@ :props="{ children: 'children', label: 'title', + isLeaf: 'leaf', }" node-key="key" @check="onCheckTree" - :data="modelTrees" + :load="loadNode" + lazy show-checkbox> @@ -112,7 +114,7 @@ export default { models: [], treeKey: 0, modelTrees: [], - viewPoint:[], + viewPoint: [], treeExpendedKeys: [], visibleList: [], viewpointList: [], @@ -122,9 +124,11 @@ export default { roamingLoading: true, selectedRoam: null, modelLoaded: false, + isPlay:false, }; }, mounted() { + window.bimRoaming = this; this.$store.dispatch("ChangeNav", 702); this.dpi = this.$dpi(); window.addEventListener("resize", () => { @@ -144,15 +148,84 @@ export default { this.initEngine(); }, methods: { + loadNode(node, resolve) { + let that = this; + if (node.level == 0) { + let nd = [ + { + title: "项目模型", + level: 0, + type: "root", + key: "root", + children: [], + hadLoad: true, + }, + ]; + + resolve(nd); + setTimeout(() => { + document.querySelectorAll(".bim-roaming .model-tree .el-tree-node")[0].click(); + }, 1000); + } else if (node.level == 1) { + let nd = []; + that.models.forEach((d) => { + let mnd = { + title: d.modelName, + level: 1, + type: "model", + hasLoad: false, + modelId: d.lightweightName, + key: d.lightweightName, + externalId: "0", + glid: "", + children: [], + data: d, + }; + nd.push(mnd); + }); + resolve(nd); + } else { + this.getTreeChildren(node, resolve); + } + }, + getTreeChildren(node, resolve) { + let that = this; + let data = node.data; + this.$api.bim.getModelTree(data.modelId, data.glid).then((d) => { + let tmps = (d.data || []).map((it) => { + let title = it.externalId == 0 ? it.name : it.externalId; + title = title.replaceAll('"', "").replaceAll("'", "").replaceAll("\\", ""); + it.title = title; + it.key = it.glid; + it.modelId = data.modelId; + it.type = "data"; + it.leaf = +it.externalId != 0; + let o = this.convertFeatureInfo(it, data.modelId); + return o; + }); + resolve(tmps); + }); + }, + convertFeatureInfo(o, modelId) { + o.modelId = modelId; + o.featureId = o.modelId + "^" + o.externalId; + o.name = o.name || ""; + o.name = o.name.replaceAll('"', "").replaceAll("'", "").replaceAll("\\", ""); + o.info = `[${o.externalId}]${o.groupname}-${o.name}`; + return o; + }, playIRPause(data) { data.play = 2; + this.isPlay=false; bimRoadmApi.Camera.pauseImmersiveRoam(false); }, playContinue(data) { data.play = 1; + this.isPlay=true; bimRoadmApi.Camera.pauseImmersiveRoam(true); }, playCancle(data) { + this.isPlay = false; if (data) { data.play = 0; this.selectedRoam = null; @@ -188,80 +261,93 @@ export default { api.Camera.startImmersiveRoam([65.702301, 670.785328, 851.817162]); setTimeout(() => { this.selectedRoam = data; + this.isPlay=true; api.Camera.playImmersiveRoam({ records: record, isLoopPlay: this.autoPlay, complete: function () { this.selectedRoam = null; data.play = 0; + this.isPlay=false; }, }); }, 400); }, 100); }, - onCheckTree(node, event) { + async onCheckTree(node, event) { + let api = bimRoadmApi; + let that = this; if (!this.modelLoaded) { this.$message.error("模型未加载完成,请稍后重试"); return; } - this.playCancle(); + if(this.isPlay){ + this.playCancle(); + } let checked = event.checkedNodes.includes(node); - console.log(node, event, checked); if (node.type == "root") { - //bimRoadmApi - node.children.forEach((m) => { - if (bimRoadmApi.m_model.has(m.modelId)) { - bimRoadmApi.Model.remove(m.modelId); - } - if (checked) { - this.addModel(m.modelId); - } - }); - } else if (node.type == "model") { - if (bimRoadmApi.m_model.has(node.modelId)) { - bimRoadmApi.Model.remove(node.modelId); - } if (checked) { - this.addModel(node.modelId); - } - } else { - if (bimRoadmApi.m_model.size == 0) { - let modelId = checkNode.modelId; - this.addModel(modelId, () => { - this.showItem(node, event, checked); + that.models.forEach((it) => { + api.Model.setVisible(it.modelId, true); + api.Model.original(it.modelId); }); } else { - this.showItem(node, event, checked); + that.models.forEach((it) => { + api.Model.setVisible(it.modelId, false); + }); + } + } else if (node.type == "model") { + if (checked) { + api.Model.setVisible(node.modelId, true); + api.Model.original(node.modelId); + } else { + api.Model.setVisible(node.modelId, false); + } + } else { + let isPartLoad = false; + if (event.checkedKeys.length == 1 && checked) { + isPartLoad = true; + } + let selFeatureIds = []; + if (node.leaf) { + selFeatureIds = [node.featureId]; + } else { + if (!node.leafs) { + let leafs = await this.getNodeLeafs(node); + node.leafs = leafs; + } + selFeatureIds = node.leafs.map((f) => f.featureId); + } + let tmps = selFeatureIds; + if (!checked) { + this.setFeatueVisible(tmps, false); + } else { + if (isPartLoad) { + api.Model.setVisible(node.modelId, true); + api.Model.original(node.modelId); + let tmpsIds2 = tmps.splice(0, 1000); + api.Feature.showFeatures(tmpsIds2.join("#")); + this.setFeatueVisible(tmps, true); + } else { + this.setFeatueVisible(tmps, true); + } } } }, - async showItem(checkNode, event, checked) { + setFeatueVisible(featureIds, show) { + let len = 1000; let api = bimRoadmApi; - api.Model.setVisible(checkNode.modelId, true); - let externalId = checkNode.externalId; - if (externalId != 0) { - if (checked) { - this.visibleList.push(externalId); - api.Feature.setVisible(this.visibleList.join("#"), true, checkNode.modelId, false); - } else { - this.visibleList = this.visibleList.filter((item) => item !== externalId); - api.Feature.setVisible(externalId, false, checkNode.modelId); - } - } else { - const res = await this.$api.bim.getTreeAllLeafChild(checkNode.modelId, checkNode.glid); - let nodes = (res.data || []).map((item) => item.glid); - if (nodes.length > 0) { - if (checked) { - this.visibleList = MergeArray(nodes, this.visibleList); - api.Model.setVisible(checkNode.modelId, true); - api.Feature.setVisible(this.visibleList.join("#"), true, checkNode.modelId, false); - } else { - this.visibleList = DelArray(this.visibleList, nodes); - api.Feature.setVisible(nodes.join("#"), false, checkNode.modelId); - } - } + let cnt = featureIds.length; + for (let i = 0; i < cnt; i += len) { + api.Feature.setVisible(featureIds.slice(i, i + len).join("#"), show); } }, + async getNodeLeafs(node) { + const res = await this.$api.bim.getTreeAllLeafChild(node.modelId, node.glid); + return (res.data || []).map((f) => { + return this.convertFeatureInfo(f, node.modelId); + }); + }, arrowRetract() { if (this.leftShow == true) { @@ -352,9 +438,14 @@ export default { this.$modal.error("暂无模型,请先关联模型"); } else { this.models.forEach((item) => { + item.modelId = item.lightweightName; + item.gis = JSON.parse(item.gisJson); this.addModel(item.lightweightName); - this.loadModelTree(); + setTimeout(() => { + this.$refs.tree.setChecked(item.lightweightName, true, true); + }, 3000); }); + this.treeKey++; } }); this.init(); diff --git a/yanzhu-bigscreen/src/views/projectDetail.vue b/yanzhu-bigscreen/src/views/projectDetail.vue index fcc224b9..3b43551b 100644 --- a/yanzhu-bigscreen/src/views/projectDetail.vue +++ b/yanzhu-bigscreen/src/views/projectDetail.vue @@ -414,6 +414,7 @@ {{ weathers[2].highTemp }} ~ {{ weathers[2].lowTemp }} +
@@ -422,10 +423,10 @@
-
当前气压
+
当前噪音
- {{ weatherInfo.pressure }} - hPa + 67.2 + dB
diff --git a/yanzhu-ui-vue3/src/views/bim/bimSetting/ModelFloorTree.vue b/yanzhu-ui-vue3/src/views/bim/bimSetting/ModelFloorTree.vue index 61e348cd..0e956c59 100644 --- a/yanzhu-ui-vue3/src/views/bim/bimSetting/ModelFloorTree.vue +++ b/yanzhu-ui-vue3/src/views/bim/bimSetting/ModelFloorTree.vue @@ -29,16 +29,7 @@ -->
- +
@@ -124,6 +115,7 @@ export default { externalId: e.externalId, modelId: a.modelId, type: "data", + featureId: a.modelId + "^" + e.externalId, children: [], hasLoad: false, isLeaf: e.externalId != 0, @@ -144,11 +136,11 @@ export default { console.log("加载模型成功"); cb && cb(); this.$emit("change"); - setTimeout(()=>{ - api.Camera.getViewPort(p=>{ - this.$emit("modelAdd",p); + setTimeout(() => { + api.Camera.getViewPort((p) => { + this.$emit("modelAdd", p); }); - },1000); + }, 1000); } ); }, @@ -214,13 +206,63 @@ export default { if (api.m_model.size == 0) { let modelId = checkNode.modelId; this.addModel(modelId, () => { - this.showItem(e); + this.showItem(e, heckedKeys); }); } else { - this.showItem(e); + this.showItem(e, heckedKeys); } }, - async showItem(e) { + async showItem(e, checkedKeys) { + const node = e.node.dataRef; + const checked = e.checked; + let isPartLoad = false; + if (checkedKeys.length == 1 && checked) { + isPartLoad = true; + } + let selFeatureIds = []; + if (node.isLeaf) { + selFeatureIds.push(node.featureId); + } else { + if (!node.leafs) { + let leafs = await this.getNodeLeafs(node); + node.leafs = leafs; + } + selFeatureIds = node.leafs.map((f) => f.featureId); + } + let tmps = selFeatureIds; + if (!checked) { + this.setFeatueVisible(tmps, false); + } else { + if (isPartLoad) { + api.Model.setVisible(node.modelId, true); + api.Model.original(node.modelId); + let tmpsIds2 = tmps.splice(0, 1000); + api.Feature.showFeatures(tmpsIds2.join("#")); + this.setFeatueVisible(tmps, true); + } else { + this.setFeatueVisible(tmps, true); + } + } + }, + setFeatueVisible(featureIds, show) { + let len = 1000; + let cnt = featureIds.length; + for (let i = 0; i < cnt; i += len) { + api.Feature.setVisible(featureIds.slice(i, i + len).join("#"), show); + } + }, + async getNodeLeafs(node) { + const res = await getTreeAllLeafChild(node.modelId, node.glid); + return (res.data || []).map((o) => { + o.modelId = node.modelId; + o.featureId = o.modelId + "^" + o.externalId; + o.name = o.name || ""; + o.name = o.name.replaceAll('"', "").replaceAll("'", "").replaceAll("\\", ""); + o.info = `[${o.externalId}]${o.groupname}-${o.name}`; + return o; + }); + }, + async showItem2(e) { const checkNode = e.node.dataRef; const checked = e.checked; api.Model.setVisible(checkNode.modelId, true); @@ -229,36 +271,21 @@ export default { if (externalId != 0) { if (checked) { this.visibleList.push(externalId); - api.Feature.setVisible( - this.visibleList.join("#"), - true, - checkNode.modelId, - false - ); + api.Feature.setVisible(this.visibleList.join("#"), true, checkNode.modelId, false); } else { - this.visibleList = this.visibleList.filter( - (item) => item !== externalId - ); + this.visibleList = this.visibleList.filter((item) => item !== externalId); api.Feature.setVisible(externalId, false, checkNode.modelId); } } else { e.node.disableCheckbox = true; - const res = await getTreeAllLeafChild( - checkNode.modelId, - checkNode.glid - ); + const res = await getTreeAllLeafChild(checkNode.modelId, checkNode.glid); let nodes = (res.data || []).map((d) => d.glid); if (nodes.length > 0) { if (checked) { this.visibleList = this.MergeArray(nodes, this.visibleList); api.Model.setVisible(checkNode.modelId, true); this.$emit("change"); - api.Feature.setVisible( - this.visibleList.join("#"), - true, - checkNode.modelId, - false - ); + api.Feature.setVisible(this.visibleList.join("#"), true, checkNode.modelId, false); } else { this.visibleList = this.DelArray(this.visibleList, nodes); api.Feature.setVisible(nodes.join("#"), false, checkNode.modelId); diff --git a/yanzhu-ui-vue3/src/views/manage/plan/bimSelectTools2.js b/yanzhu-ui-vue3/src/views/manage/plan/bimSelectTools2.js index 83b25388..a369f6c0 100644 --- a/yanzhu-ui-vue3/src/views/manage/plan/bimSelectTools2.js +++ b/yanzhu-ui-vue3/src/views/manage/plan/bimSelectTools2.js @@ -1,5 +1,5 @@ import { modelTreeAllChild } from "@/api/bim/bim"; -import { getModelTree, getTreeAllLeafChild, getModelFeatureInfo,getModelFeatureInfos } from "@/api/bim/bimModel"; +import { getModelTree, getTreeAllLeafChild, getModelFeatureInfo, getModelFeatureInfos } from "@/api/bim/bimModel"; import { MergeArray, DelArray } from "@/utils/index"; import { ElMessage } from "element-plus"; function selectFeature(that, featureId) { @@ -21,8 +21,6 @@ function selectFeature(that, featureId) { } } - - function getHideFeatures(that) { let result = []; that.readlyParts.forEach((d) => { @@ -78,10 +76,10 @@ async function getServerFeatureInfo(that, featureId) { let modelId = tmps[0]; let externalId = tmps[1]; let res = await getModelFeatureInfo(modelId, externalId); - convertServerDataToFeatureInfo(that,res,modelId); + convertServerDataToFeatureInfo(that, res, modelId); } -function convertServerDataToFeatureInfo(that,res,modelId) { +function convertServerDataToFeatureInfo(that, res, modelId) { (res.data || []).forEach((o) => { o = convertFeatureInfo(o, modelId); if (o.externalId != "0") { @@ -96,8 +94,8 @@ function convertServerDataToFeatureInfo(that,res,modelId) { }); } -async function getServerFeatureInfos(that,ids){ - if(ids.length==0){ +async function getServerFeatureInfos(that, ids) { + if (ids.length == 0) { return; } let tmps = ids[0].split("^"); @@ -105,9 +103,9 @@ async function getServerFeatureInfos(that,ids){ return; } let modelId = tmps[0]; - let externalIds=ids.map((it) => it.split("^")[1]); - let res=await getModelFeatureInfos(modelId,externalIds); - convertServerDataToFeatureInfo(that,res,modelId); + let externalIds = ids.map((it) => it.split("^")[1]); + let res = await getModelFeatureInfos(modelId, externalIds); + convertServerDataToFeatureInfo(that, res, modelId); } function clearAllSelection(that) { @@ -135,8 +133,8 @@ function initBim(that) { tmps.forEach((it) => { it.bim.forEach((it) => { if (that.readlyParts.filter((f) => f.featureId == it.featureId).length == 0) { - that.readlyParts.push(it.featureId); - } + that.readlyParts.push(it.featureId); + } }); }); } @@ -195,7 +193,7 @@ function partLoadModel(that) { }, 3000); loadModels(that); - initBim(that); + initBim(that); let func = () => { if (that.loadedModelCount == that.models.length) { setTimeout(() => { @@ -232,7 +230,6 @@ function getModelFeatures(that, modelId) { that.allFeatures.push(o); }); - console.log("====>", that.allFeatures); }); } @@ -263,11 +260,12 @@ function onCheckTree(that, node, event) { setTreeNodeChecked(that, node, event); } } + +let maxLen=1000; //根据选择控制构件的隐藏和显示 async function setTreeNodeChecked(that, node, event) { let api = bimSelectionDlgApi; let checked = event.checkedNodes.includes(node); - console.log("===>", checked, node); if (node.type == "root") { if (checked) { that.models.forEach((it) => { @@ -287,8 +285,10 @@ async function setTreeNodeChecked(that, node, event) { api.Model.setVisible(node.modelId, false); } } else { - api.Model.original(node.modelId); - console.log("---->", node); + let isPartLoad = false; + if (event.checkedKeys.length == 1 && checked) { + isPartLoad = true; + } let selFeatureIds = []; if (node.leaf) { selFeatureIds = [node.featureId]; @@ -299,15 +299,41 @@ async function setTreeNodeChecked(that, node, event) { } selFeatureIds = node.leafs.map((f) => f.featureId); } - if (checked) { - that.hideFeatures = DelArray(that.hideFeatures, selFeatureIds); + let selitemsFeatureIds = that.selectItems.map((it) => it.featureId); + let tmps = selFeatureIds + .filter((it) => !that.hideFeatures.includes(it)) + .filter((it) => !that.readlyParts.includes(it)) + .filter((it) => !selitemsFeatureIds.includes(it)); + if (!checked) { + setFeatueVisible(tmps,false); } else { - that.hideFeatures = MergeArray(that.hideFeatures, selFeatureIds); + if (isPartLoad) { + api.Model.setVisible(node.modelId, true); + api.Model.original(node.modelId); + selitemsFeatureIds.forEach((it) => { + tmps.push(it); + }); + let tmpsIds2=tmps.splice(0,maxLen); + api.Feature.showFeatures(tmpsIds2.join("#")); + setFeatueVisible(tmps,true) + } else { + setFeatueVisible(tmps,true); + } } } setFeatueShowOrHide(that); } +function setFeatueVisible(featureIds,show){ + let len=maxLen; + let api = bimSelectionDlgApi; + let cnt=featureIds.length; + for(let i=0;i { @@ -321,7 +347,7 @@ async function getNodeLeafs(that, node) { featureId: o.featureId, info: o.info, }); - return f; + return o; }); } @@ -334,7 +360,7 @@ function setFeatueShowOrHide(that) { //标注已选择的构件 that.selectItems.forEach((it) => { - api.Feature.setColor(it, "rgba(255,0,255,1)"); + api.Feature.setColor(it.featureId, "rgba(255,0,255,1)"); if (!that.showMode) { api.Feature.setVisible(it, false); } @@ -363,14 +389,14 @@ function loadModels(that) { function boxSelection(that) { let api = bimSelectionDlgApi; api.Feature.getByEvent(false); - ElMessage.info("右键取消选择") + ElMessage.info("右键取消选择"); api.Public.event("RIGHT_CLICK", (res) => { api.Feature.closeBoxSelect(); - that.activeMenu=-1; + that.activeMenu = -1; }); api.Feature.boxSelect(async (data) => { - await getServerFeatureInfos(that, data); - data.forEach( (featureId) => { + await getServerFeatureInfos(that, data); + data.forEach((featureId) => { selectFeature(that, featureId); }); }); @@ -380,7 +406,7 @@ function hideSelection(that) { let api = bimSelectionDlgApi; api.Public.clearHandler(); api.Feature.getByEvent(false); - api.Feature.getByEvent(true,async (n) => { + api.Feature.getByEvent(true, async (n) => { if (n && n["id"]) { let featureId = n.id; await getServerFeatureInfo(that, featureId); @@ -395,7 +421,6 @@ function loadNode(that, node, resolve) { if (!that.show) { return; } - console.log("node->", node); if (node.level == 0) { let nd = [ { @@ -459,7 +484,7 @@ function getTreeChildren(that, node, resolve) { } } - return it; + return o; }); //addToAllFeatures(that, tmps); resolve(tmps); diff --git a/yanzhu-ui-vue3/src/views/manage/plan/bimSelectionDialog2.vue b/yanzhu-ui-vue3/src/views/manage/plan/bimSelectionDialog2.vue index a3fef244..a3a5cb69 100644 --- a/yanzhu-ui-vue3/src/views/manage/plan/bimSelectionDialog2.vue +++ b/yanzhu-ui-vue3/src/views/manage/plan/bimSelectionDialog2.vue @@ -100,7 +100,7 @@ import useUserStore from "@/store/modules/user"; import { listBimModel } from "@/api/bim/bimModel"; import bimTools from "./bimSelectTools2"; import { updateBimInfo, getPlanAllBimInfo } from "@/api/bim/bim"; -import { ElMessage, ElMessageBox } from "element-plus"; +import { ElMessage, ElMessageBox, ElStep } from "element-plus"; export default { data() { return { @@ -131,8 +131,8 @@ export default { allFeatures: [], //所有构件集合 allParts: [], //所有构件ID集合 showParts: [], //显示构件ID集合 - hideParts:[], //隐藏构件ID集合(通过工具栏选中的) - hideFeatures:[],//隐藏构件集合(通过树型控制隐藏的) + hideParts: [], //隐藏构件ID集合(通过工具栏选中的) + hideFeatures: [], //隐藏构件集合(通过树型控制隐藏的) readlyParts: [], //隐藏构件ID集合(其他的计划已选中的构件) }; }, @@ -165,7 +165,7 @@ export default { }, doModeChange() { let api = bimSelectionDlgApi; - api.Feature.setVisible(this.selectItems.map(f=>f.featureId).join("#"), this.showMode); + api.Feature.setVisible(this.selectItems.map((f) => f.featureId).join("#"), this.showMode); }, delSelectItem(idx) { this.$modal.confirm("确定删除吗?").then(() => { @@ -329,6 +329,7 @@ export default { }).then((d) => { this.models = (d.rows || []).map((it) => { it.modelId = it.lightweightName; + it.checked = true; it.gis = this.$tryToJson(it.gisJson || "{}", {}); return it; }); @@ -367,7 +368,7 @@ export default { let api = bimSelectionDlgApi; api.Camera.stopImmersiveRoam(); api.Model.location(api.m_model.keys().toArray()[0]); - api.Feature.getByEvent(false); + api.Feature.getByEvent(false); api.Plugin.deleteMiniMap(); if (this.viewPoint) { api.Camera.setViewPort(this.viewPoint); diff --git a/yanzhu-ui-vue3/src/views/manage/plan/index.vue b/yanzhu-ui-vue3/src/views/manage/plan/index.vue index 1c33f716..78746911 100644 --- a/yanzhu-ui-vue3/src/views/manage/plan/index.vue +++ b/yanzhu-ui-vue3/src/views/manage/plan/index.vue @@ -69,7 +69,7 @@ - " +