======= 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; } } } } >>>>>>> 259d796d8a144f6fcd5b371a06c66676c11ec3e9