NEZ-1577 feat:chart 编辑页面 system 数据源增加filter(80%)

This commit is contained in:
zhangyu
2022-02-21 18:03:21 +08:00
parent e0c318d2a7
commit be8ace3455
3 changed files with 18 additions and 8 deletions

View File

@@ -290,7 +290,8 @@ export default {
group: this.chartInfo.param.datasource[0].group, group: this.chartInfo.param.datasource[0].group,
select: [this.chartInfo.param.datasource[0].select], select: [this.chartInfo.param.datasource[0].select],
limit: this.chartInfo.param.datasource[0].limit, 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 chartData = []
const params = { const params = {

View File

@@ -87,10 +87,8 @@ export default {
}, },
mounted () { mounted () {
this.metaList = this.valueList.map(item => { this.metaList = this.valueList.map(item => {
return { const obj = Object.assign(new Meta(condition), item)
...new Meta(), return obj
...item
}
}) })
}, },
methods: { methods: {
@@ -118,7 +116,6 @@ export default {
this.$emit('update:valueList', this.metaList) this.$emit('update:valueList', this.metaList)
this.$emit('change') this.$emit('change')
this.$nextTick(() => { this.$nextTick(() => {
console.log(this.$refs.columnSelect)
this.$refs.columnSelect[0].focus() this.$refs.columnSelect[0].focus()
}) })
} }
@@ -131,9 +128,9 @@ export default {
columnBlur (meta, index, type) { columnBlur (meta, index, type) {
setTimeout(() => { setTimeout(() => {
meta.name = meta.name.replace(/"/g, '') meta.name = meta.name.replace(/"/g, '')
// meta.nameIsEditing = false meta.nameIsEditing = false
if (!meta.name) { if (!meta.name) {
// this.metaList.splice(index, 1) this.metaList.splice(index, 1)
this.$emit('update:valueList', this.metaList) this.$emit('update:valueList', this.metaList)
this.$emit('change') this.$emit('change')
} }
@@ -185,6 +182,15 @@ export default {
}, },
valueBlur (meta, index, type) { valueBlur (meta, index, type) {
meta.valueIsEditing = false 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('update:valueList', this.metaList)
this.$emit('change') this.$emit('change')
}, },

View File

@@ -238,6 +238,9 @@ export default {
if (params.type === 'table') { if (params.type === 'table') {
delete params.param.tags 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) { // 修改 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) {