|
@@ -4,7 +4,8 @@
|
|
<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" accept=".jpg,.png" :before-upload="beforeUpload">
|
|
|
|
|
|
+ <el-upload class='upload-demo' action='string' :http-request='uploadAndSubmit' :show-file-list='false' v-if="step==-1" accept=".jpg,.png"
|
|
|
|
+ :before-upload="beforeUpload">
|
|
<el-button size="mini">{{hasGraph?'替换平面图图片':'上传平面图图片'}}</el-button>
|
|
<el-button size="mini">{{hasGraph?'替换平面图图片':'上传平面图图片'}}</el-button>
|
|
</el-upload>
|
|
</el-upload>
|
|
<el-button style='float:right;' size='mini' type='primary' v-if="step==0" @click="nextStep" :disabled="nextStepBtnDisable">下一步</el-button>
|
|
<el-button style='float:right;' size='mini' type='primary' v-if="step==0" @click="nextStep" :disabled="nextStepBtnDisable">下一步</el-button>
|
|
@@ -99,6 +100,7 @@ export default {
|
|
scaleItem: null, // 比例尺item
|
|
scaleItem: null, // 比例尺item
|
|
baseImgItem: null, // 当前楼层图的图片
|
|
baseImgItem: null, // 当前楼层图的图片
|
|
nextStepBtnDisable: true, // 比例尺item创建标识
|
|
nextStepBtnDisable: true, // 比例尺item创建标识
|
|
|
|
+ timeOut: true, // 保存按钮延时3秒可操作
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
@@ -115,13 +117,15 @@ export default {
|
|
} else {
|
|
} else {
|
|
this.init()
|
|
this.init()
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ this.init()
|
|
}
|
|
}
|
|
this.getCountModel()
|
|
this.getCountModel()
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
this.$refs.drawFloor.buildFloorName = `${this.BuildName}-${this.FloorName}`
|
|
this.$refs.drawFloor.buildFloorName = `${this.BuildName}-${this.FloorName}`
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- mounted() {},
|
|
|
|
|
|
+ mounted() { },
|
|
methods: {
|
|
methods: {
|
|
init() {
|
|
init() {
|
|
this.getFloorData()
|
|
this.getFloorData()
|
|
@@ -140,7 +144,7 @@ export default {
|
|
},
|
|
},
|
|
// 替换模型文件
|
|
// 替换模型文件
|
|
changeGraphy() {
|
|
changeGraphy() {
|
|
- this.$refs.checkGraphy.showDialog({ FloorID: this.FloorID, BuildID: this.BuildID })
|
|
|
|
|
|
+ this.$refs.checkGraphy.showDialog({ FloorID: this.FloorID, BuildID: this.BuildID, CurrentModelId: this.currentModelId })
|
|
},
|
|
},
|
|
// 确认保存
|
|
// 确认保存
|
|
confirm() {
|
|
confirm() {
|
|
@@ -159,14 +163,16 @@ export default {
|
|
Outline = this.$refs.drawFloor.drawMainScene.sceneMark.outLine
|
|
Outline = this.$refs.drawFloor.drawMainScene.sceneMark.outLine
|
|
Outline = Outline.map((t) => {
|
|
Outline = Outline.map((t) => {
|
|
return {
|
|
return {
|
|
- x: t.x.toFixed(2),
|
|
|
|
- y: -t.y.toFixed(2),
|
|
|
|
|
|
+ X: t.x.toFixed(2),
|
|
|
|
+ Y: -t.y.toFixed(2),
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
let pa = {
|
|
let pa = {
|
|
- content: [{ id: this.FloorID, outline: Outline }],
|
|
|
|
- projection: ['outline'],
|
|
|
|
|
|
+ content: [{ id: this.FloorID, outline: Outline }]
|
|
|
|
+ }
|
|
|
|
+ if (!Outline) {
|
|
|
|
+ pa.nullItems = ['outline']
|
|
}
|
|
}
|
|
floorUpdateOutline(pa, (res) => {
|
|
floorUpdateOutline(pa, (res) => {
|
|
this.isEdit = false
|
|
this.isEdit = false
|
|
@@ -183,12 +189,20 @@ export default {
|
|
this.isEdit = true
|
|
this.isEdit = true
|
|
},
|
|
},
|
|
// 替换模型文件成功
|
|
// 替换模型文件成功
|
|
- refresh(modelId) {
|
|
|
|
|
|
+ refresh(modelId,pa) {
|
|
this.modelId = modelId
|
|
this.modelId = modelId
|
|
this.hasGraph = true;
|
|
this.hasGraph = true;
|
|
const temp = this.modelId.split('.');
|
|
const temp = this.modelId.split('.');
|
|
- if (temp[1] && temp[1].toLowerCase() != 'png' && temp[1].toLowerCase() != 'jpg') {
|
|
|
|
|
|
+ if (temp[1]) {
|
|
|
|
+ if (temp[1].toLowerCase() != 'png' && temp[1].toLowerCase() != 'jpg') {
|
|
|
|
+ // do nothing
|
|
|
|
+ } else {
|
|
|
|
+ // do nothing
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
this.key = '';
|
|
this.key = '';
|
|
|
|
+ pa && pa.id && this.getFileName(pa.id)
|
|
|
|
+ this.initFromModelId(this.modelId)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 获取文件夹名称
|
|
// 获取文件夹名称
|
|
@@ -221,6 +235,7 @@ export default {
|
|
this.alreadyRelatedModel = res.content.map((t) => {
|
|
this.alreadyRelatedModel = res.content.map((t) => {
|
|
if (t.id != this.FloorID) return t.modelId
|
|
if (t.id != this.FloorID) return t.modelId
|
|
this.sign = t.Sign > 0
|
|
this.sign = t.Sign > 0
|
|
|
|
+ this.currentModelId = t.modelId;
|
|
t.modelId && this.getFileName(t.modelId)
|
|
t.modelId && this.getFileName(t.modelId)
|
|
}).filter((t) => t)
|
|
}).filter((t) => t)
|
|
})
|
|
})
|
|
@@ -230,7 +245,7 @@ export default {
|
|
},
|
|
},
|
|
// 统计项目下是否有模型文件
|
|
// 统计项目下是否有模型文件
|
|
getCountModel() {
|
|
getCountModel() {
|
|
- countModel({Filters:"Status in [4]"}, res => {
|
|
|
|
|
|
+ countModel({ Filters: "Status in [4]" }, res => {
|
|
this.hasModel = res.Count > 0
|
|
this.hasModel = res.Count > 0
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -266,9 +281,11 @@ export default {
|
|
// 设置步骤为第一步
|
|
// 设置步骤为第一步
|
|
vm.step = 0;
|
|
vm.step = 0;
|
|
// watch中不会走到initGraph,所以手动触发
|
|
// watch中不会走到initGraph,所以手动触发
|
|
- vm.$nextTick(()=>{
|
|
|
|
|
|
+ vm.$nextTick(() => {
|
|
vm.initFromModelId(uploadKey + '.' + type)
|
|
vm.initFromModelId(uploadKey + '.' + type)
|
|
})
|
|
})
|
|
|
|
+ // 设定保存按钮不可操作
|
|
|
|
+ this.timeOut = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -281,8 +298,8 @@ export default {
|
|
// 拿到当前上传图片的name,判断其后缀名是否符合
|
|
// 拿到当前上传图片的name,判断其后缀名是否符合
|
|
let type = this.isImage(file.name);
|
|
let type = this.isImage(file.name);
|
|
if (!type) {
|
|
if (!type) {
|
|
- this.$message.error('仅支持png、jpg格式的图片');
|
|
|
|
- return false
|
|
|
|
|
|
+ this.$message.error('仅支持png、jpg格式的图片');
|
|
|
|
+ return false
|
|
}
|
|
}
|
|
return true
|
|
return true
|
|
},
|
|
},
|
|
@@ -306,10 +323,10 @@ export default {
|
|
let Param = {
|
|
let Param = {
|
|
content: [{
|
|
content: [{
|
|
id: this.FloorID,
|
|
id: this.FloorID,
|
|
- infos: {
|
|
|
|
|
|
+ infos: {
|
|
floorMap: this.key,
|
|
floorMap: this.key,
|
|
floorMapRatio: proScale,
|
|
floorMapRatio: proScale,
|
|
- floorMapShift: JSON.stringify({x: this.baseImgItem.x, y: this.baseImgItem.y})
|
|
|
|
|
|
+ floorMapShift: JSON.stringify({ x: this.baseImgItem.x, y: this.baseImgItem.y })
|
|
},
|
|
},
|
|
properties: {
|
|
properties: {
|
|
line: line,
|
|
line: line,
|
|
@@ -359,6 +376,10 @@ export default {
|
|
this.$refs.drawFloor.scaleItem.hide();
|
|
this.$refs.drawFloor.scaleItem.hide();
|
|
// 获取楼层列表
|
|
// 获取楼层列表
|
|
this.getFloorData('next')
|
|
this.getFloorData('next')
|
|
|
|
+ // 延时3秒可操作性保存按钮
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.timeOut = false
|
|
|
|
+ }, 3000)
|
|
} else if (this.step == 1) {
|
|
} else if (this.step == 1) {
|
|
// 保存
|
|
// 保存
|
|
this.updateFloorKey();
|
|
this.updateFloorKey();
|
|
@@ -394,7 +415,7 @@ export default {
|
|
this.loadOtherImg(v)
|
|
this.loadOtherImg(v)
|
|
},
|
|
},
|
|
// 加载其他楼层图片
|
|
// 加载其他楼层图片
|
|
- loadOtherImg(v){
|
|
|
|
|
|
+ loadOtherImg(v) {
|
|
if (v.infos && v.infos.floorMap) {
|
|
if (v.infos && v.infos.floorMap) {
|
|
const temp = this.modelId.split('.');
|
|
const temp = this.modelId.split('.');
|
|
if (temp[1] && (temp[1].toLowerCase() == 'png' || temp[1].toLowerCase() == 'jpg')) {
|
|
if (temp[1] && (temp[1].toLowerCase() == 'png' || temp[1].toLowerCase() == 'jpg')) {
|
|
@@ -459,16 +480,16 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
- modelId(n, o) {
|
|
|
|
- if (o && n != o) {
|
|
|
|
- if (n) {
|
|
|
|
- // 替换的时候需要走
|
|
|
|
- this.$nextTick(()=>{
|
|
|
|
- this.initFromModelId(n)
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
|
|
+ // modelId(n, o) {
|
|
|
|
+ // if (o && n != o) {
|
|
|
|
+ // if (n) {
|
|
|
|
+ // // 替换的时候需要走
|
|
|
|
+ // this.$nextTick(() => {
|
|
|
|
+ // this.initFromModelId(n)
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
},
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|