diff --git a/yanzhu-ui-vue3/src/views/manage/plan/bimSelectTools2.js b/yanzhu-ui-vue3/src/views/manage/plan/bimSelectTools2.js
new file mode 100644
index 00000000..7691c90a
--- /dev/null
+++ b/yanzhu-ui-vue3/src/views/manage/plan/bimSelectTools2.js
@@ -0,0 +1,416 @@
+import { modelTreeAllChild } from "@/api/bim/bim";
+import { getModelTree, getTreeAllLeafChild } from "@/api/bim/bimModel";
+function selectFeature(that, featureId) {
+ let api = bimSelectionDlgApi;
+ if (that.selectItems.includes(featureId)) {
+ api.Feature.setColor(featureId, "rgba(255,255,255,1)");
+ let index = that.selectItems.indexOf(featureId);
+ if (index > -1) {
+ that.selectItems.splice(index, 1);
+ }
+ } else {
+ api.Feature.setColor(featureId, "rgba(255,0,255,1)");
+ if (!that.showMode) {
+ api.Feature.setVisible(featureId, false);
+ }
+ that.selectItems.push(featureId);
+ }
+}
+
+function hideFeatures(that) {
+ let tmps = that.allBimData.filter((it) => it.id != that.plan.id);
+ tmps.forEach((it) => {
+ it.bim.forEach((it) => {
+ hideFeature(that, it);
+ });
+ });
+}
+
+function getHideFeatures(that, checkedKeys) {
+ let result = [];
+ let tmps = that.allBimData.filter((it) => it.id != that.plan.id);
+ tmps.forEach((it) => {
+ it.bim.forEach((it) => {
+ result.push(it);
+ });
+ });
+ if (checkedKeys.length > 0) {
+ tmps = that.allFeatures
+ .filter((d) => !checkedKeys.includes(d.glid))
+ .filter((d) => d != "0")
+ .map((d) => d.featureId);
+ tmps.forEach((d) => {
+ result.push(d);
+ });
+ }
+ return result;
+}
+
+function hideFeature(that, featureId) {
+ let api = bimSelectionDlgApi;
+ api.Feature.setVisible(featureId, false);
+}
+
+function selectSingle(that) {
+ let api = bimSelectionDlgApi;
+ api.Public.clearHandler();
+ api.Feature.getByEvent(true, (n) => {
+ if (n && n["id"]) {
+ let featureId = n.id;
+ let modelId = featureId.split("^")[0];
+ selectFeature(that, featureId);
+ }
+ });
+}
+
+function clearAllSelection(that) {
+ that.$modal.confirm("确定清除所有已选择构件吗?").then(() => {
+ let api = bimSelectionDlgApi;
+ that.selectItems.forEach((d) => {
+ api.Feature.setColor(d, "rgba(255,255,255,1)");
+ });
+ that.selectItems = [];
+ this.selEl++;
+ });
+}
+
+function initBim(that) {
+ let tmps = that.allBimData.filter((it) => it.id == that.plan.id);
+ if (tmps.length > 0) {
+ tmps[0].bim.forEach((it) => {
+ selectFeature(that, it);
+ });
+ }
+}
+
+function getSelectFeatureIds(that) {
+ let tmps = that.allBimData.filter((it) => it.id == that.plan.id);
+ if (tmps.length > 0) {
+ return tmps[0].bim || [];
+ }
+ return [];
+}
+
+// 加载部分模型(计划中绑定的模型)
+function partLoadModel(that) {
+ let featureIds = getSelectFeatureIds(that);
+ let api = bimSelectionDlgApi;
+ let obj = {};
+ for (let i = 0; i < featureIds.length; i++) {
+ let it = featureIds[i];
+ let tmps = it.split("^");
+ let modelId = tmps[0];
+ if (!obj[modelId]) {
+ obj[modelId] = [];
+ }
+ obj[modelId].push(it);
+ }
+ for (let modelId in obj) {
+ let tmps = that.models.filter((it) => it.modelId == modelId);
+ setTimeout(() => {
+ that.$refs.tree.setChecked(modelId, true, true);
+ }, 1000);
+ if (tmps.length > 0) {
+ let url = `${window.config.modelUrl}/Tools/output/model/${modelId}/root.glt`;
+ that.partLoad = true;
+ api.Model.addPart(
+ url,
+ modelId,
+ obj[modelId].join("#"),
+ (res) => {},
+ (res) => {
+ that.viewPoint = p;
+ that.$message.info("模型加载完成");
+ that.bimLoaded = true;
+ that.doMenu(2);
+ initBim(that);
+ },
+ {
+ FlyTo: true,
+ }
+ );
+ }
+ }
+ if (featureIds.length == 0) {
+ setTimeout(() => {
+ that.$refs.tree.setChecked("root", true, true);
+ }, 1000);
+
+ loadModels(that);
+ let func = () => {
+ if (that.loadedModelCount == that.models.length) {
+ setTimeout(() => {
+ setFeatueShowOrHide(that, []);
+ }, 1000);
+ } else {
+ setTimeout(func, 100);
+ }
+ };
+ func();
+ }
+}
+
+//构建树形数据
+function buildTreeData(that) {
+ that.modelTrees = [
+ {
+ title: "项目模型",
+ level: 0,
+ type: "root",
+ key: "root",
+ children: [],
+ hadLoad: true,
+ },
+ ];
+ that.models.forEach((d) => {
+ let node = {
+ title: d.modelName,
+ level: 1,
+ type: "model",
+ hasLoad: false,
+ modelId: d.lightweightName,
+ key: d.lightweightName,
+ externalId: "0",
+ glid: "",
+ children: [],
+ data: d,
+ };
+ that.modelTrees[0].children.push(node);
+ getModelFeatures(that, d.lightweightName, node);
+ });
+ that.treeExpendedKeys.push("root");
+ that.$message.info("模型构件信息加载完成");
+}
+
+//获取模型所有构件
+function getModelFeatures(that, modelId, node) {
+ let tmps = that.allBimData.filter((it) => it.id != that.plan.id);
+ tmps.forEach((it) => {
+ it.bim.forEach((it) => {
+ if (!that.readlyParts.includes(it)) {
+ that.readlyParts.push(it);
+ }
+ });
+ });
+ //获取模型构件
+ modelTreeAllChild(modelId, "").then((res) => {
+ let objs = res.data || [];
+
+ objs.forEach((o) => {
+ 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}`;
+ if (o.externalId == "0") {
+ return;
+ }
+ let featureId = o.modelId + "^" + o.externalId;
+ if (!that.allParts.includes(featureId)) {
+ that.allParts.push(featureId);
+ }
+ });
+ that.allFeatures = objs;
+ let makeTree = (tmps) => {
+ tmps.forEach((item) => {
+ item.children = objs.filter((it) => it.pglid == item.glid);
+ if (item.children.length > 0) {
+ makeTree(item.children);
+ }
+ item.hasLoad = true;
+ item.title = item.name;
+ item.key = item.glid;
+ item.modelId = node.modelId;
+ });
+ return tmps;
+ };
+
+ node.children = makeTree(objs.filter((item) => item.level == 0));
+ that.treeKey++;
+ });
+ that.showParts = that.allParts.filter((it) => !that.hideParts.includes(it));
+}
+
+//树上点击事件
+function onCheckTree(that, node, event) {
+ let api = bimSelectionDlgApi;
+
+ if (that.partLoad) {
+ that.$refs.tree.setChecked("root", false, true);
+ that.partLoad = false;
+ that.models.forEach((it) => {
+ api.Model.remove(it.modelId);
+ });
+ return;
+ }
+ if (loadModels(that) > 0) {
+ let func = () => {
+ if (that.loadedModelCount == that.models.length) {
+ setTimeout(() => {
+ setTreeNodeChecked(that, node, event);
+ }, 1000);
+ } else {
+ setTimeout(func, 100);
+ }
+ };
+ func();
+ } else {
+ setTreeNodeChecked(that, node, event);
+ }
+}
+//根据选择控制构件的隐藏和显示
+function setTreeNodeChecked(that, node, event) {
+ let api = bimSelectionDlgApi;
+ let checked = event.checkedNodes.includes(node);
+ if (node.type == "root") {
+ if (checked) {
+ that.models.forEach((it) => {
+ api.Model.setVisible(it.modelId, true);
+ api.Model.original(it.modelId);
+ });
+ } else {
+ 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 {
+ api.Model.original(node.modelId);
+ }
+ setFeatueShowOrHide(that, event.checkedKeys);
+}
+
+//处理构件的隐藏和显示
+function setFeatueShowOrHide(that, checkedKeys) {
+ let api = bimSelectionDlgApi;
+ //隐藏构件
+ let hideFeatures = getHideFeatures(that, checkedKeys);
+ api.Feature.setVisible(hideFeatures.join("#"), false);
+
+ //标注已选择的构件
+ that.selectItems.forEach((it) => {
+ api.Feature.setColor(it, "rgba(255,0,255,1)");
+ if (!that.showMode) {
+ api.Feature.setVisible(it, false);
+ }
+ });
+
+ api.Feature.setVisible(that.hideParts.join("#"), false);
+}
+
+//加载模型
+function loadModels(that) {
+ let api = bimSelectionDlgApi;
+ let modelIds = that.models.map((it) => it.lightweightName);
+ let cnt = 0;
+ that.loadedModelCount = 0;
+ modelIds.forEach((modelId) => {
+ if (!api.m_model.has(modelId)) {
+ cnt++;
+ that.addModel(modelId);
+ return;
+ }
+ });
+ return cnt;
+}
+
+//框选构件
+function boxSelection(that) {
+ let api = bimSelectionDlgApi;
+ api.Feature.boxSelect((data) => {
+ data.forEach((featureId) => {
+ selectFeature(that, featureId);
+ });
+ });
+}
+//隐藏构件选择
+function hideSelection(that) {
+ let api = bimSelectionDlgApi;
+ api.Public.clearHandler();
+ api.Feature.getByEvent(true, (n) => {
+ if (n && n["id"]) {
+ let featureId = n.id;
+ that.hideParts.push(featureId);
+ api.Feature.setVisible(featureId, false);
+ that.hideEl++;
+ }
+ });
+}
+//异步加载树
+function loadNode(that, node, resolve) {
+ if (!that.show) {
+ return;
+ }
+ console.log("node->", node);
+ if (node.level == 0) {
+ let nd = [
+ {
+ title: "项目模型",
+ level: 0,
+ type: "root",
+ key: "root",
+ children: [],
+ hadLoad: true,
+ },
+ ];
+
+ resolve(nd);
+ setTimeout(() => {
+ document.querySelectorAll(".bim-selection-dialog .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 {
+ getTreeChildren(that, node, resolve);
+ }
+}
+
+function getTreeChildren(that, node, resolve) {
+ let data = node.data;
+ 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;
+ return it;
+ });
+ resolve(tmps);
+ });
+}
+export default {
+ selectSingle,
+ initBim,
+ clearAllSelection,
+ partLoadModel,
+ buildTreeData,
+ onCheckTree,
+ boxSelection,
+ hideSelection,
+ loadNode,
+};
diff --git a/yanzhu-ui-vue3/src/views/manage/plan/bimSelectionDialog2.vue b/yanzhu-ui-vue3/src/views/manage/plan/bimSelectionDialog2.vue
new file mode 100644
index 00000000..7a9831a5
--- /dev/null
+++ b/yanzhu-ui-vue3/src/views/manage/plan/bimSelectionDialog2.vue
@@ -0,0 +1,548 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除所有
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yanzhu-ui-vue3/src/views/manage/plan/index.vue b/yanzhu-ui-vue3/src/views/manage/plan/index.vue
index ac505cd0..1c33f716 100644
--- a/yanzhu-ui-vue3/src/views/manage/plan/index.vue
+++ b/yanzhu-ui-vue3/src/views/manage/plan/index.vue
@@ -78,7 +78,7 @@ import { getToken } from "@/utils/auth";
import { listPlan, getPlan, delPlan, addPlan, updatePlan } from "@/api/manage/plan";
import useUserStore from "@/store/modules/user";
import { findMyProjectList } from "@/api/publics";
-import bimSelectionDialog from "./bimSelectionDialog.vue";
+import bimSelectionDialog from "./bimSelectionDialog2.vue";
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
const planList = ref([]);