import request from '@/utils/request';
// 获取工厂下的所有车间
export async function listWorkshopByParentId(params) {
    const res = await request.get(`/main/factoryarea/listWorkshopByParentId/` + params, {});
    if (res.data.code == 0) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.message));
}
// 获取车间下的所有产线
export async function listFactoryLineByParentId(params) {
    const res = await request.get(`/main/factoryarea/listFactoryLineByParentId/` + params, {});
    if (res.data.code == 0) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.message));
}
// 获取产线下的所有工位
export async function listByProductionLineId(params) {
    const res = await request.get(`/main/factoryworkstation/listByProductionLineId/` + params, {});
    if (res.data.code == 0) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.message));
}
// 保存班组
export async function saveteam(data) {
    const res = await request.post(`/main/team/save`, data);
    if (res.data.code == 0) {
        return res.data.message;
    }
    return Promise.reject(new Error(res.data.message));
}
// 编辑班组
export async function updateteam(data) {
    const res = await request.put(`/main/team/update`, data);
    if (res.data.code == 0) {
        return res.data.message;
    }
    return Promise.reject(new Error(res.data.message));
}
// 列表
export async function getteampage(data) {
    const res = await request.get(`/main/team/page`, {
        params: data
    });
    console.log(res.data.code == 0)
    if (res.data.code == 0) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.message));
}
// 删除
export async function deleteteam(data) {
    const res = await request.delete(`/main/team/delete`, {
        data
    });
    if (res.data.code == 0) {
        return res.data.message;
    }
    return Promise.reject(new Error(res.data.message));
}
// 班次下拉列表
export async function getPullDown(data) {
    const res = await request.get(`/main/teamtime/pullDown`, {
        params: data
    });
    console.log(res.data.code == 0)
    if (res.data.code == 0) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.message));
}
// 设置班次
export async function settingTeamTime(data) {
    const res = await request.post(`/main/team/settingTeamTime`, data);
    console.log(res.data.code == 0)
    if (res.data.code == 0) {
        return res.data.message;
    }
    return Promise.reject(new Error(res.data.message));
}