|
@@ -21,8 +21,8 @@
|
|
|
<div class="plan">
|
|
|
<p>平面图上的位置:<span>{{item.local | localTransformation}}</span></p>
|
|
|
<div class="img-box">
|
|
|
- <canvas :id="'canvas'+index" :width="canvasWidth" :height="canvasHeight" ref="canvas" tabindex="0"
|
|
|
- :data-modelid="item.ModelId"></canvas>
|
|
|
+ <canvas :id="'canvas'+index" :width="canvasWidth" :height="canvasHeight" ref="canvas" tabindex="0" :data-modelid="item.ModelId"
|
|
|
+ :data-EquipID='item.EquipID' :data-x="item.local.X" :data-y="item.local.Y"></canvas>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -70,9 +70,10 @@ export default {
|
|
|
total: 0
|
|
|
},
|
|
|
canvasWidth: 400,
|
|
|
- canvasHeight: 300,
|
|
|
+ canvasHeight: 280,
|
|
|
scene: '',
|
|
|
- view: ''
|
|
|
+ view: '',
|
|
|
+ i: 0
|
|
|
}
|
|
|
},
|
|
|
filters: {
|
|
@@ -80,7 +81,7 @@ export default {
|
|
|
num = Number(num + 1)
|
|
|
return (Array(length).join('0') + num).slice(-length);
|
|
|
},
|
|
|
- localTransformation(local) {
|
|
|
+ localTransformation(local) {// 坐标转换
|
|
|
let str = "";
|
|
|
for (let key in local) {
|
|
|
if (key !== "Z") {
|
|
@@ -91,7 +92,7 @@ export default {
|
|
|
}
|
|
|
return str;
|
|
|
},
|
|
|
- timeTransformation(time) {
|
|
|
+ timeTransformation(time) {// 时间转换
|
|
|
time = time.replace(/(\d+)\-(\d+)\-(\d+)\ (\d+)\:(\d+)\:(\d+)/, function () {
|
|
|
let str = '';
|
|
|
let ary = ['年', '月', '日', '时', '分'];
|
|
@@ -116,9 +117,6 @@ export default {
|
|
|
...mapGetters('layout', ['projectId'])
|
|
|
},
|
|
|
methods: {
|
|
|
- load() {
|
|
|
- this.count += 2
|
|
|
- },
|
|
|
copyContent(element) {
|
|
|
// 双击复制
|
|
|
let content = element.target.innerText;
|
|
@@ -162,7 +160,6 @@ export default {
|
|
|
PageSize: this.page.pageSize
|
|
|
}
|
|
|
toBeSupplementEquip(params, res => {
|
|
|
- console.log(res, 39)
|
|
|
this.pageData = res.Content;
|
|
|
this.pageData.forEach(item => {
|
|
|
if (item.BIMLocation) {
|
|
@@ -194,37 +191,49 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
getGraphy() {// 绘制空间位置图片
|
|
|
- this.pageData.forEach((item, index) => {
|
|
|
- let that = this;
|
|
|
- that.clearGraphy()
|
|
|
- that.scene = new LocationPointScene();
|
|
|
- this.canvasLoading = true;
|
|
|
- that.scene.getFloorData('/modelapi/base-graph/query', { ModelId: item.ModelId }).then(res => {
|
|
|
- that.canvasLoading = false;
|
|
|
- console.log(res, 2847)
|
|
|
- if (res == 'error') {
|
|
|
- this.FloorMap = '';
|
|
|
- this.$message.warning('数据解析异常');
|
|
|
- return;
|
|
|
- }
|
|
|
- that.view.scene = that.scene;
|
|
|
- this.scene.addMarker({
|
|
|
- Id: 'Eq420105000136d2753ce7b94f5b98496e51fa89379a',
|
|
|
- X: -35559.48,
|
|
|
- Y: 16647.19
|
|
|
- })
|
|
|
- that.view.fitSceneToView();
|
|
|
- this.scene.isSpaceSelectable = false;
|
|
|
+ console.log(this.i, 39)
|
|
|
+ let can = this.$refs.canvas;
|
|
|
+ let that = this;
|
|
|
+ that.clearGraphy(this.i)
|
|
|
+ that.scene = new LocationPointScene();
|
|
|
+ this.canvasLoading = true;
|
|
|
+ that.scene.getFloorData('/modelapi/base-graph/query', { ModelId: can[this.i].dataset.modelid }).then(res => {
|
|
|
+ that.canvasLoading = false;
|
|
|
+ if (res == 'error') {
|
|
|
+ this.FloorMap = '';
|
|
|
+ this.$message.warning('数据解析异常');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let modelID = can[this.i].dataset.modelid
|
|
|
+ let EquipID = can[this.i].dataset.equipid;
|
|
|
+ let X = Number(can[this.i].dataset.x);
|
|
|
+ let Y = can[this.i].dataset.y * -1;
|
|
|
+ console.log(X, Y)
|
|
|
+ that.view.scene = that.scene;
|
|
|
+ this.scene.addMarker({
|
|
|
+ Id: EquipID,
|
|
|
+ X: X,
|
|
|
+ Y: Y
|
|
|
})
|
|
|
+ that.view.fitSceneToView();
|
|
|
+ this.scene.isSpaceSelectable = false;
|
|
|
+ this.i++;
|
|
|
})
|
|
|
},
|
|
|
- clearGraphy() {
|
|
|
- if (this.view && this.view.scene) {
|
|
|
- this.view.scene = null;
|
|
|
- return
|
|
|
+ clearGraphy(i) {
|
|
|
+ // if (this.view && this.view.scene) {
|
|
|
+ // this.view.scene = null;
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ this.view = new FloorView(`canvas${i}`)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ i() {
|
|
|
+ if (this.i >= this.pageData.length) {
|
|
|
+ return;
|
|
|
}
|
|
|
- console.log(document.getElementById('canvas0'))
|
|
|
- this.view = new FloorView('canvas0')
|
|
|
+ this.getGraphy();
|
|
|
}
|
|
|
}
|
|
|
}
|