forked from github/dataease
Merge pull request #3534 from dataease/pr@dev@feat_tab-head-sort
feat(组件): Tab组件支持排序
This commit is contained in:
commit
6596ca9d71
@ -11,16 +11,25 @@
|
|||||||
v-if="editFilter.includes(curComponent.type)"
|
v-if="editFilter.includes(curComponent.type)"
|
||||||
icon="el-icon-edit-outline"
|
icon="el-icon-edit-outline"
|
||||||
@click.native="edit"
|
@click.native="edit"
|
||||||
>{{ $t('panel.edit') }}</el-dropdown-item>
|
>{{ $t('panel.edit') }}
|
||||||
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-if="curComponent.type != 'custom-button'"
|
v-if="curComponent.type != 'custom-button'"
|
||||||
icon="el-icon-document-copy"
|
icon="el-icon-document-copy"
|
||||||
@click.native="copy"
|
@click.native="copy"
|
||||||
>{{ $t('panel.copy') }}</el-dropdown-item>
|
>{{ $t('panel.copy') }}
|
||||||
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click.native="deleteComponent"
|
@click.native="deleteComponent"
|
||||||
>{{ $t('panel.delete') }}</el-dropdown-item>
|
>{{ $t('panel.delete') }}
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item
|
||||||
|
v-if="curComponent.type ==='de-tabs'"
|
||||||
|
icon="el-icon-sort"
|
||||||
|
@click.native="openCustomSort"
|
||||||
|
>{{ $t('chart.sort') }}
|
||||||
|
</el-dropdown-item>
|
||||||
<el-dropdown-item v-if="!curComponent.auxiliaryMatrix">
|
<el-dropdown-item v-if="!curComponent.auxiliaryMatrix">
|
||||||
<el-dropdown placement="right-start">
|
<el-dropdown placement="right-start">
|
||||||
<span class="el-icon-copy-document">
|
<span class="el-icon-copy-document">
|
||||||
@ -30,19 +39,23 @@
|
|||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
icon="el-icon-upload2"
|
icon="el-icon-upload2"
|
||||||
@click.native="topComponent"
|
@click.native="topComponent"
|
||||||
>{{ $t('panel.topComponent') }}</el-dropdown-item>
|
>{{ $t('panel.topComponent') }}
|
||||||
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
@click.native="bottomComponent"
|
@click.native="bottomComponent"
|
||||||
>{{ $t('panel.bottomComponent') }}</el-dropdown-item>
|
>{{ $t('panel.bottomComponent') }}
|
||||||
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
icon="el-icon-arrow-up"
|
icon="el-icon-arrow-up"
|
||||||
@click.native="upComponent"
|
@click.native="upComponent"
|
||||||
>{{ $t('panel.upComponent') }}</el-dropdown-item>
|
>{{ $t('panel.upComponent') }}
|
||||||
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
icon="el-icon-arrow-down"
|
icon="el-icon-arrow-down"
|
||||||
@click.native="downComponent"
|
@click.native="downComponent"
|
||||||
>{{ $t('panel.downComponent') }}</el-dropdown-item>
|
>{{ $t('panel.downComponent') }}
|
||||||
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
@ -50,22 +63,26 @@
|
|||||||
v-if="linkageSettingShow"
|
v-if="linkageSettingShow"
|
||||||
icon="el-icon-link"
|
icon="el-icon-link"
|
||||||
@click.native="linkageSetting"
|
@click.native="linkageSetting"
|
||||||
>{{ $t('panel.linkage_setting') }}</el-dropdown-item>
|
>{{ $t('panel.linkage_setting') }}
|
||||||
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-if="'de-tabs'===curComponent.type"
|
v-if="'de-tabs'===curComponent.type"
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
@click.native="addTab"
|
@click.native="addTab"
|
||||||
>{{ $t('panel.add_tab') }}</el-dropdown-item>
|
>{{ $t('panel.add_tab') }}
|
||||||
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-if="linkJumpSetShow"
|
v-if="linkJumpSetShow"
|
||||||
icon="el-icon-connection"
|
icon="el-icon-connection"
|
||||||
@click.native="linkJumpSet"
|
@click.native="linkJumpSet"
|
||||||
>{{ $t('panel.setting_jump') }}</el-dropdown-item>
|
>{{ $t('panel.setting_jump') }}
|
||||||
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-if="curComponent.type != 'custom-button'"
|
v-if="curComponent.type != 'custom-button'"
|
||||||
icon="el-icon-magic-stick"
|
icon="el-icon-magic-stick"
|
||||||
@click.native="boardSet"
|
@click.native="boardSet"
|
||||||
>{{ $t('panel.component_style') }}</el-dropdown-item>
|
>{{ $t('panel.component_style') }}
|
||||||
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
v-if="curComponent.type != 'custom-button'"
|
v-if="curComponent.type != 'custom-button'"
|
||||||
@click.native="hyperlinksSet"
|
@click.native="hyperlinksSet"
|
||||||
@ -91,6 +108,38 @@
|
|||||||
@onClose="hyperlinksSetVisible = false"
|
@onClose="hyperlinksSetVisible = false"
|
||||||
/>
|
/>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
v-if="showCustomSort"
|
||||||
|
v-dialogDrag
|
||||||
|
:title="$t('chart.custom_sort')"
|
||||||
|
:visible="showCustomSort"
|
||||||
|
:show-close="false"
|
||||||
|
width="500px"
|
||||||
|
:append-to-body="true"
|
||||||
|
class="dialog-css"
|
||||||
|
>
|
||||||
|
<custom-tabs-sort
|
||||||
|
ref="customTabsSort"
|
||||||
|
:element="curComponent"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
slot="footer"
|
||||||
|
class="dialog-footer"
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
@click="closeCustomSort"
|
||||||
|
>{{ $t('chart.cancel') }}
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="mini"
|
||||||
|
@click="saveCustomSort"
|
||||||
|
>{{ $t('chart.confirm') }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
@ -100,11 +149,13 @@ import { mapState } from 'vuex'
|
|||||||
import bus from '@/utils/bus'
|
import bus from '@/utils/bus'
|
||||||
import { getViewLinkageGather } from '@/api/panel/linkage'
|
import { getViewLinkageGather } from '@/api/panel/linkage'
|
||||||
import HyperlinksDialog from '@/components/canvas/components/Editor/HyperlinksDialog'
|
import HyperlinksDialog from '@/components/canvas/components/Editor/HyperlinksDialog'
|
||||||
|
import CustomTabsSort from '@/components/widget/DeWidget/CustomTabsSort'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { HyperlinksDialog },
|
components: { CustomTabsSort, HyperlinksDialog },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
showCustomSort: false,
|
||||||
jumpExcludeViewType: [
|
jumpExcludeViewType: [
|
||||||
'richTextView',
|
'richTextView',
|
||||||
'liquid',
|
'liquid',
|
||||||
@ -150,6 +201,18 @@ export default {
|
|||||||
])
|
])
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
openCustomSort() {
|
||||||
|
this.showCustomSort = true
|
||||||
|
},
|
||||||
|
closeCustomSort() {
|
||||||
|
this.showCustomSort = false
|
||||||
|
},
|
||||||
|
saveCustomSort() {
|
||||||
|
this.$refs.customTabsSort.save()
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.showCustomSort = false
|
||||||
|
})
|
||||||
|
},
|
||||||
edit() {
|
edit() {
|
||||||
if (this.curComponent.type === 'custom') {
|
if (this.curComponent.type === 'custom') {
|
||||||
bus.$emit('component-dialog-edit', 'update')
|
bus.$emit('component-dialog-edit', 'update')
|
||||||
@ -157,7 +220,9 @@ export default {
|
|||||||
bus.$emit('button-dialog-edit')
|
bus.$emit('button-dialog-edit')
|
||||||
} else if (this.curComponent.type === 'v-text' || this.curComponent.type === 'de-rich-text' || this.curComponent.type === 'rect-shape') {
|
} else if (this.curComponent.type === 'v-text' || this.curComponent.type === 'de-rich-text' || this.curComponent.type === 'rect-shape') {
|
||||||
bus.$emit('component-dialog-style')
|
bus.$emit('component-dialog-style')
|
||||||
} else { bus.$emit('change_panel_right_draw', true) }
|
} else {
|
||||||
|
bus.$emit('change_panel_right_draw', true)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
lock() {
|
lock() {
|
||||||
this.$store.commit('lock')
|
this.$store.commit('lock')
|
||||||
@ -266,36 +331,36 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.contextmenu {
|
.contextmenu {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
border: 1px solid #e4e7ed;
|
border: 1px solid #e4e7ed;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 5px 0;
|
||||||
|
padding: 6px 0;
|
||||||
|
|
||||||
|
li {
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 0 20px;
|
||||||
|
position: relative;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
color: #606266;
|
||||||
|
height: 34px;
|
||||||
|
line-height: 34px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin: 5px 0;
|
cursor: pointer;
|
||||||
padding: 6px 0;
|
|
||||||
|
|
||||||
li {
|
&:hover {
|
||||||
font-size: 14px;
|
background-color: var(--background-color-base, #f5f7fa);
|
||||||
padding: 0 20px;
|
|
||||||
position: relative;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
color: #606266;
|
|
||||||
height: 34px;
|
|
||||||
line-height: 34px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: var(--background-color-base, #f5f7fa);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
121
frontend/src/components/widget/DeWidget/CustomTabsSort.vue
Normal file
121
frontend/src/components/widget/DeWidget/CustomTabsSort.vue
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<draggable
|
||||||
|
v-model="sortList"
|
||||||
|
group="drag"
|
||||||
|
animation="300"
|
||||||
|
class="drag-list"
|
||||||
|
>
|
||||||
|
<transition-group class="draggable-group">
|
||||||
|
<span
|
||||||
|
v-for="(item) in sortList"
|
||||||
|
:key="item.name"
|
||||||
|
class="item-dimension"
|
||||||
|
:title="item.title"
|
||||||
|
>
|
||||||
|
<svg-icon
|
||||||
|
icon-class="drag"
|
||||||
|
class="item-icon"
|
||||||
|
/>
|
||||||
|
<span class="item-span">
|
||||||
|
{{ item.title }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</transition-group>
|
||||||
|
</draggable>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import { deepCopy } from '@/components/canvas/utils/utils'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'CustomTabsSort',
|
||||||
|
props: {
|
||||||
|
element: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
sortList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
chart() {
|
||||||
|
this.init()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.init()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init() {
|
||||||
|
this.sortList = deepCopy(this.element.options.tabList)
|
||||||
|
},
|
||||||
|
save() {
|
||||||
|
this.element.options.tabList = this.sortList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.drag-list {
|
||||||
|
overflow: auto;
|
||||||
|
height: 50vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-dimension {
|
||||||
|
padding: 2px;
|
||||||
|
margin: 2px;
|
||||||
|
border: solid 1px #eee;
|
||||||
|
text-align: left;
|
||||||
|
color: #606266;
|
||||||
|
/*background-color: rgba(35,46,64,.05);*/
|
||||||
|
background-color: white;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-icon{
|
||||||
|
cursor: move;
|
||||||
|
margin: 0 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-span{
|
||||||
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blackTheme .item-dimension {
|
||||||
|
border: solid 1px;
|
||||||
|
border-color: var(--TableBorderColor);
|
||||||
|
color: var(--TextPrimary);
|
||||||
|
background-color: var(--MainBG);
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-dimension + .item-dimension {
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-dimension:hover {
|
||||||
|
color: #1890ff;
|
||||||
|
background: #e8f4ff;
|
||||||
|
border-color: #a3d3ff;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blackTheme .item-dimension:hover {
|
||||||
|
color: var(--Main);
|
||||||
|
background: var(--ContentBG);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in New Issue
Block a user