import { request } from "@/utils/request";
import { update } from "three/examples/jsm/libs/tween.module.js";

export interface Station{
    id?: number,
    stationCode?:string,
    stationName?:string,
    workshopId?:number,
    sectionId?:number,
    remark?:string,
    status?:number,
    createTime?:string,
    updateTime?:string
}


export const stationApi  = {

    page(params:{
        page:number,
        pageSize:number,
        stationCode:any
    }){
        return request({
            url:"biz/station/page",
            method:"get",
            params
        })
    },

    create(data:Station){
        return request({
            url:"biz/station/add",
            method:"post",
            data
        })
    },
    update(data:Station) {
        return request({
            url:"biz/station/update",
            method:"put",
            data
        })
    },
    delete(ids:any) {
        return request({
            url:`/biz/station/${ids.join(",")}`,
            method:"delete"
        })
    },
    export(params?:{
        ids?:string[],
        stationCode:any
    }){
        const p:Record<string,any> = {}
        if(params?.ids?.length) p.ids = params.ids.join(",")
        if(params?.stationCode != undefined && params?.stationCode !== null)
            console.log(params);
            console.log(1111);
            
        return request({
            url:`/biz/station/export`,
            method:"get",
            params:p,
            responseType:"blob"
        })   
    }
   
}