import { request } from '/@/utils/service';

const apiPrefix = '/api/assets/people/';

// 卡片展示接口
export function getCardData(query: any) {
	return request({
		url: apiPrefix + 'card/',
		method: 'GET',
		params: query,
	});
}

// 单条查询接口
export function getEmployeeDetailOverview(id: number) {
	return request({
		url: `${apiPrefix}${id}/`,
		method: 'GET',
	});
}

export function getComputerTableData(query: any) {
	return request({
		url: apiPrefix + 'computer/',
		method: 'GET',
		params: query,
	});
}

export function getShopTableData(query: any) {
	return request({
		url: apiPrefix + 'shop/',
		method: 'GET',
		params: query,
	});
}

// 创建接口
export function createEmployee(body: any) {
	return request({
		url: apiPrefix + 'create/',
		method: 'POST',
		data: body,
		headers: {
			'Content-Type': 'multipart/form-data',
		}
	});
}

// 更新接口
export function updateEmployeeDetail(query: any) {
	return request({
		url: apiPrefix + `${query.id}/`,
		method: 'POST',
		params: { partial: query.partial },
		data: query.dataToUpload,
		headers: {
			'Content-Type': 'multipart/form-data',
		}
	});
}

// 人员列表
export function getEmployeeList(query: any) {
	return request({
		url: apiPrefix + 'box/',
		method: 'GET',
		params: query,
	});
}