import request from '@/utils/request';

/** 获取页面的数据 */
// 获取列表
export function getPageListData(pageName: string, queryInfo: any) {
    return request({
        method: 'get',
        url: `/business/${pageName}/list`,
        params: queryInfo,
    });
}

// 删除
export function deletePageData(pageName: string, urlId: any) {
    return request({
        method: 'delete',
        url: `/business/${pageName}/${urlId}`,
    });
}

// 新建
export function newPageData(pageName: string, dataInfo: any) {
    return request({
        method: 'post',
        url: `/business/${pageName}`,
        data: dataInfo,
    });
}

// 修改
export function editPageData(pageName: string, dataInfo: any) {
    return request({
        method: 'put',
        url: `/business/${pageName}`,
        data: dataInfo,
    });
}

// 获取详情
export function getPageDetail(pageName: string, urlId: any) {
    return request({
        method: 'get',
        url: `/business/${pageName}/` + urlId,
    });
}

// 公共参数 agreeType 协议类型 assetType 资产类型 systemType 操作系统类型 titleType标签类型 expertLevel专家级别
export function getCommon(value: string) {
    return request({
        url: `/system/dict/data/type/${value}`,
        method: 'get',
    });
}

export function getByDictType(value: string) {
    return request({
        url: '/business/parameter/getByDictType',
        method: 'get',
        params: {
            dictType: value,
        },
    });
}
