import request from '@/utils/request'
import { AxiosPromise } from 'axios'

// apiUrl 行政区域
const api = {
	page: '/sys/region/list-tree',
	create: '/sys/region/create',
	update: '/sys/region/update',
	delete: '/sys/region/delete'
}
/**
 * 行政区域 - 列表
 */
function regionPageApi(data: any): AxiosPromise {
	return request({
		url: api.page,
		method: 'post',
		data
	})
}

/**
 * 行政区域 - 新增编辑保存
 */
function regionAddOrEditSaveApi(data: any): AxiosPromise {
	return request({
		url: data.id ? api.update : api.create,
		method: 'post',
		data
	})
}

/**
 * 行政区域 - 删除
 */
function regionDeleteApi(data: any): AxiosPromise {
	return request({
		url: api.delete,
		method: 'post',
		data
	})
}
export default {
	regionPageApi,
	regionAddOrEditSaveApi,
	regionDeleteApi
}
