BIM设置开发
parent
7451283d13
commit
add9f6a97a
|
@ -1,6 +1,21 @@
|
|||
<template>
|
||||
<el-dialog title="项目BIM设置" width="600" :modal-append-to-body="false" :close-on-click-modal="false" v-model="show"
|
||||
class="bim-config-dialog footer-center">
|
||||
<el-dialog title="项目BIM设置" width="300" :modal-append-to-body="false" :close-on-click-modal="false" v-model="show"
|
||||
class="bim-config-dialog footer-center noscroll">
|
||||
<el-form ref="form" :model="cfg" label-width="120px">
|
||||
<el-form-item label="是否显示GIS" prop="showGis">
|
||||
<el-switch v-model="cfg.showGis" active-text="是" inactive-text="否"></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="背景色" prop="background" v-show="!cfg.showGis" :key="cfg.showGis">
|
||||
<el-color-picker v-model="cfg.background" show-alpha />
|
||||
</el-form-item>
|
||||
<el-form-item label="客户端渲染" prop="clientApi">
|
||||
<el-switch v-model="cfg.clientApi" active-text="是" inactive-text="否"></el-switch>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="footer-btn" style="text-align: center;">
|
||||
<el-button type="primary" @click="onSubmit">保存</el-button>
|
||||
<el-button @click="onCancel">取消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
|
@ -12,9 +27,29 @@ export default {
|
|||
return {
|
||||
show: false,
|
||||
currentPrjId: null,
|
||||
cfg:{
|
||||
showGis:false,
|
||||
background:"",
|
||||
clientApi:false,
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSubmit(){
|
||||
this.$modal.confirm("确定保存吗?").then(() => {
|
||||
updateProjectBimConfig(this.currentPrjId,{
|
||||
showGis:this.cfg.showGis,
|
||||
background:this.cfg.background,
|
||||
clientApi:this.cfg.clientApi,
|
||||
}).then(res=>{
|
||||
this.$message.success("保存成功");
|
||||
this.show=false;
|
||||
})
|
||||
})
|
||||
},
|
||||
onCancel(){
|
||||
this.show=false;
|
||||
},
|
||||
showDialog() {
|
||||
this.userStore = useUserStore();
|
||||
this.currentPrjId = this.userStore.currentPrjId;
|
||||
|
@ -23,8 +58,13 @@ export default {
|
|||
},
|
||||
loadData(){
|
||||
getProjectBimConfig(this.currentPrjId).then(d=>{
|
||||
debugger;
|
||||
console.log(d)
|
||||
|
||||
if(d.msg){
|
||||
let config=this.$tryToJson(d.msg,{});
|
||||
this.cfg.background=config.background||"";
|
||||
this.cfg.showGis=config.showGis||false;
|
||||
this.cfg.clientApi=config.clientApi||false;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<div class="hide-features">
|
||||
<div style="padding: 0px 10px 10px" v-show="hideParts.length > 0">
|
||||
<el-button @click="delAllDelList">删除所有</el-button>
|
||||
<el-button @click="doSaveHide">保存</el-button>
|
||||
</div>
|
||||
<div class="sel-list scroll hide-list" :key="hideEl">
|
||||
<div v-for="(it, idx) in hideParts" :key="idx" class="div-sel-item">
|
||||
|
@ -16,7 +17,7 @@
|
|||
|
||||
<script>
|
||||
import {
|
||||
getModelFeatureInfos,
|
||||
getModelFeatureInfos,updateBimModel
|
||||
} from "@/api/bim/bimModel";
|
||||
export default {
|
||||
props: {
|
||||
|
@ -32,7 +33,40 @@ export default {
|
|||
hideEl: 0,
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
hideParts(val){
|
||||
this.me.hideParts=val;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doSaveHide(){
|
||||
this.$modal.confirm("确定保存吗?").then(() => {
|
||||
let obj={};
|
||||
this.hideParts.forEach(it=>{
|
||||
let modelId=it.modelId;
|
||||
if(!obj[modelId]){
|
||||
obj[modelId]=[];
|
||||
}
|
||||
obj[modelId].push({
|
||||
featureId:it.featureId,
|
||||
externalId:it.externalId,
|
||||
modelId:it.modelId,
|
||||
info:it.info
|
||||
});
|
||||
})
|
||||
for(let modelId in obj){
|
||||
let modelInfo=this.me.models.find(it=>it.modelId==modelId);
|
||||
if(modelInfo){
|
||||
modelInfo.bimCfg.hideParts=obj[modelId];
|
||||
modelInfo.bimConfig=JSON.stringify(modelInfo.bimCfg);
|
||||
updateBimModel(modelInfo).then(res => {
|
||||
this.$message.success("保存成功");
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
delAllDelList() {
|
||||
this.$modal.confirm("确定删除吗?").then(() => {
|
||||
api.Feature.setVisible(this.hideParts.map(it => it.featureId).join("#"), true);
|
||||
|
@ -44,8 +78,9 @@ export default {
|
|||
api.Feature.setVisible(this.hideParts[idx].featureId, true);
|
||||
this.hideParts.splice(idx, 1);
|
||||
},
|
||||
doHideFeatures() {
|
||||
doHideFeatures(hideParts) {
|
||||
let that = this;
|
||||
this.hideParts=hideParts||[];
|
||||
api.Public.clearHandler();
|
||||
api.Feature.getByEvent(false);
|
||||
api.Feature.getByEvent(true, async (n) => {
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
import { getModelTree, getTreeAllLeafChild } from "@/api/bim/bimModel";
|
||||
export default {
|
||||
props: {
|
||||
me: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
projectMessage: {
|
||||
type: Object,
|
||||
default: undefined,
|
||||
|
@ -140,7 +144,6 @@ export default {
|
|||
let o = this.convertFeatureInfo(it, data.modelId);
|
||||
return o;
|
||||
});
|
||||
//addToAllFeatures(that, tmps);
|
||||
resolve(tmps);
|
||||
});
|
||||
},
|
||||
|
@ -186,27 +189,34 @@ export default {
|
|||
api.Model.add(
|
||||
url,
|
||||
modelId,
|
||||
() => { },
|
||||
() => {
|
||||
console.log("加载模型成功2");
|
||||
},
|
||||
() => {
|
||||
console.log("加载模型成功");
|
||||
let modelInfo=this.projectMessage.find(m=>m.modelId==modelId);
|
||||
if(modelInfo){
|
||||
let cfg=modelInfo.bimCfg;
|
||||
let x=cfg?.x||0;
|
||||
let y=cfg?.y||0;
|
||||
let z=cfg?.z||0;
|
||||
let rotateZ=cfg?.rotateZ||0;
|
||||
if(x*1+y*1+z*1!=0){
|
||||
api.Model.moveToPosition([x,y,z], 0,modelId)
|
||||
let modelInfo = this.projectMessage.find(m => m.modelId == modelId);
|
||||
if (modelInfo) {
|
||||
let cfg = modelInfo.bimCfg;
|
||||
let x = cfg?.x || 0;
|
||||
let y = cfg?.y || 0;
|
||||
let z = cfg?.z || 0;
|
||||
let rotateZ = cfg?.rotateZ || 0;
|
||||
if (x * 1 + y * 1 + z * 1 != 0) {
|
||||
api.Model.moveToPosition([x, y, z], 0, modelId)
|
||||
}
|
||||
if(rotateZ*1!=0){
|
||||
api.Model.rotate(0, 0, rotateZ, modelId)
|
||||
if (rotateZ * 1 != 0) {
|
||||
api.Model.rotate(0, 0, rotateZ, modelId)
|
||||
}
|
||||
if (cfg && cfg.hideParts) {
|
||||
cfg.hideParts.forEach(it => {
|
||||
this.me.hideParts.push(it);
|
||||
})
|
||||
}
|
||||
}
|
||||
cb && cb();
|
||||
this.$emit("change");
|
||||
setTimeout(() => {
|
||||
api.Model.location(modelId);
|
||||
api.Model.location(modelId);
|
||||
if (this.$parent.viewPoint) {
|
||||
api.Camera.setViewPort(this.$parent.viewPoint);
|
||||
} else {
|
||||
|
@ -214,6 +224,22 @@ export default {
|
|||
this.$emit("modelAdd", p);
|
||||
});
|
||||
}
|
||||
let hideCnt = 0;
|
||||
let hideFn = () => {
|
||||
hideCnt++;
|
||||
if(hideCnt>30){
|
||||
return;
|
||||
}
|
||||
setTimeout(() => {
|
||||
let featureIds = (this.me.hideParts || []).map(it => it.featureId);
|
||||
if (featureIds.length > 0) {
|
||||
console.log(featureIds.join("#"))
|
||||
api.Feature.setVisible(featureIds.join("#"), false);
|
||||
}
|
||||
hideFn();
|
||||
}, 100)
|
||||
};
|
||||
hideFn();
|
||||
}, 1000);
|
||||
}
|
||||
);
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
<template>
|
||||
<div class="move-model">
|
||||
<el-form ref="form" :model="form" label-width="40px">
|
||||
<div class="nav-title">位置</div>
|
||||
<div class="move-button">
|
||||
<el-button type="primary" @click="doModelMove">
|
||||
<svg-icon icon-class="position" /> 在地图上移动模型
|
||||
</el-button>
|
||||
|
||||
</div>
|
||||
<div class="nav-title">位置
|
||||
|
||||
</div>
|
||||
<el-form-item label="经度">
|
||||
<el-input v-model="form.x"></el-input>
|
||||
</el-form-item>
|
||||
|
@ -33,6 +41,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { ElMessage, ElTooltip } from 'element-plus';
|
||||
import { updateBimModel } from "@/api/bim/bimModel"
|
||||
export default {
|
||||
props: {
|
||||
|
@ -58,11 +67,43 @@ export default {
|
|||
y: 0,
|
||||
z: 0,
|
||||
rotateZ: 0
|
||||
}
|
||||
},
|
||||
movePoint: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doModelMove() {
|
||||
ElMessage.info("左键单击选择移动位置,右键单击结束操作!");
|
||||
let that = this;
|
||||
api.Public.event("LEFT_CLICK", ((n) => {
|
||||
api.Public.pickupCoordinate(true, ((n) => {
|
||||
api.Public.convertWorldToCartographicLocation(n, m => {
|
||||
api.Model.moveToPosition(m, 0, this.modelId)
|
||||
if (this.saveData.rotateZ != 0) {
|
||||
api.Model.rotate(0, 0, this.saveData.rotateZ, this.modelId)
|
||||
}
|
||||
that.movePoint = m;
|
||||
});
|
||||
}
|
||||
))
|
||||
}
|
||||
)),
|
||||
api.Public.event("RIGHT_CLICK", ((n) => {
|
||||
api.Public.clearHandler(),
|
||||
api.Public.pickupCoordinate(false);
|
||||
ElMessage.info("已结束模型移动!"),
|
||||
that.activeMenu = -1;
|
||||
let pt = that.movePoint;
|
||||
this.form.x = pt[0]
|
||||
this.form.y = pt[1]
|
||||
this.form.z = pt[2]
|
||||
this.saveData.x = this.form.x;
|
||||
this.saveData.y = this.form.y;
|
||||
this.saveData.z = this.form.z;
|
||||
}));
|
||||
},
|
||||
onCancel() {
|
||||
this.resetPosition();
|
||||
this.me.showMove = false;
|
||||
this.me.activeMenu = -1;
|
||||
},
|
||||
|
@ -71,6 +112,7 @@ export default {
|
|||
let model = this.me.models.find(model => model.modelId == this.modelId);
|
||||
if (model) {
|
||||
model.bimConfig = JSON.stringify(this.saveData);
|
||||
model.bimCfg = this.saveData;
|
||||
updateBimModel(model).then(res => {
|
||||
this.$message.success("保存成功");
|
||||
this.me.showMove = false;
|
||||
|
@ -99,28 +141,30 @@ export default {
|
|||
this.saveData.rotateZ = this.form.rotateZ;
|
||||
|
||||
},
|
||||
init(pt, modelId) {
|
||||
if (pt) {
|
||||
this.form.x = pt[0]
|
||||
this.form.y = pt[1]
|
||||
this.form.z = pt[2]
|
||||
} else {
|
||||
this.form.x = 0
|
||||
this.form.y = 0
|
||||
this.form.z = 0
|
||||
resetPosition() {
|
||||
let modelInfo = this.me.models.find(model => model.modelId == this.modelId);
|
||||
if (modelInfo) {
|
||||
let cfg = modelInfo.bimCfg;
|
||||
let x = cfg?.x || 0;
|
||||
let y = cfg?.y || 0;
|
||||
let z = cfg?.z || 0;
|
||||
let rotateZ = cfg?.rotateZ || 0;
|
||||
if (x * 1 + y * 1 + z * 1 != 0) {
|
||||
api.Model.moveToPosition([x, y, z], 0, this.modelId)
|
||||
}
|
||||
if (rotateZ * 1 != 0) {
|
||||
api.Model.rotate(0, 0, rotateZ, this.modelId)
|
||||
}
|
||||
}
|
||||
this.saveData.x = this.form.x;
|
||||
this.saveData.y = this.form.y;
|
||||
this.saveData.z = this.form.z;
|
||||
let modelInfo = this.me.models.find(m => m.modelId == modelId);
|
||||
this.form.rotateZ = modelInfo?.bimCfg?.rotateZ || 0;
|
||||
this.modelId = modelId
|
||||
},
|
||||
updatePosition() {
|
||||
api.Model.moveToPosition([this.form.x, this.form.y, this.form.z], 0, this.modelId)
|
||||
this.saveData.x = this.form.x;
|
||||
this.saveData.y = this.form.y;
|
||||
this.saveData.z = this.form.z;
|
||||
if (this.saveData.rotateZ != 0) {
|
||||
api.Model.rotate(0, 0, this.saveData.rotateZ, this.modelId)
|
||||
}
|
||||
},
|
||||
|
||||
updateRotate() {
|
||||
|
@ -145,6 +189,12 @@ export default {
|
|||
.move-model {
|
||||
padding: 0px 10px 20px;
|
||||
|
||||
.move-button {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 45px;
|
||||
}
|
||||
|
||||
.nav-title {
|
||||
background: linear-gradient(45deg, #00000033, transparent);
|
||||
line-height: 40px;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<div class="bim-cfg-tools">
|
||||
<el-switch v-model="showGis" @change="doChangeGis"></el-switch>GIS
|
||||
</div>
|
||||
<model-floor-tree ref="modelFloorTree" @change="doChange" @modelAdd="modelAdded" :projectMessage="models"
|
||||
<model-floor-tree ref="modelFloorTree" :me="this" @change="doChange" @modelAdd="modelAdded" :projectMessage="models"
|
||||
v-if="showTree"></model-floor-tree>
|
||||
<div class="footer-box" v-if="showModels.length > 0">
|
||||
<el-tooltip placement="top" content="主视图">
|
||||
|
@ -52,7 +52,7 @@
|
|||
<person-roaming v-if="activeMenu == 1" ref="personRoaming" :me="this"></person-roaming>
|
||||
<custom-viewpoint v-if="activeMenu == 2" ref="customViewpoint" :me="this"></custom-viewpoint>
|
||||
<viewpoint v-if="activeMenu == 3" ref="viewpoint" :me="this"></viewpoint>
|
||||
<HideFeature v-if="activeMenu == 4" ref="hideFeature" :me="this"></HideFeature>
|
||||
<HideFeature v-show="activeMenu == 4" ref="hideFeature" :me="this"></HideFeature>
|
||||
</div>
|
||||
|
||||
<div class="bim-setting-tools" v-show="showMove">
|
||||
|
@ -80,6 +80,7 @@ import Viewpoint from "./Viewpoint.vue";
|
|||
import MoveModel from "./MoveModel.vue";
|
||||
import HideFeature from "./HideFeature.vue";
|
||||
import { ElMessage, ElTooltip } from 'element-plus';
|
||||
import { getProjectBimConfig } from "@/api/manage/proProjectInfo.js";
|
||||
export default {
|
||||
components: {
|
||||
ModelFloorTree,
|
||||
|
@ -111,6 +112,8 @@ export default {
|
|||
moveModelId: null,
|
||||
isMove: false,
|
||||
showMove: false,
|
||||
hideParts: [],
|
||||
bimCfg: {}
|
||||
};
|
||||
},
|
||||
beforeUnmount() {
|
||||
|
@ -124,9 +127,18 @@ export default {
|
|||
this.currentComId = this.userStore.currentComId;
|
||||
this.initLoadModel();
|
||||
this.initEngine();
|
||||
getProjectBimConfig(this.currentPrjId).then(d => {
|
||||
let config = this.$tryToJson(d.msg, {});
|
||||
this.bimCfg = {
|
||||
background: config.background || "",
|
||||
showGis: config.showGis || false,
|
||||
clientApi: config.clientApi || false
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
doCloseMove() {
|
||||
this.$refs.moveModel.resetPosition();
|
||||
this.showMove = false;
|
||||
this.activeMenu = -1;
|
||||
},
|
||||
|
@ -141,7 +153,9 @@ export default {
|
|||
api.Public.setTerrainState(false, "http://113.201.2.107:9304/layer.json", false)
|
||||
api.Public.setGisState(true);
|
||||
} else {
|
||||
api.Public.setGisState(false);
|
||||
let color = this.bimCfg.background || "rgba(135 ,206 ,250,1)"
|
||||
api.Public.setGisState(false, color);
|
||||
api.Public.setSkyBoxState(0)
|
||||
}
|
||||
},
|
||||
doChange() {
|
||||
|
@ -173,6 +187,9 @@ export default {
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (this.activeMenu == 5) {
|
||||
this.doCloseMove()
|
||||
}
|
||||
this.activeMenu = n;
|
||||
if (n == 0) {
|
||||
this.resetScene();
|
||||
|
@ -192,13 +209,12 @@ export default {
|
|||
if (n == 4) {
|
||||
this.param.title = "构件隐藏管理";
|
||||
setTimeout(() => {
|
||||
this.$refs.hideFeature.doHideFeatures();
|
||||
this.$refs.hideFeature.doHideFeatures(this.hideParts);
|
||||
}, 800);
|
||||
|
||||
}
|
||||
if (n == 5) {
|
||||
this.param.title = "模型偏移管理";
|
||||
//this.showMove = true;
|
||||
this.isMove = true;
|
||||
this.doModelMove();
|
||||
} else {
|
||||
|
@ -217,9 +233,8 @@ export default {
|
|||
api.Feature.getByPosition([e.x, e.y], (n) => {
|
||||
if (n && n["id"]) {
|
||||
let modelId = n.id.split("^")[0];
|
||||
//this.modelMove(modelId);
|
||||
this.showMove=true;
|
||||
this.$refs.moveModel.initData( modelId)
|
||||
this.showMove = true;
|
||||
this.$refs.moveModel.initData(modelId)
|
||||
} else {
|
||||
ElMessage.warning("请在模型上选点!");
|
||||
}
|
||||
|
@ -227,32 +242,7 @@ export default {
|
|||
});
|
||||
|
||||
},
|
||||
modelMove(modelId) {
|
||||
ElMessage.info("左键单击选择移动位置,右键单击结束操作!");
|
||||
let that = this;
|
||||
api.Public.event("LEFT_CLICK", ((n) => {
|
||||
api.Public.pickupCoordinate(true, ((n) => {
|
||||
api.Public.convertWorldToCartographicLocation(n, m => {
|
||||
api.Model.moveToPosition(m, 0, modelId)
|
||||
that.movePoint = m;
|
||||
that.moveModelId = modelId;
|
||||
});
|
||||
}
|
||||
))
|
||||
}
|
||||
)),
|
||||
api.Public.event("RIGHT_CLICK", ((n) => {
|
||||
api.Public.clearHandler(),
|
||||
api.Public.pickupCoordinate(false);
|
||||
ElMessage.info("已结束模型移动!"),
|
||||
that.activeMenu = -1;
|
||||
that.onmoveCilck(t)
|
||||
}));
|
||||
},
|
||||
onmoveCilck() {
|
||||
this.showMove = true;
|
||||
this.$refs.moveModel.init(this.movePoint, this.moveModelId)
|
||||
},
|
||||
|
||||
NotificationPopup(parameter) {
|
||||
this.param = parameter;
|
||||
|
||||
|
@ -310,6 +300,12 @@ export default {
|
|||
showAxes: true, // 是否显示XYZ轴线
|
||||
};
|
||||
api.Plugin.initNavCube(mapOptions);
|
||||
if (this.bimCfg.showGis) {
|
||||
this.showGis = true;
|
||||
this.doChangeGis();
|
||||
} else if (this.bimCfg.background) {
|
||||
api.Public.setGisState(false, this.bimCfg.background);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
@ -332,7 +328,7 @@ export default {
|
|||
}).then((d) => {
|
||||
this.models = (d.rows || []).map((it) => {
|
||||
it.modelId = it.lightweightName;
|
||||
it.bimCfg=this.$tryToJson(it.bimConfig || "{}", {});
|
||||
it.bimCfg = this.$tryToJson(it.bimConfig || "{}", {});
|
||||
it.visible = false;
|
||||
it.checked = true;
|
||||
it.gis = this.$tryToJson(it.gisJson || "{}", {});
|
||||
|
|
|
@ -204,7 +204,7 @@ function handleBim(row) {
|
|||
getPlan(row.id).then((response) => {
|
||||
row.bimId = response.data.bimId;
|
||||
row.hadLoadBim=true;
|
||||
row.bim = this.$tryToJson(row.bimId || "[]", []);
|
||||
row.bim = proxy.$tryToJson(row.bimId || "[]", []);
|
||||
row.hasBim =row.bimId && row.bimId.length > 0;
|
||||
loading.value = false;
|
||||
bimDlg.value.showDialog(row, data.planAll);
|
||||
|
|
Loading…
Reference in New Issue