Merge pull request #4119 from dataease/pr@dev@feat_filter-options

feat(仪表板): 仪表板刷新时,过滤组件的备选项同时更新
This commit is contained in:
王嘉豪 2022-12-16 17:26:04 +08:00 committed by GitHub
commit f6b5be96c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 13 deletions

View File

@ -44,6 +44,7 @@
:in-screen="inScreen"
:edit-mode="'preview'"
:h="config.style.height"
:search-count="searchCount"
:canvas-id="canvasId"
/>
<component
@ -278,7 +279,7 @@ export default {
} else {
return {
...
getStyle(style, ['top', 'left', 'width', 'height', 'rotate']),
getStyle(style, ['top', 'left', 'width', 'height', 'rotate']),
position: 'relative'
}
}

View File

@ -96,10 +96,16 @@ export default {
isRelation: {
type: Boolean,
default: false
},
searchCount: {
type: Number,
required: false,
default: 0
}
},
data() {
return {
needRefreshComponents: ['de-select', 'de-select-grid', 'de-select-tree'],
inputMaxSize: 46,
inputLargeSize: 42,
inputSmallSize: 38,
@ -138,6 +144,7 @@ export default {
return ['de-select', 'de-select-grid', 'de-date', 'de-input-search', 'de-number-range', 'de-select-tree'].includes(this.element.component)
},
...mapState([
'curComponent',
'previewCanvasScale'
])
},
@ -148,6 +155,13 @@ export default {
},
deep: true,
immediate: true
},
//
searchCount: function(val1) {
//
if (val1 > 0 && this.needRefreshComponents.includes(this.element.component) && (!this.curComponent || this.curComponent.id !== this.element.id)) {
this.$refs['deOutWidget'].refreshLoad()
}
}
},
mounted() {

View File

@ -47,6 +47,7 @@ import { isSameVueObj, mergeCustomSortOption } from '@/utils'
import { getLinkToken, getToken } from '@/utils/auth'
import customInput from '@/components/widget/deWidget/customInput'
import { textSelectWidget } from '@/components/widget/deWidget/serviceNameFn.js'
export default {
components: { ElVisualSelect },
mixins: [customInput],
@ -255,6 +256,16 @@ export default {
},
initLoad() {
this.value = this.fillValueDerfault()
this.initOptions()
if (this.element.options.value) {
this.value = this.fillValueDerfault()
this.changeValue(this.value)
}
},
refreshLoad() {
this.initOptions()
},
initOptions() {
this.data = []
if (this.element.options.attrs.fieldId) {
let method = multFieldValues
@ -273,10 +284,6 @@ export default {
bus.$emit('valid-values-change', false)
})
}
if (this.element.options.value) {
this.value = this.fillValueDerfault()
this.changeValue(this.value)
}
},
visualChange(value) {
this.value = value

View File

@ -286,6 +286,16 @@ export default {
textSelectGridWidget: textSelectGridWidget,
initLoad() {
this.value = this.element.options.attrs.multiple ? [] : null
this.initOptions()
if (this.element.options.value) {
this.value = this.fillValueDerfault()
this.changeValue(this.value)
}
},
refreshLoad() {
this.initOptions()
},
initOptions() {
if (this.element.options.attrs.fieldId) {
let method = multFieldValues
const token = this.$store.getters.token || getToken()
@ -305,10 +315,6 @@ export default {
}
})
}
if (this.element.options.value) {
this.value = this.fillValueDerfault()
this.changeValue(this.value)
}
},
changeValue(value) {
if (!this.inDraw) {

View File

@ -265,6 +265,17 @@ export default {
},
initLoad() {
this.value = this.fillValueDerfault()
this.data = []
this.initOptions()
if (this.element.options.value) {
this.value = this.fillValueDerfault()
this.changeValue(this.value)
}
},
refreshLoad() {
this.initOptions()
},
initOptions() {
this.data = []
if (this.element.options.attrs.fieldId) {
let method = mappingFieldValues
@ -283,10 +294,6 @@ export default {
})
})
}
if (this.element.options.value) {
this.value = this.fillValueDerfault()
this.changeValue(this.value)
}
},
changeValue(value) {
if (!this.inDraw) {