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,
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 = {

View File

@@ -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')
},

View File

@@ -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) {