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

// apiUrl 岗位管理
const api = {
	page: '/sys/post/page',
	create: '/sys/post/create',
	update: '/sys/post/update',
	delete: '/sys/post/delete'
}
/**
 * 岗位管理 - 列表
 */
function postPageApi(data: any): AxiosPromise {
	return request({
		url: api.page,
		method: 'post',
		data
	})
}

/**
 * 岗位管理 - 新增编辑保存
 */
function postAddOrEditSaveApi(data: any): AxiosPromise {
	return request({
		url: data.id ? api.update : api.create,
		method: 'post',
		data
	})
}

/**
 * 岗位管理 - 删除
 */
function postDeleteApi(data: any): AxiosPromise {
	return request({
		url: api.delete,
		method: 'post',
		data
	})
}
export default {
	postPageApi,
	postAddOrEditSaveApi,
	postDeleteApi
}
