mirror of
https://github.com/dataease/dataease.git
synced 2025-02-25 12:03:05 +08:00
Merge pull request #2508 from dataease/pr@dev@fix_mult_filedl_condition
fix: 过滤组件禁止同数据集多字段
This commit is contained in:
commit
6123702aea
@ -52,6 +52,7 @@ class TextSelectTreeServiceImpl extends WidgetService {
|
||||
super(options)
|
||||
this.filterDialog = true
|
||||
this.showSwitch = true
|
||||
this.isTree = true
|
||||
}
|
||||
|
||||
initLeftPanel() {
|
||||
|
@ -1754,7 +1754,8 @@ export default {
|
||||
default_settings: 'Default Settings',
|
||||
choose_background: 'Choose Component Background',
|
||||
choose_background_tips: 'The component`s own background settings will overwrite the current settings',
|
||||
visual: 'Visual'
|
||||
visual: 'Visual',
|
||||
prohibit_multiple: 'Prohibit multiple fields in the same dataset'
|
||||
},
|
||||
plugin: {
|
||||
local_install: 'Local installation',
|
||||
|
@ -1758,7 +1758,8 @@ export default {
|
||||
setting_background: '設置背景',
|
||||
setting_jump: '跳轉設置',
|
||||
select_view: '請選擇視圖...',
|
||||
visual: '虛擬化'
|
||||
visual: '虛擬化',
|
||||
prohibit_multiple: '禁止同數據集多字段'
|
||||
},
|
||||
plugin: {
|
||||
local_install: '本地安裝',
|
||||
|
@ -1767,7 +1767,8 @@ export default {
|
||||
setting_background: '设置背景',
|
||||
setting_jump: '跳转设置',
|
||||
select_view: '请选择视图...',
|
||||
visual: '虚拟化'
|
||||
visual: '虚拟化',
|
||||
prohibit_multiple: '禁止同数据集多字段'
|
||||
},
|
||||
plugin: {
|
||||
local_install: '本地安装',
|
||||
|
@ -64,7 +64,7 @@
|
||||
animation="300"
|
||||
:move="onMove"
|
||||
class="drag-list"
|
||||
@end="end"
|
||||
@end="endDs"
|
||||
>
|
||||
<transition-group>
|
||||
<div
|
||||
@ -150,7 +150,7 @@
|
||||
animation="300"
|
||||
:move="onMove"
|
||||
class="drag-list"
|
||||
@end="end"
|
||||
@end="endVw"
|
||||
>
|
||||
<transition-group>
|
||||
<div
|
||||
@ -301,7 +301,9 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
isTree() {
|
||||
return this.widget && this.widget.isTree
|
||||
},
|
||||
...mapState([
|
||||
'componentData'
|
||||
])
|
||||
@ -361,6 +363,7 @@ export default {
|
||||
}
|
||||
this.initWithField()
|
||||
this.loadViews()
|
||||
this.ProhibitMultiple()
|
||||
},
|
||||
mounted() {
|
||||
bus.$on('valid-values-change', valid => {
|
||||
@ -666,19 +669,23 @@ export default {
|
||||
return true
|
||||
},
|
||||
|
||||
end(e) {
|
||||
this.refuseMove(e)
|
||||
endDs(e) {
|
||||
this.refuseMove(e, this.fieldDatas)
|
||||
this.removeCheckedKey(e)
|
||||
},
|
||||
endVw(e) {
|
||||
this.refuseMove(e, this.comFieldDatas)
|
||||
this.removeCheckedKey(e)
|
||||
},
|
||||
|
||||
refuseMove(e) {
|
||||
refuseMove(e, datas) {
|
||||
const that = this
|
||||
const xItems = this.fieldDatas.filter(function(m) {
|
||||
const xItems = datas.filter(function(m) {
|
||||
return m.id === that.moveId
|
||||
})
|
||||
|
||||
if (xItems && xItems.length > 1) {
|
||||
this.fieldDatas.splice(e.newDraggableIndex, 1)
|
||||
this.datas.splice(e.newDraggableIndex, 1)
|
||||
}
|
||||
},
|
||||
removeCheckedKey(e) {
|
||||
@ -691,6 +698,19 @@ export default {
|
||||
if (xItems && xItems.length > 1) {
|
||||
this.currentElement.options.attrs.dragItems.splice(e.newDraggableIndex, 1)
|
||||
}
|
||||
this.ProhibitMultiple()
|
||||
},
|
||||
|
||||
ProhibitMultiple() {
|
||||
if (this.isTree) return
|
||||
const sourceLen = this.currentElement.options.attrs.dragItems.length
|
||||
if (!sourceLen) return
|
||||
const res = new Map()
|
||||
|
||||
const result = this.currentElement.options.attrs.dragItems.filter(item => !res.has(item.tableId) && res.set(item.tableId), 1)
|
||||
this.currentElement.options.attrs.dragItems = result
|
||||
const newLen = result.length
|
||||
if (sourceLen > newLen) this.$warning(this.$t('panel.prohibit_multiple'))
|
||||
},
|
||||
|
||||
enableSureButton() {
|
||||
|
@ -103,7 +103,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'FilterControl',
|
||||
@ -135,6 +134,9 @@ export default {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
|
||||
created() {
|
||||
this.attrs = this.controlAttrs
|
||||
|
Loading…
Reference in New Issue
Block a user