diff --git a/nezha-fronted/src/components/chart/panelChart.vue b/nezha-fronted/src/components/chart/panelChart.vue index 832e9350c..8ad1370ba 100644 --- a/nezha-fronted/src/components/chart/panelChart.vue +++ b/nezha-fronted/src/components/chart/panelChart.vue @@ -290,7 +290,8 @@ export default { group: this.chartInfo.param.datasource[0].group, select: [this.chartInfo.param.datasource[0].select], limit: this.chartInfo.param.datasource[0].limit, - sort: this.chartInfo.param.datasource[0].sort + sort: this.chartInfo.param.datasource[0].sort, + filter: this.chartInfo.param.datasource[0].filter ? this.chartInfo.param.datasource[0].filter.filter(item => item.value) : [] } const chartData = [] const params = { diff --git a/nezha-fronted/src/components/common/filterSearch/filterSearch.vue b/nezha-fronted/src/components/common/filterSearch/filterSearch.vue index 239e0ae47..01420d51d 100644 --- a/nezha-fronted/src/components/common/filterSearch/filterSearch.vue +++ b/nezha-fronted/src/components/common/filterSearch/filterSearch.vue @@ -87,10 +87,8 @@ export default { }, mounted () { this.metaList = this.valueList.map(item => { - return { - ...new Meta(), - ...item - } + const obj = Object.assign(new Meta(condition), item) + return obj }) }, methods: { @@ -118,7 +116,6 @@ export default { this.$emit('update:valueList', this.metaList) this.$emit('change') this.$nextTick(() => { - console.log(this.$refs.columnSelect) this.$refs.columnSelect[0].focus() }) } @@ -131,9 +128,9 @@ export default { columnBlur (meta, index, type) { setTimeout(() => { meta.name = meta.name.replace(/"/g, '') - // meta.nameIsEditing = false + meta.nameIsEditing = false if (!meta.name) { - // this.metaList.splice(index, 1) + this.metaList.splice(index, 1) this.$emit('update:valueList', this.metaList) this.$emit('change') } @@ -185,6 +182,15 @@ export default { }, valueBlur (meta, index, type) { meta.valueIsEditing = false + for (let i = 0; i < this.rule.length; i++) { + const item = this.rule[i] + const reg = new RegExp(item.regex) + if (!reg.test(meta.value)) { + meta.value = '' + this.$message.error(this.$t(item.tip)) + break + } + } this.$emit('update:valueList', this.metaList) this.$emit('change') }, diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue index d57b3cb79..dac428d55 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue @@ -238,6 +238,9 @@ export default { if (params.type === 'table') { delete params.param.tags } + if (params.datasource === 'system' && params.param.datasource[0].filter) { + params.param.datasource[0].filter = params.param.datasource[0].filter.filter(item => item.value) + } if (params.id) { // 修改 this.$put('visual/panel/chart', params).then(response => { if (response.code === 200) {