From a46a0c8654c5224d2adbad0fd99b6bc572ccf35e Mon Sep 17 00:00:00 2001 From: KaneLeung Date: Tue, 8 Jul 2025 14:55:36 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=8E=E5=A2=9E=E5=8A=A0=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E7=AB=AF=E5=88=97=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Admin.NET/Admin.NET.Core/Const/CacheConst.cs | 5 + .../Admin.NET.Core/Entity/SysColumnCustom.cs | 49 +++ .../ColumnCustom/Dto/ColumnCustomInput.cs | 63 ++++ .../ColumnCustom/Dto/ColumnCustomOutput.cs | 37 +++ .../ColumnCustom/SysColumnCustomService.cs | 81 +++++ Web/src/api-services/api.ts | 1 + .../apis/sys-column-custom-api.ts | 310 ++++++++++++++++++ .../admin-netresult-column-custom-output.ts | 69 ++++ .../models/column-custom-output.ts | 70 ++++ Web/src/api-services/models/index.ts | 4 + .../models/reset-column-custom-input.ts | 30 ++ .../models/store-column-custom-input.ts | 62 ++++ Web/src/hooks/useVxeTableOptionsHook.ts | 32 +- .../component/reportGroupPanel/index.vue | 2 +- 14 files changed, 813 insertions(+), 2 deletions(-) create mode 100644 Admin.NET/Admin.NET.Core/Entity/SysColumnCustom.cs create mode 100644 Admin.NET/Admin.NET.Core/Service/ColumnCustom/Dto/ColumnCustomInput.cs create mode 100644 Admin.NET/Admin.NET.Core/Service/ColumnCustom/Dto/ColumnCustomOutput.cs create mode 100644 Admin.NET/Admin.NET.Core/Service/ColumnCustom/SysColumnCustomService.cs create mode 100644 Web/src/api-services/apis/sys-column-custom-api.ts create mode 100644 Web/src/api-services/models/admin-netresult-column-custom-output.ts create mode 100644 Web/src/api-services/models/column-custom-output.ts create mode 100644 Web/src/api-services/models/reset-column-custom-input.ts create mode 100644 Web/src/api-services/models/store-column-custom-input.ts diff --git a/Admin.NET/Admin.NET.Core/Const/CacheConst.cs b/Admin.NET/Admin.NET.Core/Const/CacheConst.cs index 8a141f90..12f7e5a4 100644 --- a/Admin.NET/Admin.NET.Core/Const/CacheConst.cs +++ b/Admin.NET/Admin.NET.Core/Const/CacheConst.cs @@ -110,4 +110,9 @@ public class CacheConst /// Excel临时文件缓存 /// public const string KeyExcelTemp = "sys_excel_temp:"; + + /// + /// 列配置缓存 + /// + public const string KeyColumnCustom = "sys_column_custom:"; } \ No newline at end of file diff --git a/Admin.NET/Admin.NET.Core/Entity/SysColumnCustom.cs b/Admin.NET/Admin.NET.Core/Entity/SysColumnCustom.cs new file mode 100644 index 00000000..a6dcb5f5 --- /dev/null +++ b/Admin.NET/Admin.NET.Core/Entity/SysColumnCustom.cs @@ -0,0 +1,49 @@ +// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。 +// +// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。 +// +// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + +namespace Admin.NET.Core; + +/// +/// Vxe表格列配置 +/// +[SugarTable(null, "Vxe表格列配置")] +[SysTable] +[SugarIndex("i_{table}_u", nameof(UserId), OrderByType.Asc)] +[SugarIndex("i_{table}_g", nameof(GridId), OrderByType.Asc)] +public class SysColumnCustom : EntityTenantId +{ + /// + /// 用户Id + /// + [SugarColumn(ColumnDescription = "用户Id")] + public long UserId { get; set; } + /// + /// 表格Id + /// + [MaxLength(128)] + [SugarColumn(ColumnDescription = "表格Id", Length = 128)] + public string GridId { get; set; } + /// + /// 冻结列状态数据 + /// + [SugarColumn(ColumnDescription = "冻结列状态数据", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)] + public string? FixedData { get; set; } + /// + /// 列宽状态数据 + /// + [SugarColumn(ColumnDescription = "列宽状态数据", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)] + public string? ResizableData { get; set; } + /// + /// 列顺序数据 + /// + [SugarColumn(ColumnDescription = "列顺序数据", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)] + public string? SortData { get; set; } + /// + /// 显示/隐藏列状态数据 + /// + [SugarColumn(ColumnDescription = "显示/隐藏列状态数据", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)] + public string? VisibleData { get; set; } +} \ No newline at end of file diff --git a/Admin.NET/Admin.NET.Core/Service/ColumnCustom/Dto/ColumnCustomInput.cs b/Admin.NET/Admin.NET.Core/Service/ColumnCustom/Dto/ColumnCustomInput.cs new file mode 100644 index 00000000..6ffc751c --- /dev/null +++ b/Admin.NET/Admin.NET.Core/Service/ColumnCustom/Dto/ColumnCustomInput.cs @@ -0,0 +1,63 @@ +// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。 +// +// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。 +// +// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + +namespace Admin.NET.Core.Service; + +/// +/// 用户表格列配置基数输入参数 +/// +public class BaseColumnCustomInput +{ + /// + /// 表格Id + /// + [MaxLength(128)] + [Required(ErrorMessage = "表格Id不能为空")] + public virtual string GridId { get; set; } +} + +/// +/// 获取用户表格列配置输入参数 +/// +public class GetColumnCustomInput : BaseColumnCustomInput +{ +} + +/// +/// 保存用户表格列配置输入参数 +/// +public class StoreColumnCustomInput +{ + /// + /// 表格Id + /// + [MaxLength(128)] + [Required(ErrorMessage = "表格Id不能为空")] + public virtual string GridId { get; set; } + /// + /// 冻结列状态数据 + /// + public virtual Dictionary? FixedData { get; set; } + /// + /// 列宽状态数据 + /// + public virtual Dictionary? ResizableData { get; set; } + /// + /// 列顺序数据 + /// + public virtual Dictionary? SortData { get; set; } + /// + /// 显示/隐藏列状态数据 + /// + public virtual Dictionary? VisibleData { get; set; } +} + +/// +/// 重置用户表格列配置输入参数 +/// +public class ResetColumnCustomInput : BaseColumnCustomInput +{ +} \ No newline at end of file diff --git a/Admin.NET/Admin.NET.Core/Service/ColumnCustom/Dto/ColumnCustomOutput.cs b/Admin.NET/Admin.NET.Core/Service/ColumnCustom/Dto/ColumnCustomOutput.cs new file mode 100644 index 00000000..fc696873 --- /dev/null +++ b/Admin.NET/Admin.NET.Core/Service/ColumnCustom/Dto/ColumnCustomOutput.cs @@ -0,0 +1,37 @@ +// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。 +// +// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。 +// +// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + +namespace Admin.NET.Core.Service; +/// +/// 用户表格列配置输出参数 +/// +public class ColumnCustomOutput +{ + /// + /// 用户Id + /// + public virtual long UserId { get; set; } + /// + /// 表格Id + /// + public virtual string GridId { get; set; } + /// + /// 冻结列状态数据 + /// + public virtual Dictionary? FixedData { get; set; } + /// + /// 列宽状态数据 + /// + public virtual Dictionary? ResizableData { get; set; } + /// + /// 列顺序数据 + /// + public virtual Dictionary? SortData { get; set; } + /// + /// 显示/隐藏列状态数据 + /// + public virtual Dictionary? VisibleData { get; set; } +} \ No newline at end of file diff --git a/Admin.NET/Admin.NET.Core/Service/ColumnCustom/SysColumnCustomService.cs b/Admin.NET/Admin.NET.Core/Service/ColumnCustom/SysColumnCustomService.cs new file mode 100644 index 00000000..046823cd --- /dev/null +++ b/Admin.NET/Admin.NET.Core/Service/ColumnCustom/SysColumnCustomService.cs @@ -0,0 +1,81 @@ +// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。 +// +// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。 +// +// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + +namespace Admin.NET.Core.Service; + +/// +/// 表格列配置服务 🧩 +/// +/// +/// +/// +[ApiDescriptionSettings(Order = 440, Description = "代码生成模板配置")] +public class SysColumnCustomService(SqlSugarRepository rep, UserManager um, SysCacheService cache) : IDynamicApiController, ITransient +{ + /// + /// 获取用户表格列配置信息 + /// + /// + /// + [SuppressMonitor] + [DisplayName("获取用户表格列配置信息")] + public async Task GetDetail([FromQuery] GetColumnCustomInput input) + { + var key = $"{CacheConst.KeyColumnCustom}{um.UserId}:{input.GridId}"; + var result = cache.Get(key); + if (result is null) + { + var temp = await rep.GetFirstAsync(e => e.UserId == um.UserId && e.GridId == input.GridId); + if (temp != null) + { + result = new ColumnCustomOutput + { + UserId = temp.UserId, + GridId = temp.GridId, + FixedData = string.IsNullOrEmpty(temp.FixedData) ? null : JSON.Deserialize>(temp.FixedData), + ResizableData = string.IsNullOrEmpty(temp.ResizableData) ? null : JSON.Deserialize>(temp.ResizableData), + SortData = string.IsNullOrEmpty(temp.SortData) ? null : JSON.Deserialize>(temp.SortData), + VisibleData = string.IsNullOrEmpty(temp.VisibleData) ? null : JSON.Deserialize>(temp.VisibleData), + }; + cache.Set(key, result, TimeSpan.FromDays(7)); + } + } + return result; + } + + /// + /// 保存用户表格列配置信息 + /// + /// + /// + [HttpPost] + [DisplayName("保存用户表格列配置信息")] + public async Task Store(StoreColumnCustomInput input) + { + var key = $"{CacheConst.KeyColumnCustom}{um.UserId}:{input.GridId}"; + var temp = await rep.GetFirstAsync(e => e.UserId == um.UserId && e.GridId == input.GridId); + if (temp is null) temp = new SysColumnCustom { UserId = um.UserId, GridId = input.GridId }; + else cache.Remove($"{CacheConst.KeyColumnCustom}{um.UserId}:{input.GridId}"); //移除缓存 + temp.FixedData = JSON.Serialize(input.FixedData); + temp.ResizableData = JSON.Serialize(input.ResizableData); + temp.SortData = JSON.Serialize(input.SortData); + temp.VisibleData = JSON.Serialize(input.VisibleData); + await rep.Context.Storageable(temp).ExecuteCommandAsync(); + } + + /// + /// 清除用户表格列配置信息 + /// + /// + /// + [HttpPost] + [DisplayName("清除用户表格列配置信息")] + public async Task Reset(ResetColumnCustomInput input) + { + await rep.AsDeleteable().Where(e => e.UserId == um.UserId && e.GridId == input.GridId).ExecuteCommandAsync(); + cache.Remove($"{CacheConst.KeyColumnCustom}{um.UserId}:{input.GridId}"); //移除缓存 + } +} \ No newline at end of file diff --git a/Web/src/api-services/api.ts b/Web/src/api-services/api.ts index 7c4107f4..5ae4203f 100644 --- a/Web/src/api-services/api.ts +++ b/Web/src/api-services/api.ts @@ -22,6 +22,7 @@ export * from './apis/sys-cache-api'; export * from './apis/sys-code-gen-api'; export * from './apis/sys-code-gen-config-api'; export * from './apis/sys-code-gen-template-api'; +export * from './apis/sys-column-custom-api'; export * from './apis/sys-common-api'; export * from './apis/sys-config-api'; export * from './apis/sys-config-tenant-api'; diff --git a/Web/src/api-services/apis/sys-column-custom-api.ts b/Web/src/api-services/apis/sys-column-custom-api.ts new file mode 100644 index 00000000..fbb056ac --- /dev/null +++ b/Web/src/api-services/apis/sys-column-custom-api.ts @@ -0,0 +1,310 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Admin.NET 通用权限开发平台 + * 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。
👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import globalAxios, { AxiosResponse, AxiosInstance, AxiosRequestConfig } from 'axios'; +import { Configuration } from '../configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; +import { AdminNETResultColumnCustomOutput } from '../models'; +import { ResetColumnCustomInput } from '../models'; +import { StoreColumnCustomInput } from '../models'; +/** + * SysColumnCustomApi - axios parameter creator + * @export + */ +export const SysColumnCustomApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary 获取用户表格列配置信息 + * @param {string} gridId 表格Id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiSysColumnCustomDetailGet: async (gridId: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'gridId' is not null or undefined + if (gridId === null || gridId === undefined) { + throw new RequiredError('gridId','Required parameter gridId was null or undefined when calling apiSysColumnCustomDetailGet.'); + } + const localVarPath = `/api/sysColumnCustom/detail`; + // 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; + } + + if (gridId !== undefined) { + localVarQueryParameter['GridId'] = gridId; + } + + 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, + }; + }, + /** + * + * @summary 清除用户表格列配置信息 + * @param {ResetColumnCustomInput} [body] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiSysColumnCustomResetPost: async (body?: ResetColumnCustomInput, options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/sysColumnCustom/reset`; + // 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: 'POST', ...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; + } + + localVarHeaderParameter['Content-Type'] = 'application/json-patch+json'; + + 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}; + 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 {StoreColumnCustomInput} [body] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + apiSysColumnCustomStorePost: async (body?: StoreColumnCustomInput, options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/sysColumnCustom/store`; + // 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: 'POST', ...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; + } + + localVarHeaderParameter['Content-Type'] = 'application/json-patch+json'; + + 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}; + 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, + }; + }, + } +}; + +/** + * SysColumnCustomApi - functional programming interface + * @export + */ +export const SysColumnCustomApiFp = function(configuration?: Configuration) { + return { + /** + * + * @summary 获取用户表格列配置信息 + * @param {string} gridId 表格Id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiSysColumnCustomDetailGet(gridId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + const localVarAxiosArgs = await SysColumnCustomApiAxiosParamCreator(configuration).apiSysColumnCustomDetailGet(gridId, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary 清除用户表格列配置信息 + * @param {ResetColumnCustomInput} [body] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiSysColumnCustomResetPost(body?: ResetColumnCustomInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + const localVarAxiosArgs = await SysColumnCustomApiAxiosParamCreator(configuration).apiSysColumnCustomResetPost(body, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary 保存用户表格列配置信息 + * @param {StoreColumnCustomInput} [body] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiSysColumnCustomStorePost(body?: StoreColumnCustomInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { + const localVarAxiosArgs = await SysColumnCustomApiAxiosParamCreator(configuration).apiSysColumnCustomStorePost(body, options); + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * SysColumnCustomApi - factory interface + * @export + */ +export const SysColumnCustomApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + return { + /** + * + * @summary 获取用户表格列配置信息 + * @param {string} gridId 表格Id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiSysColumnCustomDetailGet(gridId: string, options?: AxiosRequestConfig): Promise> { + return SysColumnCustomApiFp(configuration).apiSysColumnCustomDetailGet(gridId, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 清除用户表格列配置信息 + * @param {ResetColumnCustomInput} [body] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiSysColumnCustomResetPost(body?: ResetColumnCustomInput, options?: AxiosRequestConfig): Promise> { + return SysColumnCustomApiFp(configuration).apiSysColumnCustomResetPost(body, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary 保存用户表格列配置信息 + * @param {StoreColumnCustomInput} [body] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async apiSysColumnCustomStorePost(body?: StoreColumnCustomInput, options?: AxiosRequestConfig): Promise> { + return SysColumnCustomApiFp(configuration).apiSysColumnCustomStorePost(body, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * SysColumnCustomApi - object-oriented interface + * @export + * @class SysColumnCustomApi + * @extends {BaseAPI} + */ +export class SysColumnCustomApi extends BaseAPI { + /** + * + * @summary 获取用户表格列配置信息 + * @param {string} gridId 表格Id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SysColumnCustomApi + */ + public async apiSysColumnCustomDetailGet(gridId: string, options?: AxiosRequestConfig) : Promise> { + return SysColumnCustomApiFp(this.configuration).apiSysColumnCustomDetailGet(gridId, options).then((request) => request(this.axios, this.basePath)); + } + /** + * + * @summary 清除用户表格列配置信息 + * @param {ResetColumnCustomInput} [body] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SysColumnCustomApi + */ + public async apiSysColumnCustomResetPost(body?: ResetColumnCustomInput, options?: AxiosRequestConfig) : Promise> { + return SysColumnCustomApiFp(this.configuration).apiSysColumnCustomResetPost(body, options).then((request) => request(this.axios, this.basePath)); + } + /** + * + * @summary 保存用户表格列配置信息 + * @param {StoreColumnCustomInput} [body] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof SysColumnCustomApi + */ + public async apiSysColumnCustomStorePost(body?: StoreColumnCustomInput, options?: AxiosRequestConfig) : Promise> { + return SysColumnCustomApiFp(this.configuration).apiSysColumnCustomStorePost(body, options).then((request) => request(this.axios, this.basePath)); + } +} diff --git a/Web/src/api-services/models/admin-netresult-column-custom-output.ts b/Web/src/api-services/models/admin-netresult-column-custom-output.ts new file mode 100644 index 00000000..fd5163b6 --- /dev/null +++ b/Web/src/api-services/models/admin-netresult-column-custom-output.ts @@ -0,0 +1,69 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Admin.NET 通用权限开发平台 + * 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。
👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import { ColumnCustomOutput } from './column-custom-output'; + /** + * 全局返回结果 + * + * @export + * @interface AdminNETResultColumnCustomOutput + */ +export interface AdminNETResultColumnCustomOutput { + + /** + * 状态码 + * + * @type {number} + * @memberof AdminNETResultColumnCustomOutput + */ + code?: number; + + /** + * 类型success、warning、error + * + * @type {string} + * @memberof AdminNETResultColumnCustomOutput + */ + type?: string | null; + + /** + * 错误信息 + * + * @type {string} + * @memberof AdminNETResultColumnCustomOutput + */ + message?: string | null; + + /** + * @type {ColumnCustomOutput} + * @memberof AdminNETResultColumnCustomOutput + */ + result?: ColumnCustomOutput; + + /** + * 附加数据 + * + * @type {any} + * @memberof AdminNETResultColumnCustomOutput + */ + extras?: any | null; + + /** + * 时间 + * + * @type {Date} + * @memberof AdminNETResultColumnCustomOutput + */ + time?: Date; +} diff --git a/Web/src/api-services/models/column-custom-output.ts b/Web/src/api-services/models/column-custom-output.ts new file mode 100644 index 00000000..70b890bc --- /dev/null +++ b/Web/src/api-services/models/column-custom-output.ts @@ -0,0 +1,70 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Admin.NET 通用权限开发平台 + * 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。
👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * 用户表格列配置输出参数 + * + * @export + * @interface ColumnCustomOutput + */ +export interface ColumnCustomOutput { + + /** + * 用户Id + * + * @type {number} + * @memberof ColumnCustomOutput + */ + userId?: number; + + /** + * 表格Id + * + * @type {string} + * @memberof ColumnCustomOutput + */ + gridId?: string | null; + + /** + * 冻结列状态数据 + * + * @type {{ [key: string]: string; }} + * @memberof ColumnCustomOutput + */ + fixedData?: { [key: string]: string; } | null; + + /** + * 列宽状态数据 + * + * @type {{ [key: string]: number; }} + * @memberof ColumnCustomOutput + */ + resizableData?: { [key: string]: number; } | null; + + /** + * 列顺序数据 + * + * @type {{ [key: string]: number; }} + * @memberof ColumnCustomOutput + */ + sortData?: { [key: string]: number; } | null; + + /** + * 显示/隐藏列状态数据 + * + * @type {{ [key: string]: boolean; }} + * @memberof ColumnCustomOutput + */ + visibleData?: { [key: string]: boolean; } | null; +} diff --git a/Web/src/api-services/models/index.ts b/Web/src/api-services/models/index.ts index bb0df82a..5f1005a1 100644 --- a/Web/src/api-services/models/index.ts +++ b/Web/src/api-services/models/index.ts @@ -27,6 +27,7 @@ export * from './address-family'; export * from './admin-netresult-boolean'; export * from './admin-netresult-captcha-output'; export * from './admin-netresult-chat-output'; +export * from './admin-netresult-column-custom-output'; export * from './admin-netresult-create-pay-transaction-native-output'; export * from './admin-netresult-create-pay-transaction-output'; export * from './admin-netresult-data-set'; @@ -181,6 +182,7 @@ export * from './chat-output'; export * from './cluster-status'; export * from './code-gen-config'; export * from './code-gen-type-enum'; +export * from './column-custom-output'; export * from './column-ouput'; export * from './column-relation'; export * from './compare-info'; @@ -392,6 +394,7 @@ export * from './report-config-output'; export * from './report-config-parse-sql-input'; export * from './report-config-parse-sql-output'; export * from './report-data-source-output'; +export * from './reset-column-custom-input'; export * from './reset-pwd-user-input'; export * from './role-api-input'; export * from './role-input'; @@ -450,6 +453,7 @@ export * from './sql-sugar-paged-list-tenant-output'; export * from './sql-sugar-paged-list-user-output'; export * from './stat-log-output'; export * from './status-enum'; +export * from './store-column-custom-input'; export * from './stress-test-harness-result'; export * from './stress-test-input'; export * from './struct-layout-attribute'; diff --git a/Web/src/api-services/models/reset-column-custom-input.ts b/Web/src/api-services/models/reset-column-custom-input.ts new file mode 100644 index 00000000..0a786628 --- /dev/null +++ b/Web/src/api-services/models/reset-column-custom-input.ts @@ -0,0 +1,30 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Admin.NET 通用权限开发平台 + * 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。
👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * 重置用户表格列配置输入参数 + * + * @export + * @interface ResetColumnCustomInput + */ +export interface ResetColumnCustomInput { + + /** + * 表格Id + * + * @type {string} + * @memberof ResetColumnCustomInput + */ + gridId: string; +} diff --git a/Web/src/api-services/models/store-column-custom-input.ts b/Web/src/api-services/models/store-column-custom-input.ts new file mode 100644 index 00000000..ac9dd6ed --- /dev/null +++ b/Web/src/api-services/models/store-column-custom-input.ts @@ -0,0 +1,62 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Admin.NET 通用权限开发平台 + * 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。
👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + /** + * 保存用户表格列配置输入参数 + * + * @export + * @interface StoreColumnCustomInput + */ +export interface StoreColumnCustomInput { + + /** + * 表格Id + * + * @type {string} + * @memberof StoreColumnCustomInput + */ + gridId: string; + + /** + * 冻结列状态数据 + * + * @type {{ [key: string]: string; }} + * @memberof StoreColumnCustomInput + */ + fixedData?: { [key: string]: string; } | null; + + /** + * 列宽状态数据 + * + * @type {{ [key: string]: number; }} + * @memberof StoreColumnCustomInput + */ + resizableData?: { [key: string]: number; } | null; + + /** + * 列顺序数据 + * + * @type {{ [key: string]: number; }} + * @memberof StoreColumnCustomInput + */ + sortData?: { [key: string]: number; } | null; + + /** + * 显示/隐藏列状态数据 + * + * @type {{ [key: string]: boolean; }} + * @memberof StoreColumnCustomInput + */ + visibleData?: { [key: string]: boolean; } | null; +} diff --git a/Web/src/hooks/useVxeTableOptionsHook.ts b/Web/src/hooks/useVxeTableOptionsHook.ts index 3441bc11..61d3f2bf 100644 --- a/Web/src/hooks/useVxeTableOptionsHook.ts +++ b/Web/src/hooks/useVxeTableOptionsHook.ts @@ -4,6 +4,8 @@ import { useThemeConfig } from '/@/stores/themeConfig'; import { merge } from 'lodash-es'; import { VxeGridProps, VxeGridPropTypes, VxeComponentSizeType } from 'vxe-table'; import { VxeTablePropTypes } from 'vxe-pc-ui/types/components/table'; +import { getAPI } from '/@/utils/axios-utils'; +import { SysColumnCustomApi } from '/@/api-services'; // 根据主题配置获取组件大小 const vxeSize: VxeComponentSizeType = useThemeConfig().themeConfig.globalComponentSize == 'small' ? 'mini' : useThemeConfig().themeConfig.globalComponentSize == 'default' ? 'small' : 'medium'; @@ -15,6 +17,7 @@ const vxeSize: VxeComponentSizeType = useThemeConfig().themeConfig.globalCompone * @param {Boolean} showFooter 是否显示表尾; * @param {any} footerData 表尾数据; * @param {VxeTablePropTypes.FooterMethod} footerMethod 表尾方法; + * @param {Boolean} remoteCustom 是否使用服务端列配置; */ interface iVxeOption { id?: string; @@ -25,6 +28,7 @@ interface iVxeOption { showFooter?: boolean; footerData?: VxeTablePropTypes.FooterData; footerMethod?: VxeTablePropTypes.FooterMethod; + remoteCustom?: boolean; } /** @@ -35,7 +39,7 @@ interface iVxeOption { */ export const useVxeTable = (opt: iVxeOption, extras?: VxeGridProps) => { // 创建tableId,表格id固定才可以记录调整列宽,再次刷新仍有效。 - opt.id = opt.id ? opt.id : String(new Date().getTime()); + opt.id = opt.id ? opt.id : opt.name; const options = reactive({ id: opt.id, height: 'auto', @@ -87,6 +91,8 @@ export const useVxeTable = (opt: iVxeOption, extras?: VxeGridProps) => { // 是否启用 localStorage 本地保存,会将列操作状态保留在本地(需要有 id) visible: true, // 启用显示/隐藏列状态 resizable: true, // 启用列宽状态 + sort: true, // 启用列顺序缓存 + fixed: true, // 启用冻结列状态缓存 }, }, }); @@ -111,5 +117,29 @@ export const useVxeTable = (opt: iVxeOption, extras?: VxeGridProps) => { } else { options.sortConfig = { remote: true }; } + if (opt.remoteCustom) { + // 重写默认的恢复自定义配置逻辑 + options.customConfig.restoreStore = async ({ id, storeData }) => { + const { data } = await getAPI(SysColumnCustomApi).apiSysColumnCustomDetailGet(id); + if (data.result?.fixedData) storeData.fixedData = data.result.fixedData; + if (data.result?.resizableData) storeData.resizableData = data.result.resizableData; + if (data.result?.sortData) storeData.sortData = data.result.sortData; + if (data.result?.visibleData) storeData.visibleData = data.result.visibleData; + return storeData; + }; + // 重写默认的保存方法 + options.customConfig.updateStore = async ({ id, type, storeData }) => { + if (type === 'reset') await getAPI(SysColumnCustomApi).apiSysColumnCustomResetPost({ gridId: id }); + else { + await getAPI(SysColumnCustomApi).apiSysColumnCustomStorePost({ + gridId: id, + fixedData: storeData?.fixedData, + resizableData: storeData?.resizableData, + sortData: storeData?.sortData, + visibleData: storeData?.visibleData, + }); + } + }; + } return extras ? merge(options, extras) : options; }; diff --git a/Web/src/views/system/reportConfig/component/reportGroupPanel/index.vue b/Web/src/views/system/reportConfig/component/reportGroupPanel/index.vue index 7b7fe588..11752cde 100644 --- a/Web/src/views/system/reportConfig/component/reportGroupPanel/index.vue +++ b/Web/src/views/system/reportConfig/component/reportGroupPanel/index.vue @@ -60,7 +60,7 @@