Skip to content

Commit fd0218a

Browse files
tknsnail
authored andcommitted
refactor: ♻️ 框架代码同步
1 parent 2ff1466 commit fd0218a

18 files changed

Lines changed: 44 additions & 24 deletions

File tree

src/backend/NetAdmin/NetAdmin.Application/Services/RepositoryService.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,16 @@ protected static async Task<IActionResult> ExportAsync<TQuery, TExport>( //
4949
/// 导出实体
5050
/// </summary>
5151
protected static async Task<IActionResult> ExportAsync<TQuery, TExport>( //
52-
Func<QueryReq<TQuery>, ISelect<TEntity>> selector, QueryReq<TQuery> query, string fileName, Expression<Func<TEntity, object>> listExp = null)
52+
Func<QueryReq<TQuery>, ISelect<TEntity>> selector, QueryReq<TQuery> query, string fileName, Expression<Func<TEntity, object>> listExp = null
53+
, Func<object, object> listHandle = null)
5354
where TQuery : DataAbstraction, new()
5455
{
5556
var select = selector(query).WithNoLockNoWait().Take(Numbers.MAX_LIMIT_EXPORT);
5657

5758
object list = listExp == null ? await select.ToListAsync().ConfigureAwait(false) : await select.ToListAsync(listExp).ConfigureAwait(false);
5859

60+
list = listHandle?.Invoke(list) ?? list;
61+
5962
return await GetExportFileStreamAsync<TExport>(fileName, list).ConfigureAwait(false);
6063
}
6164

src/backend/NetAdmin/NetAdmin.Domain/DbMaps/Sys/Sys_UserProfile.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ public record Sys_UserProfile : VersionEntity, IRegister
112112
[JsonIgnore]
113113
public virtual string EmergencyContactName { get; init; }
114114

115+
/// <summary>
116+
/// 性别
117+
/// </summary>
118+
[Column]
119+
[CsvIgnore]
120+
[JsonIgnore]
121+
public virtual Genders? Gender { get; init; }
122+
115123
/// <summary>
116124
/// 毕业学校
117125
/// </summary>
@@ -201,14 +209,6 @@ public record Sys_UserProfile : VersionEntity, IRegister
201209
[JsonIgnore]
202210
public virtual string RealName { get; init; }
203211

204-
/// <summary>
205-
/// 性别
206-
/// </summary>
207-
[Column]
208-
[CsvIgnore]
209-
[JsonIgnore]
210-
public virtual Sexes? Sex { get; init; }
211-
212212
/// <summary>
213213
/// 用户基本信息
214214
/// </summary>

src/backend/NetAdmin/NetAdmin.Domain/Dto/Sys/UserProfile/CreateUserProfileReq.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ public record CreateUserProfileReq : Sys_UserProfile
5858
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
5959
public override string EmergencyContactName { get; init; }
6060

61+
/// <inheritdoc cref="Sys_UserProfile.Gender" />
62+
[EnumDataType(typeof(Genders), ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.性别不正确))]
63+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
64+
public override Genders? Gender { get; init; }
65+
6166
/// <inheritdoc cref="Sys_UserProfile.GraduateSchool" />
6267
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
6368
public override string GraduateSchool { get; init; }
@@ -104,9 +109,4 @@ public record CreateUserProfileReq : Sys_UserProfile
104109
/// <inheritdoc cref="Sys_UserProfile.RealName" />
105110
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
106111
public override string RealName { get; init; }
107-
108-
/// <inheritdoc cref="Sys_UserProfile.Sex" />
109-
[EnumDataType(typeof(Sexes), ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.性别不正确))]
110-
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
111-
public override Sexes? Sex { get; init; }
112112
}

src/backend/NetAdmin/NetAdmin.Domain/Dto/Sys/UserProfile/QueryUserProfileRsp.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public sealed record QueryUserProfileRsp : Sys_UserProfile
5757
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
5858
public override string EmergencyContactName { get; init; }
5959

