| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import { get } from "@/utils/request";
- import Vue from "vue";
- /**
- * 组织节点全量列表
- * GET /main/group/getGroupList
- *
- * 与 PC 端 onboardingHandling 对齐:一次拉全量(不传 type 参数),
- * 法人 / 部门由前端 utils/hr/organization-tree 拆分。
- */
- export async function listOrganizations(params = {}, loding = true) {
- const res = await get(Vue.prototype.apiUrl + "/main/group/getGroupList", params, loding);
- if (res.code == 0) {
- if (Array.isArray(res.data)) return res.data;
- // 兼容分页/包装返回:{ list | records | rows | data }
- const wrapper = res.data || {};
- const list = wrapper.list || wrapper.records || wrapper.rows || wrapper.data;
- return Array.isArray(list) ? list : [];
- }
- return Promise.reject(new Error(res.message));
- }
- /**
- * 根据部门获取员工列表
- * GET /main/user/getUserPage
- */
- export async function getUserPageByGroupId(params, loding = true) {
- const res = await get(Vue.prototype.apiUrl + "/main/user/getUserPage", params, loding);
- if (res.code == 0) {
- return res.data;
- }
- return Promise.reject(new Error(res.message));
- }
- /**
- * 根据人员 id 获取用户信息(含部门)
- * GET /main/user/getById/:id
- */
- export async function getUserById(id, loding = true) {
- const res = await get(Vue.prototype.apiUrl + `/main/user/getById/${id}`, {}, loding);
- if (res.code == 0) {
- return res.data;
- }
- return Promise.reject(new Error(res.message));
- }
|