import http from '@/axios'
import { OrgVO, OrgQuery, OrgTreeVO } from '@/api/interface/system/org'

class OrgApi {
  /**
   * @name 查询组织树结构
   * @returns returns
   */
  static tree = (): Promise<ResultData<any>> => {
    return http.get<OrgTreeVO>({ url: '/system/org/tree' })
  }

  /**
   * @name 查询组织列表
   * @returns returns
   */
  static page = (params: OrgQuery): Promise<ResultData<any>> => {
    return http.get<OrgVO>({ url: '/system/org/page', params })
  }

  /**
   * @name 添加组织列表
   * @returns returns
   */
  static add = (data: OrgVO): Promise<ResultData<any>> => {
    return http.post({ url: '/system/org/add', data })
  }
  /**
   * @name 更新组织列表
   * @returns returns
   */
  static edit = (data: OrgVO): Promise<ResultData<any>> => {
    return http.put({ url: '/system/org/edit', data })
  }
}
export default OrgApi
