|
@@ -23,11 +23,9 @@
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="操作" width="250" align="center">
|
|
<el-table-column label="操作" width="250" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-button size="mini" type="primary" @click="handleShowNextLevel(scope.$index, scope.row)">分配
|
|
|
|
|
|
+ <el-button size="mini" type="primary" @click="handleUpdate(scope.row)">修改
|
|
</el-button>
|
|
</el-button>
|
|
- <el-button size="mini" type="primary" @click="handleUpdate(scope.$index, scope.row)">修改
|
|
|
|
- </el-button>
|
|
|
|
- <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除
|
|
|
|
|
|
+ <el-button size="mini" type="danger" @click="handleDelete(scope.row)">删除
|
|
</el-button>
|
|
</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -45,67 +43,27 @@ import Pagination from '@/components/Pagination'
|
|
export default {
|
|
export default {
|
|
name: 'RoleList',
|
|
name: 'RoleList',
|
|
components: { Pagination },
|
|
components: { Pagination },
|
|
- filters: {
|
|
|
|
- levelFilter(value) {
|
|
|
|
- if (value === 0) {
|
|
|
|
- return '一级'
|
|
|
|
- } else if (value === 1) {
|
|
|
|
- return '二级'
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- iconFilter(value) {
|
|
|
|
- if (!value) {
|
|
|
|
- return ''
|
|
|
|
- }
|
|
|
|
- if (value.substr(0, 7) === 'el-icon') {
|
|
|
|
- return '<i class="' + value + '" />'
|
|
|
|
- } else {
|
|
|
|
- return '<svg-icon :icon-class="' + value + '" />'
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- disableNextLevel(value) {
|
|
|
|
- if (value === 0) {
|
|
|
|
- return false
|
|
|
|
- } else {
|
|
|
|
- return true
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
tableKey: 0,
|
|
tableKey: 0,
|
|
list: [],
|
|
list: [],
|
|
- total: 5,
|
|
|
|
|
|
+ total: 0,
|
|
listLoading: true,
|
|
listLoading: true,
|
|
listQuery: {
|
|
listQuery: {
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
- pageSize: 10,
|
|
|
|
- parentId: 0
|
|
|
|
|
|
+ pageSize: 10
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
$route(route) {
|
|
$route(route) {
|
|
- this.resetParentId()
|
|
|
|
this.getList()
|
|
this.getList()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- this.resetParentId()
|
|
|
|
this.getList()
|
|
this.getList()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- isElementIcon(value) {
|
|
|
|
- return value.substr(0, 7) === 'el-icon'
|
|
|
|
- },
|
|
|
|
- resetParentId() {
|
|
|
|
- this.listQuery.pageNum = 1
|
|
|
|
- if (this.$route.query.parentId != null) {
|
|
|
|
- this.parentId = this.$route.query.parentId
|
|
|
|
- } else {
|
|
|
|
- this.parentId = 0
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
getList() {
|
|
getList() {
|
|
this.listLoading = true
|
|
this.listLoading = true
|
|
fetchList(this.listQuery).then(response => {
|
|
fetchList(this.listQuery).then(response => {
|
|
@@ -119,22 +77,19 @@ export default {
|
|
}, 1.5 * 1000)
|
|
}, 1.5 * 1000)
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- handleShowNextLevel(index, row) {
|
|
|
|
- this.$router.push({ path: '/sys/roles', query: { parentId: row.id } })
|
|
|
|
- },
|
|
|
|
- handleUpdate(index, row) {
|
|
|
|
- this.$router.push({ path: '/sys/roles/update', query: { id: row.id } })
|
|
|
|
- },
|
|
|
|
handleCreate() {
|
|
handleCreate() {
|
|
this.$router.push({ path: '/sys/roles/add' })
|
|
this.$router.push({ path: '/sys/roles/add' })
|
|
},
|
|
},
|
|
- handleDelete(index, row) {
|
|
|
|
|
|
+ handleUpdate(row) {
|
|
|
|
+ this.$router.push({ path: '/sys/roles/update', query: { id: row.id } })
|
|
|
|
+ },
|
|
|
|
+ handleDelete(row) {
|
|
this.$confirm('是否要删除该菜单', '提示', {
|
|
this.$confirm('是否要删除该菜单', '提示', {
|
|
confirmButtonText: '确定',
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
type: 'warning'
|
|
}).then(() => {
|
|
}).then(() => {
|
|
- deleteRole(row.id).then(response => {
|
|
|
|
|
|
+ deleteRole(row.id).then(() => {
|
|
this.$message({
|
|
this.$message({
|
|
message: '删除成功',
|
|
message: '删除成功',
|
|
type: 'success',
|
|
type: 'success',
|