|
@@ -1,6 +1,13 @@
|
|
<template>
|
|
<template>
|
|
<div class="app-container">
|
|
<div class="app-container">
|
|
|
|
+ <el-page-header v-if="parentTitle" @back="goBack" :content="parentTitle + ' 下的子菜单'"></el-page-header>
|
|
<div class="filter-container">
|
|
<div class="filter-container">
|
|
|
|
+ <el-select v-model="listQuery.level" style="width: 140px" class="filter-item" @change="handleFilter">
|
|
|
|
+ <el-option v-for="item in levelOptions" :key="item.key" :label="item.label" :value="item.key" />
|
|
|
|
+ </el-select>
|
|
|
|
+ <el-select v-model="listQuery.status" style="width: 140px" class="filter-item" @change="handleFilter">
|
|
|
|
+ <el-option v-for="item in statusOptions" :key="item.key" :label="item.label" :value="item.key" />
|
|
|
|
+ </el-select>
|
|
<el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-edit" @click="handleCreate">
|
|
<el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-edit" @click="handleCreate">
|
|
添加菜单
|
|
添加菜单
|
|
</el-button>
|
|
</el-button>
|
|
@@ -28,7 +35,7 @@
|
|
<template slot-scope="{row}">
|
|
<template slot-scope="{row}">
|
|
<el-button size="mini" type="text" @click="handleUpdate(scope.$index, row)">编辑
|
|
<el-button size="mini" type="text" @click="handleUpdate(scope.$index, row)">编辑
|
|
</el-button>
|
|
</el-button>
|
|
- <el-button size="mini" type="text" :disabled="row.level | disableNextLevel" @click="handleShowNextLevel(scope.$index, row)">子菜单
|
|
|
|
|
|
+ <el-button size="mini" type="text" :disabled="row.level | disableNextLevel" @click="handleShowNextLevel(row)">子菜单
|
|
</el-button>
|
|
</el-button>
|
|
<el-button size="mini" type="text" @click="handleDelete(scope.$index, row)">删除
|
|
<el-button size="mini" type="text" @click="handleDelete(scope.$index, row)">删除
|
|
</el-button>
|
|
</el-button>
|
|
@@ -80,11 +87,25 @@ export default {
|
|
list: null,
|
|
list: null,
|
|
total: 5,
|
|
total: 5,
|
|
listLoading: true,
|
|
listLoading: true,
|
|
|
|
+ parentTitle: '',
|
|
listQuery: {
|
|
listQuery: {
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
- parentId: 0
|
|
|
|
- }
|
|
|
|
|
|
+ parentId: '',
|
|
|
|
+ level: '',
|
|
|
|
+ status: ''
|
|
|
|
+ },
|
|
|
|
+ levelOptions: [
|
|
|
|
+ { label: '菜单级数', key: '' },
|
|
|
|
+ { label: '一级菜单', key: '0' },
|
|
|
|
+ { label: '二级菜单', key: '1' },
|
|
|
|
+ { label: '三级菜单', key: '2' }
|
|
|
|
+ ],
|
|
|
|
+ statusOptions: [
|
|
|
|
+ { label: '状态', key: '' },
|
|
|
|
+ { label: '启用', key: '0' },
|
|
|
|
+ { label: '停用', key: '1' }
|
|
|
|
+ ]
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -104,14 +125,20 @@ export default {
|
|
resetParentId() {
|
|
resetParentId() {
|
|
this.listQuery.pageNum = 1
|
|
this.listQuery.pageNum = 1
|
|
if (this.$route.query.parentId != null) {
|
|
if (this.$route.query.parentId != null) {
|
|
- this.parentId = this.$route.query.parentId
|
|
|
|
|
|
+ this.listQuery.parentId = this.$route.query.parentId
|
|
|
|
+ this.parentTitle = this.$route.query.title
|
|
} else {
|
|
} else {
|
|
- this.parentId = 0
|
|
|
|
|
|
+ this.listQuery.parentId = ''
|
|
|
|
+ this.parentTitle = ''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
handleAddMenu() {
|
|
handleAddMenu() {
|
|
this.$router.push('/sys/menus/form')
|
|
this.$router.push('/sys/menus/form')
|
|
},
|
|
},
|
|
|
|
+ handleFilter() {
|
|
|
|
+ this.listQuery.pageNum = 1
|
|
|
|
+ this.getList()
|
|
|
|
+ },
|
|
getList() {
|
|
getList() {
|
|
this.listLoading = true
|
|
this.listLoading = true
|
|
fetchList(this.listQuery).then(response => {
|
|
fetchList(this.listQuery).then(response => {
|
|
@@ -125,8 +152,11 @@ export default {
|
|
}, 1.5 * 1000)
|
|
}, 1.5 * 1000)
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- handleShowNextLevel(index, row) {
|
|
|
|
- this.$router.push({ path: '/sys/menus', query: { parentId: row.id } })
|
|
|
|
|
|
+ goBack() {
|
|
|
|
+ this.$router.push({ path: '/sys/menus' })
|
|
|
|
+ },
|
|
|
|
+ handleShowNextLevel(row) {
|
|
|
|
+ this.$router.push({ path: '/sys/menus', query: { parentId: row.id, title: row.title } })
|
|
},
|
|
},
|
|
handleUpdate(index, row) {
|
|
handleUpdate(index, row) {
|
|
this.$router.push({ path: '/sys/menus/form', query: { id: row.id } })
|
|
this.$router.push({ path: '/sys/menus/form', query: { id: row.id } })
|