|
@@ -3,14 +3,16 @@
|
|
|
<div id='repetitionGraphy'>
|
|
|
<div class='buttons'>
|
|
|
<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-button size="mini">{{hasGraph?'替换平面图图片':'上传平面图图片'}}</el-button>
|
|
|
</el-upload>
|
|
|
- <el-button v-if='step>-1' style='float:right;' size='mini' type='primary' @click="nextStep">{{step==0?'下一步':step==1?'保存':''}}</el-button>
|
|
|
+ <el-button style='float:right;' size='mini' type='primary' v-if="step==0" @click="nextStep">下一步</el-button>
|
|
|
+ <el-button style='float:right;' size='mini' type='primary' v-if="step==1" @click="nextStep">保存</el-button>
|
|
|
+ <el-button style='float:right;' size='mini' v-if="step==1" @click="lastStep">上一步</el-button>
|
|
|
</template>
|
|
|
<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='isEdit' size='mini' @click='cancel'>取消</el-button>
|
|
|
<el-button v-if='isEdit' size='mini' @click='confirm' type='primary'>确认</el-button>
|
|
@@ -72,7 +74,7 @@ export default {
|
|
|
otherSign: false,
|
|
|
hasGraph: false, // 当前楼层是否有平面图
|
|
|
hasModel: false, // 项目中时候有模型文件
|
|
|
- step: -1, // 当前处于第几步
|
|
|
+ step: -1, // 当前处于第几步 同时为比例尺item判断是否创建的可编辑的依据
|
|
|
key: '', // 当楼层图为图片时图的key
|
|
|
stepDes: [
|
|
|
'请在图上点击两点绘制线段并标记实际长度',
|
|
@@ -242,8 +244,13 @@ export default {
|
|
|
}
|
|
|
reader.readAsArrayBuffer(file)
|
|
|
},
|
|
|
- // 更新楼层key 为图片
|
|
|
+ // 更新楼层key 为图片,同时更新比例尺
|
|
|
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 = {
|
|
|
Content: [{
|
|
|
FloorId: this.FloorID,
|
|
@@ -251,8 +258,8 @@ export default {
|
|
|
Properties: {
|
|
|
X: this.baseImgItem.x,
|
|
|
Y: this.baseImgItem.y,
|
|
|
- line: this.scaleItem.line,
|
|
|
- Scale: this.scaleItem
|
|
|
+ Line: line,
|
|
|
+ Text: scaleItem.text
|
|
|
}
|
|
|
}],
|
|
|
Projection: ['FloorMap', 'Properties'],
|
|
@@ -260,6 +267,9 @@ export default {
|
|
|
manageUpdateFloor(Param, (res) => {
|
|
|
this.$message.success('更新成功')
|
|
|
this.step = -1;
|
|
|
+ this.baseImgItem.globalAlpha = 1
|
|
|
+ this.removeLast()
|
|
|
+ this.$refs.drawFloor.fit()
|
|
|
})
|
|
|
},
|
|
|
// 根据modelid初始化
|
|
@@ -270,6 +280,13 @@ export default {
|
|
|
this.$refs.drawFloor.initGraphy(id, 1)
|
|
|
}
|
|
|
},
|
|
|
+ // 上一步
|
|
|
+ lastStep() {
|
|
|
+ this.step = 0;
|
|
|
+ this.$refs.drawFloor.scaleItem.show()
|
|
|
+ this.baseImgItem.globalAlpha = 1
|
|
|
+ this.removeLast()
|
|
|
+ },
|
|
|
// 下一步||保存
|
|
|
nextStep() {
|
|
|
this.baseImgItem = this.$refs.drawFloor.drawMainScene.imgList[0]
|
|
@@ -278,28 +295,24 @@ export default {
|
|
|
// 下一步
|
|
|
if (this.step == 0) {
|
|
|
this.step = 1;
|
|
|
- this.scaleItem.hide();
|
|
|
- //
|
|
|
+ this.$refs.drawFloor.scaleItem.hide();
|
|
|
+ // 获取楼层列表
|
|
|
this.getFloorData()
|
|
|
} else if (this.step == 1) {
|
|
|
// 保存
|
|
|
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() {
|
|
|
- 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;
|
|
|
}
|
|
|
},
|
|
|
// 修改比例尺文字
|
|
@@ -326,7 +339,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
this.$refs.drawFloor.drawMainScene.addItem(this.curImgItem);
|
|
|
- this.$refs.drawFloor.view.fitSceneToView()
|
|
|
+ this.$refs.drawFloor.fit()
|
|
|
}
|
|
|
},
|
|
|
// 清除上一张底图
|