|
@@ -120,7 +120,6 @@ export default {
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
init() {
|
|
|
- this.getFileName(this.modelId)
|
|
|
this.getFloorData()
|
|
|
},
|
|
|
// 返回路由
|
|
@@ -200,7 +199,7 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
// 获取楼层
|
|
|
- getFloorData() {
|
|
|
+ getFloorData(flag) {
|
|
|
let floorParam = {
|
|
|
PageSize: 1000,
|
|
|
Filters: `BuildID='${this.BuildID}'`,
|
|
@@ -209,12 +208,16 @@ export default {
|
|
|
floorQueryAndSign(floorParam, (res) => {
|
|
|
this.floorList = res.Content.filter(t => t.StructureInfo && t.StructureInfo.FloorMap || t.FloorID == this.FloorID);
|
|
|
// todo
|
|
|
- this.floorRadio = this.floorList[0];
|
|
|
+ if (flag && flag == 'next') {
|
|
|
+ this.floorRadio = this.floorList[0];
|
|
|
+ this.loadOtherImg(this.floorRadio)
|
|
|
+ }
|
|
|
this.alreadyRelatedModel = res.Content.map((t) => {
|
|
|
if (t.FloorID != this.FloorID) return t.ModelId
|
|
|
this.sign = t.Sign > 0
|
|
|
this.FloorName = t.FloorLocalName || t.FloorName
|
|
|
this.$refs.drawFloor.buildFloorName = `${this.BuildName}-${this.FloorName}`
|
|
|
+ t.modelId && this.getFileName(t.modelId)
|
|
|
}).filter((t) => t)
|
|
|
})
|
|
|
},
|
|
@@ -258,6 +261,10 @@ export default {
|
|
|
vm.refresh(uploadKey + '.' + type)
|
|
|
// 设置步骤为第一步
|
|
|
vm.step = 0;
|
|
|
+ // watch中不会走到initGraph,所以手动触发
|
|
|
+ vm.$nextTick(()=>{
|
|
|
+ vm.initFromModelId(uploadKey + '.' + type)
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -289,6 +296,7 @@ export default {
|
|
|
this.$message.success('更新成功')
|
|
|
this.step = -1;
|
|
|
this.baseImgItem.globalAlpha = 1
|
|
|
+ this.baseImgItem.moveable = false;
|
|
|
scaleItem.show()
|
|
|
this.removeLast()
|
|
|
this.$refs.drawFloor.fit()
|
|
@@ -297,8 +305,12 @@ export default {
|
|
|
// 根据modelid初始化
|
|
|
initFromModelId(id){
|
|
|
const temp = id.split('.')[1];
|
|
|
- if (temp && (temp.toLowerCase() == 'png' || temp.toLowerCase() == 'jpg')) {
|
|
|
- this.$refs.drawFloor.initGraphy(id, 3)
|
|
|
+ if (temp) {
|
|
|
+ if (temp.toLowerCase() == 'png' || temp.toLowerCase() == 'jpg') {
|
|
|
+ this.$refs.drawFloor.initGraphy(id, 3)
|
|
|
+ } else {
|
|
|
+ this.$refs.drawFloor.initGraphy(id, 2)
|
|
|
+ }
|
|
|
} else {
|
|
|
this.$refs.drawFloor.initGraphy(id, 1)
|
|
|
}
|
|
@@ -308,6 +320,7 @@ export default {
|
|
|
this.step = 0;
|
|
|
this.$refs.drawFloor.scaleItem.show()
|
|
|
this.baseImgItem.globalAlpha = 1
|
|
|
+ this.baseImgItem.moveable = false;
|
|
|
this.removeLast()
|
|
|
},
|
|
|
// 下一步||保存
|
|
@@ -320,7 +333,7 @@ export default {
|
|
|
this.step = 1;
|
|
|
this.$refs.drawFloor.scaleItem.hide();
|
|
|
// 获取楼层列表
|
|
|
- this.getFloorData()
|
|
|
+ this.getFloorData('next')
|
|
|
} else if (this.step == 1) {
|
|
|
// 保存
|
|
|
this.updateFloorKey();
|
|
@@ -353,30 +366,37 @@ export default {
|
|
|
changeFloor(v) {
|
|
|
// v->当前改为的楼层对象
|
|
|
this.removeLast();
|
|
|
+ this.loadOtherImg(v)
|
|
|
+ },
|
|
|
+ // 加载其他楼层图片
|
|
|
+ loadOtherImg(v) {
|
|
|
if (v.StructureInfo && v.StructureInfo.FloorMap) {
|
|
|
- const url = this.imgService + v.StructureInfo.FloorMap
|
|
|
- this.curImgItem = new SImageItem(null, url);
|
|
|
- this.curImgItem.enabled = false;
|
|
|
- this.curImgItem.showType = SImageShowType.AutoFit;
|
|
|
- if (v.Properties) {
|
|
|
- try {
|
|
|
- // 计算两个比例尺差距
|
|
|
- const scaleItem = this.$refs.drawFloor.scaleItem
|
|
|
- this.curImgItem.zOrder = scaleItem.zOrder - 1;
|
|
|
- const r = this.calScaleGap(v.Properties, scaleItem);
|
|
|
- if (r != 1) {
|
|
|
- this.$message.warning('比例尺相差较大,可以返回上一步修改比例尺')
|
|
|
+ const temp = this.modelId.split('.');
|
|
|
+ if (temp[1] && (temp[1].toLowerCase() == 'png' || temp[1].toLowerCase() == 'jpg')) {
|
|
|
+ const url = this.imgService + v.StructureInfo.FloorMap
|
|
|
+ this.curImgItem = new SImageItem(null, url);
|
|
|
+ this.curImgItem.enabled = false;
|
|
|
+ this.curImgItem.showType = SImageShowType.AutoFit;
|
|
|
+ if (v.Properties) {
|
|
|
+ try {
|
|
|
+ // 计算两个比例尺差距
|
|
|
+ const scaleItem = this.$refs.drawFloor.scaleItem
|
|
|
+ this.curImgItem.zOrder = scaleItem.zOrder - 1;
|
|
|
+ const r = this.calScaleGap(v.Properties, scaleItem);
|
|
|
+ if (r != 1) {
|
|
|
+ this.$message.warning('比例尺相差较大,可以返回上一步修改比例尺')
|
|
|
+ }
|
|
|
+ this.curImgItem.showType == SImageShowType.Full;
|
|
|
+ this.curImgItem.moveTo(v.Properties.X, v.Properties.Y);
|
|
|
+ // this.curImgItem.width = v.Properties.width;
|
|
|
+ // this.curImgItem.height = v.Properties.height;
|
|
|
+ } catch (err) {
|
|
|
+ console.log(err);
|
|
|
}
|
|
|
- this.curImgItem.showType == SImageShowType.Full;
|
|
|
- this.curImgItem.moveTo(v.Properties.X, v.Properties.Y);
|
|
|
- // this.curImgItem.width = v.Properties.width;
|
|
|
- // this.curImgItem.height = v.Properties.height;
|
|
|
- } catch (err) {
|
|
|
- console.log(err);
|
|
|
}
|
|
|
+ this.$refs.drawFloor.drawMainScene.addItem(this.curImgItem);
|
|
|
+ this.$refs.drawFloor.fit()
|
|
|
}
|
|
|
- this.$refs.drawFloor.drawMainScene.addItem(this.curImgItem);
|
|
|
- this.$refs.drawFloor.fit()
|
|
|
}
|
|
|
},
|
|
|
// 清除上一张底图
|
|
@@ -418,6 +438,7 @@ export default {
|
|
|
modelId(n, o) {
|
|
|
if (n != o) {
|
|
|
if (n) {
|
|
|
+ // 替换的时候需要走
|
|
|
this.$nextTick(()=>{
|
|
|
this.initFromModelId(n)
|
|
|
})
|