From f9ade243f991a3b442d64cea7647120ba86147c3 Mon Sep 17 00:00:00 2001 From: "lj7788@126.com" Date: Sat, 5 Jul 2025 10:14:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=914D=E6=A8=A1=E6=8B=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../public/css/largeScreenStyle.css | 2 + yanzhu-bigscreen/src/views/bim/bim4DTools.js | 308 ++++++++++++++++++ .../src/views/bim4DSimulation.vue | 299 ++++++++++------- .../quality/dialog/qualityCheckDialog.vue | 2 +- .../src/views/quality/qualityCheck.vue | 2 +- .../views/safety/dialog/safetyCheckDialog.vue | 2 +- .../src/views/bim/sandTableSetting/index.vue | 5 +- 7 files changed, 492 insertions(+), 128 deletions(-) create mode 100644 yanzhu-bigscreen/src/views/bim/bim4DTools.js diff --git a/yanzhu-bigscreen/public/css/largeScreenStyle.css b/yanzhu-bigscreen/public/css/largeScreenStyle.css index 2cf9ab5e..233ffc5d 100644 --- a/yanzhu-bigscreen/public/css/largeScreenStyle.css +++ b/yanzhu-bigscreen/public/css/largeScreenStyle.css @@ -50,6 +50,7 @@ body { #app { width: 1912px; height: 1080px; + overflow: hidden; } .screen-content-max { width: 1912px; @@ -89,6 +90,7 @@ body { #app { width: 2550px; height: 1440px; + overflow: hidden; } .screen-content-max { width: 2550px; diff --git a/yanzhu-bigscreen/src/views/bim/bim4DTools.js b/yanzhu-bigscreen/src/views/bim/bim4DTools.js new file mode 100644 index 00000000..83cd0ded --- /dev/null +++ b/yanzhu-bigscreen/src/views/bim/bim4DTools.js @@ -0,0 +1,308 @@ +const options = { + taskMapping: { + progress: "percent", + }, + maxRows: 10, + title: { + label: "任务列表", + html: false, + }, + row: { + height: 24, + }, + times: { + timeZoom: 20, + }, + calendar: { + workingDays: [1, 2, 3, 4, 5, 6], + gap: 0, + strokeWidth: 5, + hour: { + display: !1, + }, + }, + chart: { + progress: { + bar: false, + }, + expander: { + display: true, + }, + }, + taskList: { + expander: { + straight: false, + }, + columns: [ + { + id: 1, + label: "ID", + value: "id", + width: 40, + }, + { + id: 2, + label: "任务名称", + value: "label", + width: 200, + expander: true, + html: true, + }, + { + id: 3, + label: "任务工期", + value: "days", + width: 120, + }, + { + id: 4, + label: "开始时间", + value: "start", + width: 120, + }, + + { + id: 5, + label: "结束时间", + value: "end", + width: 120, + }, + ], + }, + locale: { + name: "en", + Now: "当前时间", + "X-Scale": "缩放宽度", + "Y-Scale": "缩放高度", + "Task list width": "列头宽度", + "Before/After": "时间跨度", + "Display task list": "显示列头", + weekdays: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"], + months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], + }, +}; +const ganttStyle = { + "main-view": { + background: "#06445b81", + "border-top": "1px solid var(--plan-color)", + }, + "main-container-wrapper": { + overflow: "hidden", + "border-top": "1px solid var(--plan-color);", + "border-bottom": "1px solid var(--plan-color);", + }, + "calendar-row-rect-child": { + "border-right-color": "var(--plan-color)", + }, + "task-list": { "border-color": "var(--plan-color)" }, + "task-list-header": { + "border-bottom": "1px solid var(--plan-color)", + "border-left": "1px solid var(--plan-color)", + }, + "task-list-item": { + "border-top": "1px solid var(--plan-color)", + "border-right": "1px solid var(--plan-color)", + }, + "task-list-item-column": { + "border-left": "1px solid var(--plan-color)", + "border-color": "var(--plan-color)", + }, + "grid-line-time": { + stroke: "#FF000080", + "stroke-width": 5, + }, + "chart-calendar-container": { + "border-right": "1px solid var(--plan-color)", + }, + "chart-graph-container": { + "border-right": "1px solid var(--plan-color)", + }, + "task-list-header-column": { + "border-left": "1px solid var(--plan-color)", + "box-sizing": "border-box", + display: "flex", + background: "#f3f5f7", + "border-color": "transparent", + }, + calendar: { + background: "transparent", + }, + "chart-row-text": { + background: "transparent", + "border-radius": "0px", + color: "#fff", + }, + "task-list-expander-border": { + fill: "#00f1ff", + stroke: "#003357", + }, + "chart-expander-border": { + fill: "#00f1ff", + stroke: "#000000A0", + }, +}; + +function initEngine(that) { + console.log("开始初始化引擎") + window.bim4DApi = new SAPI( + { + serverIP: window.config.serverIP, //服务ip地址 + port: window.config.port, //HTTP端口 + useHttps: window.config.useHttps, //使用Https + container: "bim4DContainer", //[必须]容器id + secretKey: window.config.secretKey, + openEarth: window.config.openEarth, //[可选]开启Gis场景 + bgColor: window.config.bgColor, //[可选]bim场景背景色, 传值即为纯色天空盒 + tintColor: window.config.tintColor, //[可选]osgb单体化颜色 + sceneTime: window.config.sceneTime, //[可选]分别为当前时间、日出时间、日落时间 + cadMode: window.config.cadMode, // 是否是Cad图纸预览模式 + }, + () => { + that.initSuccess = true; + console.log("初始化成功"); + setTimeout(() => { + initLoadModel(that); + }, 10); + let mapOptions = { + imgs: { + // 六面图片 + top: "/cdn/bim/sapi/img/top.png", + bottom: "/cdn/bim/sapi/img/under.png", + east: "/cdn/bim/sapi/img/east.png", + south: "/cdn/bim/sapi/img/south.png", + west: "/cdn/bim/sapi/img/west.png", + north: "/cdn/bim/sapi/img/north.png", + }, + offset: { + // 屏幕坐标偏移 + corner: GLENavigationCube.RightTop, + x: 25, + y: 20, + }, + cube: { + hoverColor: "#7193dc", // 立方导航快鼠标移过显示颜色 + size: 32, // 导航立方尺寸 + hotPointSize: 7, // 导航立方棱角热点区域尺寸 + cubeTextColor: "#4c4c4ccc", // cube 各个面文字颜色 + cubeStrokeColor: "#374769cc", // cube 各个面边框颜色 + cubeFillColor: "#374769cc", // cube 各个面填充颜色 + }, + zoomRatios: 1, // 缩放倍率 + show: true, // 是否显示 + showAxes: true, // 是否显示XYZ轴线 + }; + bim4DApi.Plugin.initNavCube(mapOptions); + } + ); +} + +function initLoadModel(that) { + that.$api.bim + .listBimModel({ + pageNum: 1, + pageSize: 100, + comId: that.selProject.comId, + projectId: that.selProject.id, + }) + .then((d) => { + that.models = (d.rows || []).map((it) => { + it.modelId = it.lightweightName; + it.visible = false; + it.checked = true; + it.gis = that.$tryToJson(it.gisJson || "{}", {}); + return it; + }); + if (that.models.length == 0) { + that.$modal.error("暂无模型,请先关联模型"); + } else { + that.models.forEach((item) => { + item.modelId = item.lightweightName; + item.gis = JSON.parse(item.gisJson); + addModel(that, item.lightweightName); + }); + } + }); +} + +function addModel(that, modelId, cb) { + let api = window.bim4DApi; + let url = `${window.config.modelUrl}/Tools/output/model/${modelId}/root.glt`; + console.log(modelId, url); + api.Model.add( + url, + modelId, + () => {}, + () => { + cb && cb(); + console.log("加载模型成功"); + setTimeout(() => { + bim4DApi.Camera.getViewPort((p) => { + that.viewPoint = p; + that.modelLoaded = true; + }); + }, 1000); + } + ); +} + +const maxLen = 500; +function showBim(that, index) { + let api = bim4DApi; + if (index <= 0) { + index = getCurrentTaskIndex(that); + } + console.log(index); + let showFeatureIds = []; + let currFeatureId = []; + for (let i = 0; i <= that.taskList.length; i++) { + if (i <= index) { + that.taskList[i].gis.forEach((item) => { + let featureId = item.featureId; + if (!showFeatureIds.includes(featureId)) { + showFeatureIds.push(featureId); + } + }); + } + } + if (showFeatureIds.length > 0) { + let featureId = showFeatureIds[0]; + let modelId = featureId.split("_")[0]; + let tmpsIds2 = showFeatureIds.splice(0, maxLen); + api.Model.original(modelId); + api.Feature.showFeatures(tmpsIds2.join("#")); + setFeatueVisible(showFeatureIds, true); + } +} + +function setFeatueVisible(featureIds, show) { + let len = maxLen; + let api = bim4DApi; + let cnt = featureIds.length; + if (cnt == 0) { + return; + } + for (let i = 0; i < cnt; i += len) { + api.Feature.setVisible(featureIds.slice(i, i + len).join("#"), show); + } +} + +function getCurrentTaskIndex(that) { + let index = 0; + let taskList = that.taskList; + for (let i = 0; i < taskList.length; i++) { + let task = taskList[i]; + if (task.children.length == 0 && that.$dt(task.start) - new Date() >= 0) { + index = i; + break; + } + } + return index; +} + +export default { + options, + ganttStyle, + initEngine, + initLoadModel, + showBim, +}; diff --git a/yanzhu-bigscreen/src/views/bim4DSimulation.vue b/yanzhu-bigscreen/src/views/bim4DSimulation.vue index b4376cb5..ed47f018 100644 --- a/yanzhu-bigscreen/src/views/bim4DSimulation.vue +++ b/yanzhu-bigscreen/src/views/bim4DSimulation.vue @@ -1,7 +1,38 @@