From 89e540640b87f4be8656a5bc78f4a5dbcdf1c21f Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 01 七月 2025 15:53:41 +0800
Subject: [PATCH] ss
---
admin/src/views/system/menu.vue | 75 ++++++++++++++++++++++++++-----------
1 files changed, 52 insertions(+), 23 deletions(-)
diff --git a/admin/src/views/system/menu.vue b/admin/src/views/system/menu.vue
index 27b05ad..02ab31d 100644
--- a/admin/src/views/system/menu.vue
+++ b/admin/src/views/system/menu.vue
@@ -9,17 +9,17 @@
<li><el-button @click="sort('bottom')" :loading="isWorking.sort" icon="el-icon-sort-down" v-permissions="['system:menu:sort']">涓嬬Щ</el-button></li>
</ul>
<el-table
+ :height="tableHeightNew"
ref="table"
v-loading="isWorking.search"
:data="tableData.list"
- :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
row-key="id"
stripe
default-expand-all
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" fixed="left"></el-table-column>
- <el-table-column prop="name" label="鑿滃崟鍚嶇О" fixed="left" min-width="160px"></el-table-column>
+ <el-table-column prop="name" label="鑿滃崟鍚嶇О" fixed="left" min-width="160px"></el-table-column>
<el-table-column prop="icon" label="鍥炬爣" min-width="80px" class-name="table-column-icon">
<template slot-scope="{row}">
<i v-if="row.icon != null && row.icon !== ''" :class="{[row.icon]: true}"></i>
@@ -27,7 +27,6 @@
</template>
</el-table-column>
<el-table-column prop="path" label="璁块棶璺緞" min-width="140px"></el-table-column>
- <el-table-column prop="params" label="鍙傛暟" min-width="120px"></el-table-column>
<el-table-column prop="remark" label="澶囨敞" min-width="120px"></el-table-column>
<el-table-column prop="createUser" label="鍒涘缓浜�" min-width="100px">
<template slot-scope="{row}">{{row.createUserInfo == null ? '' : row.createUserInfo.username}}</template>
@@ -79,7 +78,9 @@
}
},
methods: {
- // 鏌ヨ鏁版嵁
+ /**
+ * 瑕嗙洊椤电爜鍙樻洿澶勭悊
+ */
handlePageChange () {
this.isWorking.search = true
fetchTree()
@@ -93,7 +94,11 @@
this.isWorking.search = false
})
},
- // 鎺掑簭
+ /**
+ * 鎺掑簭
+ *
+ * @param direction 鏂瑰悜锛屽彇鍊糩top:涓婄Щ, bottom:涓嬬Щ]
+ */
sort (direction) {
if (this.isWorking.sort) {
return
@@ -146,49 +151,70 @@
this.isWorking.sort = false
})
},
- // 鍚敤/绂佺敤鑿滃崟
+ /**
+ * 鍚敤/绂佺敤
+ *
+ * @param row 琛屽璞�
+ */
switchDisabled (row) {
- if (!row.disabled) {
- this.__updateMenuStatus(row)
+ const newValue = row.disabled
+ row.disabled = !row.disabled
+ // 寮�鍚�
+ if (!newValue) {
+ this.__updateMenuStatus(row, newValue)
return
}
+ // 绂佺敤
this.$dialog.disableConfirm(`纭绂佺敤 ${row.name} 鑿滃崟鍚楋紵`)
.then(() => {
- this.__updateMenuStatus(row)
- }).catch(() => {
- row.disabled = !row.disabled
+ this.__updateMenuStatus(row, newValue)
+ })
+ .catch(() => {
})
},
- // 鏌ヨ鐖惰妭鐐�
+ /**
+ * 鏌ヨ鐖惰妭鐐�
+ *
+ * @param id 鑺傜偣ID
+ * @param parent 鍦ㄥ摢涓埗鑺傜偣涓繘琛屾煡鎵�
+ * @returns {null|{children}|*|*|undefined|null}
+ * @private
+ */
__findParent (id, parent) {
- if (parent.children === 0) {
+ if (parent.children == null || parent.children.length === 0) {
return
}
- for (const menu of parent.children) {
- if (menu.id === id) {
+ for (const row of parent.children) {
+ if (row.id === id) {
return parent
}
- if (menu.children.length > 0) {
- const m = this.__findParent(id, menu)
- if (m != null) {
- return m
+ if (row.children.length > 0) {
+ const target = this.__findParent(id, row)
+ if (target != null) {
+ return target
}
}
}
return null
},
- // 淇敼鑿滃崟鐘舵��
- __updateMenuStatus (row) {
+ /**
+ * 淇敼鑿滃崟鐘舵��
+ *
+ * @param row 琛屽璞�
+ * @param newValue 鏂板��
+ * @private
+ */
+ __updateMenuStatus (row, newValue) {
updateStatus({
id: row.id,
parentId: row.parentId,
- disabled: row.disabled
+ disabled: newValue
})
.then(() => {
+ row.disabled = newValue
this.$tip.apiSuccess('淇敼鎴愬姛')
})
.catch(e => {
- row.disabled = !row.disabled
this.$tip.apiFailed(e)
})
}
@@ -208,6 +234,9 @@
.menu-layout {
/deep/ .table-content {
margin-top: 0;
+ .table-wrap {
+ padding-bottom: 16px;
+ }
}
}
// 鍥炬爣鍒�
--
Gitblit v1.9.3