优化
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { http, unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http'
|
||||
import { overseasHttp } from '@/shared/api/overseasHttp'
|
||||
import type { PlatformPermissionResource } from '@/shared/types/platformPermission'
|
||||
|
||||
export type { PlatformPermissionResource } from '@/shared/types/platformPermission'
|
||||
@@ -253,6 +254,7 @@ export interface PlatformManagedUser {
|
||||
roleNames: string[]
|
||||
lastLoginAt: string | null
|
||||
protectedAccount: boolean
|
||||
overseasWarehouseId: number | string | null
|
||||
}
|
||||
|
||||
export interface PlatformManagedUserPage {
|
||||
@@ -272,7 +274,14 @@ export interface PlatformManagedUserQuery {
|
||||
|
||||
export interface PlatformUserOptions {
|
||||
tenants: Array<{ id: number | string; name: string; status: string }>
|
||||
roles: Array<{ id: number | string; tenantId: number | string; name: string; status: string }>
|
||||
roles: Array<{ id: number | string; tenantId: number | string; roleCode: string; name: string; status: string }>
|
||||
}
|
||||
|
||||
export interface SharedReceivingOverseasWarehouseOption {
|
||||
id: string
|
||||
warehouseCode: string
|
||||
warehouseName: string
|
||||
countryCode: string
|
||||
}
|
||||
|
||||
export interface CreatePlatformManagedUserRequest {
|
||||
@@ -282,6 +291,7 @@ export interface CreatePlatformManagedUserRequest {
|
||||
email: string
|
||||
tenantId: number | string
|
||||
roleIds: Array<number | string>
|
||||
overseasWarehouseId: number | string | null
|
||||
password: string
|
||||
status: 'ACTIVE' | 'DISABLED'
|
||||
}
|
||||
@@ -292,6 +302,7 @@ export interface UpdatePlatformManagedUserRequest {
|
||||
email: string
|
||||
tenantId: number | string
|
||||
roleIds: Array<number | string>
|
||||
overseasWarehouseId: number | string | null
|
||||
}
|
||||
|
||||
async function getData<T>(path: string): Promise<T> {
|
||||
@@ -558,6 +569,34 @@ export function getPlatformUserOptions() {
|
||||
return getData<PlatformUserOptions>('/platform/v1/iam/users/options')
|
||||
}
|
||||
|
||||
export async function listSharedReceivingOverseasWarehouseOptions() {
|
||||
interface WarehousePage {
|
||||
records: Array<{
|
||||
id: number | string
|
||||
customerId: number | string
|
||||
warehouseCode: string
|
||||
warehouseName: string
|
||||
warehouseType: string
|
||||
countryCode: string
|
||||
status: string
|
||||
}>
|
||||
}
|
||||
const response = await overseasHttp.get<ApiEnvelope<WarehousePage>, ApiEnvelope<WarehousePage>>(
|
||||
'/platform/v1/warehouse-admin',
|
||||
{ params: { customerId: '0', page: 1, size: 200, capabilityCode: 'RECEIVING', status: 'ACTIVE' } },
|
||||
)
|
||||
return unwrapApiResponse(response).records
|
||||
.filter((warehouse) => String(warehouse.customerId) === '0'
|
||||
&& warehouse.warehouseType === 'OVERSEAS'
|
||||
&& warehouse.status === 'ACTIVE')
|
||||
.map((warehouse) => ({
|
||||
id: String(warehouse.id),
|
||||
warehouseCode: warehouse.warehouseCode,
|
||||
warehouseName: warehouse.warehouseName,
|
||||
countryCode: warehouse.countryCode,
|
||||
}))
|
||||
}
|
||||
|
||||
export function createPlatformManagedUser(payload: CreatePlatformManagedUserRequest) {
|
||||
return postData<PlatformManagedUser>('/platform/v1/iam/users', payload)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user