import request from '@/config/axios'

// 工位安排 VO
export interface OrgWorkerVO {
  id: number // id
  orgId: number // 工位id
  orgType: string
  orgName: string
  workDate: Date // 工作日期
  groupType: number // 班别
  workerId: number // 工人id
  reportId: number // 报工单id
  planDates:[]
}

// 工位安排 API
export const OrgWorkerApi = {
  // 查询工位安排分页
  getOrgWorkerPage: async (params: any) => {
    return await request.get({ url: `/mes/org-worker/page`, params })
  },

  // 查询工位安排详情
  getOrgWorker: async (id: number) => {
    return await request.get({ url: `/mes/org-worker/get?id=` + id })
  },

  // 新增工位安排
  createOrgWorker: async (data: OrgWorkerVO) => {
    return await request.post({ url: `/mes/org-worker/create`, data })
  },

  // 修改工位安排
  updateOrgWorker: async (data: OrgWorkerVO) => {
    return await request.put({ url: `/mes/org-worker/update`, data })
  },

  // 删除工位安排
  deleteOrgWorker: async (id: number) => {
    return await request.delete({ url: `/mes/org-worker/delete?id=` + id })
  },

  // 导出工位安排 Excel
  exportOrgWorker: async (params) => {
    return await request.download({ url: `/mes/org-worker/export-excel`, params })
  },
  // 多个日期新增工位安排
  getCreateWorker: async (params: any) => {
    return await request.get({ url: `/mes/org-worker/createWorker`, params })
  },

  // 获得当前用户排班工位
  getOrgWorkerList1: async (params: any) => {
    return await request.get({ url: `/mes/org-worker/getOrgWorkerRespVO` , params  })
  },
  // 获得当前用户管理的工人排班工位
  getOrgWorkerList2: async (params: any) => {
    return await request.get({ url: `/mes/org-worker/getOtherOrgWorkerRespVO` , params  })
  },

  // 获得当前用户管理的用户列表
  getOtherPersonalUser: async (params: any) => {
    return await request.get({ url: `/mes/org-worker/getOtherPersonalUser`, params })
  },
  // 获得工位
  getOrgWorkerListByOrgId: async (orgId: number) => {
    return await request.get({ url: `/mes/org-worker/getOrgWorkerListByOrgId?orgId=`+orgId   })
  },
}
