|
@@ -3,18 +3,30 @@
|
|
|
<div id='repetitionGraphy'>
|
|
|
<div class='buttons'>
|
|
|
<el-button icon='el-icon-back' size='mini' @click='backRouter'></el-button>
|
|
|
- <el-button v-if='!isEdit' size='mini' @click='changeGraphy'>替换平面图</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>
|
|
|
+ <template v-if="!hasGraph">
|
|
|
+ <el-button size='mini' @click='changeGraphy'>{{hasModel?'关联模型文件':'上传平面图图片'}}</el-button>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-button v-if='!isEdit' size='mini' @click='changeGraphy'>替换平面图</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>
|
|
|
+ </template>
|
|
|
<span style='float:right;' v-if='file.FolderName'>当前对应的模型文件:{{file.FolderName}} - {{file.FloorName}}</span>
|
|
|
</div>
|
|
|
<!-- 展示图片 -->
|
|
|
<div class='drawImg'>
|
|
|
- <drawFloor ref='drawFloor' :isEdit='isEdit' :showTools='true' :id='1' @changeSign='changeSign'></drawFloor>
|
|
|
+ <div style="width: 100%;height: 100%" v-if="hasGraph">
|
|
|
+ <drawFloor ref='drawFloor' :isEdit='isEdit' :showTools='true' :id='1' @changeSign='changeSign'></drawFloor>
|
|
|
+ </div>
|
|
|
+ <div style="width: 100%;height: 100%" v-else>
|
|
|
+ <div class="center" style="padding-top: 300px">
|
|
|
+ <i class="icon-wushuju iconfont"></i>暂无平面图
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<!-- 查看图片弹窗 -->
|
|
|
- <checkGraphy ref='checkGraphy' @refresh='refresh' :alreadyRelatedModel='alreadyRelatedModel'></checkGraphy>
|
|
|
+ <checkGraphy ref='checkGraphy' @refresh='refresh' :alreadyRelatedModel='alreadyRelatedModel' @hasModel="getCount"></checkGraphy>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
@@ -35,6 +47,8 @@ export default {
|
|
|
alreadyRelatedModel: [],
|
|
|
sign: false,
|
|
|
otherSign: false,
|
|
|
+ hasGraph: false, // 当前楼层是否有平面图
|
|
|
+ hasModel: false, // 项目中时候有模型文件
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -42,12 +56,17 @@ export default {
|
|
|
this.FloorID = this.$route.query.FloorID
|
|
|
this.BuildID = this.$route.query.BuildID
|
|
|
this.BuildName = this.$route.query.BuildName
|
|
|
- if (this.modelId.split('.')[1].toString() == 'png' || this.modelId.split('.')[1].toString() == 'jpg') {
|
|
|
- return
|
|
|
- }else{
|
|
|
- this.init()
|
|
|
+ if (this.modelId != '') {
|
|
|
+ this.hasGraph = true;
|
|
|
+ const temp = this.modelId.split('.');
|
|
|
+ if (temp.length > 1 && (temp[1] == 'png' || temp[1] == 'jpg')) {
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ this.init()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.hasGraph = false;
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
@@ -106,7 +125,11 @@ export default {
|
|
|
// 替换模型文件成功
|
|
|
refresh(modelId) {
|
|
|
this.modelId = modelId
|
|
|
- this.getFileName(this.modelId)
|
|
|
+ this.hasGraph = true;
|
|
|
+ const temp = this.modelId.split('.');
|
|
|
+ if (temp[1] && temp[1] != 'png' && temp[1] != 'jpg') {
|
|
|
+ this.getFileName(this.modelId)
|
|
|
+ }
|
|
|
},
|
|
|
// 获取文件夹名称
|
|
|
getFileName(modelId) {
|
|
@@ -136,15 +159,20 @@ export default {
|
|
|
changeSign(flag) {
|
|
|
this.otherSign = flag
|
|
|
},
|
|
|
+ // 当前项目中是否有模型文件
|
|
|
+ getCount(flag) {
|
|
|
+ this.hasModel = flag;
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
modelId(n, o) {
|
|
|
- if (o && n != o) {
|
|
|
- console.log(n.split('.')[1])
|
|
|
- if (n.split('.')[1].toString() == 'png' || n.split('.')[1].toString() == 'jpg') {
|
|
|
- this.$refs.drawFloor.initGraphy(n, 3)
|
|
|
- } else {
|
|
|
- this.$refs.drawFloor.initGraphy(n, 1)
|
|
|
+ if (n != o) {
|
|
|
+ if (n) {
|
|
|
+ if (n.split('.')[1].toString() == 'png' || n.split('.')[1].toString() == 'jpg') {
|
|
|
+ this.$refs.drawFloor.initGraphy(n, 3)
|
|
|
+ } else {
|
|
|
+ this.$refs.drawFloor.initGraphy(n, 1)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
},
|