forked from github/dataease
fix(仪表板-下拉框过滤器): 拖入多个字段排序字段无法展示
This commit is contained in:
parent
765909db1d
commit
2ea8a41d75
@ -181,7 +181,7 @@
|
|||||||
|
|
||||||
<de-main-container class="ms-main-container">
|
<de-main-container class="ms-main-container">
|
||||||
<div v-if="currentElement.options && currentElement.options.attrs">
|
<div v-if="currentElement.options && currentElement.options.attrs">
|
||||||
<filter-head :element="currentElement" :table-fields-map="tableFieldsMap" :widget="widget" />
|
<filter-head :element="currentElement" :widget="widget" />
|
||||||
|
|
||||||
<filter-control :element="currentElement" :widget="widget" :control-attrs="myAttrs" :child-views="childViews" />
|
<filter-control :element="currentElement" :widget="widget" :control-attrs="myAttrs" :child-views="childViews" />
|
||||||
|
|
||||||
@ -297,7 +297,6 @@ export default {
|
|||||||
datasetParams: []
|
datasetParams: []
|
||||||
},
|
},
|
||||||
currentElement: null,
|
currentElement: null,
|
||||||
tableFieldsMap: {},
|
|
||||||
tempTreeDatas: null,
|
tempTreeDatas: null,
|
||||||
showTips: false
|
showTips: false
|
||||||
}
|
}
|
||||||
@ -632,7 +631,6 @@ export default {
|
|||||||
loadField(tableId) {
|
loadField(tableId) {
|
||||||
fieldListWithPermission(tableId).then(res => {
|
fieldListWithPermission(tableId).then(res => {
|
||||||
let datas = res.data
|
let datas = res.data
|
||||||
this.$set(this.tableFieldsMap, tableId, JSON.parse(JSON.stringify(datas)))
|
|
||||||
if (this.widget && this.widget.filterFieldMethod) {
|
if (this.widget && this.widget.filterFieldMethod) {
|
||||||
datas = this.widget.filterFieldMethod(datas)
|
datas = this.widget.filterFieldMethod(datas)
|
||||||
}
|
}
|
||||||
@ -643,7 +641,6 @@ export default {
|
|||||||
comLoadField(tableId) {
|
comLoadField(tableId) {
|
||||||
fieldListWithPermission(tableId).then(res => {
|
fieldListWithPermission(tableId).then(res => {
|
||||||
let datas = res.data
|
let datas = res.data
|
||||||
this.$set(this.tableFieldsMap, tableId, JSON.parse(JSON.stringify(datas)))
|
|
||||||
if (this.widget && this.widget.filterFieldMethod) {
|
if (this.widget && this.widget.filterFieldMethod) {
|
||||||
datas = this.widget.filterFieldMethod(datas)
|
datas = this.widget.filterFieldMethod(datas)
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
<v-flex v-for="(item,index) in element.options.attrs.dragItems" :key="item.id">
|
<v-flex v-for="(item,index) in element.options.attrs.dragItems" :key="item.id">
|
||||||
<drag-item :key="item.id" :is-sort-widget="isSortWidget" :item="item" :index="index" :sort="element.options.attrs.sort" :all-fields="index ? [] : fieldsMap[item.tableId]" @closeItem="closeItem" @sort-change="sortChange" />
|
<drag-item :key="item.id" :is-sort-widget="isSortWidget" :item="item" :index="index" :sort="element.options.attrs.sort" :all-fields="index ? [] : tableFields" @closeItem="closeItem" @sort-change="sortChange" />
|
||||||
</v-flex>
|
</v-flex>
|
||||||
|
|
||||||
<span solt="footer">{{ $t('panel.drag_here') }}</span>
|
<span solt="footer">{{ $t('panel.drag_here') }}</span>
|
||||||
@ -34,6 +34,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import draggable from 'vuedraggable'
|
import draggable from 'vuedraggable'
|
||||||
import DragItem from '@/components/DragItem'
|
import DragItem from '@/components/DragItem'
|
||||||
|
import { fieldListWithPermission } from '@/api/dataset/dataset'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'FilterHead',
|
name: 'FilterHead',
|
||||||
components: {
|
components: {
|
||||||
@ -45,10 +47,7 @@ export default {
|
|||||||
type: Object,
|
type: Object,
|
||||||
default: () => {}
|
default: () => {}
|
||||||
},
|
},
|
||||||
tableFieldsMap: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {}
|
|
||||||
},
|
|
||||||
widget: {
|
widget: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: null
|
default: null
|
||||||
@ -56,25 +55,42 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
targets: []
|
targets: [],
|
||||||
|
tableFields: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isSortWidget() {
|
isSortWidget() {
|
||||||
return this.widget && this.widget.isSortWidget && this.widget.isSortWidget()
|
return this.widget && this.widget.isSortWidget && this.widget.isSortWidget()
|
||||||
},
|
},
|
||||||
fieldsMap() {
|
|
||||||
return JSON.parse(JSON.stringify(this.tableFieldsMap))
|
firstTableId() {
|
||||||
|
if (!this.isSortWidget) return null
|
||||||
|
if (this.element.options.attrs.dragItems && this.element.options.attrs.dragItems.length) {
|
||||||
|
return this.element.options.attrs.dragItems[0].tableId
|
||||||
|
}
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
|
firstTableId(val, old) {
|
||||||
|
if (val !== old) {
|
||||||
|
this.loadFields()
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
if (this.isSortWidget && this.element.options.attrs.dragItems && this.element.options.attrs.dragItems.length) {
|
||||||
|
this.loadFields()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
loadFields() {
|
||||||
|
fieldListWithPermission(this.firstTableId).then(res => {
|
||||||
|
this.tableFields = JSON.parse(JSON.stringify(res.data))
|
||||||
|
})
|
||||||
|
},
|
||||||
onMove(e, originalEvent) {
|
onMove(e, originalEvent) {
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user