import request from '@/config/axios'

export interface rolePageSaveReqVO{
  id:number,
  roleId:number,
  roleName:string,
  pageType?:number
}
export interface pageUiComponentSaveReqVO{
  id:number,
  pageId:number,
  componentId:number,
  componentRow?:string,
  componentColumn?:string,
}

// 查询角色页面数据列表
export const getRolePagePage=async(params:PageParam)=>{
  return await request.get({url:'/sys/role-page/getRolePagePage',params})
}


//获取角色数据详细信息/sys/role-page/selectRolePageById
export const selectRolePageById=async(id:number)=>{
  return await request.get({url:'/sys/role-page/selectRolePageById',params:{id:id}})
}


//创建角色页面/sys/role-page/insertRolePage
export const insertRolePage =async(data:rolePageSaveReqVO)=>{
  return await request.post({url:'/sys/role-page/insertRolePage',data})
}

//更新角色页面
export const updateRolePage =async(data:rolePageSaveReqVO)=>{
  return await request.put({url:'/sys/role-page/updateRolePage',data})
}

//删除角色页面数据
export const deleteRolePageList=async(ids:[])=>{
  return await request.delete({url:'/sys/role-page/deleteRolePageList?ids='+ids})
}



//驾驶舱页面和组件关联
// 获得分页数据
export const getPageUiComponentPage=async(params:PageParam)=>{
  return await request.get({url:'/sys/page-ui-component/getPageUiComponentPage',params})
}

//获得详情数据
export const selectPageUiComponentById=async(id:number)=>{
  return await request.get({url:'/sys/page-ui-component/selectPageUiComponentById',params:{id:id}})
}


//创建页面和组件关联
export const insertPageUiComponent=async(data:pageUiComponentSaveReqVO)=>{
  return await request.post({url:'/sys/page-ui-component/insertPageUiComponent',data})
}

//修改页面和组件关联
export const updatePageUiComponent=async(data:pageUiComponentSaveReqVO)=>{
  return await request.put({url:'/sys/page-ui-component/updatePageUiComponent',data})
}

//批量删除
export const deletePageUiComponentList=async(ids:[])=>{
  return await request.delete({url:'sys/page-ui-component/deletePageUiComponentList?ids='+ids})
}
