-
+
@if(Model.QueryWhetherList.Count > 0){
-
+
foreach (var column in Model.QueryWhetherList) {
if(@column.EffectType == "Input" || @column.EffectType == "InputTextArea") {
-
+
} else if(@column.EffectType == "InputNumber") {
-
+
} else if(@column.EffectType == "fk") {
@@ -52,7 +52,7 @@
} else if(@column.EffectType == "Select") {
-
+
@@ -60,7 +60,7 @@
} else if(@column.EffectType == "EnumSelector") {
-
+
@@ -86,7 +86,7 @@
- 查询
+ 查询
重置
高级查询
隐藏
@@ -96,7 +96,7 @@
-
+
新增
@@ -154,7 +154,11 @@
@:
@: {{dv('@(@column.DictTypeCode)', row.@column.LowerPropertyName)?.name}}
@:
- }
+ } else if(@column.EffectType == "DatePicker") {
+ @:
+ @:{{ formatDate(new Date(row.@(@column.LowerPropertyName)), 'YYYY-mm-dd HH:MM:SS') }}
+ @:
+ }
}
}
@@ -173,15 +177,6 @@
-
-
-
@@ -194,8 +189,10 @@
import { onMounted, reactive, ref } from 'vue';
import { ElMessageBox, ElMessage } from "element-plus";
import { auth } from '/@@/utils/authFunction';
-import { VxeGridInstance, VxePagerEvents, VxePagerDefines } from 'vxe-table';
-import { useVxeTable } from '/@@/hooks/vxeTableOptionsHook';
+
+import { VxeGridInstance, VxeGridListeners, VxeGridPropTypes } from 'vxe-table';
+import { useVxeTable } from '/@@/hooks/useVxeTableOptionsHook';
+import { Local } from '/@@/utils/storage';
@if(@Model.TableField.Any(x=>x.EffectType == "ConstSelector")){
@:import { codeToName, getConstType } from "/@@/utils/constHelper";
@@ -256,81 +253,82 @@ const state = reactive({
}
}
},
- tableParams: {
- page: 1,
- pageSize: 50,
- field: 'id', // 默认的排序字段
- order: 'aes', // 排序方向
- descStr: 'desc', // 降序排序的关键字符
- total: 0 as any,
+ localPageParam: {
+ pageSize: 50 as number,
+ defaultSort: { field: 'createTime', order: 'asc', descStr: 'desc' },
},
visible: false,
title: '',
});
+// 本地存储参数
+const localPageParamKey = 'localPageParam:@(@Model.LowerClassName)';
+
// 改变高级查询的控件显示状态
const changeAdvanceQueryUI = () => {
state.showAdvanceQueryUI = !state.showAdvanceQueryUI;
};
// 表格参数配置
-const options = useVxeTable<@(@Model.ClassName)>({
- id: '@(@Model.ClassName)',
- name: '@(@Model.BusName)',
- columns: [
- { type: 'seq', title: '序号', width: 60, fixed: 'left' },
- @foreach (var column in Model.TableField) {
- var whethersortable =column.WhetherSortable == "Y" ? "sortable: true" : "sortable: false";
- if(@column.WhetherTable == "Y") {
- if(@column.EffectType == "Upload" || @column.EffectType == "fk" || @column.EffectType == "ApiTreeSelect" || @column.EffectType == "Switch" || @column.EffectType == "ConstSelector") {
- if(@column.EffectType == "Upload") {
- @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' }, @whethersortable },
- } else if(@column.EffectType == "fk") {
- @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' }, @whethersortable },
- } else if(@column.EffectType == "ApiTreeSelect") {
- @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' }, @whethersortable },
- } else if(@column.EffectType == "Switch") {
- @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' }, @whethersortable },
- } else if(@column.EffectType == "ConstSelector") {
- @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' }, @whethersortable },
- }
- } else if(@column.EffectType == "Select") {
- @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' }, @whethersortable },
- } else if(@column.EffectType == "EnumSelector") {
- @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' }, @whethersortable },
- } else if(@column.EffectType == "DatePicker") {
- @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', formatter: ({ cellValue }) => formatDate(new Date(cellValue), 'YYYY-mm-dd HH:MM:SS'), @whethersortable },
- } else {
- @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', @whethersortable},
- }
- }
- }
- { field: '', title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
- { title: '操作', fixed: 'right', width: 180, showOverflow: true, slots: { default: 'row_buttons' } },
- ],
- enableExport: auth('@(@Model.LowerClassName):export'),
- searchCallback: () => handleQuery(),
- queryAllCallback: () => fetchData({ pageSize: 99999 }),
-});
+const options = useVxeTable<@(@Model.ClassName)>(
+ {
+ id: '@(@Model.ClassName)',
+ name: '@(@Model.BusName)',
+ columns: [
+ { type: 'seq', title: '序号', width: 60, fixed: 'left' },
+ @foreach (var column in Model.TableField) {
+ var whethersortable =column.WhetherSortable == "Y" ? "sortable: true" : "sortable: false";
+ if(@column.WhetherTable == "Y") {
+ if(@column.EffectType == "Upload" || @column.EffectType == "fk" || @column.EffectType == "ApiTreeSelect" || @column.EffectType == "Switch" || @column.EffectType == "ConstSelector") {
+ if(@column.EffectType == "Upload") {
+ @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' }, @whethersortable },
+ } else if(@column.EffectType == "fk") {
+ @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' }, @whethersortable },
+ } else if(@column.EffectType == "ApiTreeSelect") {
+ @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' }, @whethersortable },
+ } else if(@column.EffectType == "Switch") {
+ @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' }, @whethersortable },
+ } else if(@column.EffectType == "ConstSelector") {
+ @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' }, @whethersortable },
+ }
+ } else if(@column.EffectType == "Select") {
+ @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' }, @whethersortable },
+ } else if(@column.EffectType == "EnumSelector") {
+ @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' }, @whethersortable },
+ } else if(@column.EffectType == "DatePicker") {
+ @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', slots: { default: 'row_@column.LowerPropertyName' }, @whethersortable },
+ } else {
+ @:{ field: '@column.LowerPropertyName', title: '@column.ColumnComment', minWidth: 100, showOverflow: 'tooltip', @whethersortable},
+ }
+ }
+ }
+ { field: '', title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
+ { title: '操作', fixed: 'right', width: 180, showOverflow: true, slots: { default: 'row_buttons' } },
+ ],
+ },
+ // vxeGrid配置参数(此处可覆写任何参数),参考vxe-table官方文档
+ {
+ // 代理配置
+ proxyConfig: { autoLoad: true, ajax: { query: ({ page, sort }) => handleQueryApi(page, sort) } },
+ // 排序配置
+ sortConfig: { defaultSort: Local.get(localPageParamKey)?.defaultSort || state.localPageParam.defaultSort },
+ // 分页配置
+ pagerConfig: { pageSize: Local.get(localPageParamKey)?.pageSize || state.localPageParam.pageSize },
+ // 工具栏配置
+ toolbarConfig: { export: false },
+ // 行设置
+ rowConfig: { height: 80 },
+ }
+);
// 页面初始化
onMounted(async () => {
await handleQuery();
});
-// 查询操作
-const handleQuery = async (reset = false) => {
- options.loading = true;
- if (reset) state.tableParams.page = 1;
- var res = await fetchData(null);
- xGrid.value?.loadData(res.data.result?.items ?? []);
- state.tableParams.total = res.data.result?.total;
- options.loading = false;
-};
-
-// 获取数据
-const fetchData = async (tableParams: any) => {
- let params = Object.assign(state.queryParams, state.tableParams, tableParams);
+// 查询api
+const handleQueryApi = async (page: VxeGridPropTypes.ProxyAjaxQueryPageParams, sort: VxeGridPropTypes.ProxyAjaxQuerySortCheckedParams) => {
+ const params = Object.assign(state.queryParams, { page: page.currentPage, pageSize: page.pageSize, field: sort.field, order: sort.order, descStr: 'desc' }) as @(@Model.ClassName)Input;
@if (@Model.IsApiService) {
@:return getAPI(@(@Model.ClassName)Api).api@(@Model.ClassName)PagePost(params);
} else {
@@ -338,6 +336,11 @@ const fetchData = async (tableParams: any) => {
}
};
+// 查询操作
+const handleQuery = async (reset = false) => {
+ await xGrid.value?.commitProxy('query');
+};
+
// 重置操作
const resetQuery = () => {
state.queryParams.searchKey = undefined,
@@ -346,21 +349,7 @@ const resetQuery = () => {
@:state.queryParams.@(@column.LowerPropertyName) = undefined,
}
}
- handleQuery(true);
-};
-
-// 改变页码序号或页面容量
-const pageChange: VxePagerEvents.PageChange = ({ currentPage, pageSize }: VxePagerDefines.PageChangeEventParams) => {
- state.tableParams.page = currentPage;
- state.tableParams.pageSize = pageSize;
- handleQuery();
-};
-
-// 列排序
-const sortChange = (options: any) => {
- state.tableParams.field = options.field;
- state.tableParams.order = options.order;
- handleQuery();
+ await xGrid.value?.commitProxy('reload');
};
// 打开新增页面
@@ -415,6 +404,20 @@ const handleDelete = (row: any) => {
.catch(() => {});
};
+// 表格事件
+const gridEvents: VxeGridListeners<@(@Model.ClassName)> = {
+ // 只对 pager-config 配置时有效,分页发生改变时会触发该事件
+ async pageChange({ pageSize }) {
+ state.localPageParam.pageSize = pageSize;
+ Local.set(localPageParamKey, state.localPageParam);
+ },
+ // 当排序条件发生变化时会触发该事件
+ async sortChange({ field, order }) {
+ state.localPageParam.defaultSort = { field: field, order: order!, descStr: 'desc' };
+ Local.set(localPageParamKey, state.localPageParam);
+ },
+};
+
@foreach (var column in Model.QueryWhetherList) {
@if(@column.EffectType == "fk") {
@:const @LowerFirstLetter(@column.FkEntityName)@(@column.PropertyName)DropdownList = ref
([]);
diff --git a/Admin.NET/Plugins/Admin.NET.Plugin.ReZero/Admin.NET.Plugin.ReZero.csproj b/Admin.NET/Plugins/Admin.NET.Plugin.ReZero/Admin.NET.Plugin.ReZero.csproj
index 78754ba0..585392af 100644
--- a/Admin.NET/Plugins/Admin.NET.Plugin.ReZero/Admin.NET.Plugin.ReZero.csproj
+++ b/Admin.NET/Plugins/Admin.NET.Plugin.ReZero/Admin.NET.Plugin.ReZero.csproj
@@ -24,7 +24,7 @@
-
+
diff --git a/Web/package.json b/Web/package.json
index 15fca79c..c9251964 100644
--- a/Web/package.json
+++ b/Web/package.json
@@ -2,7 +2,7 @@
"name": "admin.net.pro",
"type": "module",
"version": "2.4.33",
- "lastBuildTime": "2024.07.10",
+ "lastBuildTime": "2024.07.12",
"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
"author": "zuohuaijun",
"license": "MIT",
@@ -68,8 +68,8 @@
"vue-signature-pad": "^3.0.2",
"vue3-tree-org": "^4.2.2",
"vuedraggable": "4.0.3",
- "vxe-pc-ui": "^4.0.58",
- "vxe-table": "^4.7.47",
+ "vxe-pc-ui": "^4.0.61",
+ "vxe-table": "^4.7.48",
"vxe-table-plugin-element": "^4.0.4",
"vxe-table-plugin-export-xlsx": "^4.0.5",
"xe-utils": "^3.5.28",
diff --git a/Web/src/stores/userInfo.ts b/Web/src/stores/userInfo.ts
index 5ac24f64..d4667bae 100644
--- a/Web/src/stores/userInfo.ts
+++ b/Web/src/stores/userInfo.ts
@@ -132,8 +132,7 @@ export const useUserInfo = defineStore('userInfo', {
// 根据字典类型和代码取字典项
getDictItemByCode(typePCode: string, val: string) {
- if(val!=undefined)
- {
+ if (val != undefined) {
val = val.toString();
if (val) {
const _val = val.toString();
diff --git a/Web/src/views/about/index.vue b/Web/src/views/about/index.vue
index f3864372..d5dd711a 100644
--- a/Web/src/views/about/index.vue
+++ b/Web/src/views/about/index.vue
@@ -5,8 +5,8 @@
简介(About)
- 基于 .NET6 (Furion/SqlSugar) 实现的通用权限开发框架,前端采用
- Vue3+Element-plus+Vite5,整合众多优秀技术和框架,模块插件式开发。集成多租户、缓存、数据校验、鉴权、事件总线、动态API、通讯、远程请求、任务调度、打印等众多黑科技。代码结构简单清晰,注释详尽,易于上手与二次开发,即便是复杂业务逻辑也能迅速实现,真正实现“开箱即用”。
+ 🔥基于 .NET 6/8 (Furion/SqlSugar) 实现的通用权限开发框架,前端采用
+ Vue3/Element-plus,代码简洁、易扩展。整合最新技术,模块插件式开发,前后端分离,开箱即用。集成多租户、缓存、数据校验、鉴权、事件总线、动态API、通讯、远程请求、任务调度、打印等众多黑科技。让开发更简单、更通用、更流行!