feat: 用户选择器 (#189)

Co-authored-by: tk <fiyne1a@dingtalk.com>
This commit is contained in:
nsnail 2024-11-06 11:48:36 +08:00 committed by GitHub
parent a454f2ab2d
commit 8479f69bdc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 46 additions and 20 deletions

View File

@ -11,4 +11,4 @@
"path": "node_modules/cz-git"
}
}
}
}

View File

@ -5,8 +5,8 @@
<ItemGroup>
<PackageReference Include="FreeSql.DbContext.NS" Version="3.2.833-ns4"/>
<PackageReference Include="FreeSql.Provider.Sqlite.NS" Version="3.2.833-ns4"/>
<PackageReference Include="Gurion" Version="1.1.0"/>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.11.0"/>
<PackageReference Include="Gurion" Version="1.2.0"/>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.12.0-3.final"/>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.0.0-rc.2.24474.3"/>
<PackageReference Include="Minio" Version="6.0.3"/>
<PackageReference Include="NSExt" Version="2.2.0"/>

View File

@ -1,6 +1,5 @@
{
"AppSettings": {
"InjectSpecificationDocument": true,
"InjectMiniProfiler": true
"InjectSpecificationDocument": true
}
}

View File

@ -1,6 +1,5 @@
{
"AppSettings": {
"InjectSpecificationDocument": true,
"InjectMiniProfiler": true
"InjectSpecificationDocument": true
}
}

View File

@ -1,6 +1,5 @@
{
"AppSettings": {
"InjectSpecificationDocument": true,
"InjectMiniProfiler": true
"InjectSpecificationDocument": true
}
}

View File

@ -1,8 +1,7 @@
{
// App
"AppSettings": {
"InjectSpecificationDocument": false,
"InjectMiniProfiler": false
"InjectSpecificationDocument": false
},
// Swagger ------------------------------------------------------------------------------
"SpecificationDocumentSettings": {

View File

@ -1,4 +1,4 @@
namespace NetAdmin.Infrastructure.Utils;
namespace NetAdmin.Infrastructure.Utils;
/// <summary>
/// 忽略 JsonIgnore 特性

View File

@ -246,7 +246,13 @@ public sealed class UserService(
public async Task<IEnumerable<QueryUserRsp>> QueryAsync(QueryReq<QueryUserReq> req)
{
req.ThrowIfInvalid();
var list = await (await QueryInternalAsync(req).ConfigureAwait(false)).Take(req.Count).ToListAsync(_listUserExp).ConfigureAwait(false);
var list = await (await QueryInternalAsync(req, false).ConfigureAwait(false))
#if DBTYPE_SQLSERVER
.WithLock(SqlServerLock.NoLock | SqlServerLock.NoWait)
#endif
.Take(req.Count)
.ToListAsync(a => new Sys_User { Id = a.Id, UserName = a.UserName })
.ConfigureAwait(false);
return list.Adapt<IEnumerable<QueryUserRsp>>();
}

View File

@ -42,7 +42,7 @@ public record CreateMenuReq : Sys_Menu
/// <inheritdoc cref="Sys_Menu.ParentId" />
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public override long ParentId { get; init; } = 0;
public override long ParentId { get; init; }
/// <inheritdoc cref="Sys_Menu.Path" />
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]

View File

@ -5,7 +5,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.0-rc.2.24474.3"/>
<PackageReference Include="xunit" Version="2.9.2"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0-pre.42">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>

View File

@ -71,6 +71,15 @@
:style="item.style"
clearable
filterable />
<na-user-select
v-else-if="item.type === 'user-select' && (!item.condition || item.condition())"
v-model="form[item.field[0]][item.field[1]]"
v-role="item.role || '*/*/*'"
:class="item.class"
:placeholder="item.placeholder"
:style="item.style"
clearable
filterable />
</template>
<el-badge :hidden="vue.query.dynamicFilter.filters.length === 0" :value="vue.query.dynamicFilter.filters.length">

View File

@ -46,7 +46,7 @@ export default {
immediate: true,
deep: true,
handler(n) {
this.user = n ?? {}
this.user = n
},
},
},

View File

@ -72,6 +72,7 @@ export default {
//
setFullscreen() {
this.isFullscreen = !this.isFullscreen
this.$emit('onSetFullscreen', this.isFullscreen)
},
},
}

View File

@ -63,6 +63,9 @@ export default {
this.myChart = myChart
window.addEventListener('resize', () => myChart.resize())
},
resize(width) {
this.myChart.resize({ width: width || 'auto' })
},
},
}
</script>

View File

@ -505,7 +505,7 @@ export default {
this.loading = true
try {
await this.exportApi.post(this.getQueryParams())
this.$message.success(`数据已导出(上限2万条)`)
this.$message.success(`数据已导出(上限5万条)`)
} catch {}
this.loading = false
},

View File

@ -158,7 +158,9 @@ export default {
}
})
} else {
const setrow = this.tableData.filter((item) => item[this.defaultProps.value] === this.defaultValue[this.defaultProps.value])
const setrow = this.tableData.filter(
(item) => item[this.defaultProps.value] === (this.defaultValue ?? {})[this.defaultProps.value],
)
this.$refs.table.setCurrentRow(setrow[0])
}
this.$refs.table.setScrollTop(0)
@ -182,7 +184,7 @@ export default {
item.currentLabel = item.value[this.defaultProps.label]
})
} else {
this.$refs.select.states.selectedLabel = this.defaultValue[this.defaultProps.label]
this.$refs.select.states.selectedLabel = (this.defaultValue ?? {})[this.defaultProps.label]
}
})
},

View File

@ -118,7 +118,7 @@ export default {
///
moduleRemark: '',
///
type: 'SysComponent',
type: 'NetAdmin.SysComponent',
},
}
},

View File

@ -30,6 +30,15 @@
<div class="left-panel">
<na-search
:controls="[
{
type: 'remote-select',
field: ['dy', 'ownerId'],
api: $API.sys_user.query,
config: { props: { label: 'userName', value: 'id' } },
placeholder: '用户',
style: 'width:15rem',
condition: () => $GLOBAL.hasPermission('sys/log/operation/user'),
},
{
multiple: true,
type: 'select',