| | |
| | | import { TableState } from 'ant-design-vue/lib/table/interface' |
| | | import { onMounted, reactive, Ref, ref, UnwrapRef } from 'vue' |
| | | import { IPage } from '/@/api/http/type' |
| | | import { getAllUsersInfo, updateUserInfo } from '/@/api/manage' |
| | | import { getAllUsersInfo, getUserPage, updateUserInfo } from '/@/api/manage' |
| | | import { ELocalStorageKey } from '/@/types' |
| | | import { EditOutlined, DeleteOutlined, CheckOutlined, CloseOutlined } from '@ant-design/icons-vue' |
| | | import { useMyStore } from '/@/store' |
| | | |
| | | export interface Member { |
| | | user_id: string |
| | |
| | | } |
| | | const columns = [ |
| | | { title: '账号', dataIndex: 'username', width: 150, sorter: (a: Member, b: Member) => a.username.localeCompare(b.username), className: 'titleStyle' }, |
| | | { title: '人员组织名称', dataIndex: 'organization_name', sorter: (a: Member, b: Member) => a.organization_name.localeCompare(b.organization_name), width: 150, className: 'titleStyle' }, |
| | | { title: '用户角色', dataIndex: 'user_role', width: 150, className: 'titleStyle', slots: { customRender: 'user_role' } }, |
| | | { title: '所属项目', dataIndex: 'project', width: 150, className: 'titleStyle' }, |
| | | { title: '人员组织名称', dataIndex: 'deptName', sorter: (a: Member, b: Member) => a.organization_name.localeCompare(b.organization_name), width: 150, className: 'titleStyle' }, |
| | | { title: '用户角色', dataIndex: 'roleName', width: 150, className: 'titleStyle', slots: { customRender: 'user_role' } }, |
| | | { title: '所属项目', dataIndex: 'projectName', width: 150, className: 'titleStyle' }, |
| | | { title: '加入方式', dataIndex: 'join_way', width: 150, className: 'titleStyle', slots: { customRender: 'join_way' } }, |
| | | { title: '加入时间', dataIndex: 'create_time', width: 150, sorter: (a: Member, b: Member) => a.create_time.localeCompare(b.create_time), className: 'titleStyle' }, |
| | | { title: '加入时间', dataIndex: 'createTime', width: 150, sorter: (a: Member, b: Member) => a.create_time.localeCompare(b.create_time), className: 'titleStyle' }, |
| | | { title: '操作', dataIndex: 'action', width: 70, className: 'titleStyle', slots: { customRender: 'action' } }, |
| | | ] |
| | | |
| | |
| | | page_size: 50 |
| | | } |
| | | const workspaceId: string = localStorage.getItem(ELocalStorageKey.WorkspaceId)! |
| | | const store = useMyStore() |
| | | const projectId:string = store.state.common.projectId |
| | | |
| | | onMounted(() => { |
| | | getAllUsers(workspaceId, body) |
| | | getAllUsers({ projectId }, body) |
| | | }) |
| | | |
| | | function refreshData (page: Pagination) { |
| | | body.page = page?.current! |
| | | body.page_size = page?.pageSize! |
| | | getAllUsers(workspaceId, body) |
| | | getAllUsers({ projectId }, body) |
| | | } |
| | | |
| | | function getAllUsers (workspaceId: string, page: IPage) { |
| | | getAllUsersInfo(workspaceId, page).then(res => { |
| | | const userList: Member[] = res.data.list |
| | | data.member = userList |
| | | paginationProp.total = res.data.pagination.total |
| | | paginationProp.current = res.data.pagination.page |
| | | function getAllUsers (params:any, page: IPage) { |
| | | getUserPage(params, page).then(res => { |
| | | const resData = res.data |
| | | data.member = resData.list |
| | | |
| | | paginationProp.total = resData.total |
| | | paginationProp.current = resData.pageNum |
| | | }).catch(err => { |
| | | console.log(err) |
| | | }) |
| | | } |
| | | |