fix: 调整全局变量处理
This commit is contained in:
@@ -176,7 +176,7 @@ export default {
|
||||
// eslint-disable-next-line vue/no-mutating-props
|
||||
this.chartInfo.elements = this.chartInfo.elements.map((item, index) => { // 处理表达式的变量
|
||||
// 全局变量替换
|
||||
item.expression = this.globalVariablesReplace(item.expression, searchTime)
|
||||
item.expression = this.globalVariablesReplace(item.expression)
|
||||
// group图表设置repeat的表达式替换
|
||||
if (this.chartInfo.repeatVariable) {
|
||||
item.expression = this.variablesReplaceRepeat(item.expression)
|
||||
@@ -253,7 +253,7 @@ export default {
|
||||
if (!this.chartInfo.oldElements) { // 创建一个备份 用于判断变量替换 能拿到原本变量的位置
|
||||
this.chartInfo.oldElements = this.chartInfo.elements ? JSON.parse(JSON.stringify(this.chartInfo.elements)) : []
|
||||
}
|
||||
this.variablesHandle()
|
||||
this.variablesHandle([startTime * 1000, endTime * 1000])
|
||||
const elements = this.chartInfo.elements || []
|
||||
if (this.isExportHtml) {
|
||||
this.chartInfo.loaded && this.queryData(elements, startTime, endTime, step, params, isRefresh)
|
||||
|
||||
@@ -29,6 +29,12 @@ export default {
|
||||
if (!timeRange) {
|
||||
return
|
||||
}
|
||||
if (!isNaN(timeRange[0])) {
|
||||
timeRange[0] = bus.computeTimezone(timeRange[0])
|
||||
}
|
||||
if (!isNaN(timeRange[1])) {
|
||||
timeRange[1] = bus.computeTimezone(timeRange[1])
|
||||
}
|
||||
this.globalVariables.forEach(item => {
|
||||
switch (item.name) {
|
||||
case '$G.dashboard.name': {
|
||||
@@ -83,6 +89,8 @@ export default {
|
||||
value = parseInt(step) * 1000
|
||||
} else if (unit === 'm') {
|
||||
value = parseInt(step) * 1000 * 60
|
||||
} else if (unit === 'h') {
|
||||
value = parseInt(step) * 1000 * 60 * 60
|
||||
}
|
||||
item.value = value
|
||||
break
|
||||
@@ -95,6 +103,8 @@ export default {
|
||||
value = parseInt(step)
|
||||
} else if (unit === 'm') {
|
||||
value = parseInt(step) * 60
|
||||
} else if (unit === 'h') {
|
||||
value = parseInt(step) * 60 * 60
|
||||
}
|
||||
item.value = value
|
||||
break
|
||||
|
||||
@@ -126,8 +126,6 @@ export default {
|
||||
const findItem = this.customTableTitle.find(item => item.prop == column.property)
|
||||
findItem && (findItem.width = newWidth)
|
||||
this.$parent.$parent.setPreference()
|
||||
console.log(this.customTableTitle)
|
||||
console.log(column)
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dataTable.doLayout()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user