diff --git a/src/views/system/post/index.vue b/src/views/system/post/index.vue index 8f59872..e8a06da 100644 --- a/src/views/system/post/index.vue +++ b/src/views/system/post/index.vue @@ -24,50 +24,6 @@ {{ Number(record.status) === 1 ? '正常' : '停用' }} - @@ -93,10 +48,8 @@ import type { TableColumnData } from '@arco-design/web-vue' import PostAddModal from './PostAddModal.vue' import PostDetailDrawer from './PostDetailDrawer.vue' -import UserDetailDrawer from '../user/UserDetailDrawer.vue' -import { deletePost, listPost, getPostUsers } from '@/apis/system/post' +import { deletePost, listPost } from '@/apis/system/post' import type { PostVO } from '@/apis/system/type' -import type { UserNewResp } from '@/apis/system/type' import { useResetReactive, useTable } from '@/hooks' import { isMobile } from '@/utils' import has from '@/utils/has' @@ -144,10 +97,6 @@ const { ...queryForm, }), { immediate: true }) -// 岗位用户数据 -const postUsersMap = ref>({}) -const userLoadingMap = ref>({}) - const tableColumns = ref([ { title: '序号', @@ -159,7 +108,6 @@ const tableColumns = ref([ { title: '岗位名称', dataIndex: 'postName', - slotName: 'postName', minWidth: 140, ellipsis: true, tooltip: true, @@ -220,66 +168,8 @@ const onDelete = (record: PostVO) => { }) } - - -// 下拉框显示状态变化时自动加载数据 -const onDropdownVisibleChange = async (visible: boolean, record: PostVO) => { - if (visible && !postUsersMap.value[record.postId] && !userLoadingMap.value[record.postId]) { - // 设置加载状态 - userLoadingMap.value[record.postId] = true - - try { - const response = await getPostUsers(record.postId) - - if (response.success && response.data) { - postUsersMap.value[record.postId] = response.data - } else { - postUsersMap.value[record.postId] = [] - } - } catch (error) { - console.error('获取岗位用户信息失败:', error) - postUsersMap.value[record.postId] = [] - } finally { - userLoadingMap.value[record.postId] = false - } - } -} - -// 点击岗位名称触发用户查询 -const onPostClick = async (record: PostVO) => { - // 如果已经加载过该岗位的用户数据,直接返回 - if (postUsersMap.value[record.postId]) { - return - } - - // 设置加载状态 - userLoadingMap.value[record.postId] = true - - try { - const response = await getPostUsers(record.postId) - - if (response.success && response.data) { - postUsersMap.value[record.postId] = response.data - } else { - postUsersMap.value[record.postId] = [] - } - } catch (error) { - console.error('获取岗位用户信息失败:', error) - postUsersMap.value[record.postId] = [] - } finally { - userLoadingMap.value[record.postId] = false - } -} - -// 点击用户详情 -const onUserClick = (user: UserNewResp) => { - UserDetailDrawerRef.value?.onOpen(user.userId) -} - - const PostAddModalRef = ref>() const PostDetailDrawerRef = ref>() -const UserDetailDrawerRef = ref>() // 新增 const onAdd = () => { @@ -297,80 +187,4 @@ const onDetail = (record: PostVO) => { } - +