|
@@ -3,11 +3,14 @@
|
|
|
<div id='repetitionGraphy'>
|
|
|
<div class='buttons'>
|
|
|
<el-button icon='el-icon-back' size='mini' @click='backRouter'></el-button>
|
|
|
- <template v-if="!hasGraph">
|
|
|
- <el-button size='mini' @click='changeGraphy'>{{hasModel?'关联模型文件':'上传平面图图片'}}</el-button>
|
|
|
+ <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>
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
- <el-button v-if='!isEdit' size='mini' @click='changeGraphy'>替换平面图</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>
|
|
@@ -16,8 +19,14 @@
|
|
|
</div>
|
|
|
<!-- 展示图片 -->
|
|
|
<div class='drawImg'>
|
|
|
- <div style="width: 100%;height: 100%" v-if="hasGraph">
|
|
|
+ <div style="width: 100%;height: 100%;position: relative;" v-if="hasGraph">
|
|
|
<drawFloor ref='drawFloor' :isEdit='isEdit' :showTools='true' :id='1' @changeSign='changeSign'></drawFloor>
|
|
|
+ <div class="stepContainer" v-if="step>-1">
|
|
|
+ <el-steps :active="step" align-center finish-status="success" process-status="process">
|
|
|
+ <el-step title="设定比例尺"></el-step>
|
|
|
+ <el-step title="楼层对齐"></el-step>
|
|
|
+ </el-steps>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div style="width: 100%;height: 100%" v-else>
|
|
|
<div class="center" style="padding-top: 300px">
|
|
@@ -26,14 +35,14 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 查看图片弹窗 -->
|
|
|
- <checkGraphy ref='checkGraphy' @refresh='refresh' :alreadyRelatedModel='alreadyRelatedModel' @hasModel="getCount"></checkGraphy>
|
|
|
+ <checkGraphy ref='checkGraphy' @refresh='refresh' :alreadyRelatedModel='alreadyRelatedModel'></checkGraphy>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import drawFloor from './drawGraphy/drawFloor'
|
|
|
import checkGraphy from './drawGraphy/checkGraphy' //查看图片
|
|
|
-import { floorUpdateOutline, floorQueryAndSign } from '@/api/scan/request'
|
|
|
-import { getFileNameById } from '@/api/model/file'
|
|
|
+import { floorUpdateOutline, floorQueryAndSign, manageUpdateFloor } from '@/api/scan/request'
|
|
|
+import { getFileNameById, countModel } from '@/api/model/file'
|
|
|
export default {
|
|
|
components: {
|
|
|
drawFloor,
|
|
@@ -49,6 +58,7 @@ export default {
|
|
|
otherSign: false,
|
|
|
hasGraph: false, // 当前楼层是否有平面图
|
|
|
hasModel: false, // 项目中时候有模型文件
|
|
|
+ step: -1, // 当前处于第几步
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -60,13 +70,12 @@ export default {
|
|
|
this.hasGraph = true;
|
|
|
const temp = this.modelId.split('.');
|
|
|
if (temp[1] == 'png' || temp[1] == 'jpg') {
|
|
|
- return
|
|
|
+ // return
|
|
|
} else {
|
|
|
this.init()
|
|
|
}
|
|
|
- } else {
|
|
|
- this.hasGraph = false;
|
|
|
}
|
|
|
+ this.getCountModel()
|
|
|
},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
@@ -80,7 +89,7 @@ export default {
|
|
|
},
|
|
|
// 替换模型文件
|
|
|
changeGraphy() {
|
|
|
- this.$refs.checkGraphy.showDialog({ FloorID: this.FloorID, BuildID: this.BuildID })
|
|
|
+ this.$refs.checkGraphy.showDialog({ FloorID: this.FloorID, BuildID: this.BuildID })
|
|
|
},
|
|
|
// 确认保存
|
|
|
confirm() {
|
|
@@ -159,20 +168,87 @@ export default {
|
|
|
changeSign(flag) {
|
|
|
this.otherSign = flag
|
|
|
},
|
|
|
- // 当前项目中是否有模型文件
|
|
|
- getCount(flag) {
|
|
|
- this.hasModel = flag;
|
|
|
- }
|
|
|
+ // 统计项目下是否有模型文件
|
|
|
+ getCountModel(){
|
|
|
+ countModel({}, res => {
|
|
|
+ this.hasModel = res.Count > 0
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //上传图片
|
|
|
+ uploadAndSubmit(item) {
|
|
|
+ let file = item.file
|
|
|
+ let reader = new FileReader()
|
|
|
+ let vm = this
|
|
|
+ let fileType = file.name.split('.')
|
|
|
+ let type = fileType[fileType.length - 1]
|
|
|
+ let uploadKey = file.uid
|
|
|
+ reader.onloadend = function () {
|
|
|
+ // 这个事件在读取结束后,无论成功或者失败都会触发
|
|
|
+ if (reader.error) {
|
|
|
+ } else {
|
|
|
+ // document.getElementById("bytesRead").textContent = file.size;
|
|
|
+ // 构造 XMLHttpRequest 对象,发送文件 Binary 数据
|
|
|
+ var xhr = new XMLHttpRequest()
|
|
|
+ xhr.open(
|
|
|
+ /* method */ 'POST',
|
|
|
+ /* target url */
|
|
|
+ '/image-service/common/image_upload?systemId=dataPlatform&secret=9e0891a7a8c8e885&overwrite=true&key=' + uploadKey + '.' + type
|
|
|
+ /*, async, default to true */
|
|
|
+ )
|
|
|
+ //xhr.overrideMimeType("application/octet-stream");
|
|
|
+ xhr.send(reader.result)
|
|
|
+ xhr.onreadystatechange = function () {
|
|
|
+ if (xhr.readyState == 4) {
|
|
|
+ if (xhr.status == 200) {
|
|
|
+ vm.key = uploadKey + '.' + type
|
|
|
+ // 将图片展示
|
|
|
+ vm.refresh(uploadKey + '.' + type)
|
|
|
+ // 设置步骤为第一步
|
|
|
+ vm.step = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ reader.readAsArrayBuffer(file)
|
|
|
+ },
|
|
|
+ // 更新楼层key 为图片
|
|
|
+ updateFloorKey(){
|
|
|
+ let Param = {
|
|
|
+ Content: [{ FloorId: this.FloorID, StructureInfo: { FloorMap: this.key } }],
|
|
|
+ Projection: ['FloorMap'],
|
|
|
+ }
|
|
|
+ manageUpdateFloor(Param, (res) => {
|
|
|
+ this.$message.success('更新成功')
|
|
|
+ this.step = -1;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 根据modelid初始化
|
|
|
+ initFromModelId(id){
|
|
|
+ if (id.split('.')[1] == 'png' || id.split('.')[1] == 'jpg') {
|
|
|
+ this.$refs.drawFloor.initGraphy(id, 3)
|
|
|
+ } else {
|
|
|
+ this.$refs.drawFloor.initGraphy(id, 1)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 下一步||保存
|
|
|
+ nextStep() {
|
|
|
+ // 下一步
|
|
|
+ if (this.step == 0) {
|
|
|
+ this.step = 1
|
|
|
+ } else if (this.step == 1) {
|
|
|
+ // 保存
|
|
|
+ this.updateFloorKey();
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
watch: {
|
|
|
modelId(n, o) {
|
|
|
if (n != o) {
|
|
|
if (n) {
|
|
|
- if (n.split('.')[1] == 'png' || n.split('.')[1] == 'jpg') {
|
|
|
- this.$refs.drawFloor.initGraphy(n, 3)
|
|
|
- } else {
|
|
|
- this.$refs.drawFloor.initGraphy(n, 1)
|
|
|
- }
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.initFromModelId(n)
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -192,5 +268,17 @@ export default {
|
|
|
margin-top: 10px;
|
|
|
height: calc(100% - 40px);
|
|
|
}
|
|
|
+ .upload-demo {
|
|
|
+ display: inline-block;
|
|
|
+ }
|
|
|
+ .stepContainer {
|
|
|
+ width: 100%;
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 50%;
|
|
|
+ margin-left: -50%;
|
|
|
+ z-index: 9;
|
|
|
+ background-color: #fff;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|