fix:diagram 图片 宽高不对的问题

This commit is contained in:
zhangyu
2021-12-24 14:36:07 +08:00
parent 765a6e6cc6
commit acae91f698
9 changed files with 16 additions and 26 deletions

View File

@@ -47,14 +47,6 @@ import { randomcolor } from '@/components/common/js/radomcolor/randomcolor'
export default { export default {
name: 'chart-guage', name: 'chart-guage',
mixins: [chartMixin, chartFormat], mixins: [chartMixin, chartFormat],
watch: {
isFullscreen: {
immediate: true,
handler (n) {
console.log(n)
}
}
},
data () { data () {
return { return {
gaugeData: [], gaugeData: [],

View File

@@ -1,12 +1,14 @@
<template> <template>
<div style="width: 100%;height: 100%" :id="'chartUrl' + chartInfo.id" class="mt-10 url-container" v-show="firstShow"> <div style="width: 100%;height: 100%" :id="'chartUrl' + chartId" class="mt-10 url-container" v-show="firstShow">
<iframe :id="'urlContainer' + chartInfo.id" frameborder="0" width="100%" height="100%" name="showHere" scrolling=auto style="z-index:5000;padding-bottom:6px;"></iframe> <iframe :id="'urlContainer' + chartId" frameborder="0" width="100%" height="100%" name="showHere" scrolling=auto style="z-index:5000;padding-bottom:6px;"></iframe>
</div> </div>
</template> </template>
<script> <script>
import chartMixin from '@/components/chart/chartMixin'
export default { export default {
name: 'chart-url', name: 'chart-url',
mixins: [chartMixin],
props: { props: {
chartInfo: {}, chartInfo: {},
chartData: {} chartData: {}
@@ -20,7 +22,7 @@ export default {
setLoadFrame (data) { setLoadFrame (data) {
const that = this const that = this
this.$nextTick(() => { this.$nextTick(() => {
const iframe = document.querySelector('#urlContainer' + this.chartInfo.id) const iframe = document.querySelector('#urlContainer' + this.chartId)
// 处理兼容行问题 // 处理兼容行问题
if (iframe.attachEvent) { if (iframe.attachEvent) {
iframe.attachEvent('onload', function () { iframe.attachEvent('onload', function () {

View File

@@ -312,7 +312,7 @@ export default {
} }
} }
} catch (e) { } catch (e) {
console.log(e) console.info(e)
this.loading = false this.loading = false
} }
}, },

View File

@@ -1763,8 +1763,8 @@ export default {
imageId: item.id, imageId: item.id,
unit: item.unit, unit: item.unit,
rect: { rect: {
width: res2[index].width, width: res2[index].width === -1 ? 100 : res2[index].width,
height: res2[index].height height: res2[index].height === -1 ? 100 : res2[index].height
} }
} }
}) })
@@ -1780,8 +1780,8 @@ export default {
imageId: item.id, imageId: item.id,
unit: item.unit, unit: item.unit,
rect: { rect: {
width: res2[index].width, width: res2[index].width === -1 ? 100 : res2[index].width,
height: res2[index].height height: res2[index].height === -1 ? 100 : res2[index].height
} }
} }
}] }]
@@ -1835,8 +1835,8 @@ export default {
data: ('data:image/jpeg;base64,' + res.data), data: ('data:image/jpeg;base64,' + res.data),
// width: res.headers.width === -1 ? 100 : (res.headers.width > 900 ? 900 : res.headers.width), // width: res.headers.width === -1 ? 100 : (res.headers.width > 900 ? 900 : res.headers.width),
// height: res.headers.height === -1 ? 100 : (res.headers.height > 900 ? 900 : res.headers.height) // height: res.headers.height === -1 ? 100 : (res.headers.height > 900 ? 900 : res.headers.height)
width: res.headers.width === -1 ? 100 : Number(res.headers.width), width: (res.headers.width === -1 || res.headers.width === 0) ? 100 : Number(res.headers.width),
height: res.headers.height === -1 ? 100 : Number(res.headers.height) height: (res.headers.height === -1 || res.headers.height === 0) ? 100 : Number(res.headers.height)
} }
if (imageInfo.width > 900 || imageInfo.height > 900) { if (imageInfo.width > 900 || imageInfo.height > 900) {
if (imageInfo.height > imageInfo.width) { if (imageInfo.height > imageInfo.width) {

View File

@@ -30,7 +30,6 @@ export default {
}, },
// 更新path包含请求参数 // 更新path包含请求参数
updatePath (param, path) { updatePath (param, path) {
console.log(param)
const params = lodash.cloneDeep(param) const params = lodash.cloneDeep(param)
Object.keys(params).forEach(key => { Object.keys(params).forEach(key => {
if (!params[key]) { if (!params[key]) {

View File

@@ -1739,8 +1739,8 @@ export default {
imageId: item.id, imageId: item.id,
unit: item.unit, unit: item.unit,
rect: { rect: {
width: res2[index].width, width: res2[index].width === -1 ? 100 : res2[index].width,
height: res2[index].height height: res2[index].height === -1 ? 100 : res2[index].height
} }
} }
}) })
@@ -1756,8 +1756,8 @@ export default {
imageId: item.id, imageId: item.id,
unit: item.unit, unit: item.unit,
rect: { rect: {
width: res2[index].width, width: res2[index].width === -1 ? 100 : res2[index].width,
height: res2[index].height height: res2[index].height === -1 ? 100 : res2[index].height
} }
} }
}] }]

View File

@@ -243,7 +243,6 @@ export default {
}) })
}, },
selectPanel (panel) { selectPanel (panel) {
console.log(panel)
this.panelName = panel.name this.panelName = panel.name
this.editChart.panelName = panel.name this.editChart.panelName = panel.name
this.panelId = panel.id this.panelId = panel.id

View File

@@ -175,7 +175,6 @@ export default {
setCustomTime (timeGroup, timeRange) { setCustomTime (timeGroup, timeRange) {
if (timeGroup) { if (timeGroup) {
this.showTime = this.nowTimeType = this.timeData.find(item => item.id == timeGroup.id) this.showTime = this.nowTimeType = this.timeData.find(item => item.id == timeGroup.id)
console.log(this.showTime)
if (this.showTime) { if (this.showTime) {
this.showTime = Object.assign({}, this.showTime) this.showTime = Object.assign({}, this.showTime)
this.$set(this.searchTime, 0, timeGroup.start_time) this.$set(this.searchTime, 0, timeGroup.start_time)

View File

@@ -49,7 +49,6 @@ export default {
} }
}, },
created () { created () {
console.log(this.$route.query)
this.switchTab = this.$route.query.switchTab || 'exprTemp' this.switchTab = this.$route.query.switchTab || 'exprTemp'
}, },
mounted () { mounted () {