From c01eb57eb88e1c17bb2d6415efed663948062e9e Mon Sep 17 00:00:00 2001 From: "CAOMEI\\s" Date: Mon, 8 Jul 2024 14:44:56 +0800 Subject: [PATCH 01/32] =?UTF-8?q?=E6=97=B6=E9=97=B4=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=94=B1'YYYY-mm-dd'=E6=9B=B4=E6=94=B9=E4=B8=BA'YYYY-mm-dd=20H?= =?UTF-8?q?H:MM:SS'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm b/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm index 07501517..0b9a918f 100644 --- a/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm +++ b/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm @@ -149,7 +149,7 @@ @: } else if(@column.EffectType == "DatePicker") { @: } } From 34f3e668612fc216592370b11acfdb27def12f34 Mon Sep 17 00:00:00 2001 From: shuerchoi <74034219+shuerchoi@users.noreply.github.com> Date: Tue, 9 Jul 2024 09:47:33 +0800 Subject: [PATCH 02/32] =?UTF-8?q?=E8=8F=9C=E5=8D=95=20=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Web/src/hooks/setupVXETableHook.ts | 22 +--- Web/src/hooks/useVxeTableOptionsHook.ts | 85 ++++++++++++++ Web/src/views/system/config/index.vue | 142 +++++++++++------------- Web/src/views/system/menu/index.vue | 64 ++++++----- 4 files changed, 192 insertions(+), 121 deletions(-) create mode 100644 Web/src/hooks/useVxeTableOptionsHook.ts diff --git a/Web/src/hooks/setupVXETableHook.ts b/Web/src/hooks/setupVXETableHook.ts index 8c699285..8905b88b 100644 --- a/Web/src/hooks/setupVXETableHook.ts +++ b/Web/src/hooks/setupVXETableHook.ts @@ -8,10 +8,11 @@ import 'vxe-table-plugin-element/dist/style.css'; // Vxe UI 组件库 import VxeUI, { VxeComponentSizeType } from 'vxe-pc-ui'; import ExcelJS from 'exceljs'; -import { Local } from '../utils/storage'; +import { useThemeConfig } from '/@/stores/themeConfig'; +const vxeSize:VxeComponentSizeType = useThemeConfig().themeConfig.globalComponentSize == 'small' ? 'mini' + : useThemeConfig().themeConfig.globalComponentSize == 'default' ? 'small' : 'medium'; export const setupVXETable = (app: App) => { - let vxeSize = getVxeTableSize(); // 加载插件 VxeUITable.use(VXETablePluginElement); VxeUITable.use(VXETablePluginExportXLSX, { ExcelJS: ExcelJS }); @@ -108,19 +109,4 @@ export const setupVXETable = (app: App) => { // app.config.globalProperties.$XPrint = VxeUI.print // app.config.globalProperties.$XSaveFile = VxeUI.saveFile // app.config.globalProperties.$XReadFile = VxeUI.readFile -}; - -// 从全局主题里面获取组件大小模式 -function getVxeTableSize() { - let vxeSize: VxeComponentSizeType = 'mini'; - - let themeConfig = Local.get('themeConfig'); - if (themeConfig == null || themeConfig == undefined) return vxeSize; - - let size = themeConfig.globalComponentSize; - if (size == 'large') vxeSize = 'medium'; - else if (size == 'default') vxeSize = 'small'; - else if (size == 'small') vxeSize = 'mini'; - - return vxeSize; -} +}; \ No newline at end of file diff --git a/Web/src/hooks/useVxeTableOptionsHook.ts b/Web/src/hooks/useVxeTableOptionsHook.ts new file mode 100644 index 00000000..73c9d681 --- /dev/null +++ b/Web/src/hooks/useVxeTableOptionsHook.ts @@ -0,0 +1,85 @@ +import { dayjs } from 'element-plus'; +import { reactive } from 'vue'; +import { VxeGridProps, VxeGridPropTypes,VxeComponentSizeType } from 'vxe-table'; +import { useThemeConfig } from '/@/stores/themeConfig'; +import { merge } from 'lodash-es'; + +const vxeSize:VxeComponentSizeType = useThemeConfig().themeConfig.globalComponentSize == 'small' ? 'mini' +: useThemeConfig().themeConfig.globalComponentSize == 'default' ? 'small' : 'medium'; + +/** + * @param {String} id 表格唯一标识,为空时自动随机产生; + * @param {String} id name:表格名称,与导出文件名有关; + * @param {VxeGridPropTypes.Columns} columns 列配置; + */ +interface iVxeOption { + id?: string; + name?: string; + columns: VxeGridPropTypes.Columns; +} + +/** + * Vxe表格参数化Hook + * @param {iVxeOption} opt 参数 + * @param {VxeGridProps} extras 要覆盖的参数 + * @returns + */ +export const useVxeTable = (opt: iVxeOption, extras?: VxeGridProps) => { + // 默认参数 + opt = Object.assign({ enableExport: true, remoteExport: false }, opt); + // 创建tableId,表格id固定才可以记录调整列宽,再次刷新仍有效。 + opt.id = opt.id ? opt.id : String(new Date().getTime()); + // console.log(opt); + const options = reactive({ + id: opt.id, + height: 'auto', + autoResize: true, + size: vxeSize, + loading: false, + align: 'center', // 自动监听父元素的变化去重新计算表格(对于父元素可能存在动态变化、显示隐藏的容器中、列宽异常等场景中的可能会用到) + // data: [] as Array, + columns: opt.columns, + toolbarConfig: { + size: vxeSize, + slots: { buttons: 'toolbar_buttons', tools: 'toolbar_tools' }, + refresh: { + code: 'query', + }, + export: true, + print: true, + zoom: true, + custom: true, + }, + checkboxConfig: { range: true }, + sortConfig: { trigger: 'cell', remote: true }, + exportConfig: { + remote: false, // 设置使用服务端导出 + filename: `${opt.name}导出_${dayjs().format('YYMMDDHHmmss')}`, + }, + pagerConfig: { + enabled: true, + size: vxeSize, + pageSize: 20, + }, // 分页 + printConfig: { sheetName: '' }, + proxyConfig: { + enabled: true, + autoLoad: false, + sort: true, + props: { + list: 'data.result', // 不分页时 + result: 'data.result.items', // 分页时 + total: 'data.result.total', + message: 'data.message', + }, + }, + customConfig: { + storage: { + // 是否启用 localStorage 本地保存,会将列操作状态保留在本地(需要有 id) + visible: true, // 启用显示/隐藏列状态 + resizable: true, // 启用列宽状态 + }, + }, + }); + return extras ? merge(options, extras) : options; +}; diff --git a/Web/src/views/system/config/index.vue b/Web/src/views/system/config/index.vue index 4d6ddf47..48e32374 100644 --- a/Web/src/views/system/config/index.vue +++ b/Web/src/views/system/config/index.vue @@ -5,12 +5,12 @@ - + - + @@ -28,7 +28,7 @@ - 查询 + 查询 重置 @@ -36,7 +36,7 @@ - + - @@ -79,17 +70,16 @@ diff --git a/Web/src/views/system/file/component/editSysfile.vue b/Web/src/views/system/file/component/editFile.vue similarity index 100% rename from Web/src/views/system/file/component/editSysfile.vue rename to Web/src/views/system/file/component/editFile.vue diff --git a/Web/src/views/system/file/index.vue b/Web/src/views/system/file/index.vue index 0333ff12..635d4253 100644 --- a/Web/src/views/system/file/index.vue +++ b/Web/src/views/system/file/index.vue @@ -142,7 +142,7 @@ import VueOfficePdf from '@vue-office/pdf'; import '@vue-office/docx/lib/index.css'; import '@vue-office/excel/lib/index.css'; -import EditFile from '/@/views/system/file/component/editSysfile.vue'; +import EditFile from '/@/views/system/file/component/editFile.vue'; import { getAPI } from '/@/utils/axios-utils'; import { SysFileApi } from '/@/api-services/api'; From c04a902fb8aee1f5846cfa264208662517a7b11c Mon Sep 17 00:00:00 2001 From: "CAOMEI\\s" Date: Wed, 10 Jul 2024 20:42:07 +0800 Subject: [PATCH 10/32] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90=E5=99=A8=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm b/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm index ff8e9766..c367c9ff 100644 --- a/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm +++ b/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm @@ -227,13 +227,13 @@ import ModifyRecord from '/@@/components/table/modifyRecord.vue'; @if (@Model.IsApiService) { // 接口函数 -import { getAPI } from '/@@/utils/axios-utils'; +@:import { getAPI } from '/@@/utils/axios-utils'; // 接口 -import { @(@Model.ClassName)Api } from '/@@/api-services/api'; +@:import { @(@Model.ClassName)Api } from '/@@/api-services/api'; // 模型 -import { @(@Model.ClassName), @(@Model.ClassName)Input, @(@Model.ClassName)Output } from '/@@/api-services/models'; +@:import { @(@Model.ClassName), @(@Model.ClassName)Input, @(@Model.ClassName)Output } from '/@@/api-services/models'; } else { @:import { page@(@Model.ClassName), delete@(@Model.ClassName) } from '/@@/api/@(@Model.PagePath)/@(@Model.LowerClassName)'; From c8e0267241b0bbc165e7f839e504d1c6db74bfc2 Mon Sep 17 00:00:00 2001 From: "CAOMEI\\s" Date: Wed, 10 Jul 2024 22:05:08 +0800 Subject: [PATCH 11/32] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=AB=98=E7=BA=A7?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8C=89Enter=E9=94=AE=E4=BC=9A=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E9=A1=B5=E9=9D=A2table=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm b/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm index c367c9ff..de62f3c7 100644 --- a/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm +++ b/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm @@ -20,7 +20,7 @@