forked from github/dataease
Merge pull request #1502 from dataease/pr@dev@refactor_panel-mb
refactor: 仪表板滚动时可以使过滤组件失去焦点隐藏弹框
This commit is contained in:
commit
4ea876fb80
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="bg" :style="customStyle">
|
<div class="bg" :style="customStyle" @scroll="canvasScroll">
|
||||||
<div id="canvasInfoMain" ref="canvasInfoMain" :style="canvasInfoMainStyle">
|
<div id="canvasInfoMain" ref="canvasInfoMain" :style="canvasInfoMainStyle">
|
||||||
<div
|
<div
|
||||||
id="canvasInfoTemp"
|
id="canvasInfoTemp"
|
||||||
@ -65,6 +65,7 @@ import elementResizeDetectorMaker from 'element-resize-detector'
|
|||||||
import UserViewDialog from '@/components/canvas/custom-component/UserViewDialog'
|
import UserViewDialog from '@/components/canvas/custom-component/UserViewDialog'
|
||||||
import CanvasOptBar from '@/components/canvas/components/Editor/CanvasOptBar'
|
import CanvasOptBar from '@/components/canvas/components/Editor/CanvasOptBar'
|
||||||
import UserViewMobileDialog from '@/components/canvas/custom-component/UserViewMobileDialog'
|
import UserViewMobileDialog from '@/components/canvas/custom-component/UserViewMobileDialog'
|
||||||
|
import bus from '@/utils/bus'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { UserViewMobileDialog, ComponentWrapper, UserViewDialog, CanvasOptBar },
|
components: { UserViewMobileDialog, ComponentWrapper, UserViewDialog, CanvasOptBar },
|
||||||
@ -314,6 +315,9 @@ export default {
|
|||||||
},
|
},
|
||||||
initMobileCanvas() {
|
initMobileCanvas() {
|
||||||
this.$store.commit('openMobileLayout')
|
this.$store.commit('openMobileLayout')
|
||||||
|
},
|
||||||
|
canvasScroll() {
|
||||||
|
bus.$emit('onScroll')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,15 @@
|
|||||||
:size="size"
|
:size="size"
|
||||||
:editable="false"
|
:editable="false"
|
||||||
@change="dateChange"
|
@change="dateChange"
|
||||||
|
@focus="toFocus"
|
||||||
|
@blur="onBlur"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ApplicationContext } from '@/utils/ApplicationContext'
|
import { ApplicationContext } from '@/utils/ApplicationContext'
|
||||||
import { timeSection } from '@/utils'
|
import { timeSection } from '@/utils'
|
||||||
|
import bus from "@/utils/bus";
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
@ -40,7 +43,9 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
operator: 'between',
|
operator: 'between',
|
||||||
values: null
|
values: null,
|
||||||
|
onFocus: false
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -100,7 +105,20 @@ export default {
|
|||||||
this.dateChange(this.values)
|
this.dateChange(this.values)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
bus.$on('onScroll', () => {
|
||||||
|
if (this.onFocus) {
|
||||||
|
this.$refs.dateRef.hidePicker()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
onBlur() {
|
||||||
|
this.onFocus = false
|
||||||
|
},
|
||||||
|
toFocus() {
|
||||||
|
this.onFocus = true
|
||||||
|
},
|
||||||
search() {
|
search() {
|
||||||
this.setCondition()
|
this.setCondition()
|
||||||
},
|
},
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
:size="size"
|
:size="size"
|
||||||
@change="changeValue"
|
@change="changeValue"
|
||||||
@focus="setOptionWidth"
|
@focus="setOptionWidth"
|
||||||
|
@blur="onBlur"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in datas"
|
v-for="item in datas"
|
||||||
@ -28,6 +29,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { multFieldValues } from '@/api/dataset/dataset'
|
import { multFieldValues } from '@/api/dataset/dataset'
|
||||||
|
import bus from '@/utils/bus'
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
@ -52,7 +54,8 @@ export default {
|
|||||||
selectOptionWidth: 0,
|
selectOptionWidth: 0,
|
||||||
show: true,
|
show: true,
|
||||||
value: null,
|
value: null,
|
||||||
datas: []
|
datas: [],
|
||||||
|
onFocus: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -105,8 +108,18 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.initLoad()
|
this.initLoad()
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
bus.$on('onScroll', () => {
|
||||||
|
if (this.onFocus) {
|
||||||
|
this.$refs.deSelect.blur()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
onBlur() {
|
||||||
|
this.onFocus = false
|
||||||
|
},
|
||||||
initLoad() {
|
initLoad() {
|
||||||
this.value = this.fillValueDerfault()
|
this.value = this.fillValueDerfault()
|
||||||
this.datas = []
|
this.datas = []
|
||||||
@ -181,6 +194,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
setOptionWidth(event) {
|
setOptionWidth(event) {
|
||||||
|
this.onFocus = true
|
||||||
// 下拉框弹出时,设置弹框的宽度
|
// 下拉框弹出时,设置弹框的宽度
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.selectOptionWidth = event.srcElement.offsetWidth + 'px'
|
this.selectOptionWidth = event.srcElement.offsetWidth + 'px'
|
||||||
|
@ -887,6 +887,7 @@ export default {
|
|||||||
canvasScroll(event) {
|
canvasScroll(event) {
|
||||||
this.scrollLeft = event.target.scrollLeft
|
this.scrollLeft = event.target.scrollLeft
|
||||||
this.scrollTop = event.target.scrollTop
|
this.scrollTop = event.target.scrollTop
|
||||||
|
bus.$emit('onScroll')
|
||||||
},
|
},
|
||||||
destroyTimeMachine() {
|
destroyTimeMachine() {
|
||||||
this.timeMachine && clearTimeout(this.timeMachine)
|
this.timeMachine && clearTimeout(this.timeMachine)
|
||||||
|
Loading…
Reference in New Issue
Block a user