From 827d0823aa5d3f1ae52765bca8ddfd73a3c00018 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 29 Mar 2022 11:46:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B5=8F=E8=A7=88=E5=99=A8=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E9=A1=B5=E9=9D=A2=E5=88=86=E5=89=B2=E7=BA=BF=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/dataease/DeAsideContainer.vue | 16 ++++++++++++--- .../dataease/dragbar/DeLeft2RightDragBar.vue | 10 ++++++++-- frontend/src/directive/index.js | 5 ++++- frontend/src/layout/index.vue | 2 +- frontend/src/utils/LayoutUtil.js | 17 ++++++++++++++++ frontend/src/views/dataset/index.vue | 4 ++-- frontend/src/views/panel/list/PanelMain.vue | 2 +- .../src/views/system/datasource/DsMain.vue | 20 ++++++++++++------- .../src/views/system/datasource/index.vue | 4 ++-- 9 files changed, 61 insertions(+), 19 deletions(-) create mode 100644 frontend/src/utils/LayoutUtil.js diff --git a/frontend/src/components/dataease/DeAsideContainer.vue b/frontend/src/components/dataease/DeAsideContainer.vue index 32a90322fd..7b53d3a455 100644 --- a/frontend/src/components/dataease/DeAsideContainer.vue +++ b/frontend/src/components/dataease/DeAsideContainer.vue @@ -1,16 +1,17 @@ diff --git a/frontend/src/components/dataease/dragbar/DeLeft2RightDragBar.vue b/frontend/src/components/dataease/dragbar/DeLeft2RightDragBar.vue index 9d26739bae..9a11e677d1 100644 --- a/frontend/src/components/dataease/dragbar/DeLeft2RightDragBar.vue +++ b/frontend/src/components/dataease/dragbar/DeLeft2RightDragBar.vue @@ -1,10 +1,16 @@ diff --git a/frontend/src/directive/index.js b/frontend/src/directive/index.js index f26cb177cf..1273bd4c9e 100644 --- a/frontend/src/directive/index.js +++ b/frontend/src/directive/index.js @@ -1,8 +1,9 @@ import permission from '@/directive/Permission' -// import dataPermission from '@/directive/DataPermission' +import { setLayout } from '@/utils/LayoutUtil' export const left2RightDrag = { inserted(el, binding) { + const value = binding.value el.onmousedown = function(e) { const init = e.clientX const parent = el.parentNode @@ -15,6 +16,8 @@ export const left2RightDrag = { } } document.onmouseup = function() { + value && setLayout(value, parent.style.width) + document.onmousemove = document.onmouseup = null } } diff --git a/frontend/src/layout/index.vue b/frontend/src/layout/index.vue index 2d609a192b..763b188d4c 100644 --- a/frontend/src/layout/index.vue +++ b/frontend/src/layout/index.vue @@ -4,7 +4,7 @@ - + diff --git a/frontend/src/utils/LayoutUtil.js b/frontend/src/utils/LayoutUtil.js new file mode 100644 index 0000000000..5ffce3e9c6 --- /dev/null +++ b/frontend/src/utils/LayoutUtil.js @@ -0,0 +1,17 @@ +const defaultLayout = { + panel: '260px', + dataset: '260px', + datasource: '260px', + system: '260px' +} +const STORAGE_KEY = 'global_layout' + +export const getLayout = (type) => { + const key = STORAGE_KEY + '_' + type + return localStorage.getItem(key) || defaultLayout[type] +} + +export const setLayout = (type, val) => { + const key = STORAGE_KEY + '_' + type + localStorage.setItem(key, val || defaultLayout[type]) +} diff --git a/frontend/src/views/dataset/index.vue b/frontend/src/views/dataset/index.vue index 328d47a505..46eb2fa035 100644 --- a/frontend/src/views/dataset/index.vue +++ b/frontend/src/views/dataset/index.vue @@ -1,7 +1,7 @@