fix: 修改 topo tooltip 样式不正确的问题
This commit is contained in:
@@ -194,6 +194,7 @@ export default {
|
|||||||
pen.visible = pen.visible || true
|
pen.visible = pen.visible || true
|
||||||
pen.locked = pen.locked || 0
|
pen.locked = pen.locked || 0
|
||||||
pen.isBottom = true
|
pen.isBottom = true
|
||||||
|
pen.autoPlay = true
|
||||||
},
|
},
|
||||||
pensActive (pens, e) { // 选中节点
|
pensActive (pens, e) { // 选中节点
|
||||||
this.selectPens = pens
|
this.selectPens = pens
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ export default {
|
|||||||
data.pens = []
|
data.pens = []
|
||||||
}
|
}
|
||||||
data.pens.forEach(pen => {
|
data.pens.forEach(pen => {
|
||||||
|
pen.isBottom = false
|
||||||
if (pen.isNz) {
|
if (pen.isNz) {
|
||||||
if (pen.data.legend && pen.data.enable.valueMapping) {
|
if (pen.data.legend && pen.data.enable.valueMapping) {
|
||||||
const findItem = queryValues.find(query => query.name === pen.data.legend && query.parent === pen.data.parent)
|
const findItem = queryValues.find(query => query.name === pen.data.legend && query.parent === pen.data.parent)
|
||||||
|
|||||||
@@ -129,7 +129,7 @@
|
|||||||
<i class="nz-icon nz-icon-arrow-down" @click="updateShow('border')"/>
|
<i class="nz-icon nz-icon-arrow-down" @click="updateShow('border')"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="elements.border" class="form-row-content">
|
<div v-show="elements.border" class="form-row-content">
|
||||||
<div class="form-row-item ">
|
<div class="form-row-item special-meta2d-select">
|
||||||
<div class="form-row-key">
|
<div class="form-row-key">
|
||||||
{{$t('overall.type')}}
|
{{$t('overall.type')}}
|
||||||
</div>
|
</div>
|
||||||
@@ -401,7 +401,7 @@
|
|||||||
<i class="nz-icon nz-icon-arrow-down" @click="updateShow('line')"/>
|
<i class="nz-icon nz-icon-arrow-down" @click="updateShow('line')"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="elements.line" class="form-row-content">
|
<div v-show="elements.line" class="form-row-content">
|
||||||
<div class="form-row-item">
|
<div class="form-row-item special-meta2d-select">
|
||||||
<div class="form-row-key">
|
<div class="form-row-key">
|
||||||
{{$t('project.topology.style')}}
|
{{$t('project.topology.style')}}
|
||||||
</div>
|
</div>
|
||||||
@@ -1222,6 +1222,7 @@ export default {
|
|||||||
uid: getUUID()
|
uid: getUUID()
|
||||||
}
|
}
|
||||||
this.pen.data.valueMapping.push(obj)
|
this.pen.data.valueMapping.push(obj)
|
||||||
|
this.change('data.valueMapping')
|
||||||
},
|
},
|
||||||
copyMapping (index) {
|
copyMapping (index) {
|
||||||
const temp = lodash.cloneDeep(this.pen.data.valueMapping[index])
|
const temp = lodash.cloneDeep(this.pen.data.valueMapping[index])
|
||||||
|
|||||||
@@ -38,6 +38,69 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!--Custom picture-->
|
||||||
|
<el-dialog
|
||||||
|
:title="title"
|
||||||
|
:visible.sync="uploadPicShow"
|
||||||
|
width="auto"
|
||||||
|
@close="uploadPicShow = false"
|
||||||
|
destroy-on-close>
|
||||||
|
<el-row class="upload-pic-row">
|
||||||
|
<el-col :span="4" class="upload-pic-label">{{ $t('overall.name') }}</el-col>
|
||||||
|
<el-col :span="20">
|
||||||
|
<el-input maxlength="64" show-word-limit v-model="uploadPic.name" size="small" :placeholder="$t('project.topology.placeholderImg')"></el-input>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row class="upload-pic-row">
|
||||||
|
<el-col :span="4" class="upload-pic-label">{{ $t('overall.folder') }}</el-col>
|
||||||
|
<el-col :span="20">
|
||||||
|
<el-autocomplete
|
||||||
|
popper-class="right-box-select-top right-public-box-dropdown-top"
|
||||||
|
:maxlength="64" show-word-limit
|
||||||
|
class="inline-input"
|
||||||
|
v-model="uploadPic.unit"
|
||||||
|
:fetch-suggestions="querySearch"
|
||||||
|
size="small"
|
||||||
|
></el-autocomplete>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row class="upload-pic-row">
|
||||||
|
<el-col :span="4" class="upload-pic-label"> </el-col>
|
||||||
|
<el-col :span="20">
|
||||||
|
<div class="upload-body">
|
||||||
|
<el-upload
|
||||||
|
drag
|
||||||
|
class="upload-demo"
|
||||||
|
action=" "
|
||||||
|
:show-file-list="true"
|
||||||
|
:on-change="beforeAvatarUpload"
|
||||||
|
:auto-upload="false"
|
||||||
|
accept=".jpg,.png"
|
||||||
|
:limit="1"
|
||||||
|
:id="'upload-pic-show'">
|
||||||
|
<!--<div slot="tip" class="el-upload__tip" >{{$t('overall.importTipImg')}}</div>-->
|
||||||
|
<i class="nz-icon nz-icon-upload"></i>
|
||||||
|
<div class="el-upload__text">{{$t('overall.dragFileTip')}},{{$t('overall.or')}} <em>{{$t('overall.clickUpload')}}</em></div>
|
||||||
|
</el-upload>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<div class="upload-pic-row" style="text-align: center">
|
||||||
|
<span>
|
||||||
|
<button class="nz-btn nz-btn-size-normal nz-btn-style-light" style="margin-right: 20px" @click="uploadPicShow=false">
|
||||||
|
{{$t('project.topology.exit')}}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button class="nz-btn nz-btn-size-normal nz-btn-style-normal" @click="imgUpload" :disabled="prevent_opt.save"
|
||||||
|
:class="{'nz-btn-disabled':prevent_opt.save}"
|
||||||
|
style="">
|
||||||
|
{{$t('overall.save')}}
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -57,7 +120,14 @@ export default {
|
|||||||
iconArray: [],
|
iconArray: [],
|
||||||
selectBoxShow: false,
|
selectBoxShow: false,
|
||||||
imageNull: '',
|
imageNull: '',
|
||||||
activeNames: []
|
activeNames: [],
|
||||||
|
uploadPicShow: false,
|
||||||
|
imgWidth: 0,
|
||||||
|
imgHeight: 0,
|
||||||
|
uploadPic: {
|
||||||
|
name: '',
|
||||||
|
unit: ''
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
@@ -158,8 +228,152 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
uploadPicChange () {
|
uploadPicChange () {
|
||||||
|
this.unitArr = []
|
||||||
|
this.tools.forEach((item, index) => {
|
||||||
|
if (index > 0) {
|
||||||
|
this.unitArr.push({
|
||||||
|
value: item.group
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
this.uploadPic.name = ''
|
||||||
|
this.uploadPic.unit = ''
|
||||||
|
this.file = null
|
||||||
|
this.uploadPicShow = true
|
||||||
|
},
|
||||||
|
querySearch (queryString, cb) {
|
||||||
|
const restaurants = this.unitArr
|
||||||
|
const results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
|
||||||
|
// 调用 callback 返回建议列表的数据
|
||||||
|
cb(results)
|
||||||
|
},
|
||||||
|
createFilter (queryString) {
|
||||||
|
return (restaurant) => {
|
||||||
|
return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeAvatarUpload (file, fileList) {
|
||||||
|
const this_ = this
|
||||||
|
const isJPG = (file.raw.type === 'image/jpeg' || file.raw.type === 'image/png')
|
||||||
|
const isLt2M = (file.size / 1024 / 1024) < 2
|
||||||
|
if (!isJPG) {
|
||||||
|
this.$message.error(this_.$t('project.topology.imgFormat'))
|
||||||
|
fileList = fileList.splice(fileList.length - 1, 1)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (!isLt2M) {
|
||||||
|
this.$message.error(this_.$t('project.topology.imgSize'))
|
||||||
|
fileList = fileList.splice(fileList.length - 1, 1)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
new Promise(function (resolve, reject) {
|
||||||
|
const width = 0
|
||||||
|
const height = 0
|
||||||
|
const _URL = window.URL || window.webkitURL
|
||||||
|
const img = new Image()
|
||||||
|
img.onload = function () {
|
||||||
|
const valid = img.width > width && img.height > height
|
||||||
|
this_.imgWidth = img.width
|
||||||
|
this_.imgHeight = img.height
|
||||||
|
valid ? resolve() : reject()
|
||||||
|
}
|
||||||
|
img.src = _URL.createObjectURL(file.raw)
|
||||||
|
}).then(() => {
|
||||||
|
if (isJPG) {
|
||||||
|
this.file = file.raw
|
||||||
|
}
|
||||||
|
return file.raw
|
||||||
|
}, () => {
|
||||||
|
this.$message.error(this_.$t('project.topology.imgMeasure'))
|
||||||
|
return Promise.reject()
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
imgUpload () {
|
||||||
|
const this_ = this
|
||||||
|
if (!this.imageSave) {
|
||||||
|
this.imageSave = true
|
||||||
|
}
|
||||||
|
if (!this.uploadPic.unit) {
|
||||||
|
this.$message({
|
||||||
|
message: this_.$t('project.topology.unitError'),
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!this.file) {
|
||||||
|
this.$message({
|
||||||
|
message: this_.$t('project.topology.imgError'),
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.upload()
|
||||||
|
},
|
||||||
|
upload () {
|
||||||
|
const form = new FormData()
|
||||||
|
form.append('file', this.file)
|
||||||
|
if (this.uploadPic.name) {
|
||||||
|
form.append('name', this.uploadPic.name)
|
||||||
|
} else {
|
||||||
|
form.append('name', this.file.name.substring(0, this.file.name.lastIndexOf('.')))
|
||||||
|
}
|
||||||
|
form.append('unit', this.uploadPic.unit)
|
||||||
|
form.append('width', this.imgWidth)
|
||||||
|
form.append('height', this.imgHeight)
|
||||||
|
this.$post('monitor/project/topo/icon', form, { 'Content-Type': 'multipart/form-data' }).then(res => {
|
||||||
|
this.imageSave = false
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||||
|
this.uploadPicShow = false
|
||||||
|
this.$get('monitor/project/topo/icon', { id: res.data.id }).then(iconInfo => {
|
||||||
|
dealImg(`monitor/project/topo/icon/${res.data.id}/1`, res.data.id).then((data, header) => {
|
||||||
|
const group = this.tools.find(tool => tool.group === this.uploadPic.unit)
|
||||||
|
this.iconArray.push({
|
||||||
|
...iconInfo.data.list[0],
|
||||||
|
image: data.data
|
||||||
|
})
|
||||||
|
if (group) {
|
||||||
|
group.children.push({
|
||||||
|
...imageTemp,
|
||||||
|
data: {
|
||||||
|
...imageTemp.data,
|
||||||
|
text: res.data.imageName,
|
||||||
|
image: data.data,
|
||||||
|
imageId: res.data.id,
|
||||||
|
unit: this.uploadPic.unit,
|
||||||
|
rect: {
|
||||||
|
width: data.width,
|
||||||
|
height: data.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.tools.push({
|
||||||
|
group: this.uploadPic.unit,
|
||||||
|
children: [{
|
||||||
|
...imageTemp,
|
||||||
|
data: {
|
||||||
|
...imageTemp.data,
|
||||||
|
text: res.data.imageName,
|
||||||
|
image: data.data,
|
||||||
|
imageId: res.data.id,
|
||||||
|
unit: this.uploadPic.unit,
|
||||||
|
rect: {
|
||||||
|
width: data.width,
|
||||||
|
height: data.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="tooltip-box" style="width: 400px;height: 300px">
|
<div class="tooltip-box" style="width: 400px;height: 300px;display: flex;flex-direction: column">
|
||||||
<div v-if="params.titleShow && params.title">{{params.title}}</div>
|
<div v-if="params.titleShow && params.title" style="margin-bottom: 5px">{{params.title}}</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="params.chartType === 'text'"
|
v-if="params.chartType === 'text'"
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<panelChart
|
<panelChart
|
||||||
v-else
|
v-else
|
||||||
|
style="flex: 1"
|
||||||
ref="panelChart"
|
ref="panelChart"
|
||||||
:chart-info="chartInfo"
|
:chart-info="chartInfo"
|
||||||
:show-header="false"
|
:show-header="false"
|
||||||
@@ -56,17 +57,27 @@ export default {
|
|||||||
const obj = {}
|
const obj = {}
|
||||||
this.params.legends.forEach(item => {
|
this.params.legends.forEach(item => {
|
||||||
const findItem = this.queryValues.find(query => query.name === item.legend && query.parent === item.parent)
|
const findItem = this.queryValues.find(query => query.name === item.legend && query.parent === item.parent)
|
||||||
if (findItem) {
|
// if (findItem) {
|
||||||
|
// // chartData.push([findItem])
|
||||||
|
// if (obj[findItem.elements.name]) {
|
||||||
|
// chartData[obj[findItem.elements.name].index].push(findItem)
|
||||||
|
// } else {
|
||||||
// chartData.push([findItem])
|
// chartData.push([findItem])
|
||||||
if (obj[findItem.elements.name]) {
|
// obj[findItem.elements.name] = {
|
||||||
chartData[obj[findItem.elements.name].index].push(findItem)
|
// index: chartData.length - 1
|
||||||
} else {
|
// }
|
||||||
|
// elements.push(findItem.elements)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
if (findItem) {
|
||||||
chartData.push([findItem])
|
chartData.push([findItem])
|
||||||
obj[findItem.elements.name] = {
|
const element = {
|
||||||
index: chartData.length - 1
|
...findItem.elements
|
||||||
}
|
}
|
||||||
elements.push(findItem.elements)
|
if (item.alias) {
|
||||||
|
element.legend = item.alias
|
||||||
}
|
}
|
||||||
|
elements.push(element)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (chartData.length && this.$refs.panelChart) {
|
if (chartData.length && this.$refs.panelChart) {
|
||||||
@@ -75,6 +86,7 @@ export default {
|
|||||||
this.$refs.panelChart.loading = false
|
this.$refs.panelChart.loading = false
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.panelChart.$refs.chart.$refs['chart' + this.chartInfo.id].initChart()
|
this.$refs.panelChart.$refs.chart.$refs['chart' + this.chartInfo.id].initChart()
|
||||||
|
this.$refs.panelChart.$refs.chart.$refs['chart' + this.chartInfo.id].resize()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user