|
@@ -3,7 +3,7 @@
|
|
<div id='repetitionGraphy'>
|
|
<div id='repetitionGraphy'>
|
|
<div class='buttons'>
|
|
<div class='buttons'>
|
|
<el-button icon='el-icon-back' size='mini' @click='backRouter'></el-button>
|
|
<el-button icon='el-icon-back' size='mini' @click='backRouter'></el-button>
|
|
- <template v-if="!!hasModel">
|
|
|
|
|
|
+ <template v-if="!hasModel">
|
|
<el-upload class='upload-demo' action='string' :http-request='uploadAndSubmit' :show-file-list='false' v-if="step==-1">
|
|
<el-upload class='upload-demo' action='string' :http-request='uploadAndSubmit' :show-file-list='false' v-if="step==-1">
|
|
<el-button size="mini">{{hasGraph?'替换平面图图片':'上传平面图图片'}}</el-button>
|
|
<el-button size="mini">{{hasGraph?'替换平面图图片':'上传平面图图片'}}</el-button>
|
|
</el-upload>
|
|
</el-upload>
|
|
@@ -12,7 +12,7 @@
|
|
<el-button style='float:right;' size='mini' v-if="step==1" @click="lastStep">上一步</el-button>
|
|
<el-button style='float:right;' size='mini' v-if="step==1" @click="lastStep">上一步</el-button>
|
|
</template>
|
|
</template>
|
|
<template v-else>
|
|
<template v-else>
|
|
- <el-button v-if='!isEdit' size='mini' @click='changeGraphy'>{{hasGraph?'关联模型文件':'替换模型文件'}}</el-button>
|
|
|
|
|
|
+ <el-button v-if='!isEdit' size='mini' @click='changeGraphy'>{{hasGraph?'替换模型文件':'关联模型文件'}}</el-button>
|
|
<el-button v-if='(sign||otherSign)&&!isEdit' size='mini' @click='editGraphy'>编辑平面图</el-button>
|
|
<el-button v-if='(sign||otherSign)&&!isEdit' size='mini' @click='editGraphy'>编辑平面图</el-button>
|
|
<el-button v-if='isEdit' size='mini' @click='cancel'>取消</el-button>
|
|
<el-button v-if='isEdit' size='mini' @click='cancel'>取消</el-button>
|
|
<el-button v-if='isEdit' size='mini' @click='confirm' type='primary'>确认</el-button>
|
|
<el-button v-if='isEdit' size='mini' @click='confirm' type='primary'>确认</el-button>
|
|
@@ -74,7 +74,7 @@ export default {
|
|
otherSign: false,
|
|
otherSign: false,
|
|
hasGraph: false, // 当前楼层是否有平面图
|
|
hasGraph: false, // 当前楼层是否有平面图
|
|
hasModel: false, // 项目中时候有模型文件
|
|
hasModel: false, // 项目中时候有模型文件
|
|
- step: -1, // 当前处于第几步
|
|
|
|
|
|
+ step: -1, // 当前处于第几步 同时为比例尺item判断是否创建的可编辑的依据
|
|
key: '', // 当楼层图为图片时图的key
|
|
key: '', // 当楼层图为图片时图的key
|
|
stepDes: [
|
|
stepDes: [
|
|
'请在图上点击两点绘制线段并标记实际长度',
|
|
'请在图上点击两点绘制线段并标记实际长度',
|
|
@@ -244,8 +244,13 @@ export default {
|
|
}
|
|
}
|
|
reader.readAsArrayBuffer(file)
|
|
reader.readAsArrayBuffer(file)
|
|
},
|
|
},
|
|
- // 更新楼层key 为图片
|
|
|
|
|
|
+ // 更新楼层key 为图片,同时更新比例尺
|
|
updateFloorKey(){
|
|
updateFloorKey(){
|
|
|
|
+ const scaleItem = this.$refs.drawFloor.scaleItem;
|
|
|
|
+ // 比例尺坐标处理,当底图被对齐操作后,需要跟随底图改变坐标
|
|
|
|
+ const line = scaleItem.line.map(t => {
|
|
|
|
+ return { x: t.x + this.baseImgItem.x, y: t.y + this.baseImgItem.y }
|
|
|
|
+ })
|
|
let Param = {
|
|
let Param = {
|
|
Content: [{
|
|
Content: [{
|
|
FloorId: this.FloorID,
|
|
FloorId: this.FloorID,
|
|
@@ -253,8 +258,8 @@ export default {
|
|
Properties: {
|
|
Properties: {
|
|
X: this.baseImgItem.x,
|
|
X: this.baseImgItem.x,
|
|
Y: this.baseImgItem.y,
|
|
Y: this.baseImgItem.y,
|
|
- line: JSON.parse(JSON.stringify(this.scaleItem.line)),
|
|
|
|
- Scale: this.scaleItem.text
|
|
|
|
|
|
+ Line: line,
|
|
|
|
+ Text: scaleItem.text
|
|
}
|
|
}
|
|
}],
|
|
}],
|
|
Projection: ['FloorMap', 'Properties'],
|
|
Projection: ['FloorMap', 'Properties'],
|
|
@@ -264,6 +269,7 @@ export default {
|
|
this.step = -1;
|
|
this.step = -1;
|
|
this.baseImgItem.globalAlpha = 1
|
|
this.baseImgItem.globalAlpha = 1
|
|
this.removeLast()
|
|
this.removeLast()
|
|
|
|
+ this.$refs.drawFloor.fit()
|
|
})
|
|
})
|
|
},
|
|
},
|
|
// 根据modelid初始化
|
|
// 根据modelid初始化
|
|
@@ -277,7 +283,7 @@ export default {
|
|
// 上一步
|
|
// 上一步
|
|
lastStep() {
|
|
lastStep() {
|
|
this.step = 0;
|
|
this.step = 0;
|
|
- this.scaleItem.show()
|
|
|
|
|
|
+ this.$refs.drawFloor.scaleItem.show()
|
|
this.baseImgItem.globalAlpha = 1
|
|
this.baseImgItem.globalAlpha = 1
|
|
this.removeLast()
|
|
this.removeLast()
|
|
},
|
|
},
|
|
@@ -289,28 +295,24 @@ export default {
|
|
// 下一步
|
|
// 下一步
|
|
if (this.step == 0) {
|
|
if (this.step == 0) {
|
|
this.step = 1;
|
|
this.step = 1;
|
|
- this.scaleItem.hide();
|
|
|
|
- //
|
|
|
|
|
|
+ this.$refs.drawFloor.scaleItem.hide();
|
|
|
|
+ // 获取楼层列表
|
|
this.getFloorData()
|
|
this.getFloorData()
|
|
} else if (this.step == 1) {
|
|
} else if (this.step == 1) {
|
|
// 保存
|
|
// 保存
|
|
this.updateFloorKey();
|
|
this.updateFloorKey();
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- // 比例尺
|
|
|
|
- setScale() {
|
|
|
|
- this.scaleItem = new EditLineItem(null)
|
|
|
|
- this.$refs.drawFloor.drawMainScene.addItem(this.scaleItem)
|
|
|
|
- this.scaleItem.connect('changText', this, this.changeText)
|
|
|
|
- this.scaleItem.strokeColor = SColor.Red;
|
|
|
|
- this.scaleItem.status = SItemStatus.Create;
|
|
|
|
- this.$refs.drawFloor.drawMainScene.grabItem = this.scaleItem;
|
|
|
|
- this.scaleItem.moveable = true;
|
|
|
|
- },
|
|
|
|
- // 加载图成功
|
|
|
|
|
|
+ // 加载图成功 仅在底图为图片时返回成功
|
|
getGraphSuc() {
|
|
getGraphSuc() {
|
|
- if (this.key) {
|
|
|
|
- this.setScale();
|
|
|
|
|
|
+ const scaleItem = this.$refs.drawFloor.scaleItem
|
|
|
|
+ if (this.step == 0) {
|
|
|
|
+ scaleItem.status = SItemStatus.Create;
|
|
|
|
+ this.$refs.drawFloor.drawMainScene.grabItem = scaleItem;
|
|
|
|
+ scaleItem.connect('changText', this, this.changeText)
|
|
|
|
+ scaleItem.moveable = true;
|
|
|
|
+ } else if (this.step == -1) {
|
|
|
|
+ scaleItem.status = SItemStatus.Normal;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 修改比例尺文字
|
|
// 修改比例尺文字
|
|
@@ -337,7 +339,7 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.$refs.drawFloor.drawMainScene.addItem(this.curImgItem);
|
|
this.$refs.drawFloor.drawMainScene.addItem(this.curImgItem);
|
|
- this.$refs.drawFloor.view.fitSceneToView()
|
|
|
|
|
|
+ this.$refs.drawFloor.fit()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 清除上一张底图
|
|
// 清除上一张底图
|