refactor(仪表板): 修改Tab轮播设置位置

This commit is contained in:
Wangjiahao 2023-04-06 11:50:49 +08:00
parent 6a7e597c14
commit 7359568d75
6 changed files with 162 additions and 42 deletions

View File

@ -66,6 +66,12 @@
@click.native="linkageSetting"
>{{ $t('panel.linkage_setting') }}
</el-dropdown-item>
<el-dropdown-item
v-if="tabCarouselShow"
icon="el-icon-switch-button"
@click.native="tabCarouselSet"
>{{ $t('panel.carousel') }}
</el-dropdown-item>
<el-dropdown-item
v-if="'de-tabs'===curComponent.type"
icon="el-icon-plus"
@ -115,6 +121,21 @@
/>
</el-dialog>
<!--tab 轮播设计-->
<el-dialog
:visible.sync="tabCarouselVisible"
width="400px"
class="dialog-css"
:destroy-on-close="true"
:append-to-body="true"
:show-close="true"
>
<TabCarouselDialog
v-if="tabCarouselVisible"
@onClose="tabCarouselVisible = false"
/>
</el-dialog>
<el-dialog
v-if="showCustomSort"
v-dialogDrag
@ -155,12 +176,14 @@ import { mapState } from 'vuex'
import bus from '@/utils/bus'
import { getViewLinkageGather } from '@/api/panel/linkage'
import HyperlinksDialog from '@/components/canvas/components/editor/HyperlinksDialog'
import TabCarouselDialog from '@/components/canvas/components/editor/TabCarouselDialog'
import CustomTabsSort from '@/components/widget/deWidget/CustomTabsSort'
export default {
components: { CustomTabsSort, HyperlinksDialog },
components: { CustomTabsSort, HyperlinksDialog,TabCarouselDialog },
data() {
return {
tabCarouselVisible: false,
systemOS: 'Mac',
showCustomSort: false,
jumpExcludeViewType: [
@ -189,6 +212,9 @@ export default {
}
},
computed: {
tabCarouselShow() {
return this.curComponent.type === 'de-tabs'
},
linkJumpSetShow() {
return this.curComponent.type === 'view' &&
!this.jumpExcludeViewType.includes(this.curComponent.propValue.innerType) &&
@ -340,7 +366,12 @@ export default {
//
hyperlinksSet() {
this.hyperlinksSetVisible = true
},
//
tabCarouselSet() {
this.tabCarouselVisible = true
}
}
}
</script>

View File

@ -0,0 +1,127 @@
<template>
<el-row>
<el-form
ref="form"
size="mini"
label-width="70px"
>
<el-form-item :label="$t('panel.enable_carousel')">
<el-switch
v-model="carouselEnable"
size="mini"
/>
</el-form-item>
<el-form-item :label="$t('panel.switch_time')">
<el-input
v-model="switchTime"
:disabled="!carouselEnable"
type="number"
size="mini"
:min="2"
:max="3600"
class="hide-icon-number number-padding"
@change="switchTimeChange"
>
<template slot="append">S</template>
</el-input>
</el-form-item>
<el-form-item>
<el-button
type="primary"
@click="onSubmit"
>{{ $t('panel.confirm') }}</el-button>
<el-button @click="onClose">{{ $t('panel.cancel') }}</el-button>
</el-form-item>
</el-form>
</el-row>
</template>
<script>
import { mapState } from 'vuex'
export default {
data() {
return {
carouselEnable: false,
switchTime: 50
}
},
computed: {
...mapState([
'curComponent'
])
},
created() {
this.carouselEnable = this.curComponent.style.carouselEnable
this.switchTime = this.curComponent.style.switchTime
},
mounted() {
},
methods: {
switchTimeChange() {
if (!this.switchTime || this.switchTime < 2) {
this.switchTime = 2
} else if (this.switchTime && this.switchTime > 3600) {
this.switchTime = 3600
}
},
onSubmit() {
this.curComponent.style.carouselEnable = this.carouselEnable
this.curComponent.style.switchTime = this.switchTime
this.$store.commit('canvasChange')
this.onClose()
},
onClose() {
this.$emit('onClose')
}
}
}
</script>
<style lang="scss" scoped>
.slot-class{
color: white;
}
.bottom {
margin-top: 20px;
text-align: center;
}
.ellip{
/*width: 100%;*/
margin-left: 10px;
margin-right: 10px;
overflow: hidden;/*超出部分隐藏*/
white-space: nowrap;/*不换行*/
text-overflow:ellipsis;/*超出部分文字以...显示*/
background-color: #f7f8fa;
color: #3d4d66;
font-size: 12px;
line-height: 24px;
height: 24px;
border-radius: 3px;
}
.select-filed{
/*width: 100%;*/
margin-left: 10px;
margin-right: 10px;
overflow: hidden;/*超出部分隐藏*/
white-space: nowrap;/*不换行*/
text-overflow:ellipsis;/*超出部分文字以...显示*/
color: #3d4d66;
font-size: 12px;
line-height: 35px;
height: 35px;
border-radius: 3px;
}
::v-deep .el-popover{
height: 200px;
overflow: auto;
}
.icon-font{
color: white;
}
</style>

View File

@ -112,39 +112,6 @@
<el-radio-button label="right">{{ $t('chart.text_pos_right') }}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('panel.carousel')">
<el-row>
<el-col :span="6">
<el-checkbox
v-model="styleInfo.carouselEnable"
size="mini"
@change="styleChange"
>{{ $t('commons.enable') }}
</el-checkbox>
</el-col>
<el-col
:span="8"
style="text-align: right;padding-right: 10px"
>
{{ $t('panel.switch_time') }}
</el-col>
<el-col :span="10">
<el-input
v-model="styleInfo.switchTime"
:disabled="!styleInfo.carouselEnable"
type="number"
size="mini"
:min="2"
:max="3600"
class="hide-icon-number number-padding"
@change="switchTimeChange"
>
<template slot="append">S</template>
</el-input>
</el-col>
</el-row>
</el-form-item>
</el-form>
<i
slot="reference"
@ -181,14 +148,6 @@ export default {
const current = this.$refs[pickKey]
current && (current.showPicker = true)
},
switchTimeChange() {
if (!this.styleInfo.switchTime || this.styleInfo.switchTime < 2) {
this.styleInfo.switchTime = 2
} else if (this.styleInfo.switchTime && this.styleInfo.switchTime > 3600) {
this.styleInfo.switchTime = 3600
}
this.styleChange()
},
styleChange() {
this.$store.commit('canvasChange')
}

View File

@ -2001,6 +2001,7 @@ export default {
position_adjust_component: 'Position adjust',
active_font_size: 'Selected font size',
carousel: 'Carousel',
enable_carousel: 'Enable Carousel',
switch_time: 'Switch time',
position_adjust: 'Position',
space_top: 'Top',

View File

@ -1995,6 +1995,7 @@ export default {
position_adjust_component: '位置調整',
active_font_size: '选中字體大小',
carousel: '輪播',
enable_carousel: '啟用輪播',
switch_time: '切換時間',
position_adjust: '位置',
space_top: '上',

View File

@ -2012,6 +2012,7 @@ export default {
position_adjust_component: '位置调整',
active_font_size: '选中字体大小',
carousel: '轮播',
enable_carousel: '启用轮播',
switch_time: '切换时间',
position_adjust: '位置',
space_top: '上',