| | |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | v-if="vws" |
| | | type="primary" |
| | | plain |
| | | icon="el-icon-plus" |
| | |
| | | v-hasPermi="['system:role:remove']" |
| | | >批量取消授权</el-button> |
| | | </el-col> --> |
| | | <el-col :span="1.5"> |
| | | <!-- <el-col :span="1.5"> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | |
| | | size="mini" |
| | | @click="handleClose" |
| | | >关闭</el-button> |
| | | </el-col> |
| | | </el-col> --> |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | |
| | | <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="状态" align="center" prop="status"> |
| | | <el-table-column label="用户名称" prop="sysUser.userName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="用户昵称" prop="sysUser.nickName" :show-overflow-tooltip="true" > |
| | | <template slot-scope="scope">{{scope.row.sysUser.nickName?scope.row.sysUser.nickName:'--'}}</template> |
| | | |
| | | </el-table-column> |
| | | <el-table-column label="邮箱" prop="sysUser.email" :show-overflow-tooltip="true" > |
| | | <template slot-scope="scope">{{scope.row.sysUser.email?scope.row.sysUser.email:'--'}}</template> |
| | | |
| | | </el-table-column> |
| | | <el-table-column label="手机" prop="sysUser.phonenumber" :show-overflow-tooltip="true" > |
| | | <template slot-scope="scope">{{scope.row.sysUser.phonenumber?scope.row.sysUser.phonenumber:'--'}}</template> |
| | | |
| | | </el-table-column> |
| | | <!-- <el-table-column label="状态" align="center" prop="sysUser.status"> |
| | | <template slot-scope="scope"> |
| | | <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> --> |
| | | <el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ parseTime(scope.row.createTime) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| | | <el-table-column label="操作" align="center" prop="11" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | |
| | | :limit.sync="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | <select-user ref="select" :roleId="queryParams.roleId" @ok="handleQuery" /> |
| | | <select-user ref="select" :roleId="queryParams.roleId" :recordId="queryParams.archiveRecordsId" @ok="handleQuery" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import {UserRoleIdList, allocatedUserList, authUserCancel, authUserCancelAll } from "@/api/system/role" |
| | | import selectUser from "./seleUser" |
| | | |
| | | import { listMaterials, getMaterials, delMaterials, addMaterials, updateMaterials,getArchiverecordstouserByReIdAndUid } from "@/api/system/materials" |
| | | import {listArchiverecordstouser,addArchiverecordstouser,delArchiverecordstouserByReIdAndUid,getArchiverecordstouser} from "@/api/system/archiverecordstouser" |
| | | export default { |
| | | name: "AuthUser1", |
| | | dicts: ['sys_normal_disable'], |
| | | components: { selectUser }, |
| | | data() { |
| | | return { |
| | | vws: true, |
| | | // 遮罩层 |
| | | loading: true, |
| | | // 选中用户组 |
| | |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | roleId: undefined, |
| | | userName: undefined, |
| | | phonenumber: undefined |
| | | archiveRecordsId: undefined, |
| | | |
| | | // SysUser.userName: undefined, |
| | | // phonenumber: undefined |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | const roleId = this.$route.params && this.$route.params.roleId |
| | | if (roleId) { |
| | | const recordId = this.$route.params && this.$route.params.archiveRecordsId |
| | | |
| | | if (roleId && recordId) { |
| | | this.queryParams.roleId = roleId |
| | | // 进行类型转换 |
| | | this.queryParams.archiveRecordsId = !isNaN(Number(recordId)) ? Number(recordId) : 0 |
| | | this.getList() |
| | | } |
| | | }, |
| | | methods: { |
| | | // 修改 getList 方法 |
| | | /** 查询授权用户列表 */ |
| | | getList() { |
| | | this.loading = true |
| | | console.log(this.queryParams) |
| | | console.log("------------") |
| | | UserRoleIdList(this.queryParams).then(response => { |
| | | this.userList = response.rows |
| | | this.total = response.total |
| | | this.loading = false |
| | | } |
| | | ) |
| | | // 创建一个新对象,将字符串类型的archiveRecordsId转换为数字类型 |
| | | const params = { |
| | | ...this.queryParams, |
| | | archiveRecordsId: !isNaN(Number(this.queryParams.archiveRecordsId)) ? |
| | | Number(this.queryParams.archiveRecordsId) : 0 |
| | | } |
| | | listArchiverecordstouser(params).then(response => { |
| | | this.userList = response.data.data |
| | | this.total = response.data.total |
| | | this.loading = false |
| | | }) |
| | | }, |
| | | /** 打开授权用户表弹窗 */ |
| | | openSelectUser() { |
| | | // 确保传递给select组件的recordId是数字类型 |
| | | const recordId = !isNaN(Number(this.queryParams.archiveRecordsId)) ? |
| | | Number(this.queryParams.archiveRecordsId) : 0 |
| | | |
| | | this.$refs.select.show(recordId) |
| | | }, |
| | | // 返回按钮 |
| | | handleClose() { |
| | |
| | | }, |
| | | /** 打开授权用户表弹窗 */ |
| | | openSelectUser() { |
| | | this.$refs.select.show() |
| | | // alert(this.queryParams.roleId) |
| | | // alert(this.queryParams.archiveRecordsId ) |
| | | this.$refs.select.show(this.queryParams.archiveRecordsId) |
| | | }, |
| | | /** 取消授权按钮操作 */ |
| | | cancelAuthUser(row) { |
| | | const roleId = this.queryParams.roleId |
| | | this.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?').then(function() { |
| | | return authUserCancel({ userId: row.userId, roleId: roleId }) |
| | | const recordId = this.queryParams.archiveRecordsId |
| | | var userId = row.userId |
| | | // alert(userId) |
| | | // alert(this.queryParams.archiveRecordsId) |
| | | // alert(row.sysUser.userName) |
| | | this.$modal.confirm('确认要取消该用户"' + row.sysUser.userName + '"授权吗?').then(function() { |
| | | return delArchiverecordstouserByReIdAndUid({ recordId: recordId, userId: userId }) |
| | | }).then(() => { |
| | | this.getList() |
| | | this.$modal.msgSuccess("取消授权成功") |
| | |
| | | } |
| | | } |
| | | </script> |
| | | <style scoped> |
| | | /* el-table 列数据为空自动显示 -- */ |
| | | .className :empty::before{ |
| | | content:'--'; |
| | | color:gray; |
| | | } |
| | | </style> |