fix:修改 filter 切换system 未删除的问题 以及 不支持class语法的问题
This commit is contained in:
@@ -63,13 +63,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div class="tag-search__add cursor-pointer" @click="addCondition">{{$t('project.topology.add')}}</div>
|
<div class="tag-search__add cursor-pointer" @click="addCondition()">{{$t('project.topology.add')}}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import _ from 'lodash'
|
import { connection, condition } from './filterSearch.js'
|
||||||
import Meta, { connection, condition } from './filterSearch.js'
|
|
||||||
export default {
|
export default {
|
||||||
name: 'filterSearch',
|
name: 'filterSearch',
|
||||||
props: {
|
props: {
|
||||||
@@ -82,34 +81,47 @@ export default {
|
|||||||
connection,
|
connection,
|
||||||
compareList: [],
|
compareList: [],
|
||||||
metaList: [],
|
metaList: [],
|
||||||
rule: []
|
rule: [],
|
||||||
|
meta: {
|
||||||
|
meta: condition,
|
||||||
|
name: '',
|
||||||
|
nameIsEditing: false,
|
||||||
|
oper: '',
|
||||||
|
operIsEditing: false,
|
||||||
|
value: '',
|
||||||
|
valueIsEditing: false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.metaList = this.valueList.map(item => {
|
this.metaList = this.valueList.map(item => {
|
||||||
const obj = Object.assign(new Meta(condition), item)
|
return item
|
||||||
return obj
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 新增条件
|
// 新增条件
|
||||||
addCondition (meta) {
|
addCondition (meta) {
|
||||||
this.metaList.forEach(m => {
|
this.metaList.forEach(m => {
|
||||||
m.cancelEditing()
|
this.nameIsEditing = false
|
||||||
|
this.operIsEditing = false
|
||||||
|
this.valueIsEditing = false
|
||||||
})
|
})
|
||||||
// 先判断上一个condition是否已填写完整,没有则删除;之后将当前所有meta的内容的isEditing置为false
|
// 先判断上一个condition是否已填写完整,没有则删除;之后将当前所有meta的内容的isEditing置为false
|
||||||
if (this.metaList.length > 0) {
|
if (this.metaList.length > 0) {
|
||||||
const prevMeta = this.metaList[this.metaList.length - 1]
|
const prevMeta = this.metaList[this.metaList.length - 1]
|
||||||
if (!prevMeta.isCompleteCondition()) {
|
if (!(prevMeta.name && prevMeta.oper && prevMeta.value)) {
|
||||||
this.metaList.splice(this.metaList.length - 1, 1)
|
this.metaList.splice(this.metaList.length - 1, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 不是首个condition时,先增加一个connection,再增加一个新condition
|
// 不是首个condition时,先增加一个connection,再增加一个新condition
|
||||||
if (meta instanceof Meta) {
|
console.log(meta)
|
||||||
|
if (meta) {
|
||||||
this.metaList.push(meta)
|
this.metaList.push(meta)
|
||||||
this.$emit('metaList')
|
this.$emit('metaList')
|
||||||
} else {
|
} else {
|
||||||
const newCondition = new Meta(condition)
|
let self = this
|
||||||
|
const newCondition = Object.assign({}, self.meta)
|
||||||
|
console.log(newCondition)
|
||||||
newCondition.nameIsEditing = true
|
newCondition.nameIsEditing = true
|
||||||
this.metaList.push(newCondition)
|
this.metaList.push(newCondition)
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
|
|||||||
@@ -100,6 +100,7 @@
|
|||||||
prop="param.filter"
|
prop="param.filter"
|
||||||
>
|
>
|
||||||
<filterSearch
|
<filterSearch
|
||||||
|
ref="filterSearch"
|
||||||
:valueList.sync="item.filter"
|
:valueList.sync="item.filter"
|
||||||
@change="change"
|
@change="change"
|
||||||
:keyList="keyList"
|
:keyList="keyList"
|
||||||
@@ -589,7 +590,7 @@
|
|||||||
import publicConfig from '@/components/common/rightBox/chart/publicConfig'
|
import publicConfig from '@/components/common/rightBox/chart/publicConfig'
|
||||||
import chartTypeShow from '@/components/common/rightBox/chart/chartTypeShow'
|
import chartTypeShow from '@/components/common/rightBox/chart/chartTypeShow'
|
||||||
import nezhaColor from '@/components/common/nezhaColor'
|
import nezhaColor from '@/components/common/nezhaColor'
|
||||||
import filterSearch from '@/components/common/filterSearch/filterSearch'
|
import filterSearch, { condition } from '@/components/common/filterSearch/filterSearch'
|
||||||
import VueTagsInput from '@johmun/vue-tags-input'
|
import VueTagsInput from '@johmun/vue-tags-input'
|
||||||
import { isGauge } from '@/components/chart/chart/tools'
|
import { isGauge } from '@/components/chart/chart/tools'
|
||||||
|
|
||||||
@@ -770,6 +771,7 @@ export default {
|
|||||||
this.chartConfig.param.datasource[0].group = ''
|
this.chartConfig.param.datasource[0].group = ''
|
||||||
this.chartConfig.param.datasource[0].select = ''
|
this.chartConfig.param.datasource[0].select = ''
|
||||||
this.chartConfig.param.datasource[0].filter = []
|
this.chartConfig.param.datasource[0].filter = []
|
||||||
|
this.$refs.filterSearch[0].metaList = []
|
||||||
this.groupList = item.group
|
this.groupList = item.group
|
||||||
this.selectList = JSON.parse(JSON.stringify(item.select))
|
this.selectList = JSON.parse(JSON.stringify(item.select))
|
||||||
this.keyList = JSON.parse(JSON.stringify(item.filter))
|
this.keyList = JSON.parse(JSON.stringify(item.filter))
|
||||||
|
|||||||
Reference in New Issue
Block a user