feat ;修改 chart 参数调整
This commit is contained in:
@@ -65,7 +65,7 @@ export default {
|
|||||||
this.$emit('refresh')
|
this.$emit('refresh')
|
||||||
},
|
},
|
||||||
editChart () {
|
editChart () {
|
||||||
|
this.$emit('edit-chart', this.chartInfo)
|
||||||
},
|
},
|
||||||
removeChart () {
|
removeChart () {
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
>
|
>
|
||||||
<panel-chart
|
<panel-chart
|
||||||
:ref="'chart' + item.id"
|
:ref="'chart' + item.id"
|
||||||
|
@edit-chart="$emit('edit-chart', item)"
|
||||||
:chart-info="item"
|
:chart-info="item"
|
||||||
:time-range="timeRange"
|
:time-range="timeRange"
|
||||||
@showFullscreen="showFullscreen"
|
@showFullscreen="showFullscreen"
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
</el-popover>
|
</el-popover>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col style="flex: 1">
|
<el-col style="flex: 1">
|
||||||
<el-input maxlength="512" show-word-limit size="small" type="text" v-model="expressionsShow[index-1].legend" ></el-input>
|
<el-input maxlength="512" show-word-limit size="small" type="text" v-model="expressionsShow[index-1].legend" @change="expressionChange"></el-input>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|||||||
@@ -163,15 +163,16 @@ export default {
|
|||||||
Promise.all(arr).then(res => {
|
Promise.all(arr).then(res => {
|
||||||
this.editChart.panelId = this.panelId
|
this.editChart.panelId = this.panelId
|
||||||
const params = JSON.parse(JSON.stringify(this.editChart))
|
const params = JSON.parse(JSON.stringify(this.editChart))
|
||||||
delete params.panel
|
|
||||||
if (!params.groupId) {
|
if (!params.groupId) {
|
||||||
params.groupId = -1
|
params.groupId = 0
|
||||||
}
|
}
|
||||||
|
delete params.panel
|
||||||
if (params.id) { // 修改
|
if (params.id) { // 修改
|
||||||
this.$put('visual/panel/chart', params).then(response => {
|
this.$put('visual/panel/chart', params).then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||||
this.esc(true)
|
this.esc(true)
|
||||||
|
this.$emit('on-create-success')
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(response.msg)
|
this.$message.error(response.msg)
|
||||||
}
|
}
|
||||||
@@ -181,6 +182,7 @@ export default {
|
|||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||||
this.esc(true)
|
this.esc(true)
|
||||||
|
this.$emit('on-create-success')
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(response.msg)
|
this.$message.error(response.msg)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selectList (n) {
|
selectList (n) {
|
||||||
if (n.length === 1) {
|
if (n.length === 1 && !this.chartConfig.param.systemSelect) {
|
||||||
this.chartConfig.param.systemSelect = this.selectList[0].name
|
this.chartConfig.param.systemSelect = this.selectList[0].name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -439,14 +439,21 @@ export default {
|
|||||||
},
|
},
|
||||||
getSystemData () {
|
getSystemData () {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.$get('/mock/getSystemData').then(res => {
|
this.$get('/sys/config/key/stat_query_json').then(res => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.systemData = res.data.list
|
this.systemData = JSON.parse(res.data.paramValue)
|
||||||
if (res.data.list.length) {
|
if (this.systemData.length) {
|
||||||
this.chartConfig.param.system = res.data.list[0].name
|
if (!this.chartConfig.param.system) {
|
||||||
this.groupList = res.data.list[0].group
|
this.chartConfig.param.system = this.systemData[0].name
|
||||||
this.selectList = res.data.list[0].select
|
this.groupList = this.systemData[0].group
|
||||||
|
this.selectList = this.systemData[0].select
|
||||||
|
} else {
|
||||||
|
const system = this.systemData.find(item => item.name === this.chartConfig.param.system)
|
||||||
|
this.chartConfig.param.system = system.name
|
||||||
|
this.groupList = system.group
|
||||||
|
this.selectList = system.select
|
||||||
|
}
|
||||||
this.$refs.chartForm.clearValidate()
|
this.$refs.chartForm.clearValidate()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -90,7 +90,7 @@
|
|||||||
:from="fromRoute.panel"
|
:from="fromRoute.panel"
|
||||||
:panel-lock="panelLock"
|
:panel-lock="panelLock"
|
||||||
:time-range="searchTime"
|
:time-range="searchTime"
|
||||||
@on-edit-chart="editChart"
|
@edit-chart="editChart"
|
||||||
@on-refresh-time="refreshTime"
|
@on-refresh-time="refreshTime"
|
||||||
@on-remove-chart="delChart"
|
@on-remove-chart="delChart"
|
||||||
@on-add-group-item-chart="addGroupItem"
|
@on-add-group-item-chart="addGroupItem"
|
||||||
@@ -191,7 +191,7 @@ export default {
|
|||||||
name: '',
|
name: '',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
span: 4,
|
span: 4,
|
||||||
datasource: '1',
|
datasource: 'metrics',
|
||||||
height: 4,
|
height: 4,
|
||||||
unit: 2,
|
unit: 2,
|
||||||
param: {
|
param: {
|
||||||
@@ -205,7 +205,7 @@ export default {
|
|||||||
panel: '',
|
panel: '',
|
||||||
sync: 0,
|
sync: 0,
|
||||||
remark: '',
|
remark: '',
|
||||||
groupId: -1
|
groupId: ''
|
||||||
},
|
},
|
||||||
pageObj: {
|
pageObj: {
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
@@ -385,6 +385,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 编辑图表信息,打开编辑弹窗
|
// 编辑图表信息,打开编辑弹窗
|
||||||
editChart (data, copy) {
|
editChart (data, copy) {
|
||||||
|
console.log(456)
|
||||||
if (copy) {
|
if (copy) {
|
||||||
this.chart = JSON.parse(JSON.stringify(data))
|
this.chart = JSON.parse(JSON.stringify(data))
|
||||||
this.chart.panelId = this.showPanel.id
|
this.chart.panelId = this.showPanel.id
|
||||||
@@ -394,19 +395,14 @@ export default {
|
|||||||
this.$get('visual/panel/chart/' + data.id).then(res => {
|
this.$get('visual/panel/chart/' + data.id).then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const chartData = res.data.data
|
const chartData = res.data.data
|
||||||
if (typeof chartData.param === 'string') {
|
|
||||||
chartData.param = chartData.param ? JSON.parse(chartData.param) : {}
|
|
||||||
}
|
|
||||||
if (!chartData.param) {
|
|
||||||
chartData.param = { url: '', threshold: '' }
|
|
||||||
} else if (!chartData.param.threshold) {
|
|
||||||
chartData.param.threshold = ''
|
|
||||||
} else if (!chartData.param.url) {
|
|
||||||
chartData.param.url = ''
|
|
||||||
}
|
|
||||||
this.chart = JSON.parse(JSON.stringify(chartData))
|
this.chart = JSON.parse(JSON.stringify(chartData))
|
||||||
this.chart.panelId = this.showPanel.id
|
this.chart.panelId = this.showPanel.id
|
||||||
this.chart.panelName = this.showPanel.name
|
this.chart.panelName = this.showPanel.name
|
||||||
|
this.chart.param = JSON.parse(this.chart.param)
|
||||||
|
this.chart.datasource = 'metrics'
|
||||||
|
if (!this.chart.groupId || this.chart.groupId == -1) {
|
||||||
|
this.chart.groupId = ''
|
||||||
|
}
|
||||||
this.rightBox.chart.show = true
|
this.rightBox.chart.show = true
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(res.msg)
|
this.$message.error(res.msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user