From cb78b4fbcd31bbee7ed7882c7b5f6f660f20c511 Mon Sep 17 00:00:00 2001 From: doum <doum> Date: 星期一, 20 十月 2025 09:56:19 +0800 Subject: [PATCH] 最新版本541200007 --- admin/src/views/system/menu.vue | 86 +++++++++++++++++++++++++++++++++++++----- 1 files changed, 75 insertions(+), 11 deletions(-) diff --git a/admin/src/views/system/menu.vue b/admin/src/views/system/menu.vue index 27b05ad..849b26e 100644 --- a/admin/src/views/system/menu.vue +++ b/admin/src/views/system/menu.vue @@ -1,14 +1,23 @@ <template> <TableLayout class="menu-layout" :permissions="['system:menu:query']"> + <el-form ref="searchForm" slot="search-form" label-width="100px" inline> + <div class="platgroup_tabs"> + <div class="tab" :class="{ active: activeGroup === item.id }" @click="groupClick(item)" + v-for="(item, i) in groupList" :key="i"> + {{ item.name }} + </div> + </div> + </el-form> <!-- 琛ㄦ牸鍜屽垎椤� --> <template v-slot:table-wrap> <ul class="toolbar" v-permissions="['system:menu:create', 'system:menu:delete', 'system:menu:sort']"> - <li><el-button type="primary" @click="$refs.operaMenuWindow.open('鏂板缓涓�绾ц彍鍗�')" icon="el-icon-plus" v-permissions="['system:menu:create']">鏂板缓</el-button></li> + <li><el-button type="primary" @click="$refs.operaMenuWindow.open(activeType==0?'鏂板缓涓�绾ц彍鍗�':'鏂板缓椤堕儴瀵艰埅鑿滃崟',null,null,activeType)" icon="el-icon-plus" v-permissions="['system:menu:create']">鏂板缓</el-button></li> <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['system:menu:delete']">鍒犻櫎</el-button></li> <li><el-button @click="sort('top')" :loading="isWorking.sort" icon="el-icon-sort-up" v-permissions="['system:menu:sort']">涓婄Щ</el-button></li> <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" @@ -19,16 +28,21 @@ @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="icon" label="鍥炬爣" min-width="80px" class-name="table-column-icon"> + <el-table-column prop="name" label="鑿滃崟鍚嶇О" fixed="left" min-width="160px" show-tooltip-when-overflow></el-table-column> + <el-table-column prop="icon" v-if="activeGroup !== 1" 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> <template v-else>鏈缃�</template> </template> </el-table-column> - <el-table-column prop="path" label="璁块棶璺緞" min-width="140px"></el-table-column> + <el-table-column prop="path" label="璁块棶璺緞" show-tooltip-when-overflow min-width="200px"></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="linkType" label="鑿滃崟绫诲瀷" min-width="80px"> + <template slot-scope="{row}"> + {{row.linkType == 1 ? '澶栭儴绯荤粺' : '鍐呴儴绯荤粺'}} + </template> + </el-table-column> + <el-table-column prop="remark" label="澶囨敞" min-width="150px" show-tooltip-when-overflow></el-table-column> <el-table-column prop="createUser" label="鍒涘缓浜�" min-width="100px"> <template slot-scope="{row}">{{row.createUserInfo == null ? '' : row.createUserInfo.username}}</template> </el-table-column> @@ -37,7 +51,7 @@ <template slot-scope="{row}">{{row.updateUserInfo == null ? '' : row.updateUserInfo.username}}</template> </el-table-column> <el-table-column prop="updateTime" label="鏇存柊鏃堕棿" min-width="140px"></el-table-column> - <el-table-column prop="disabled" label="鏄惁鍚敤" min-width="80px"> + <el-table-column prop="disabled" label="鏄惁鍚敤" min-width="80px" fixed="right"> <template slot-scope="{row}"> <el-switch v-model="row.disabled" :active-value="false" :inactive-value="true" @change="switchDisabled(row)"/> </template> @@ -49,8 +63,8 @@ fixed="right" > <template slot-scope="{row}"> - <el-button type="text" icon="el-icon-edit" @click="$refs.operaMenuWindow.open('缂栬緫鑿滃崟', row)" v-permissions="['system:menu:update']">缂栬緫</el-button> - <el-button type="text" icon="el-icon-plus" @click="$refs.operaMenuWindow.open('鏂板缓瀛愯彍鍗�', null, row)" v-permissions="['system:menu:create']">鏂板缓瀛愯彍鍗�</el-button> + <el-button type="text" icon="el-icon-edit" @click="$refs.operaMenuWindow.open('缂栬緫鑿滃崟', row,null,activeType)" v-permissions="['system:menu:update']">缂栬緫</el-button> + <el-button v-if="activeGroup !== 1" type="text" icon="el-icon-plus" @click="$refs.operaMenuWindow.open('鏂板缓瀛愯彍鍗�', null, row,activeType)" v-permissions="['system:menu:create']">鏂板缓瀛愯彍鍗�</el-button> <el-button v-if="!row.fixed" type="text" icon="el-icon-delete" @click="deleteById(row)" v-permissions="['system:menu:delete']">鍒犻櫎</el-button> </template> </el-table-column> @@ -73,18 +87,48 @@ data () { return { // 鏄惁姝e湪澶勭悊涓� + activeGroup: -1, + activeType: 1, + topMenuId:null, + groupList:[{id:-1,name: "椤堕儴瀵艰埅閰嶇疆",type:1},{id:-2,name: "绯荤粺宸︿晶鑿滃崟",type:0}], isWorking: { sort: false } } }, methods: { + groupClick(item){ + this.activeGroup = item.id + this.activeType = item.type + this.handlePageChange(); + }, // 鏌ヨ鏁版嵁 handlePageChange () { this.isWorking.search = true - fetchTree() + fetchTree({type: this.activeType == 1?this.activeType:null}) .then(records => { - this.tableData.list = records + if(this.activeType === 1){ + this.tableData.list = records + this.groupList = [{id:-1,name: "椤堕儴瀵艰埅閰嶇疆",type:1}] + var tops = [] + this.tableData.list.forEach(item=>{ + if(item.linkType !== 1){ + tops.push({id:item.id,name: item.name,type:0}) + } + }) + if(tops.length){ + this.groupList.push(...tops) + }else { + this.groupList.push({id:0,name: "绯荤粺宸︿晶鑿滃崟",type:0}) + } + }else{ + //濡傛灉鏄唴閮ㄨ彍鍗� + records.forEach(item =>{ + if(item.id === this.activeGroup){ + this.tableData.list =item.children + } + }) + } }) .catch(e => { this.$tip.apiFailed(e) @@ -205,9 +249,29 @@ <style lang="scss" scoped> @import "@/assets/style/variables.scss"; +.platgroup_tabs { + flex: 1; + display: flex; + border-bottom: 1px solid #dfe2e8; + + .tab { + color: #666666; + margin-right: 40px; + cursor: pointer; + padding-bottom: 18px; + border-bottom: 2px solid #fff; + } + + .active { + font-weight: 500; + font-size: 15px; + color: #222222; + border-bottom: 2px solid $primary-color; + } +} .menu-layout { /deep/ .table-content { - margin-top: 0; + margin-top: 0px; } } // 鍥炬爣鍒� -- Gitblit v1.9.3