diff --git a/Admin.NET/Admin.NET.Core/Service/Org/SysOrgService.cs b/Admin.NET/Admin.NET.Core/Service/Org/SysOrgService.cs index 8e02b2be..47fcddbc 100644 --- a/Admin.NET/Admin.NET.Core/Service/Org/SysOrgService.cs +++ b/Admin.NET/Admin.NET.Core/Service/Org/SysOrgService.cs @@ -107,6 +107,17 @@ public class SysOrgService : IDynamicApiController, ITransient return await iSugarQueryable.Where(u => u.Level < level).ToTreeAsync(u => u.Children, u => u.Pid, pid); } + /// + /// 获取当前用户机构子树 🔖 + /// + /// + /// + [DisplayName("获取当前用户机构子树")] + public async Task> GetUserChildTree(int level = 100) + { + return await GetChildTree(_userManager.OrgId, level); + } + /// /// 增加机构 🔖 /// diff --git a/Web/src/api-services/system/apis/sys-org-api.ts b/Web/src/api-services/system/apis/sys-org-api.ts index bde6da5f..8754c894 100644 --- a/Web/src/api-services/system/apis/sys-org-api.ts +++ b/Web/src/api-services/system/apis/sys-org-api.ts @@ -289,6 +289,55 @@ export const SysOrgApiAxiosParamCreator = function (configuration?: Configuratio const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); + return { + url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary 获取当前用户机构子树 🔖 + * @param {number} level + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiSysOrgUserChildTreeLevelGet: async (level: number, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'level' is not null or undefined + if (level === null || level === undefined) { + throw new RequiredError('level','Required parameter level was null or undefined when calling apiSysOrgUserChildTreeLevelGet.'); + } + const localVarPath = `/api/sysOrg/userChildTree/{level}` + .replace(`{${"level"}}`, encodeURIComponent(String(level))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, 'https://example.com'); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication Bearer required + // http bearer authentication required + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + accessToken; + } + + const query = new URLSearchParams(localVarUrlObj.search); + for (const key in localVarQueryParameter) { + query.set(key, localVarQueryParameter[key]); + } + for (const key in options.params) { + query.set(key, options.params[key]); + } + localVarUrlObj.search = (new URLSearchParams(query)).toString(); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, @@ -377,6 +426,20 @@ export const SysOrgApiFp = function(configuration?: Configuration) { return axios.request(axiosRequestArgs); }; }, + /** + * + * @summary 获取当前用户机构子树 🔖 + * @param {number} level + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiSysOrgUserChildTreeLevelGet(level: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + const localVarAxiosArgs = await SysOrgApiAxiosParamCreator(configuration).apiSysOrgUserChildTreeLevelGet(level, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, } }; @@ -440,6 +503,16 @@ export const SysOrgApiFactory = function (configuration?: Configuration, basePat async apiSysOrgUpdatePost(body?: UpdateOrgInput, options?: AxiosRequestConfig): Promise> { return SysOrgApiFp(configuration).apiSysOrgUpdatePost(body, options).then((request) => request(axios, basePath)); }, + /** + * + * @summary 获取当前用户机构子树 🔖 + * @param {number} level + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiSysOrgUserChildTreeLevelGet(level: number, options?: AxiosRequestConfig): Promise> { + return SysOrgApiFp(configuration).apiSysOrgUserChildTreeLevelGet(level, options).then((request) => request(axios, basePath)); + }, }; }; @@ -509,4 +582,15 @@ export class SysOrgApi extends BaseAPI { public async apiSysOrgUpdatePost(body?: UpdateOrgInput, options?: AxiosRequestConfig) : Promise> { return SysOrgApiFp(this.configuration).apiSysOrgUpdatePost(body, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @summary 获取当前用户机构子树 🔖 + * @param {number} level + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SysOrgApi + */ + public async apiSysOrgUserChildTreeLevelGet(level: number, options?: AxiosRequestConfig) : Promise> { + return SysOrgApiFp(this.configuration).apiSysOrgUserChildTreeLevelGet(level, options).then((request) => request(this.axios, this.basePath)); + } }