From 7b0a6bc2bec7059c9cfc5367e7c09a90e9816920 Mon Sep 17 00:00:00 2001
From: sheng <15292050171@163.com>
Date: Wed, 26 Jul 2023 18:12:15 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=20=E8=8F=9C=E5=8D=95=E7=AE=A1=E7=90=86?=
=?UTF-8?q?=E8=8F=9C=E5=8D=95=E5=88=97=E8=A1=A8=E4=B8=8A=E7=A7=BB=E4=B8=8B?=
=?UTF-8?q?=E7=A7=BB=E6=B7=BB=E5=8A=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
web/.env.development | 4 ++--
web/src/views/system/menu/index.vue | 35 ++++++++++++++++++++++++-----
2 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/web/.env.development b/web/.env.development
index f7bcb53..176b8ec 100644
--- a/web/.env.development
+++ b/web/.env.development
@@ -2,8 +2,8 @@
ENV = 'development'
# 本地环境接口地址
-VITE_API_URL = 'https://demo.dvadmin.com/api'
-#VITE_API_URL = 'http://192.168.1.160:8000'
+#VITE_API_URL = 'https://demo.dvadmin.com/api'
+VITE_API_URL = 'http://192.168.1.160:8002'
# 是否启用按钮权限
VITE_PM_ENABLED = true
diff --git a/web/src/views/system/menu/index.vue b/web/src/views/system/menu/index.vue
index 96203c8..8e3c783 100644
--- a/web/src/views/system/menu/index.vue
+++ b/web/src/views/system/menu/index.vue
@@ -49,13 +49,13 @@
-
+
-
+
@@ -160,6 +160,7 @@ const ElementTreeLine = getElementLabelLine(h);
const filterText = ref('');
const treeRef = ref>();
let drawerVisible = ref(false)
+let treeSelectNode = ref(null)
watch(filterText, (val) => {
treeRef.value!.filter(val);
@@ -315,12 +316,13 @@ const addChildMenu = () => {
handleDrawerClose();
};
-const handleNodeClick = (data: any) => {
+const handleNodeClick = (record: any, node: Node) => {
+ treeSelectNode.value = node;
Object.keys(toRaw(data)).forEach((key: string) => {
- form[key] = data[key];
+ form[key] = record[key];
});
delete form.component_name;
- form.id = data.id;
+ form.id = record.id;
isAddNewMenu.value = false;
};
@@ -367,6 +369,29 @@ const handleDeleteMenu = () => {
})
};
+/**
+ * 移动操作
+ */
+const handleSort = (type: string) => {
+ if (!form.id && treeSelectNode.value) {
+ warningMessage('请选择菜单!')
+ return
+ }
+ const parentList = treeSelectNode.value?.parent.childNodes || [];
+ const index = parentList.findIndex(i => i.data.id === form.id)
+ const record = parentList.find(i => i.data.id === form.id)
+
+ if (type === 'up') {
+ if (index === 0) return
+ parentList.splice(index - 1, 0, record as any)
+ parentList.splice(index + 1, 1)
+ }
+ if (type === 'down') {
+ parentList.splice(index + 2, 0, record as any)
+ parentList.splice(index, 1)
+ }
+}
+
// 页面打开后获取列表数据
onMounted(() => {
getData();