import request from "@/utils/request";
import constant from "@/utils/constant";
import {ElMessage} from "element-plus";

// 导入数据
const importData = (params, type) => {
    if (type === 'Excel') {
        return importExcel(params);
    } else if (type === 'Shape') {
        return importShape(params);
    } else if (type === 'GeoJson') {
        return importGeoJson(params);
    } else {
        return new Promise((resolve, reject) => {reject()})
    }
}

// 导入Excel数据
const importExcel = (params) => {
    return request.postWithFile(constant.dtbserverProxy + '/file/addDataForExcel', params)
}

// 导入SHAPE数据
const importShape = (params) => {
    return request.postWithFile(constant.dtbserverProxy + '/file/addDataForShapeZip', params)
}

// 导入GeoJson数据
const importGeoJson = (params) => {
    return request.postWithFile(constant.dtbserverProxy + '/file/addDataForGeojson', params)
}

export default {
    importData,
    // importExcel,
    // importGeoJson,
    // importShape
}