Align H5 with portal APIs for reimburse withdraw, approval history, applicant/date/title, and UUID-based expense/workflow config using portal user options. Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
675 B
TypeScript
22 lines
675 B
TypeScript
import { ref } from 'vue'
|
|
import { portalAdminApi } from '@/api/portalAdmin'
|
|
|
|
export function useApplicantOptions() {
|
|
const applicantOptions = ref<{ label: string; value: string }[]>([])
|
|
|
|
async function loadApplicantOptions() {
|
|
try {
|
|
const res: any = await portalAdminApi.userOptions()
|
|
const data = res?.data ?? res ?? []
|
|
applicantOptions.value = (Array.isArray(data) ? data : []).map((u: any) => ({
|
|
value: String(u.value ?? u.id ?? ''),
|
|
label: String(u.label ?? u.nickName ?? u.realName ?? u.username ?? ''),
|
|
}))
|
|
} catch {
|
|
applicantOptions.value = []
|
|
}
|
|
}
|
|
|
|
return { applicantOptions, loadApplicantOptions }
|
|
}
|