- 用户和角色是一对多的关系
- 用户和部门是多对多得关系
-
<template> <div class="s"> <!-- 操作按钮 --> <div class="shang"> <el-input v-model="searchText" placeholder="请输入搜索关键词" style="width: 500px;"></el-input> <el-button type="primary" @click="search">搜索</el-button> <el-button @click="resetForm">重置</el-button> </div> <br> <el-button type="primary" @click="showAddDialog">新增用户</el-button> <el-table :data="tableData" style="width: 100%"> <el-table-column prop="name" label="姓名"></el-table-column> <el-table-column prop="user_email" label="邮箱号"></el-table-column> <el-table-column label="角色"> <template slot-scope="scope"> { { getRoleName(scope.row.role_id) }} </template> </el-table-column> <el-table-column label="部门"> <template slot-scope="scope"> <span v-for="(department, index) in scope.row.department_id" :key="department"> { { department.split(' ----- ').pop() }} </span> </template> </el-table-column> <el-table-column label="操作"> <template slot-scope="scope"> <el-button size="mini" @click="showEditDialog(scope.row)">编辑</el-button> <el-button size="mini" type="danger" @click="handleDelete(scope.row.user_id)">删除</el-button>
vue前端可以完整的显示编辑子级部门,用户管理可以为用户分配角色和部门?
于 2024-08-14 16:19:47 首次发布