import request from '@/utils/request'

// 查询员工管理列表
export function listEmployee(query) {
	return request({
		url: '/basic/employee/list',
		method: 'get',
		params: query
	})
}

// 查询员工管理详细
export function getEmployee(id) {
	return request({
		url: '/basic/employee/' + id,
		method: 'get'
	})
}

// 新增员工管理
export function addEmployee(data) {
	return request({
		url: '/basic/employee',
		method: 'post',
		data: data
	})
}

// 修改员工管理
export function updateEmployee(data) {
	return request({
		url: '/basic/employee',
		method: 'put',
		data: data
	})
}

// 删除员工管理
export function delEmployee(id) {
	return request({
		url: '/basic/employee/' + id,
		method: 'delete'
	})
}

// 删除员工管理
export function printEmployees(ids) {
	return request({
		url: '/basic/employee/mergePrintPdfs',
		method: 'post',
		data: ids
	})
}

// 获取采购部员工
export function listPurchaseDepartmentEmployee(query) {
	return request({
		url: '/basic/employee/getListByPurchaseDepartment',
		method: 'get',
		params: query
	})
}

// 查询所有产线下的员工
export function listEmployeeInProLines() {
  return request({
    url: '/basic/lineEmployee/list',
    method: 'get'
  })
}

// 修改员工关联产线
export function updateEmployeeLineRel(data) {
	return request({
		url: '/basic/employee/line-rel',
		method: 'put',
		data: data
	})
}

// 删除员工与产线的关联关系
export function delEmployeeLineRel(id) {
	return request({
		url: '/basic/employee/line-rel/' + id,
		method: 'delete'
	})
}

export function getEmployeeByCode(code) {
	return request({
		url: '/basic/employee/getEmpByCode/' + code,
		method: 'get'
	})
}