| ¶Ô±ÈÐÂÎļþ |
| | |
| | |
|
| | | <template>
|
| | | <div class="app-container">
|
| | | <el-form :model="queryParams" ref="queryRef" v-show="showSearch" :inline="true">
|
| | | <el-form-item label="ç¨æ·åç§°" prop="userName">
|
| | | <el-input
|
| | | v-model="queryParams.userName"
|
| | | placeholder="请è¾å
¥ç¨æ·åç§°"
|
| | | clearable
|
| | | style="width: 240px"
|
| | | @keyup.enter="handleQuery"
|
| | | />
|
| | | </el-form-item>
|
| | | <el-form-item label="ææºå·ç " prop="phonenumber">
|
| | | <el-input
|
| | | v-model="queryParams.phonenumber"
|
| | | placeholder="请è¾å
¥ææºå·ç "
|
| | | clearable
|
| | | style="width: 240px"
|
| | | @keyup.enter="handleQuery"
|
| | | />
|
| | | </el-form-item>
|
| | | <el-form-item>
|
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button>
|
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button>
|
| | | </el-form-item>
|
| | | </el-form>
|
| | |
|
| | | <el-row :gutter="10" class="mb8">
|
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="primary"
|
| | | plain
|
| | | icon="Plus"
|
| | | @click="openSelectUser"
|
| | | v-hasPermi="['system:role:add']"
|
| | | >æ·»å ç¨æ·</el-button>
|
| | | </el-col>
|
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="danger"
|
| | | plain
|
| | | icon="CircleClose"
|
| | | :disabled="multiple"
|
| | | @click="cancelAuthUserAll"
|
| | | v-hasPermi="['system:role:remove']"
|
| | | >æ¹éåæ¶ææ</el-button>
|
| | | </el-col>
|
| | | <el-col :span="1.5">
|
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | icon="Close"
|
| | | @click="handleClose"
|
| | | >å
³é</el-button>
|
| | | </el-col>
|
| | | <right-toolbar v-model:showSearch="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">
|
| | | <template #default="scope">
|
| | | <dict-tag :options="sys_normal_disable" :value="scope.row.status" />
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column label="å建æ¶é´" align="center" prop="createTime" width="180">
|
| | | <template #default="scope">
|
| | | <span>{{ parseTime(scope.row.createTime) }}</span>
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width">
|
| | | <template #default="scope">
|
| | | <el-button link type="primary" icon="CircleClose" @click="cancelAuthUser(scope.row)" v-hasPermi="['system:role:remove']">åæ¶ææ</el-button>
|
| | | </template>
|
| | | </el-table-column>
|
| | | </el-table>
|
| | |
|
| | | <pagination
|
| | | v-show="total > 0"
|
| | | :total="total"
|
| | | v-model:page="queryParams.pageNum"
|
| | | v-model:limit="queryParams.pageSize"
|
| | | @pagination="getList"
|
| | | />
|
| | | <select-user ref="selectRef" :roleId="queryParams.roleId" @ok="handleQuery" />
|
| | | </div>
|
| | | </template>
|
| | |
|
| | | <script setup name="AuthUser">
|
| | | import selectUser from "./selectUser"
|
| | | import { allocatedUserList, authUserCancel, authUserCancelAll } from "@/api/system/role"
|
| | | import {onMounted} from "vue";
|
| | |
|
| | | const route = useRoute()
|
| | | const { proxy } = getCurrentInstance()
|
| | | const { sys_normal_disable } = proxy.useDict("sys_normal_disable")
|
| | |
|
| | | const userList = ref([])
|
| | | const loading = ref(true)
|
| | | const showSearch = ref(true)
|
| | | const multiple = ref(true)
|
| | | const total = ref(0)
|
| | | const userIds = ref([])
|
| | |
|
| | | const queryParams = reactive({
|
| | | pageNum: 1,
|
| | | pageSize: 10,
|
| | | roleId: route.params.roleId,
|
| | | userName: undefined,
|
| | | phonenumber: undefined,
|
| | | })
|
| | |
|
| | | /** æ¥è¯¢ææç¨æ·å表 */
|
| | | function getList() {
|
| | | loading.value = true
|
| | | allocatedUserList(queryParams).then(response => {
|
| | | userList.value = response.rows
|
| | | total.value = response.total
|
| | | loading.value = false
|
| | | })
|
| | | }
|
| | |
|
| | | /** è¿åæé® */
|
| | | function handleClose() {
|
| | | const obj = { path: "/system/role" }
|
| | | proxy.$tab.closeOpenPage(obj)
|
| | | }
|
| | |
|
| | | /** æç´¢æé®æä½ */
|
| | | function handleQuery() {
|
| | | queryParams.pageNum = 1
|
| | | getList()
|
| | | }
|
| | |
|
| | | /** éç½®æé®æä½ */
|
| | | function resetQuery() {
|
| | | proxy.resetForm("queryRef")
|
| | | handleQuery()
|
| | | }
|
| | |
|
| | | /** å¤éæ¡é䏿°æ® */
|
| | | function handleSelectionChange(selection) {
|
| | | userIds.value = selection.map(item => item.userId)
|
| | | multiple.value = !selection.length
|
| | | }
|
| | |
|
| | | /** æå¼ææç¨æ·è¡¨å¼¹çª */
|
| | | function openSelectUser() {
|
| | | proxy.$refs["selectRef"].show()
|
| | | }
|
| | |
|
| | | /** åæ¶æææé®æä½ */
|
| | | function cancelAuthUser(row) {
|
| | | proxy.$modal.confirm('确认è¦åæ¶è¯¥ç¨æ·"' + row.userName + '"è§è²åï¼').then(function () {
|
| | | return authUserCancel({ userId: row.userId, roleId: queryParams.roleId })
|
| | | }).then(() => {
|
| | | getList()
|
| | | proxy.$modal.msgSuccess("åæ¶æææå")
|
| | | }).catch(() => {})
|
| | | }
|
| | |
|
| | | /** æ¹éåæ¶æææé®æä½ */
|
| | | function cancelAuthUserAll(row) {
|
| | | const roleId = queryParams.roleId
|
| | | const uIds = userIds.value.join(",")
|
| | | proxy.$modal.confirm("æ¯å¦åæ¶éä¸ç¨æ·æææ°æ®é¡¹?").then(function () {
|
| | | return authUserCancelAll({ roleId: roleId, userIds: uIds })
|
| | | }).then(() => {
|
| | | getList()
|
| | | proxy.$modal.msgSuccess("åæ¶æææå")
|
| | | }).catch(() => {})
|
| | | }
|
| | |
|
| | | onMounted(() => {
|
| | | getList();
|
| | | });
|
| | | </script>
|