import request from '@/benyun/utils/request'

// 获取树形导航分类
function treeList(url : any) {
	return request({
		url: '/maindata/' + url + '/treeList',
		method: 'GET',
	})
}
// 树形查询不包含禁用
function treeUseList(url : any) {
	return request({
		url: '/maindata/' + url + '/treeUseList',
		method: 'GET',
	})
}
// 通过父级id查子集
function childrenTreeList(data : any, url : any) {
	return request({
		url: '/maindata/' + url + '/childrenTreeList',
		method: 'GET',
		params: data
	})
}
// 根据分类ID（数组）分页查询数据
function byCategoryPage(data : any, url : any) {
	return request({
		url: '/maindata/' + url + '/ByCategoryPage',
		method: 'GET',
		params: data
	})
}
// 通过主建id查单条数据
function single(data : any, url : any) {
	return request({
		url: '/maindata/' + url + '/single',
		method: 'GET',
		params: data
	})
}
// 分页查询数据
function pageList(data : any, url : any) {
	return request({
		url: '/maindata/' + url + '/page',
		method: 'GET',
		params: data
	})
}
// 新增数据
function saveList(data : any, url : any) {
	return request({
		url: '/maindata/' + url + '/save',
		method: 'POST',
		data: data
	})
}
// 修改数据
function updateList(data : any, url : any) {
	return request({
		url: '/maindata/' + url + '/update',
		method: 'POST',
		data: data
	})
}
// 删除数据
function deleteList(data : any, url : any) {
	return request({
		url: '/maindata/' + url + '/delete',
		method: 'POST',
		params: data
	})
}
// 删除数据
function delCategoryId(data : any, url : any) {
	return request({
		url: '/maindata/' + url + '/delete',
		method: 'delete',
		params: data
	})
}
export default {
	treeList,
	treeUseList,
	childrenTreeList,
	byCategoryPage,
	single,
	pageList,
	saveList,
	updateList,
	deleteList,
	delCategoryId
}