60+
/// <inheritdoc cref="Sys_UserProfile.Gender" />
61+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
62+
public override Genders? Gender { get; init; }
63+
6064
/// <inheritdoc cref="Sys_UserProfile.GraduateSchool" />
6165
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
6266
public override string GraduateSchool { get; init; }
@@ -103,10 +107,6 @@ public sealed record QueryUserProfileRsp : Sys_UserProfile
103107
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
104108
public override string RealName { get; init; }
105109

106-
/// <inheritdoc cref="Sys_UserProfile.Sex" />
107-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
108-
public override Sexes? Sex { get; init; }
109-
110110
/// <inheritdoc cref="IFieldVersion.Version" />
111111
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
112112
public override long Version { get; init; }

src/backend/NetAdmin/NetAdmin.Infrastructure/Enums/Sexes.cs renamed to src/backend/NetAdmin/NetAdmin.Infrastructure/Enums/Genders.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace NetAdmin.Infrastructure.Enums;
44
/// 性别
55
/// </summary>
66
[Export]
7-
public enum Sexes
7+
public enum Genders
88
{
99
/// <summary>
1010
/// 男

src/frontend/admin/src/components/scTable/index.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,12 @@
121121
</div>
122122
<scContextmenu @command="contextMenuCommand" @visible-change="contextMenuVisibleChange" ref="contextmenu">
123123
<scContextmenuItem
124-
v-for="(menu, index) in contextMenus.filter((x) => x === current.column?.property)"
124+
v-for="(menu, index) in contextMenus.filter((x) => {
125+
if (current.column?.property === x) {
126+
return true
127+
}
128+
return this.contextMulti && !!this.contextMulti[current.column?.property]?.find((y) => y === x)
129+
})"
125130
:command="menu"
126131
:key="index"
127132
:title="`${menu}`">
@@ -214,6 +219,7 @@ export default {
214219
contextMenus: { type: Array },
215220
contextOpers: { type: Array, default: ['copy', 'add', 'view', 'edit', 'del'] },
216221
contextAdvs: { type: Array, default: [] },
222+
contextMulti: { type: Object },
217223
tableName: { type: String, default: '' },
218224
beforePost: {
219225
type: Function,

src/frontend/admin/src/views/sys/config/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<el-main class="nopadding">
6161
<scTable
6262
:context-menus="['id', 'userRegisterConfirm', 'userRegisterDept.name', 'userRegisterRole.name', 'enabled', 'createdTime']"
63+
:context-multi="{ id: ['createdTime'] }"
6364
:export-api="$API.sys_config.export"
6465
:params="query"
6566
:query-api="$API.sys_config.pagedQuery"

src/frontend/admin/src/views/sys/dept/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
<el-main class="nopadding">
6868
<scTable
6969
:context-menus="['id', 'name', 'sort', 'enabled', 'createdTime', 'summary']"
70+
:context-multi="{ id: ['createdTime'] }"
7071
:default-sort="{ prop: 'sort', order: 'descending' }"
7172
:export-api="$API.sys_dept.export"
7273
:params="query"

src/frontend/admin/src/views/sys/dic/list/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
<scTable
7575
:before-post="(data) => data.dynamicFilter.filters.length > 0"
7676
:context-menus="['key', 'value', 'enabled', 'createdTime', 'id', 'summary']"
77+
:context-multi="{ id: ['createdTime'] }"
7778
:default-sort="{ prop: 'id', order: 'descending' }"
7879
:export-api="$API.sys_dic.exportContent"
7980
:params="query"

src/frontend/admin/src/views/sys/doc/list/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
<scTable
8686
:before-post="(data) => data.dynamicFilter.filters.length > 0"
8787
:context-menus="['title', 'enabled', 'createdTime', 'id', 'visibility']"
88+
:context-multi="{ id: ['createdTime'] }"
8889
:default-sort="{ prop: 'id', order: 'descending' }"
8990
:export-api="$API.sys_doc.exportContent"
9091
:params="query"

0 commit comments

Comments
 (0)