import { tableList, wrapTreeNode } from '@/utils/format';
import request from '@/utils/request';
import type { SERVERPARTModel } from './data'; // 引用标准接口数据对象
// 获取列表【服务区站点】
export async function getList(params?: any) {
    const search = params ? { ...params, SortStr: params?.SortStr, keyWord: params?.keyWord, PageIndex: params?.searchParameter.current } : {};
    const data = await request(`/BaseInfo/GetSERVERPARTList`, {
        method: 'POST',
        data: search,
    });
    if (data.Result_Code !== 100) {
        return {
            data: [],
            current: 1,
            pageSize: 10,
            total: 0,
            success: false
        }
    }
    return tableList(data.Result_Data);
}
// 获取明细【服务区站点】
export async function getDetail(serverpartId: number) {
    const data = await request(`/BaseInfo/GetSERVERPARTDetail?serverpartId=${serverpartId}`, {
        method: 'GET',
    });
    if (data.Result_Code !== 100) {
        return data.Result_Desc
    }
    return data.Result_Data;
}
// 同步数据【服务区站点】
export async function updateserverpart(serverpart: SERVERPARTModel) {
    return request(`/BaseInfo/DeleteSERVERPART`, {
        method: 'POST',
        data: serverpart,
        requestType: 'form',
    });
}
// 删除数据【服务区站点】
export async function delserverpart(serverpartid: number) {
    return request(`/BaseInfo/DeleteSERVERPART?serverpartid=${serverpartid}`, {
        method: 'POST',
        requestType: 'form',
    });
}
