فهرست منبع

!1806 撤销掉临时改动的代码使其与主版本的一致
Merge pull request !1806 from hwjmyz/v2-20250612-2

zuohuaijun 10 ماه پیش
والد
کامیت
432c9bf22f
2فایلهای تغییر یافته به همراه25 افزوده شده و 12 حذف شده
  1. 4 4
      Admin.NET/Admin.NET.Core/Service/Dict/SysDictTypeService.cs
  2. 21 8
      Web/src/views/system/dict/index.vue

+ 4 - 4
Admin.NET/Admin.NET.Core/Service/Dict/SysDictTypeService.cs

@@ -35,12 +35,12 @@ public class SysDictTypeService : IDynamicApiController, ITransient
     [DisplayName("获取字典类型分页列表")]
     public async Task<SqlSugarPagedList<SysDictType>> Page(PageDictTypeInput input)
     {
-        return await _sysDictTypeRep.AsQueryable()
+        var query = _sysDictTypeRep.AsQueryable()
             .WhereIF(!_userManager.SuperAdmin, u => u.IsTenant == YesNoEnum.Y)
             .WhereIF(!string.IsNullOrEmpty(input.Code?.Trim()), u => u.Code.Contains(input.Code))
-            .WhereIF(!string.IsNullOrEmpty(input.Name?.Trim()), u => u.Name.Contains(input.Name))
-            .OrderBy(u => new { u.OrderNo, u.Code })
-            .ToPagedListAsync(input.Page, input.PageSize);
+            .WhereIF(!string.IsNullOrEmpty(input.Name?.Trim()), u => u.Name.Contains(input.Name));
+            //.OrderBy(u => new { u.OrderNo, u.Code })
+        return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
     }
 
     /// <summary>

+ 21 - 8
Web/src/views/system/dict/index.vue

@@ -10,6 +10,9 @@
 						<el-form-item label="名称">
 							<el-input v-model="state.queryDictTypeParams.name" @keyup.enter.native="handleDictTypeQuery" placeholder="字典名称" clearable />
 						</el-form-item>
+						<el-form-item label="编码">
+							<el-input v-model="state.queryDictTypeParams.code" @keyup.enter.native="handleDictTypeQuery" placeholder="字典编码" clearable />
+						</el-form-item>
 						<el-form-item>
 							<el-button-group>
 								<el-button type="primary" icon="ele-Search" @click="handleDictTypeQuery" v-auth="'sysDictType:page'"> 查询 </el-button>
@@ -21,26 +24,26 @@
 						</el-form-item>
 					</el-form>
 
-					<el-table :data="state.dictTypeData" style="width: 100%" v-loading="state.typeLoading" @row-click="handleDictType" highlight-current-row border>
-						<el-table-column type="index" label="序号" width="55" align="center" />
-						<el-table-column prop="name" label="字典名称" min-width="120" header-align="center" show-overflow-tooltip />
-						<el-table-column prop="code" label="字典编码" min-width="140" header-align="center" show-overflow-tooltip />
-						<el-table-column prop="sysFlag" label="系统内置" min-width="70" align="center" show-overflow-tooltip v-if="userInfo.accountType === AccountTypeEnum.NUMBER_999">
+					<el-table :data="state.dictTypeData" style="width: 100%" v-loading="state.typeLoading" @row-click="handleDictType" highlight-current-row @sort-change="sortChangeDityType" border>
+						<el-table-column type="index" label="序号" width="55" align="center" sortable='custom' />
+						<el-table-column prop="name" label="字典名称" min-width="120" header-align="center" sortable='custom' show-overflow-tooltip />
+						<el-table-column prop="code" label="字典编码" min-width="140" header-align="center" sortable='custom' show-overflow-tooltip />
+						<el-table-column prop="sysFlag" label="系统内置" min-width="90" align="center" sortable='custom' show-overflow-tooltip v-if="userInfo.accountType === AccountTypeEnum.NUMBER_999">
 							<template #default="scope">
                 <g-sys-dict v-model="scope.row.sysFlag" code="YesNoEnum" />
 							</template>
 						</el-table-column>
-						<el-table-column prop="isTenant" label="租户字典" min-width="70" align="center" show-overflow-tooltip v-if="userInfo.accountType === AccountTypeEnum.NUMBER_999">
+						<el-table-column prop="isTenant" label="租户字典" min-width="90" align="center"  sortable='custom'  show-overflow-tooltip v-if="userInfo.accountType === AccountTypeEnum.NUMBER_999">
 							<template #default="scope">
                 <g-sys-dict v-model="scope.row.isTenant" code="YesNoEnum" />
 							</template>
 						</el-table-column>
-						<el-table-column prop="status" label="状态" width="70" align="center" show-overflow-tooltip>
+						<el-table-column prop="status" label="状态" width="80" align="center"  sortable='custom'  show-overflow-tooltip>
 							<template #default="scope">
                 <g-sys-dict v-model="scope.row.status" code="StatusEnum" />
 							</template>
 						</el-table-column>
-						<el-table-column prop="orderNo" label="排序" width="60" align="center" show-overflow-tooltip />
+						<el-table-column prop="orderNo" label="排序" width="80" align="center"  sortable='custom'  show-overflow-tooltip />
 						<el-table-column label="修改记录" width="100" align="center" show-overflow-tooltip>
 							<template #default="scope">
 								<ModifyRecord :data="scope.row" />
@@ -181,6 +184,9 @@ const state = reactive({
 		page: 1,
 		pageSize: 50,
 		total: 0 as any,
+		field: 'orderNo',
+		order: 'ascending', // 排序方向
+		descStr: 'descending', // 降序排序的关键字符
 	},
 	queryDictDataParams: {
     label: undefined,
@@ -220,6 +226,13 @@ const handleDictDataQuery = async () => {
 	state.loading = false;
 };
 
+// 列排序
+const sortChangeDityType = async (column: any) => {
+  state.tableDictTypeParams.field = column.prop;
+  state.tableDictTypeParams.order = column.order;
+  await handleDictTypeQuery();
+};
+
 // 点击表格
 const handleDictType = (row: any, event: any, column: any) => {
 	openDictDataDialog(row);