|
@@ -3,14 +3,22 @@
|
|
|
<doc-alert title="三方登陆" url="https://doc.iocoder.cn/social-user/" />
|
|
|
<doc-alert title="Excel 导入导出" url="https://doc.iocoder.cn/excel-import-and-export/" />
|
|
|
|
|
|
- <el-row :gutter="20">
|
|
|
+ <el-row :gutter="20" class="user-manage-row">
|
|
|
<!-- 左侧部门树 -->
|
|
|
- <el-col :span="4" :xs="24">
|
|
|
- <ContentWrap class="h-1/1">
|
|
|
+ <el-col :span="6" :xs="24">
|
|
|
+ <ContentWrap
|
|
|
+ class="h-1/1"
|
|
|
+ :style="{
|
|
|
+ height: `${calculateTableHeight(175)}px`,
|
|
|
+ overflowY: 'hidden',
|
|
|
+ paddingBottom: 0,
|
|
|
+ marginBottom: 0
|
|
|
+ }"
|
|
|
+ >
|
|
|
<DeptTree @node-click="handleDeptNodeClick" />
|
|
|
</ContentWrap>
|
|
|
</el-col>
|
|
|
- <el-col :span="20" :xs="24">
|
|
|
+ <el-col :span="18" :xs="24">
|
|
|
<!-- 搜索 -->
|
|
|
<ContentWrap>
|
|
|
<el-form
|
|
@@ -20,10 +28,10 @@
|
|
|
:inline="true"
|
|
|
label-width="68px"
|
|
|
>
|
|
|
- <el-form-item label="用户名称" prop="username">
|
|
|
+ <el-form-item label="用户昵称" prop="nickname">
|
|
|
<el-input
|
|
|
- v-model="queryParams.username"
|
|
|
- placeholder="请输入用户名称"
|
|
|
+ v-model="queryParams.nickname"
|
|
|
+ placeholder="请输入用户昵称"
|
|
|
clearable
|
|
|
@keyup.enter="handleQuery"
|
|
|
class="!w-240px"
|
|
@@ -66,13 +74,22 @@
|
|
|
<el-form-item>
|
|
|
<el-button @click="handleQuery"><Icon icon="ep:search" />搜索</el-button>
|
|
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" />重置</el-button>
|
|
|
- <el-button
|
|
|
+ <!-- <el-button
|
|
|
type="primary"
|
|
|
plain
|
|
|
@click="openForm('create')"
|
|
|
v-hasPermi="['system:user:create']"
|
|
|
>
|
|
|
<Icon icon="ep:plus" /> 新增
|
|
|
+ </el-button> -->
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ @click="associatedUser"
|
|
|
+ v-hasPermi="['system:user:create']"
|
|
|
+ v-if="deptName !== '浙江万维空间股份有限公司'"
|
|
|
+ >
|
|
|
+ <Icon icon="ep:plus" /> 关联人员
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
type="warning"
|
|
@@ -95,17 +112,19 @@
|
|
|
</el-form>
|
|
|
</ContentWrap>
|
|
|
<ContentWrap>
|
|
|
- <el-table v-loading="loading" :data="list">
|
|
|
+ <el-table v-loading="loading" :data="list" :height="calculateTableHeight(400)">
|
|
|
<el-table-column
|
|
|
- label="用户名称"
|
|
|
+ label="工号"
|
|
|
align="center"
|
|
|
prop="username"
|
|
|
+ width="100"
|
|
|
:show-overflow-tooltip="true"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
label="用户昵称"
|
|
|
align="center"
|
|
|
prop="nickname"
|
|
|
+ width="120"
|
|
|
:show-overflow-tooltip="true"
|
|
|
/>
|
|
|
<el-table-column
|
|
@@ -115,8 +134,8 @@
|
|
|
prop="dept.name"
|
|
|
:show-overflow-tooltip="true"
|
|
|
/>
|
|
|
- <el-table-column label="手机号码" align="center" prop="mobile" width="120" />
|
|
|
- <el-table-column label="状态" key="status">
|
|
|
+ <el-table-column label="手机号码" align="center" prop="mobile" width="150" />
|
|
|
+ <el-table-column label="状态" key="status" width="80">
|
|
|
<template #default="scope">
|
|
|
<el-switch
|
|
|
v-model="scope.row.status"
|
|
@@ -131,7 +150,7 @@
|
|
|
align="center"
|
|
|
prop="createTime"
|
|
|
:formatter="dateFormatter"
|
|
|
- width="180"
|
|
|
+ width="240"
|
|
|
/>
|
|
|
<el-table-column label="操作" align="center" width="160">
|
|
|
<template #default="scope">
|
|
@@ -155,12 +174,12 @@
|
|
|
<el-button type="primary" link><Icon icon="ep:d-arrow-right" /> 更多</el-button>
|
|
|
<template #dropdown>
|
|
|
<el-dropdown-menu>
|
|
|
- <el-dropdown-item
|
|
|
+ <!-- <el-dropdown-item
|
|
|
command="handleDelete"
|
|
|
v-if="checkPermi(['system:user:delete'])"
|
|
|
>
|
|
|
<Icon icon="ep:delete" />删除
|
|
|
- </el-dropdown-item>
|
|
|
+ </el-dropdown-item> -->
|
|
|
<el-dropdown-item
|
|
|
command="handleResetPwd"
|
|
|
v-if="checkPermi(['system:user:update-password'])"
|
|
@@ -173,6 +192,12 @@
|
|
|
>
|
|
|
<Icon icon="ep:circle-check" />分配角色
|
|
|
</el-dropdown-item>
|
|
|
+ <el-dropdown-item
|
|
|
+ command="disassociate"
|
|
|
+ v-if="scope?.row?.deptId !== currentDeptId"
|
|
|
+ >
|
|
|
+ <Icon icon="ep:promotion" />取消关联
|
|
|
+ </el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
</template>
|
|
|
</el-dropdown>
|
|
@@ -192,6 +217,13 @@
|
|
|
|
|
|
<!-- 添加或修改用户对话框 -->
|
|
|
<UserForm ref="formRef" @success="getList" />
|
|
|
+ <!-- 关联人员 -->
|
|
|
+ <AssociatedUser
|
|
|
+ ref="associatedRef"
|
|
|
+ @success="getList"
|
|
|
+ :deptId="queryParams.deptId"
|
|
|
+ :deptName="deptName"
|
|
|
+ />
|
|
|
<!-- 用户导入对话框 -->
|
|
|
<UserImportForm ref="importFormRef" @success="getList" />
|
|
|
<!-- 分配角色 -->
|
|
@@ -204,10 +236,14 @@ import { dateFormatter } from '@/utils/formatTime'
|
|
|
import download from '@/utils/download'
|
|
|
import { CommonStatusEnum } from '@/utils/constants'
|
|
|
import * as UserApi from '@/api/system/user'
|
|
|
+import { disassociateUser } from '@/api/system/dept'
|
|
|
import UserForm from './UserForm.vue'
|
|
|
import UserImportForm from './UserImportForm.vue'
|
|
|
import UserAssignRoleForm from './UserAssignRoleForm.vue'
|
|
|
import DeptTree from './DeptTree.vue'
|
|
|
+import { calculateTableHeight } from '@/utils/tool'
|
|
|
+import AssociatedUser from './AssociatedUser.vue'
|
|
|
+import { ElMessageBox } from 'element-plus'
|
|
|
|
|
|
defineOptions({ name: 'SystemUser' })
|
|
|
|
|
@@ -217,10 +253,13 @@ const { t } = useI18n() // 国际化
|
|
|
const loading = ref(true) // 列表的加载中
|
|
|
const total = ref(0) // 列表的总页数
|
|
|
const list = ref([]) // 列表的数
|
|
|
+const deptName = ref('浙江万维空间股份有限公司') // 当前部门名(默认万维)
|
|
|
+const currentDeptId = ref('4e99393c-c0ea-4146-a7fb-56fb8019c477') // 当前部门id
|
|
|
const queryParams = reactive({
|
|
|
pageNo: 1,
|
|
|
pageSize: 10,
|
|
|
username: undefined,
|
|
|
+ nickname: undefined,
|
|
|
mobile: undefined,
|
|
|
status: 0,
|
|
|
deptId: undefined,
|
|
@@ -255,6 +294,8 @@ const resetQuery = () => {
|
|
|
/** 处理部门被点击 */
|
|
|
const handleDeptNodeClick = async (row) => {
|
|
|
queryParams.deptId = row.id
|
|
|
+ currentDeptId.value = row.id
|
|
|
+ deptName.value = row.name ?? ''
|
|
|
await getList()
|
|
|
}
|
|
|
|
|
@@ -303,6 +344,34 @@ const handleExport = async () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/** 关联人员 */
|
|
|
+const associatedRef = ref()
|
|
|
+const associatedUser = () => {
|
|
|
+ associatedRef.value.open()
|
|
|
+}
|
|
|
+/** 取消关联 */
|
|
|
+const disassociate = (row) => {
|
|
|
+ const { deptId, id, nickname } = row
|
|
|
+ // 判断是否是主要部门,主要部门不能取消关联
|
|
|
+ if (deptId === currentDeptId.value) {
|
|
|
+ message.error('主要部门不能取消关联!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ElMessageBox.confirm(`确定将 ${nickname} 与 ${deptName.value} 取消关联?`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(async () => {
|
|
|
+ try {
|
|
|
+ await disassociateUser({ id, minorDeptId: currentDeptId.value })
|
|
|
+ message.success('取消关联成功!')
|
|
|
+ await getList()
|
|
|
+ } catch {
|
|
|
+ // message.error('取消关联失败,请稍后再试!')
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
/** 操作分发 */
|
|
|
const handleCommand = (command: string, row: UserApi.UserVO) => {
|
|
|
switch (command) {
|
|
@@ -315,6 +384,10 @@ const handleCommand = (command: string, row: UserApi.UserVO) => {
|
|
|
case 'handleRole':
|
|
|
handleRole(row)
|
|
|
break
|
|
|
+ case 'disassociate':
|
|
|
+ // 取消人员关联
|
|
|
+ disassociate(row)
|
|
|
+ break
|
|
|
default:
|
|
|
break
|
|
|
}
|
|
@@ -359,3 +432,9 @@ onMounted(() => {
|
|
|
getList()
|
|
|
})
|
|
|
</script>
|
|
|
+<style>
|
|
|
+.user-manage-row {
|
|
|
+ margin-bottom: -15px;
|
|
|
+ padding-bottom: 0;
|
|
|
+}
|
|
|
+</style>
|