diff --git a/yanzhu-ui-vue3/public/images/pitMonitor.png b/yanzhu-ui-vue3/public/images/pitMonitor.png new file mode 100644 index 00000000..0ed75985 Binary files /dev/null and b/yanzhu-ui-vue3/public/images/pitMonitor.png differ diff --git a/yanzhu-ui-vue3/public/images/pitMonitor.svg b/yanzhu-ui-vue3/public/images/pitMonitor.svg index e72ff1c2..d6f7ee8c 100644 --- a/yanzhu-ui-vue3/public/images/pitMonitor.svg +++ b/yanzhu-ui-vue3/public/images/pitMonitor.svg @@ -1 +1,2 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/yanzhu-ui-vue3/public/images/power.png b/yanzhu-ui-vue3/public/images/power.png new file mode 100644 index 00000000..af6da13c Binary files /dev/null and b/yanzhu-ui-vue3/public/images/power.png differ diff --git a/yanzhu-ui-vue3/public/images/power.svg b/yanzhu-ui-vue3/public/images/power.svg index fbf095fc..45203192 100644 --- a/yanzhu-ui-vue3/public/images/power.svg +++ b/yanzhu-ui-vue3/public/images/power.svg @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/yanzhu-ui-vue3/public/images/towerMonitor.png b/yanzhu-ui-vue3/public/images/towerMonitor.png new file mode 100644 index 00000000..12d0093e Binary files /dev/null and b/yanzhu-ui-vue3/public/images/towerMonitor.png differ diff --git a/yanzhu-ui-vue3/public/images/towerMonitor.svg b/yanzhu-ui-vue3/public/images/towerMonitor.svg index 3c372688..8bb95249 100644 --- a/yanzhu-ui-vue3/public/images/towerMonitor.svg +++ b/yanzhu-ui-vue3/public/images/towerMonitor.svg @@ -1,3 +1,3 @@ - - \ No newline at end of file + + \ No newline at end of file diff --git a/yanzhu-ui-vue3/public/images/videoMonitor.png b/yanzhu-ui-vue3/public/images/videoMonitor.png new file mode 100644 index 00000000..95eea9df Binary files /dev/null and b/yanzhu-ui-vue3/public/images/videoMonitor.png differ diff --git a/yanzhu-ui-vue3/src/api/bim/bim.js b/yanzhu-ui-vue3/src/api/bim/bim.js index c31354f5..41899dd4 100644 --- a/yanzhu-ui-vue3/src/api/bim/bim.js +++ b/yanzhu-ui-vue3/src/api/bim/bim.js @@ -69,3 +69,19 @@ export function devicePositionGet(data) { params: data, }); } + +export function devicePositionAddItems(data) { + return request({ + url: "/manage/api/bim/devicePosition/addItems", + method: "post", + data: data, + }); +} + +export function devicePositionUpdateItems(data) { + return request({ + url: "/manage/api/bim/devicePosition/updatePosition", + method: "post", + data: data, + }); +} \ No newline at end of file diff --git a/yanzhu-ui-vue3/src/views/bim/bimModel/modelDialog.vue b/yanzhu-ui-vue3/src/views/bim/bimModel/modelDialog.vue index 5bdb938e..b2c09e1e 100644 --- a/yanzhu-ui-vue3/src/views/bim/bimModel/modelDialog.vue +++ b/yanzhu-ui-vue3/src/views/bim/bimModel/modelDialog.vue @@ -1,6 +1,7 @@ @@ -94,7 +109,7 @@ import useUserStore from "@/store/modules/user"; import { listBimModel } from "@/api/bim/bimModel"; import { ElMessage, ElMessageBox } from "element-plus"; import { emitter } from "@/router/index.js"; -import { devicePositionGet } from "@/api/bim/bim.js"; +import { devicePositionGet,devicePositionAddItems, devicePositionUpdateItems} from "@/api/bim/bim.js"; import icons from "./icons.js"; export default { name: "SandTableSetting", @@ -113,6 +128,7 @@ export default { positionByModalId: "", selItem: null, iconVideo: "", + addLabels:[], }; }, created() { @@ -137,46 +153,107 @@ export default { this.initEngine(); }, methods: { - AddLable: function (e, t) { + doSave() { + this.$confirm("确认保存修改?", "提示", { + type:"warning", + confirmButtonText: "确 认", + cancelButtonText: "取 消", + }).then(() => { + let adds=this.devices.filter((item)=>{ + return item.id==null + }).map(item=>{ + return { + deviceId:item.deviceId, + deviceType:item.deviceType, + position:JSON.stringify( item.position), + enabled:item.show?1:0, + currentUser:this.userStore.name, + remark:'', + } + }) + let updates=this.devices.filter((item)=>{ + return item.id!=null + }).map(item=>{ + return { + id:item.id, + position:JSON.stringify( item.position), + currentUser:this.userStore.name, + enabled:item.show?1:0, + } + }) + console.log("-->",adds,updates) + let ajaxs=[]; + if(adds.length>0){ + ajaxs.push(devicePositionAddItems({items:adds})) + } + if(updates.length>0){ + ajaxs.push(devicePositionUpdateItems({items:updates})) + } + Promise.all(ajaxs).then((res)=>{ + ElMessage.success("保存成功") + }) + }); + }, + clearLabels(){ + this.addLabels.forEach(id=>{ + window.sandSettingApi.Label.removeBalloon(id); + }) + this.addLabels=[]; + }, + addDeviceLabel(){ + this.devices.forEach(d=>{ + if(d.position && d.position.length>0){ + this.AddLable(d) + } + }); + }, + AddLable: function (item) { + let img = "videoMonitor"; + if (this.activeMenu == 1) { + img = "videoMonitor"; + } else if (this.activeMenu == 2) { + img = "pitMonitor"; + } else if (this.activeMenu == 3) { + img = "towerMonitor"; + } else if (this.activeMenu == 4) { + img = "power"; + } let html = ` + text-align: center;color: #ffffff;display: flex;font-size:12px;}
- - ${this.selItem.name}
`; - console.log(html); + + ${item.name} + + `; + window.sandSettingApi.Label.addBalloon({ Html: html, - ID: this.selItem.elId, + ID: item.elId, Pivot: "2", - Position: t, - Title: this.selItem.name, + Position: item.position, + Title: item.name, MaxDistance: 1e6, - - // ID: e, - // Position: t, - // Html: `
${this.selItem.name}
`, - // Pivot: 8, - // onClick: function (e) { - // console.log(e); - // }, }); + this.addLabels.push(item.elId); }, getPosition(item, index) { this.selItem = item; window.sandSettingApi && window.sandSettingApi.Public.clearHandler(); ElMessage.info("请在场景中拾取坐标位置"); - window.sandSettingApi.Label.removeBalloon(item.elId); + window.sandSettingApi.Public.pickupCoordinate(false); window.sandSettingApi.Public.event("LEFT_CLICK", (e) => { window.sandSettingApi.Feature.getByPosition([e.x, e.y], (n) => { if (n && n["id"]) { this.positionByModalId = n.id.split("^")[0]; window.sandSettingApi.Public.pickupCoordinate(true, (e) => { - this.AddLable("position_label", e); + this.selItem.position = e; + window.sandSettingApi.Label.removeBalloon(item.elId); + this.AddLable(this.selItem); + window.sandSettingApi.Public.pickupCoordinate(false); window.sandSettingApi.Public.clearHandler(); }); } else { @@ -184,28 +261,16 @@ export default { } }); }); - - // window.sandSettingApi.Public.event("LEFT_CLICK", (function(e) { - // window.sandSettingApi.Feature.getByEvent(e.position, n=> { - // this.positionByModalId = n.id.split("^")[0]; - // window.sandSettingApi.Public.pickupCoordinate(e.position, (function(e) { - // window.sandSettingApi.Lable.DeleteCustomLabel("position_label"), - // this.AddLable("position_label", e) - // } - // ))) : ElMessage.warning("请在模型上选点!") - // } - // ), !1) - // } - // )) }, doToolsClose() { this.activeMenu = 0; this.resetScene(); }, resetScene() { - api.Camera.stopImmersiveRoam(); - api.Model.location(api.m_model.keys().toArray()[0]); - api.Plugin.deleteMiniMap(); + this.clearLabels(); + sandSettingApi.Camera.stopImmersiveRoam(); + sandSettingApi.Model.location(api.m_model.keys().toArray()[0]); + sandSettingApi.Plugin.deleteMiniMap(); }, doMenu(n) { if (n == this.activeMenu) { @@ -233,9 +298,12 @@ export default { .filter((item) => item.deviceType == this.activeMenu) .map((item) => { item.show = item.enabled != 0; + item.position=this.$tryToJson(item.position,[]); item.elId = (item.id ? item.id : cnt++) + "-" + item.deviceType; return item; }); + this.clearLabels(); + this.addDeviceLabel(); }); }, initEngine() { @@ -387,7 +455,7 @@ export default { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); min-width: 300px; min-height: 400px; - + padding-bottom: 50px; .tools-title { padding: 10px; color: #114c5f; @@ -402,6 +470,8 @@ export default { } .device-list { padding: 0px 10px; + max-height: 60vh; + overflow-y: auto; .device-item { display: flex; align-items: center; @@ -419,6 +489,30 @@ export default { } } } + .tools-bottom{ + position: absolute; + bottom: 10px; + width:100%; + text-align: center; + } + } + .test-box { + position: absolute; + display: none; + top: 10px; + left: 10px; + .tag-box { + position: relative; + } + .tag-txt { + position: absolute; + top: 30%; + left: 50%; + transform: translate(-50%, -50%); + text-align: center; + color: #ffffff; + display: flex; + } } }