import request from '@/utils/request';

/**
 * 品类准入管理列表
 */
interface getPageData {
    pageNo: number;
    pageSize: number;
    deptId?: string;
    accessType?: string;
    reviewStatus?: string;
    approveStatus?: string;
    categoryId?: string;
}
export const getPage = (data: getPageData) => request.post('/coscoAccessWorkCategory/getPage', { data });

/**
 * 发起审批
 */
interface startApproveData {
    accessWorkId: string;
}
export const startApprove = (params: startApproveData) => request.get(`/coscoAccessWorkCategory/startApprove`, { params });

/**
 * 供应商准入管理详情
 */
export const coscoAccessWorkCategory = (id: string) => request.get(`/coscoAccessWorkCategory/${id}`);

/**
 * 供应商分页列表查询
 */
interface coscoSupplierBaseData {
    basePageRequest: basePageRequests;
    accessStatus?: number;
    name?: string;
    supplierType?: string;
}
interface basePageRequests {
    pageNo: number;
    pageSize: number;
}
export const coscoSupplierBase = (data: coscoSupplierBaseData) => request.post('/coscoSupplierBase/getSupplierPage', { data });
/**
 * 的供应商分页列表查询
 */
interface addInterface {
    categoryIds: string[];
    coscoAccessWork: CoscoAccessWork;
    supplierIds: string[];
    [property: string]: any;
}

interface CoscoAccessWork {
    accessWorkName: string;
    deptId: string;
    [property: string]: any;
}
export const add = (data: addInterface) => request.post('/coscoAccessWorkCategory/add', { data });

/**
 * 品类选择查询树
 */
export const categoryTree = () => request.get('/cosco/category/categoryTree');
