import request from '/@/utils/request';

/**
 * 分页查询宿舍房间列表
 */
export const fetchList = (query?: any) => {
  return request({
    url: '/stuwork/dormroom/page',
    method: 'get',
    params: query
  });
};

/**
 * 新增宿舍房间
 */
export const addObj = (data: any) => {
  return request({
    url: '/stuwork/dormroom',
    method: 'post',
    data
  });
};

/**
 * 编辑宿舍房间
 */
export const putObj = (data: any) => {
  return request({
    url: '/stuwork/dormroom/edit',
    method: 'post',
    data
  });
};

/**
 * 删除宿舍房间
 */
export const delObj = (id: string) => {
  return request({
    url: `/stuwork/dormroom/delete`,
    method: 'post',
    data: [id]
  });
};

/**
 * 学院安排
 */
export const editDept = (data: { deptCode: string; ids: string[] }) => {
  return request({
    url: '/stuwork/dormroom/editDept',
    method: 'post',
    data
  });
};

/**
 * 获取宿舍房间详情
 */
export const getObj = (id: string) => {
  return request({
    url: `/stuwork/dormroom/${id}`,
    method: 'get'
  });
};

/**
 * 获取宿舍号选择列表
 */
export const getRoomList = () => {
  return request({
    url: '/stuwork/dormroom/list',
    method: 'get'
  });
};

/**
 * 获取宿舍树状列表
 * @param dormdataType 宿舍空几人类型
 */
export const fetchDormRoomTreeList = (dormdataType?: string) => {
  return request({
    url: '/stuwork/dormroom/fetchDormRoomTreeList',
    method: 'get',
    params: { dormdataType }
  });
};

//宿舍房间
export function dormRoomList() {
  return request({
    url:'/stuwork/dormroom/list',
    method:'get'
  })
}


export function dormRoomByRoleList() {
  return request({
    url:'/stuwork/dormroom/dormRoomByRoleList',
    method:'get'
  })
}

//根据楼号查宿舍
export function getDormRoomDataByBuildingNo(query: any) {
  return request({
    url:'/stuwork/dormroom/getDormRoomDataByBuildingNo',
    method:'get',
    params: query
  })
}

export function getDataByRoomNo(data: any) {
  return request({
    url: '/stuwork/dormroom/getDataByRoomNo',
    method:'get',
    params:data
  })
}

