diff --git a/src/api/workbench/index.ts b/src/api/workbench/index.ts index 6cf1d12..34bfe7a 100644 --- a/src/api/workbench/index.ts +++ b/src/api/workbench/index.ts @@ -20,6 +20,11 @@ export function rankListApi(params?: any) { export function completedCustomerListApi(params?: any) { return request.get({ url: '/control/transactionCustomerStatistics', params }) } +// 排名榜查看更多 +export function rankMoreListApi(params?: any) { + return request.get({ url: '/control/topAll', params }) +} + // 获取所有组织以及人员信息 export function allUserListApi(params?: any) { return request.get({ url: '/organization/getAllChildOrgInfo', params }) diff --git a/src/components/ProDialog/index.vue b/src/components/ProDialog/index.vue index df98fe6..4e32e53 100644 --- a/src/components/ProDialog/index.vue +++ b/src/components/ProDialog/index.vue @@ -1,9 +1,12 @@ @@ -14,6 +17,12 @@ export interface IParams { width?: string | number data: { [key: string]: any } } +defineProps({ + showConfirmButton: { + type: Boolean, + default: true + } +}) const emit = defineEmits(['handleCancel', 'handleConfirm']) const dialogVisible = ref(false) diff --git a/src/hooks/useCommon.ts b/src/hooks/useCommon.ts index fda7d9b..70a86be 100644 --- a/src/hooks/useCommon.ts +++ b/src/hooks/useCommon.ts @@ -20,6 +20,8 @@ import { applyForEdit } from '@/api/finance/withdraw' import { useCreateModal } from './useCreateModal' import { toast, formatFileSize } from '@/utils/util' import { postLists } from '@/api/account_center/postion' +import { organzationLists } from '@/api/account_center/organization' +import { allUserListApi } from '@/api/workbench' export interface CategoryProp { id: number @@ -312,7 +314,7 @@ export function useUploadMoreAction() { previewPdf } } - +// 岗位数据 export function usePositionData() { const positionOptions = ref([]) const postId = ref() @@ -330,3 +332,59 @@ export function usePositionData() { fetchPostionData } } +// 工作台数据 +export function useWorkbench(callback?: (params: number) => void) { + const organizationList = ref([]) + const userList = ref([]) + const defaultProps = { + label: 'name', + value: 'id' + } + const CascaderProps = { + label: 'name', + value: 'id' + } + + const fetchOrganizationList = async () => { + try { + const result = await organzationLists() + organizationList.value = result ?? [] + if (result.length > 0) callback && callback(result[0].id) + } catch (error) {} + } + const fetchAllUserList = async () => { + try { + const result = await allUserListApi() + const renamedData = renameFields(result) + userList.value = renamedData + } catch (error) {} + } + const renameFields = (data: any[]): any[] => { + return data.map(item => { + const newItem = { ...item } + if (newItem.organizationVoList) { + newItem.children = renameFields(newItem.organizationVoList) + delete newItem.organizationVoList + } + if (newItem.userVos) { + newItem.userVos.forEach(item => { + item.name = item.username + }) + newItem.children = newItem.children ? [...newItem.children, ...newItem.userVos] : newItem.userVos + delete newItem.userVos + } + if (!newItem.children.length) { + newItem.disabled = true + } + return newItem + }) + } + return { + defaultProps, + CascaderProps, + organizationList, + userList, + fetchOrganizationList, + fetchAllUserList + } +} diff --git a/src/views/workbench/components/card.vue b/src/views/workbench/components/card.vue index c40021e..b30a7ec 100644 --- a/src/views/workbench/components/card.vue +++ b/src/views/workbench/components/card.vue @@ -1,7 +1,10 @@