进度计划和BIM绑定
parent
e34ff19559
commit
d334651bd7
|
@ -92,4 +92,25 @@ export function updateBimInfo(data) {
|
||||||
method: "post",
|
method: "post",
|
||||||
data: data,
|
data: data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getPlanBimInfo(id){
|
||||||
|
return request({
|
||||||
|
url: `/manage/api/bim/plan/getBimInfo?id=${id}`,
|
||||||
|
method: "get"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPlanAllBimInfo(prjId){
|
||||||
|
return request({
|
||||||
|
url: `/manage/api/bim/plan/getAllBimInfo?projectId=${prjId}`,
|
||||||
|
method: "get"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function modelTreeAllChild (name, pid) {
|
||||||
|
return request({
|
||||||
|
url: "/manage/bim/modelInfo/modelTreeAllChild/" + name + "?pid=" + pid,
|
||||||
|
method: "get",
|
||||||
|
});
|
||||||
|
};
|
|
@ -1,3 +1,32 @@
|
||||||
|
import { modelTreeAllChild } from "@/api/bim/bim";
|
||||||
|
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)");
|
||||||
|
that.selectItems.push(featureId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function hideFeatures(that) {
|
||||||
|
let tmps = that.allBimData.filter((it) => it.id != that.plan.id);
|
||||||
|
tmps.forEach((it) => {
|
||||||
|
console.log("hide-->", it.bim);
|
||||||
|
it.bim.forEach((it) => {
|
||||||
|
hideFeature(that, it);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideFeature(that, featureId) {
|
||||||
|
let api = bimSelectionDlgApi;
|
||||||
|
api.Feature.setVisible(featureId, false);
|
||||||
|
}
|
||||||
|
|
||||||
function selectSingle(that) {
|
function selectSingle(that) {
|
||||||
let api = bimSelectionDlgApi;
|
let api = bimSelectionDlgApi;
|
||||||
api.Public.clearHandler();
|
api.Public.clearHandler();
|
||||||
|
@ -5,20 +34,164 @@ function selectSingle(that) {
|
||||||
if (n && n["id"]) {
|
if (n && n["id"]) {
|
||||||
let featureId = n.id;
|
let featureId = n.id;
|
||||||
let modelId = featureId.split("^")[0];
|
let modelId = featureId.split("^")[0];
|
||||||
if(that.selectItems.includes(featureId)){
|
selectFeature(that, 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)");
|
|
||||||
that.selectItems.push(featureId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearAllSelection(that) {
|
||||||
|
let api = bimSelectionDlgApi;
|
||||||
|
api.Public.clearHandler();
|
||||||
|
that.selectItems.forEach((it) => {
|
||||||
|
selectFeature(that, it);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function initBim(that) {
|
||||||
|
console.log("initBim");
|
||||||
|
let tmps = that.allBimData.filter((it) => it.id == that.plan.id);
|
||||||
|
if (tmps.length > 0) {
|
||||||
|
console.log("selected-->", tmps[0].bim);
|
||||||
|
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) => {
|
||||||
|
console.log("load part success", res);
|
||||||
|
that.viewPoint = p;
|
||||||
|
that.$message.info("模型加载完成");
|
||||||
|
that.doMenu(2);
|
||||||
|
initBim(that);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
FlyTo: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//构建树形数据
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取模型所有构件
|
||||||
|
function getModelFeatures(that, modelId, node) {
|
||||||
|
let tmps = that.allBimData.filter((it) => it.id != that.plan.id);
|
||||||
|
tmps.forEach((it) => {
|
||||||
|
console.log("hide-->", it.bim);
|
||||||
|
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));
|
||||||
|
}
|
||||||
export default {
|
export default {
|
||||||
selectSingle,
|
selectSingle,
|
||||||
|
initBim,
|
||||||
|
clearAllSelection,
|
||||||
|
partLoadModel,
|
||||||
|
buildTreeData,
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,11 +6,28 @@
|
||||||
<div class="div-left" :class="{ 'is-hide': !leftExpend }">
|
<div class="div-left" :class="{ 'is-hide': !leftExpend }">
|
||||||
<div class="div-left-title">
|
<div class="div-left-title">
|
||||||
<el-tabs v-model="activeTab">
|
<el-tabs v-model="activeTab">
|
||||||
<el-tab-pane label="结构树" name="a1"> </el-tab-pane>
|
<el-tab-pane label="结构树" name="a1">
|
||||||
|
<div class="model-tree scroll">
|
||||||
|
<el-tree
|
||||||
|
:key="treeKey"
|
||||||
|
ref="tree"
|
||||||
|
:default-expanded-keys="treeExpendedKeys"
|
||||||
|
:props="{
|
||||||
|
children: 'children',
|
||||||
|
label: 'title',
|
||||||
|
}"
|
||||||
|
node-key="key"
|
||||||
|
@check="onCheckTree"
|
||||||
|
:data="modelTrees"
|
||||||
|
show-checkbox></el-tree>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
<el-tab-pane label="已关联" name="a2">
|
<el-tab-pane label="已关联" name="a2">
|
||||||
<div class="sel-list scroll">
|
<div class="sel-list scroll">
|
||||||
<div v-for="(it, idx) in selectItems" :key="idx" class="div-sel-item">
|
<div v-for="(it, idx) in getSelectItems(selectItems)" :key="idx" class="div-sel-item">
|
||||||
<div>{{ it.split("^")[1] }}</div>
|
<el-tooltip placement="bottom" :content="it.info">
|
||||||
|
<div class="sel-item-info">{{ it.info }}</div>
|
||||||
|
</el-tooltip>
|
||||||
<el-button link>删除</el-button>
|
<el-button link>删除</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -63,13 +80,14 @@
|
||||||
import useUserStore from "@/store/modules/user";
|
import useUserStore from "@/store/modules/user";
|
||||||
import { listBimModel } from "@/api/bim/bimModel";
|
import { listBimModel } from "@/api/bim/bimModel";
|
||||||
import bimTools from "./bimSelectTools";
|
import bimTools from "./bimSelectTools";
|
||||||
import { updateBimInfo } from "@/api/bim/bim";
|
import { updateBimInfo, getPlanAllBimInfo } from "@/api/bim/bim";
|
||||||
import { ElMessage, ElMessageBox } from "element-plus";
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
title: "任务计划绑定BIM",
|
title: "任务计划绑定BIM",
|
||||||
show: false,
|
show: false,
|
||||||
|
partLoad: false, //部分加载构件
|
||||||
plan: null,
|
plan: null,
|
||||||
currentPrjId: null,
|
currentPrjId: null,
|
||||||
currentComId: null,
|
currentComId: null,
|
||||||
|
@ -81,6 +99,14 @@ export default {
|
||||||
activeMenu: 0,
|
activeMenu: 0,
|
||||||
elId: 0,
|
elId: 0,
|
||||||
selectItems: [],
|
selectItems: [],
|
||||||
|
allBimData: [],
|
||||||
|
treeKey: 0,
|
||||||
|
modelTrees: [],
|
||||||
|
treeExpendedKeys: [],
|
||||||
|
allFeatures: [], //所有构件集合
|
||||||
|
allParts: [], //所有构件ID集合
|
||||||
|
showParts: [], //显示构件ID集合
|
||||||
|
readlyParts: [], //隐藏构件ID集合
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
@ -92,17 +118,24 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
onCheckTree(node, event) {},
|
||||||
|
getSelectItems() {
|
||||||
|
return this.selectItems.map((it) => {
|
||||||
|
return this.allFeatures.find((item) => item.featureId == it);
|
||||||
|
});
|
||||||
|
},
|
||||||
doSave() {
|
doSave() {
|
||||||
updateBimInfo({
|
updateBimInfo({
|
||||||
id: this.plan.id,
|
id: this.plan.id,
|
||||||
text: JSON.stringify(this.selectItems),
|
text: JSON.stringify(this.selectItems),
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
if(res.success){
|
if (res.success) {
|
||||||
ElMessage.success('保存成功')
|
ElMessage.success("保存成功");
|
||||||
this.show = false;
|
this.show = false;
|
||||||
}else{
|
this.$emit("success");
|
||||||
ElMessage.error('保存失败')
|
} else {
|
||||||
|
ElMessage.error("保存失败");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -113,6 +146,7 @@ export default {
|
||||||
this.resetScene();
|
this.resetScene();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
bimTools.clearAllSelection(this);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
bimTools.selectSingle(this);
|
bimTools.selectSingle(this);
|
||||||
|
@ -124,12 +158,30 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showDialog(plan) {
|
showDialog(plan) {
|
||||||
|
window.bimDlg = this;
|
||||||
this.plan = plan;
|
this.plan = plan;
|
||||||
this.show = true;
|
this.show = true;
|
||||||
this.activeTab = "a1";
|
this.activeTab = "a1";
|
||||||
this.userStore = useUserStore();
|
this.userStore = useUserStore();
|
||||||
this.currentPrjId = this.userStore.currentPrjId;
|
this.currentPrjId = this.userStore.currentPrjId;
|
||||||
this.currentComId = this.userStore.currentComId;
|
this.currentComId = this.userStore.currentComId;
|
||||||
|
this.selectItems = [];
|
||||||
|
this.allBimData = [];
|
||||||
|
this.treeKey = 0;
|
||||||
|
this.partLoad = false;
|
||||||
|
this.modelTrees = [];
|
||||||
|
this.treeExpendedKeys = [];
|
||||||
|
this.allParts = [];
|
||||||
|
this.hideParts = [];
|
||||||
|
this.readlyParts = [];
|
||||||
|
this.allFeatures = [];
|
||||||
|
|
||||||
|
getPlanAllBimInfo(this.plan.projectId).then((res) => {
|
||||||
|
this.allBimData = (res.data || []).map((it) => {
|
||||||
|
it.bim = this.$tryToJson(it.bimId || "[]", []);
|
||||||
|
return it;
|
||||||
|
});
|
||||||
|
});
|
||||||
this.initEngine();
|
this.initEngine();
|
||||||
},
|
},
|
||||||
initEngine() {
|
initEngine() {
|
||||||
|
@ -198,13 +250,19 @@ export default {
|
||||||
comId: this.currentComId,
|
comId: this.currentComId,
|
||||||
projectId: this.currentPrjId,
|
projectId: this.currentPrjId,
|
||||||
}).then((d) => {
|
}).then((d) => {
|
||||||
this.models = d.rows || [];
|
this.models = (d.rows || []).map((it) => {
|
||||||
|
it.modelId = it.lightweightName;
|
||||||
|
it.gis = this.$tryToJson(it.gisJson || "{}", {});
|
||||||
|
return it;
|
||||||
|
});
|
||||||
if (this.models.length == 0) {
|
if (this.models.length == 0) {
|
||||||
this.$modal.msgError("暂无模型,请先关联模型");
|
this.$modal.msgError("暂无模型,请先关联模型");
|
||||||
} else {
|
} else {
|
||||||
this.models.forEach((item) => {
|
bimTools.buildTreeData(this);
|
||||||
this.addModel(item.lightweightName);
|
bimTools.partLoadModel(this);
|
||||||
});
|
// this.models.forEach((item) => {
|
||||||
|
// this.addModel(item.lightweightName);
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -222,6 +280,8 @@ export default {
|
||||||
bimSelectionDlgApi.Camera.getViewPort((p) => {
|
bimSelectionDlgApi.Camera.getViewPort((p) => {
|
||||||
this.viewPoint = p;
|
this.viewPoint = p;
|
||||||
this.$message.info("模型加载完成");
|
this.$message.info("模型加载完成");
|
||||||
|
bimTools.initBim(this);
|
||||||
|
this.doMenu(2);
|
||||||
});
|
});
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
@ -359,6 +419,13 @@ export default {
|
||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
padding: 0px 10px;
|
padding: 0px 10px;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
|
.sel-item-info {
|
||||||
|
width: calc(100% - 40px);
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
.el-button {
|
.el-button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
|
@ -367,6 +434,31 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.model-tree {
|
||||||
|
height: calc(100% - 36px);
|
||||||
|
overflow-y: auto;
|
||||||
|
.el-tree {
|
||||||
|
background: transparent;
|
||||||
|
color: #eee;
|
||||||
|
.el-checkbox {
|
||||||
|
color: #45fdfe;
|
||||||
|
}
|
||||||
|
.el-tree-node {
|
||||||
|
&:focus {
|
||||||
|
& > .el-tree-node__content {
|
||||||
|
background: #3489d966;
|
||||||
|
&:hover {
|
||||||
|
background: #3489d966;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.el-tree-node__content:hover {
|
||||||
|
background: #3489d966;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
<el-table-column label="负责人" align="center" prop="operator" width="120" />
|
<el-table-column label="负责人" align="center" prop="operator" width="120" />
|
||||||
<el-table-column label="班组名称" align="center" prop="groupName" width="120" />
|
<el-table-column label="班组名称" align="center" prop="groupName" width="120" />
|
||||||
</el-table>
|
</el-table>
|
||||||
<bim-selection-dialog ref="bimDlg"></bim-selection-dialog>"
|
<bim-selection-dialog ref="bimDlg" @success="doSelectSuccess"></bim-selection-dialog>"
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -141,6 +141,9 @@ const data = reactive({
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data);
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
|
function doSelectSuccess(){
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
function buildTree(all, id) {
|
function buildTree(all, id) {
|
||||||
let tmps = all.filter((d) => d.parentId == id);
|
let tmps = all.filter((d) => d.parentId == id);
|
||||||
if (tmps.length > 0) {
|
if (tmps.length > 0) {
|
||||||
|
|
Loading…
Reference in New Issue