123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350 |
- <template>
- <div class="app-container">
- <el-card class="operate-container" shadow="never">
- <i class="el-icon-tickets" style="margin-top: 5px"></i>
- <<<<<<< HEAD
- <span style="margin-top: 5px;">数据列表</span>
- <el-button class="btn-add" @click="handleAddMenu()" size="mini">
- =======
- <span style="margin-top: 5px">数据列表</span>
- <el-button
- class="btn-add"
- @click="handleAddMenu()"
- size="mini">
- >>>>>>> 259d796d8a144f6fcd5b371a06c66676c11ec3e9
- 添加
- </el-button>
- </el-card>
- <div class="table-container">
- <<<<<<< HEAD
- <el-table ref="menuTable" style="width: 100%" :data="list" v-loading="listLoading" border>
- <el-table-column label="编号" width="100" align="center">
- <template slot-scope="scope">{{ scope.row.id }}</template>
- </el-table-column>
- <el-table-column label="菜单名称" align="center">
- <template slot-scope="scope">{{ scope.row.title }}</template>
- </el-table-column>
- <el-table-column label="菜单级数" width="100" align="center">
- <template slot-scope="scope">{{ scope.row.level | levelFilter }}</template>
- </el-table-column>
- <el-table-column label="前端名称" align="center">
- <template slot-scope="scope">{{ scope.row.name }}</template>
- =======
- <el-table ref="menuTable"
- style="width: 100%"
- :data="list"
- v-loading="listLoading" border>
- <el-table-column label="编号" width="100" align="center">
- <template slot-scope="scope">{{scope.row.id}}</template>
- </el-table-column>
- <el-table-column label="菜单名称" align="center">
- <template slot-scope="scope">{{scope.row.title}}</template>
- </el-table-column>
- <el-table-column label="菜单级数" width="100" align="center">
- <template slot-scope="scope">{{scope.row.level | levelFilter}}</template>
- </el-table-column>
- <el-table-column label="前端名称" align="center">
- <template slot-scope="scope">{{scope.row.name}}</template>
- >>>>>>> 259d796d8a144f6fcd5b371a06c66676c11ec3e9
- </el-table-column>
- <el-table-column label="前端图标" width="100" align="center">
- <template slot-scope="scope"><svg-icon :icon-class="scope.row.icon"></svg-icon></template>
- </el-table-column>
- <el-table-column label="是否显示" width="100" align="center">
- <template slot-scope="scope">
- <<<<<<< HEAD
- <el-switch @change="handleHiddenChange(scope.$index, scope.row)" :active-value="0" :inactive-value="1"
- =======
- <el-switch
- @change="handleHiddenChange(scope.$index, scope.row)"
- :active-value="0"
- :inactive-value="1"
- >>>>>>> 259d796d8a144f6fcd5b371a06c66676c11ec3e9
- v-model="scope.row.hidden">
- </el-switch>
- </template>
- </el-table-column>
- <el-table-column label="排序" width="100" align="center">
- <<<<<<< HEAD
- <template slot-scope="scope">{{ scope.row.sort }}</template>
- </el-table-column>
- <el-table-column label="设置" width="120" align="center">
- <template slot-scope="scope">
- <el-button size="mini" type="text" :disabled="scope.row.level | disableNextLevel"
- =======
- <template slot-scope="scope">{{scope.row.sort }}</template>
- </el-table-column>
- <el-table-column label="设置" width="120" align="center">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- :disabled="scope.row.level | disableNextLevel"
- >>>>>>> 259d796d8a144f6fcd5b371a06c66676c11ec3e9
- @click="handleShowNextLevel(scope.$index, scope.row)">查看下级
- </el-button>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="200" align="center">
- <template slot-scope="scope">
- <<<<<<< HEAD
- <el-button size="mini" type="text" @click="handleUpdate(scope.$index, scope.row)">编辑
- </el-button>
- <el-button size="mini" type="text" @click="handleDelete(scope.$index, scope.row)">删除
- =======
- <el-button
- size="mini"
- type="text"
- @click="handleUpdate(scope.$index, scope.row)">编辑
- </el-button>
- <el-button
- size="mini"
- type="text"
- @click="handleDelete(scope.$index, scope.row)">删除
- >>>>>>> 259d796d8a144f6fcd5b371a06c66676c11ec3e9
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="pagination-container">
- <<<<<<< HEAD
- <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
- layout="total, sizes,prev, pager, next,jumper" :page-size="listQuery.pageSize" :page-sizes="[10, 15, 20]"
- :current-page.sync="listQuery.pageNum" :total="total">
- =======
- <el-pagination
- background
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- layout="total, sizes,prev, pager, next,jumper"
- :page-size="listQuery.pageSize"
- :page-sizes="[10,15,20]"
- :current-page.sync="listQuery.pageNum"
- :total="total">
- >>>>>>> 259d796d8a144f6fcd5b371a06c66676c11ec3e9
- </el-pagination>
- </div>
- </div>
- </template>
- <script>
- <<<<<<< HEAD
- import { fetchList, deleteMenu, updateMenu, updateHidden } from '@/api/menu'
- export default {
- name: "menuList",
- data() {
- return {
- list: null,
- total: null,
- listLoading: true,
- listQuery: {
- pageNum: 1,
- pageSize: 30
- },
- parentId: 0
- }
- },
- created() {
- this.resetParentId();
- this.getList();
- },
- watch: {
- $route(route) {
- this.resetParentId();
- this.getList();
- }
- },
- methods: {
- resetParentId() {
- this.listQuery.pageNum = 1;
- if (this.$route.query.parentId != null) {
- this.parentId = this.$route.query.parentId;
- } else {
- this.parentId = 0;
- }
- },
- handleAddMenu() {
- this.$router.push('/ums/addMenu');
- },
- getList() {
- this.listLoading = true;
- fetchList(this.parentId, this.listQuery).then(response => {
- this.listLoading = false;
- this.list = response.data.list;
- this.total = response.data.total;
- });
- },
- handleSizeChange(val) {
- this.listQuery.pageNum = 1;
- this.listQuery.pageSize = val;
- this.getList();
- },
- handleCurrentChange(val) {
- this.listQuery.pageNum = val;
- this.getList();
- },
- handleHiddenChange(index, row) {
- updateHidden(row.id, { hidden: row.hidden }).then(response => {
- this.$message({
- message: '修改成功',
- type: 'success',
- duration: 1000
- });
- });
- },
- handleShowNextLevel(index, row) {
- this.$router.push({ path: '/ums/menu', query: { parentId: row.id } })
- },
- handleUpdate(index, row) {
- this.$router.push({ path: '/ums/updateMenu', query: { id: row.id } });
- },
- handleDelete(index, row) {
- this.$confirm('是否要删除该菜单', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- deleteMenu(row.id).then(response => {
- this.$message({
- message: '删除成功',
- type: 'success',
- duration: 1000
- });
- this.getList();
- });
- });
- }
- },
- filters: {
- levelFilter(value) {
- if (value === 0) {
- return '一级';
- } else if (value === 1) {
- return '二级';
- }
- },
- disableNextLevel(value) {
- if (value === 0) {
- return false;
- } else {
- return true;
- }
- }
- }
- }
- </script>
- <style scoped></style>
- =======
- import {fetchList,deleteMenu,updateMenu,updateHidden} from '@/api/menu'
- export default {
- name: "menuList",
- data() {
- return {
- list: null,
- total: null,
- listLoading: true,
- listQuery: {
- pageNum: 1,
- pageSize:30
- },
- parentId: 0
- }
- },
- created() {
- this.resetParentId();
- this.getList();
- },
- watch: {
- $route(route) {
- this.resetParentId();
- this.getList();
- }
- },
- methods: {
- resetParentId(){
- this.listQuery.pageNum = 1;
- if (this.$route.query.parentId != null) {
- this.parentId = this.$route.query.parentId;
- } else {
- this.parentId = 0;
- }
- },
- handleAddMenu() {
- this.$router.push('/ums/addMenu');
- },
- getList() {
- this.listLoading = true;
- fetchList(this.parentId, this.listQuery).then(response => {
- this.listLoading = false;
- this.list = response.data.list;
- this.total = response.data.total;
- });
- },
- handleSizeChange(val) {
- this.listQuery.pageNum = 1;
- this.listQuery.pageSize = val;
- this.getList();
- },
- handleCurrentChange(val) {
- this.listQuery.pageNum = val;
- this.getList();
- },
- handleHiddenChange(index, row) {
- updateHidden(row.id,{hidden:row.hidden}).then(response=>{
- this.$message({
- message: '修改成功',
- type: 'success',
- duration: 1000
- });
- });
- },
- handleShowNextLevel(index, row) {
- this.$router.push({path: '/ums/menu', query: {parentId: row.id}})
- },
- handleUpdate(index, row) {
- this.$router.push({path:'/ums/updateMenu',query:{id:row.id}});
- },
- handleDelete(index, row) {
- this.$confirm('是否要删除该菜单', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- deleteMenu(row.id).then(response => {
- this.$message({
- message: '删除成功',
- type: 'success',
- duration: 1000
- });
- this.getList();
- });
- });
- }
- },
- filters: {
- levelFilter(value) {
- if (value === 0) {
- return '一级';
- } else if (value === 1) {
- return '二级';
- }
- },
- disableNextLevel(value) {
- if (value === 0) {
- return false;
- } else {
- return true;
- }
- }
- }
- }
- </script>
- <style scoped>
- </style>
- >>>>>>> 259d796d8a144f6fcd5b371a06c66676c11ec3e9
|