forked from github/dataease
Merge pull request #2943 from dataease/pr@dev@fix_filter_button
fix(仪表板-过滤器按钮): 清空按钮可以拖入多个
This commit is contained in:
commit
8cd0eb8932
@ -135,6 +135,16 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
deleteComponent() {
|
deleteComponent() {
|
||||||
|
if (this.curComponent.type === 'custom-button' && this.curComponent.serviceName === 'buttonSureWidget') {
|
||||||
|
let len = this.componentData.length
|
||||||
|
while (len--) {
|
||||||
|
const item = this.componentData[len]
|
||||||
|
|
||||||
|
if (item.type === 'custom-button' && item.serviceName === 'buttonResetWidget') {
|
||||||
|
this.componentData.splice(len, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
this.$emit('amRemoveItem')
|
this.$emit('amRemoveItem')
|
||||||
this.deleteCurCondition()
|
this.deleteCurCondition()
|
||||||
this.$store.commit('deleteComponent')
|
this.$store.commit('deleteComponent')
|
||||||
|
@ -368,7 +368,7 @@ export default {
|
|||||||
},
|
},
|
||||||
'cfilters': {
|
'cfilters': {
|
||||||
handler: function(val1, val2) {
|
handler: function(val1, val2) {
|
||||||
if (isChange(val1, val2) && !this.isFirstLoad) {
|
if ((isChange(val1, val2) || isChange(val1, this.filters)) && !this.isFirstLoad) {
|
||||||
this.getData(this.element.propValue.viewId)
|
this.getData(this.element.propValue.viewId)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -100,7 +100,6 @@ export const buildFilterMap = panelItems => {
|
|||||||
let result = buildViewKeyMap(panelItems)
|
let result = buildViewKeyMap(panelItems)
|
||||||
|
|
||||||
result = buildViewKeyFilters(panelItems, result)
|
result = buildViewKeyFilters(panelItems, result)
|
||||||
fillElementsFilter(panelItems, result)
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
v-for="(widget, index) in item"
|
v-for="(widget, index) in item"
|
||||||
:key="widget.widgetName+index"
|
:key="widget.widgetName+index"
|
||||||
:data-id="widget.widgetName"
|
:data-id="widget.widgetName"
|
||||||
:draggable="(widget.widgetName !== 'buttonSureWidget' && widget.widgetName !== 'buttonResetWidget') || (widget.widgetName === 'buttonSureWidget' && !searchButtonExist) || (widget.widgetName === 'buttonResetWidget' && searchButtonExist)"
|
:draggable="(widget.widgetName !== 'buttonSureWidget' && widget.widgetName !== 'buttonResetWidget') || (widget.widgetName === 'buttonSureWidget' && !searchButtonExist) || (widget.widgetName === 'buttonResetWidget' && searchButtonExist && !resetButtonExist)"
|
||||||
:data-index="index"
|
:data-index="index"
|
||||||
:class="'filter-widget '+ (widget.defaultClass || '')"
|
:class="('filter-widget '+ (widget.widgetName === 'buttonSureWidget' ? sureButtonClass : widget.widgetName === 'buttonResetWidget' ? resetButtonClass : widget.defaultClass))"
|
||||||
>
|
>
|
||||||
<div class="filter-widget-icon">
|
<div class="filter-widget-icon">
|
||||||
<i :class="(widget.icon || 'el-icon-setting') + ' widget-icon-i'" />
|
<i :class="(widget.icon || 'el-icon-setting') + ' widget-icon-i'" />
|
||||||
@ -74,38 +74,15 @@ export default {
|
|||||||
resetButtonExist() {
|
resetButtonExist() {
|
||||||
return this.componentData && this.componentData.some(component => component.type === 'custom-button' && component.serviceName === 'buttonResetWidget')
|
return this.componentData && this.componentData.some(component => component.type === 'custom-button' && component.serviceName === 'buttonResetWidget')
|
||||||
},
|
},
|
||||||
resetButtonDisable() {
|
sureButtonClass() {
|
||||||
return !this.resetButtonExist && this.searchButtonExist
|
return this.searchButtonExist ? 'button-disable-filter' : 'time-filter'
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
searchButtonExist(val, old) {
|
|
||||||
if (val === old) return
|
|
||||||
if (val) {
|
|
||||||
this.widgetSubjects['按钮'][0].defaultClass = 'button-disable-filter'
|
|
||||||
if (this.resetButtonExist) {
|
|
||||||
this.widgetSubjects['按钮'][1].defaultClass = 'button-disable-filter'
|
|
||||||
} else {
|
|
||||||
this.widgetSubjects['按钮'][1].defaultClass = 'time-filter'
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.widgetSubjects['按钮'][0].defaultClass = 'time-filter'
|
|
||||||
this.widgetSubjects['按钮'][1].defaultClass = 'button-disable-filter'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
resetButtonExist(val, old) {
|
resetButtonClass() {
|
||||||
if (val === old) return
|
return (this.searchButtonExist && !this.resetButtonExist) ? 'time-filter' : 'button-disable-filter'
|
||||||
if (val) {
|
|
||||||
this.widgetSubjects['按钮'][1].defaultClass = 'button-disable-filter'
|
|
||||||
} else {
|
|
||||||
if (this.searchButtonExist) {
|
|
||||||
this.widgetSubjects['按钮'][1].defaultClass = 'time-filter'
|
|
||||||
} else {
|
|
||||||
this.widgetSubjects['按钮'][1].defaultClass = 'button-disable-filter'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.init()
|
this.init()
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user