forked from github/dataease
Merge pull request #3838 from dataease/pr@dev@feat_filter_select_grid_custom_sort
feat(过滤器): 文本下拉列表增加自定义排序
This commit is contained in:
commit
754c8c8673
@ -71,7 +71,7 @@
|
|||||||
import { linkMultFieldValues, multFieldValues } from '@/api/dataset/dataset'
|
import { linkMultFieldValues, multFieldValues } from '@/api/dataset/dataset'
|
||||||
import { getLinkToken, getToken } from '@/utils/auth'
|
import { getLinkToken, getToken } from '@/utils/auth'
|
||||||
import bus from '@/utils/bus'
|
import bus from '@/utils/bus'
|
||||||
import { isSameVueObj } from '@/utils'
|
import { isSameVueObj, mergeCustomSortOption } from '@/utils'
|
||||||
import { attrsMap, styleAttrs, textSelectGridWidget } from '@/components/widget/deWidget/serviceNameFn.js'
|
import { attrsMap, styleAttrs, textSelectGridWidget } from '@/components/widget/deWidget/serviceNameFn.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -142,6 +142,9 @@ export default {
|
|||||||
cssArr() {
|
cssArr() {
|
||||||
const { brColor, wordColor, innerBgColor } = this.element.style
|
const { brColor, wordColor, innerBgColor } = this.element.style
|
||||||
return { brColor, wordColor, innerBgColor }
|
return { brColor, wordColor, innerBgColor }
|
||||||
|
},
|
||||||
|
isCustomSortWidget() {
|
||||||
|
return this.element.serviceName === 'textSelectGridWidget'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -354,7 +357,11 @@ export default {
|
|||||||
},
|
},
|
||||||
optionData(data) {
|
optionData(data) {
|
||||||
if (!data) return null
|
if (!data) return null
|
||||||
return data.filter(item => !!item).map(item => {
|
let tempData = data.filter(item => !!item)
|
||||||
|
if (this.isCustomSortWidget && this.element.options.attrs?.sort?.sort === 'custom') {
|
||||||
|
tempData = mergeCustomSortOption(this.element.options.attrs.sort.list, tempData)
|
||||||
|
}
|
||||||
|
return tempData.map(item => {
|
||||||
return {
|
return {
|
||||||
id: item,
|
id: item,
|
||||||
text: item
|
text: item
|
||||||
|
@ -96,6 +96,9 @@ class TextSelectGridServiceImpl extends WidgetService {
|
|||||||
isSortWidget() {
|
isSortWidget() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
isCustomSortWidget() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
fillValueDerfault(element) {
|
fillValueDerfault(element) {
|
||||||
const defaultV = element.options.value === null ? '' : element.options.value.toString()
|
const defaultV = element.options.value === null ? '' : element.options.value.toString()
|
||||||
if (element.options.attrs.multiple) {
|
if (element.options.attrs.multiple) {
|
||||||
|
Loading…
Reference in New Issue
Block a user