fix: project topo 支持gif 以及 预览tooltip位置调整

This commit is contained in:
zhangyu
2023-04-13 16:03:06 +08:00
parent a2e3988397
commit cffce39732
4 changed files with 19 additions and 6 deletions

View File

@@ -411,10 +411,12 @@ export default {
} }
if (key === 'image') { if (key === 'image') {
obj.imageId = pen[key] obj.imageId = pen[key]
obj.name = pen.name
obj.icon = '' obj.icon = ''
} }
if (key === 'icon') { if (key === 'icon') {
obj.imageId = pen[key] obj.imageId = pen[key]
obj.name = pen.name
obj.image = '' obj.image = ''
} }
getTopology(this.meta2dId).setValue(obj) // 更新pen getTopology(this.meta2dId).setValue(obj) // 更新pen

View File

@@ -1226,16 +1226,19 @@ export default {
this.pen.imageId = image.id this.pen.imageId = image.id
if (image.image) { if (image.image) {
this.pen.image = image.image this.pen.image = image.image
this.pen.name = image.type || 'png'
this.pen.icon = '' this.pen.icon = ''
this.change('image') this.change('image')
} }
if (image.icon) { if (image.icon) {
this.pen.icon = image.icon this.pen.icon = image.icon
this.pen.name = ''
this.pen.image = '' this.pen.image = ''
this.change('icon') this.change('icon')
} }
if (!image.id) { if (!image.id) {
this.pen.image = image.image this.pen.image = image.image
this.pen.name = ''
this.pen.icon = '' this.pen.icon = ''
this.change('image') this.change('image')
} }

View File

@@ -35,7 +35,7 @@
</div> </div>
<transition name="el-zoom-in-top"> <transition name="el-zoom-in-top">
<div v-show="item.show" class="nz-collapse-body"> <div v-show="item.show" class="nz-collapse-body">
<div v-for="(btn, i) in item.children" :key="'info2'+'-'+index+'-'+i" class="buttons image-box-item" :class="btn.id === selectImgId ? 'is-select':''"> <div v-for="(btn, i) in item.children" :key="'info2'+'-'+index+'-'+i" class="buttons image-box-item" :class="btn.id == selectImgId ? 'is-select':''">
<img :src="baseUrl + btn.image" v-if="btn.image" class="image-src" @click.stop="selectImageChange(btn)"> <img :src="baseUrl + btn.image" v-if="btn.image" class="image-src" @click.stop="selectImageChange(btn)">
<i v-if="btn.nzClassName" class="nz-icon image-src" :class="btn.nzClassName" style="font-size: 40px" @click.stop="selectImageChange(btn)"/> <i v-if="btn.nzClassName" class="nz-icon image-src" :class="btn.nzClassName" style="font-size: 40px" @click.stop="selectImageChange(btn)"/>
<div class="img-text text-ellipsis" :title="btn.imageName">{{btn.imageName}}</div> <div class="img-text text-ellipsis" :title="btn.imageName">{{btn.imageName}}</div>
@@ -87,7 +87,7 @@
:show-file-list="true" :show-file-list="true"
:on-change="beforeAvatarUpload" :on-change="beforeAvatarUpload"
:auto-upload="false" :auto-upload="false"
accept=".jpg,.png" accept=".jpg,.png,.gif"
:limit="1" :limit="1"
:id="'upload-pic-show'"> :id="'upload-pic-show'">
<!--<div slot="tip" class="el-upload__tip" >{{$t('overall.importTipImg')}}</div>--> <!--<div slot="tip" class="el-upload__tip" >{{$t('overall.importTipImg')}}</div>-->
@@ -180,6 +180,7 @@ export default {
if (findItem) { if (findItem) {
this.unit = findItem.unit this.unit = findItem.unit
this.imageName = findItem.name this.imageName = findItem.name
this.selectImgId = findItem.id
} }
} }
this.imageInit() this.imageInit()
@@ -196,9 +197,11 @@ export default {
if (this.imgId == item.id) { if (this.imgId == item.id) {
this.unit = item.unit this.unit = item.unit
this.imageName = item.imageName this.imageName = item.imageName
this.selectImgId = item.id
} else if (this.selectImage === item.image) { } else if (this.selectImage === item.image) {
this.unit = item.unit this.unit = item.unit
this.imageName = item.imageName this.imageName = item.imageName
this.selectImgId = item.id
} }
const group = this.tools.find(tool => tool.group === item.unit) const group = this.tools.find(tool => tool.group === item.unit)
if (group) { if (group) {
@@ -208,7 +211,8 @@ export default {
image: item.image, image: item.image,
imageId: item.id, imageId: item.id,
id: item.id, id: item.id,
unit: item.unit unit: item.unit,
type: item.type
}) })
} else { } else {
this.tools.push({ this.tools.push({
@@ -220,7 +224,8 @@ export default {
image: item.image, image: item.image,
imageId: item.id, imageId: item.id,
id: item.id, id: item.id,
unit: item.unit unit: item.unit,
type: item.type
}] }]
}) })
} }
@@ -235,7 +240,7 @@ export default {
}, },
changeSelectBoxShow (flag) { changeSelectBoxShow (flag) {
this.selectBoxShow = flag this.selectBoxShow = flag
this.selectImgId = this.imgId // this.selectImgId = this.imgId
const findItem = this.tools.find(group => { const findItem = this.tools.find(group => {
group.show = false group.show = false
return group.group === this.unit return group.group === this.unit
@@ -262,6 +267,7 @@ export default {
changImage () { changImage () {
this.unit = this.selectImg.unit this.unit = this.selectImg.unit
this.imageName = this.selectImg.imageName this.imageName = this.selectImg.imageName
this.selectImgId = this.selectImg.id
this.$emit('updateImage', this.selectImg) this.$emit('updateImage', this.selectImg)
this.changeSelectBoxShow(false) this.changeSelectBoxShow(false)
}, },
@@ -331,7 +337,8 @@ export default {
}, },
beforeAvatarUpload (file, fileList) { beforeAvatarUpload (file, fileList) {
const this_ = this const this_ = this
const isJPG = (file.raw.type === 'image/jpeg' || file.raw.type === 'image/png') console.log(file.raw.type)
const isJPG = (file.raw.type === 'image/jpeg' || file.raw.type === 'image/png' || file.raw.type === 'image/gif')
const isLt2M = (file.size / 1024 / 1024) < 2 const isLt2M = (file.size / 1024 / 1024) < 2
if (!isJPG) { if (!isJPG) {
this.$message.error(this_.$t('project.topology.imgFormat')) this.$message.error(this_.$t('project.topology.imgFormat'))

View File

@@ -42,6 +42,7 @@
:title="'123'" :title="'123'"
:visible.sync="isPreview.show" :visible.sync="isPreview.show"
fullscreen fullscreen
class="no-transform-dialog"
custom-class="nz-new-dialog meta2d-preview" custom-class="nz-new-dialog meta2d-preview"
:append-to-body="true" :append-to-body="true"
:modal-append-to-body="false" :modal-append-to-body="false"