fix: 修改 system — chartType 不正确的问题
This commit is contained in:
@@ -305,7 +305,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
drag: function (e) {
|
||||
console.log(e)
|
||||
const parentRect = document.getElementById('content').getBoundingClientRect()
|
||||
let mouseInGrid = false
|
||||
if (((mouseXY.x > parentRect.left) && (mouseXY.x < parentRect.right)) && ((mouseXY.y > parentRect.top) && (mouseXY.y < parentRect.bottom))) {
|
||||
@@ -367,17 +366,14 @@ export default {
|
||||
moveEvent: function (i, newX, newY) {
|
||||
const msg = 'MOVE i=' + i + ', X=' + newX + ', Y=' + newY
|
||||
this.eventLog.push(msg)
|
||||
console.log(msg)
|
||||
},
|
||||
movedEvent: function (i, newX, newY) {
|
||||
const msg = 'MOVED i=' + i + ', X=' + newX + ', Y=' + newY
|
||||
this.eventLog.push(msg)
|
||||
console.log(msg)
|
||||
},
|
||||
resizeEvent: function (i, newH, newW, newHPx, newWPx) {
|
||||
const msg = 'RESIZE i=' + i + ', H=' + newH + ', W=' + newW + ', H(px)=' + newHPx + ', W(px)=' + newWPx
|
||||
this.eventLog.push(msg)
|
||||
console.log(msg, this.$refs['editChart' + i])
|
||||
setTimeout(() => {
|
||||
this.$refs['editChart' + i][0].chartResize()
|
||||
})
|
||||
@@ -385,7 +381,6 @@ export default {
|
||||
resizedEvent: function (i, newX, newY, newHPx, newWPx) {
|
||||
const msg = 'RESIZED i=' + i + ', X=' + newX + ', Y=' + newY + ', H(px)=' + newHPx + ', W(px)=' + newWPx
|
||||
this.eventLog.push(msg)
|
||||
console.log(msg)
|
||||
setTimeout(() => {
|
||||
this.$refs['editChart' + i][0].chartResize()
|
||||
}, 50)
|
||||
@@ -393,27 +388,21 @@ export default {
|
||||
containerResizedEvent: function (i, newH, newW, newHPx, newWPx) {
|
||||
const msg = 'CONTAINER RESIZED i=' + i + ', H=' + newH + ', W=' + newW + ', H(px)=' + newHPx + ', W(px)=' + newWPx
|
||||
this.eventLog.push(msg)
|
||||
console.log(msg)
|
||||
},
|
||||
layoutCreatedEvent: function (newLayout) {
|
||||
this.eventLog.push('Created layout')
|
||||
console.log('Created layout: ', newLayout)
|
||||
},
|
||||
layoutBeforeMountEvent: function (newLayout) {
|
||||
this.eventLog.push('beforeMount layout')
|
||||
console.log('beforeMount layout: ', newLayout)
|
||||
},
|
||||
layoutMountedEvent: function (newLayout) {
|
||||
this.eventLog.push('Mounted layout')
|
||||
console.log('Mounted layout: ', newLayout)
|
||||
},
|
||||
layoutReadyEvent: function (newLayout) {
|
||||
this.eventLog.push('Ready layout')
|
||||
console.log('Ready layout: ', newLayout)
|
||||
},
|
||||
layoutUpdatedEvent: function (newLayout) {
|
||||
this.eventLog.push('Updated layout')
|
||||
console.log('Updated layout: ', newLayout)
|
||||
},
|
||||
dropmenuChange (id, show) {
|
||||
if (show) {
|
||||
|
||||
@@ -408,47 +408,37 @@ export default {
|
||||
moveEvent: function (i, newX, newY) {
|
||||
const msg = 'MOVE i=' + i + ', X=' + newX + ', Y=' + newY
|
||||
this.eventLog.push(msg)
|
||||
console.log(msg)
|
||||
},
|
||||
movedEvent: function (i, newX, newY) {
|
||||
const msg = 'MOVED i=' + i + ', X=' + newX + ', Y=' + newY
|
||||
this.eventLog.push(msg)
|
||||
console.log(msg)
|
||||
},
|
||||
resizeEvent: function (i, newH, newW, newHPx, newWPx) {
|
||||
const msg = 'RESIZE i=' + i + ', H=' + newH + ', W=' + newW + ', H(px)=' + newHPx + ', W(px)=' + newWPx
|
||||
this.eventLog.push(msg)
|
||||
console.log(msg)
|
||||
},
|
||||
resizedEvent: function (i, newX, newY, newHPx, newWPx) {
|
||||
const msg = 'RESIZED i=' + i + ', X=' + newX + ', Y=' + newY + ', H(px)=' + newHPx + ', W(px)=' + newWPx
|
||||
this.eventLog.push(msg)
|
||||
console.log(msg)
|
||||
},
|
||||
containerResizedEvent: function (i, newH, newW, newHPx, newWPx) {
|
||||
const msg = 'CONTAINER RESIZED i=' + i + ', H=' + newH + ', W=' + newW + ', H(px)=' + newHPx + ', W(px)=' + newWPx
|
||||
this.eventLog.push(msg)
|
||||
console.log(msg)
|
||||
},
|
||||
layoutCreatedEvent: function (newLayout) {
|
||||
this.eventLog.push('Created layout')
|
||||
console.log('Created layout: ', newLayout)
|
||||
},
|
||||
layoutBeforeMountEvent: function (newLayout) {
|
||||
this.eventLog.push('beforeMount layout')
|
||||
console.log('beforeMount layout: ', newLayout)
|
||||
},
|
||||
layoutMountedEvent: function (newLayout) {
|
||||
this.eventLog.push('Mounted layout')
|
||||
console.log('Mounted layout: ', newLayout)
|
||||
},
|
||||
layoutReadyEvent: function (newLayout) {
|
||||
this.eventLog.push('Ready layout')
|
||||
console.log('Ready layout: ', newLayout)
|
||||
},
|
||||
layoutUpdatedEvent: function (newLayout) {
|
||||
this.eventLog.push('Updated layout')
|
||||
console.log('Updated layout: ', newLayout)
|
||||
},
|
||||
tempDomInit () {
|
||||
const span = document.querySelector('.temp-dom')
|
||||
|
||||
@@ -226,7 +226,6 @@ export default {
|
||||
isMap,
|
||||
isTable,
|
||||
resize () {
|
||||
console.log(this.$refs['chart' + this.chartInfo.id])
|
||||
this.$refs['chart' + this.chartInfo.id].resize()
|
||||
}
|
||||
},
|
||||
|
||||
@@ -53,9 +53,7 @@ export default {
|
||||
chartData: {
|
||||
immediate: true,
|
||||
handler (n) {
|
||||
console.log(n)
|
||||
this.$nextTick(() => {
|
||||
console.log(this.from)
|
||||
this.dataList = JSON.parse(JSON.stringify(n))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -151,7 +151,6 @@ export default {
|
||||
}
|
||||
shadowMarker.bindTooltip(this.mapTooltipFormatter(dcStat), { sticky: false, pane: 'myPane', direction: 'left', data: dcStat })
|
||||
shadowMarker.on('mouseover', (param) => {
|
||||
console.log(param)
|
||||
const point = param.containerPoint
|
||||
const event = param.originalEvent
|
||||
const boxWidth = window.innerWidth / 2
|
||||
|
||||
@@ -74,7 +74,6 @@ export default {
|
||||
stat.showValue = chartDataFormat.getUnit(chartInfo.unit ? chartInfo.unit : 2).compute(stat.value, null, -1, 2)
|
||||
stat.mapping = this.selectMapping(stat.value, chartInfo.param.valueMapping, chartInfo.param.enable && this.chartInfo.param.enable.valueMapping)
|
||||
this.statData.push(stat)
|
||||
console.log(this.statData)
|
||||
colorIndex++
|
||||
})
|
||||
})
|
||||
|
||||
@@ -57,7 +57,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
initChart () {
|
||||
console.log(this.chartInfo, this.chartData)
|
||||
this.columns = this.chartInfo.param.columns
|
||||
this.chartInfo.param.valueMapping.forEach((item) => {
|
||||
if (this.valueMapping[item.column]) {
|
||||
@@ -68,7 +67,6 @@ export default {
|
||||
})
|
||||
const data = this.initTableData(this.chartInfo, this.chartData)
|
||||
const arr = []
|
||||
console.log(data)
|
||||
Object.keys(data).forEach(key => {
|
||||
arr.push(data[key])
|
||||
})
|
||||
@@ -80,18 +78,22 @@ export default {
|
||||
})
|
||||
this.tableData = arr
|
||||
this.$refs.dataTable.doLayout()
|
||||
console.log(data)
|
||||
},
|
||||
initTableData (chartInfo, originalDatas) {
|
||||
let colorIndex = 0
|
||||
const returnData = {}
|
||||
const arr = chartInfo.param.indexs.split(',')
|
||||
console.log(returnData)
|
||||
originalDatas.forEach((originalData, expressionIndex) => {
|
||||
const key = chartInfo.elements[expressionIndex].name || expressionIndex
|
||||
let key = expressionIndex
|
||||
if (chartInfo.elements && chartInfo.elements[expressionIndex].name) {
|
||||
key = chartInfo.elements[expressionIndex].name
|
||||
}
|
||||
if (chartInfo.datasource == 'system' && chartInfo.param.datasource[0].name) {
|
||||
key = chartInfo.param.datasource[0].name
|
||||
}
|
||||
originalData.forEach((data, dataIndex) => {
|
||||
data.$labels = data.metric
|
||||
const value = getMetricTypeValue(data.values, chartInfo.param.statistics)
|
||||
const value = getMetricTypeValue(data.values, chartInfo.param.statistics || 'last')
|
||||
const showValue = chartDataFormat.getUnit(chartInfo.unit ? chartInfo.unit : 2).compute(value, null, -1, 2)
|
||||
// const mapping = this.selectTableMapping(value, chartInfo.param.valueMapping)
|
||||
data.$value = value
|
||||
@@ -128,7 +130,7 @@ export default {
|
||||
this.columns.forEach((column) => {
|
||||
if (valueMapping[column.title]) {
|
||||
obj[column.title + 'mapping'] = ''
|
||||
if (chartInfo.param.enable && this.chartInfo.param.enable.valueMapping) {
|
||||
if (this.chartInfo.param.enable && this.chartInfo.param.enable.valueMapping) {
|
||||
valueMapping[column.title].forEach(item => {
|
||||
const rowValue = row.display[column.title + 'display']
|
||||
if (item.type === 'value') {
|
||||
|
||||
@@ -204,7 +204,6 @@ export default {
|
||||
// console.log(height,copyList, group, flag)
|
||||
// console.log(this.$refs.layout)
|
||||
const groupFind = this.copyDataList.find(item => item.id == group.id)
|
||||
console.log(groupFind)
|
||||
if (group && groupFind) {
|
||||
groupFind.height = groupFind.h = height + this.headerHPadding
|
||||
groupFind.children = copyList
|
||||
@@ -272,7 +271,6 @@ export default {
|
||||
},
|
||||
mounted () {
|
||||
this.init()
|
||||
console.log(this.from,'chartList')
|
||||
if (!this.isGroup) {
|
||||
bus.$on('groupMove', this.changeGroupHeight)
|
||||
this.$store.commit('setChartListId', `chartList${this.timestamp}`)
|
||||
|
||||
@@ -45,7 +45,6 @@ export default {
|
||||
if (chartInfo.param.stack) { // 堆叠
|
||||
s.stack = 'Total'
|
||||
}
|
||||
console.log(lodash.isEmpty(chartInfo.param.thresholds))
|
||||
if (chartInfo.param.enable && chartInfo.param.enable.legend && !lodash.isEmpty(chartInfo.param.thresholds)) { // 阈值
|
||||
s.markLine = {
|
||||
symbol: 'circle',
|
||||
|
||||
@@ -95,7 +95,6 @@ export default {
|
||||
this.query(elements, startTime, endTime, step)
|
||||
},
|
||||
query (elements, startTime, endTime, step) {
|
||||
console.log(this.from, this.chartInfo.datasource,this.chartInfo.type, elements, startTime, endTime, step)
|
||||
try {
|
||||
switch (this.chartInfo.datasource) {
|
||||
case 'metrics':
|
||||
@@ -157,8 +156,6 @@ export default {
|
||||
break
|
||||
}
|
||||
case 'system': {
|
||||
console.log(this.chartInfo.param.datasource[0])
|
||||
|
||||
const q = {
|
||||
type: this.chartInfo.param.datasource[0].type,
|
||||
group: this.chartInfo.param.datasource[0].group,
|
||||
@@ -167,7 +164,6 @@ export default {
|
||||
sort: this.chartInfo.param.datasource[0].sort
|
||||
}
|
||||
const chartData = []
|
||||
console.log(this.chartInfo.type)
|
||||
const params = {
|
||||
q: encodeURIComponent(JSON.stringify(q)),
|
||||
stat: startTime,
|
||||
@@ -202,7 +198,6 @@ export default {
|
||||
}
|
||||
}
|
||||
if (this.chartInfo.type === 'group') {
|
||||
console.log(this.chartInfo.children)
|
||||
this.chartData = [...this.chartInfo.children]
|
||||
this.groupInit()
|
||||
}
|
||||
@@ -271,7 +266,6 @@ export default {
|
||||
this.chartInfo.height = height + this.headerHPadding
|
||||
this.chartInfo.h = height + this.headerHPadding
|
||||
} else {
|
||||
console.log(this.headerH)
|
||||
this.chartInfo.height = this.headerH + height
|
||||
this.chartInfo.h = this.headerH + height
|
||||
}
|
||||
@@ -296,7 +290,6 @@ export default {
|
||||
},
|
||||
mounted () {
|
||||
this.getChartData()
|
||||
console.log(this.from,this.chartInfo.type)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -405,7 +405,6 @@ export default {
|
||||
params.end_time = endTimeTmp
|
||||
params.from = this.from
|
||||
}
|
||||
console.log(this.from)
|
||||
if (this.from !== 'chartTemp') {
|
||||
this.$get('visual/panel/chart?panelId=' + params.panelId + '&groupId=0' + '&pageSize=-1').then(response => {
|
||||
if (response.code === 200) {
|
||||
|
||||
@@ -244,7 +244,6 @@ export default {
|
||||
setTimeout(() => {
|
||||
this.hexagonData = JSON.parse(JSON.stringify(this.hexData))
|
||||
const box = `#${this.hexagonSvgID}`
|
||||
console.log(box,document.getElementById(this.hexagonSvgID))
|
||||
if (!document.getElementById(this.hexagonSvgID)) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -819,7 +819,6 @@ export function getMetricTypeValue (queryItem, type) {
|
||||
}
|
||||
case 'last': {
|
||||
const last = copy.sort((x, y) => { return parseFloat(y[0]) - parseFloat(x[0]) })[0][1]
|
||||
console.log(last)
|
||||
return last
|
||||
}
|
||||
case 'first': {
|
||||
|
||||
@@ -171,7 +171,6 @@ export default {
|
||||
}
|
||||
delete params.panel
|
||||
if (params.type === 'table') {
|
||||
console.log(params.param.tags)
|
||||
delete params.param.tags
|
||||
}
|
||||
if (params.id) { // 修改
|
||||
@@ -290,7 +289,7 @@ export default {
|
||||
valueMapping: true
|
||||
},
|
||||
datasource: [{
|
||||
name: 'A',
|
||||
name: 'System',
|
||||
type: 'asset',
|
||||
systemGroup: '',
|
||||
systemSelect: '',
|
||||
|
||||
@@ -396,7 +396,6 @@ export default {
|
||||
this.chartConfig.param.columns[index].show = !this.chartConfig.param.columns[index].show
|
||||
},
|
||||
tagsChange (newTags) {
|
||||
console.log(newTags, newTags)
|
||||
this.chartConfig.param.tags = newTags
|
||||
this.chartConfig.param.indexs = newTags.map(item => item.text).join(',')
|
||||
this.change()
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
label-position= "top"
|
||||
label-width="120px"
|
||||
>
|
||||
|
||||
<div class="chart-title chart-title-config">
|
||||
System
|
||||
</div>
|
||||
<div class="system-chart-config" v-loading="loading" v-for="(item, index) in chartConfig.param.datasource " :key="index">
|
||||
<div class="system-chart-config-left">
|
||||
<ul>
|
||||
@@ -15,7 +17,7 @@
|
||||
v-for="(system,index1) in systemData"
|
||||
:key="index1"
|
||||
class="system-chart-item"
|
||||
:class="item.name === system.system ? 'is-select' : ''"
|
||||
:class="item.type === system.system ? 'is-select' : ''"
|
||||
@click="changeSystem(system, index)"
|
||||
>{{system.name}}</li>
|
||||
</ul>
|
||||
@@ -515,8 +517,8 @@ export default {
|
||||
thresholds: true
|
||||
},
|
||||
datasource: [{
|
||||
name: 'A',
|
||||
type: 'asset',
|
||||
name: 'System',
|
||||
type: '',
|
||||
systemGroup: '',
|
||||
systemSelect: '',
|
||||
group: '',
|
||||
@@ -543,8 +545,8 @@ export default {
|
||||
thresholds: true
|
||||
},
|
||||
datasource: [{
|
||||
name: 'A',
|
||||
type: 'asset',
|
||||
name: 'System',
|
||||
type: '',
|
||||
systemGroup: '',
|
||||
systemSelect: '',
|
||||
group: '',
|
||||
@@ -556,6 +558,9 @@ export default {
|
||||
}
|
||||
break
|
||||
}
|
||||
this.chartConfig.param.datasource[0].type = this.systemData[0].name
|
||||
this.groupList = this.systemData[0].group
|
||||
this.selectList = this.systemData[0].select
|
||||
this.oldType = type
|
||||
this.change()
|
||||
},
|
||||
|
||||
@@ -1062,7 +1062,6 @@ export default {
|
||||
},
|
||||
// input框监听是按删除还是回车
|
||||
enter (val, e) {
|
||||
console.log(val, e)
|
||||
const keyCode = window.event ? e.keyCode : e.which
|
||||
if (val == 'ID' && keyCode == 13) {
|
||||
const id = /^[0-9]*$/
|
||||
|
||||
Reference in New Issue
Block a user