chore: 🔨 时间选择器调整

[skip ci]
This commit is contained in:
tk 2024-12-18 14:00:12 +08:00 committed by nsnail
parent e5e1d6f50f
commit ef17a8bd79
9 changed files with 76 additions and 48 deletions

View File

@ -14,4 +14,9 @@ public record ExecuteSqlReq : DataAbstraction
/// 超时时间(秒) /// 超时时间(秒)
/// </summary> /// </summary>
public int TimeoutSecs { get; init; } public int TimeoutSecs { get; init; }
/// <summary>
/// 等待结果
/// </summary>
public bool WaitResult { get; init; } = true;
} }

View File

@ -13,10 +13,11 @@ public sealed class ToolsService : ServiceBase<IToolsService>, IToolsService
} }
/// <inheritdoc /> /// <inheritdoc />
public Task<object[][]> ExecuteSqlAsync(ExecuteSqlReq req) public async Task<object[][]> ExecuteSqlAsync(ExecuteSqlReq req)
{ {
req.ThrowIfInvalid(); req.ThrowIfInvalid();
return App.GetService<IFreeSql>().Ado.CommandFluent(req.Sql).CommandTimeout(req.TimeoutSecs).ExecuteArrayAsync(); var cmd = App.GetService<IFreeSql>().Ado.CommandFluent(req.Sql).CommandTimeout(req.TimeoutSecs).ExecuteArrayAsync();
return req.WaitResult ? await cmd.ConfigureAwait(false) : null;
} }
/// <inheritdoc /> /// <inheritdoc />

View File

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

View File

@ -196,58 +196,70 @@ export default {
}, },
}, },
{ {
text: this.$t('最近三日'), text: this.$t('本周'),
value: () => { value: () => {
const start = new Date() //
start.setHours(0, 0, 0, 0) const currentDate = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 2) currentDate.setHours(0, 0, 0, 0)
const end = new Date()
end.setHours(0, 0, 0, 0) // 01...6
return [start, end] const dayOfWeek = currentDate.getDay()
//
const diffToFirstDay = dayOfWeek > 0 ? -(dayOfWeek - 1) : -6
//
const firstDayOfWeek = new Date(currentDate)
firstDayOfWeek.setDate(currentDate.getDate() + diffToFirstDay)
return [firstDayOfWeek, new Date()]
}, },
}, },
{ {
text: this.$t('最近一周'), text: this.$t('后退一周'),
value: () => { value: () => {
const start = new Date() try {
start.setHours(0, 0, 0, 0) const start = new Date(this.form.dy[this.dateField][0])
start.setTime(start.getTime() - 3600 * 1000 * 24 * 6) const end = new Date(this.form.dy[this.dateField][1])
const end = new Date() start.setDate(start.getDate() - 7)
end.setHours(0, 0, 0, 0) end.setDate(end.getDate() - 7)
return [start, end] return [start, end]
} catch {}
}, },
}, },
{ {
text: this.$t('最近一月'), text: this.$t('月'),
value: () => { value: () => {
const start = new Date() const start = new Date()
start.setHours(0, 0, 0, 0) start.setHours(0, 0, 0, 0)
start.setMonth(start.getMonth() - 1) start.setDate(1)
const end = new Date() return [start, new Date()]
end.setHours(0, 0, 0, 0)
return [start, end]
}, },
}, },
{ {
text: this.$t('最近三月'), text: this.$t('后退一月'),
value: () => { value: () => {
const start = new Date() try {
start.setHours(0, 0, 0, 0) const start = new Date(this.form.dy[this.dateField][0])
start.setMonth(start.getMonth() - 3) const end = new Date(this.form.dy[this.dateField][1])
const end = new Date() return [
end.setHours(0, 0, 0, 0) new Date(
return [start, end] start.getMonth() === 0 ? start.getFullYear() - 1 : start.getFullYear(),
}, start.getMonth() === 0 ? 11 : start.getMonth() - 1,
}, start.getDate(),
{ start.getHours(),
text: this.$t('最近六月'), start.getMinutes(),
value: () => { start.getSeconds(),
const start = new Date() ),
start.setHours(0, 0, 0, 0) new Date(
start.setMonth(start.getMonth() - 6) end.getMonth() === 0 ? end.getFullYear() - 1 : end.getFullYear(),
const end = new Date() end.getMonth() === 0 ? 11 : end.getMonth() - 1,
end.setHours(0, 0, 0, 0) end.getDate(),
return [start, end] end.getHours(),
end.getMinutes(),
end.getSeconds(),
),
]
} catch {}
}, },
}, },
], ],
@ -432,6 +444,16 @@ export default {
return [start, end] return [start, end]
}, },
}, },
{
text: this.$t('最近整点'),
value: () => {
const start = new Date()
return [
new Date(start.getFullYear(), start.getMonth(), start.getDate(), start.getHours(), 0, 0),
new Date(start.getFullYear(), start.getMonth(), start.getDate(), start.getHours() + 1, 0, 0),
]
},
},
{ {
text: this.$t('后退一时'), text: this.$t('后退一时'),
value: () => { value: () => {

View File

@ -4,7 +4,7 @@
<div v-for="item in data" :class="`sc-select-filter__item${item.w100p ? ' sc-select-filter__item-w100p' : ''}`" :key="item.key"> <div v-for="item in data" :class="`sc-select-filter__item${item.w100p ? ' sc-select-filter__item-w100p' : ''}`" :key="item.key">
<div :style="{ width: labelWidth + 'rem' }" @click="autoHeight" class="sc-select-filter__item-title"> <div :style="{ width: labelWidth + 'rem' }" @click="autoHeight" class="sc-select-filter__item-title">
<label> <label>
<span>{{ item.title }}({{ item.options.length - 1 }})</span> <span>{{ item.title }}({{ item.options?.length - 1 }})</span>
<el-icon style="display: none"> <el-icon style="display: none">
<el-icon-arrow-up></el-icon-arrow-up> <el-icon-arrow-up></el-icon-arrow-up>
</el-icon> </el-icon>

View File

@ -3,7 +3,7 @@ export default {
return { return {
required: true, required: true,
message: '您的邮箱地址', message: '您的邮箱地址',
pattern: _this.$GLOBAL.chars.RGX_EMAIL, pattern: _this.$GLOBAL.chars.RGXL_EMAIL,
} }
}, },
emailNoUsed: (_this, id) => { emailNoUsed: (_this, id) => {

View File

@ -49,7 +49,7 @@
<Tags v-if="!ismobile && layoutTags" :vue="this"></Tags> <Tags v-if="!ismobile && layoutTags" :vue="this"></Tags>
<div class="adminui-main" id="adminui-main"> <div class="adminui-main" id="adminui-main">
<router-view v-slot="{ Component }" :key="routerViewKey"> <router-view v-slot="{ Component }" :key="routerViewKey">
<keep-alive> <keep-alive :max="5">
<component v-if="$store.state.keepAlive.routeShow" :is="Component" :key="$route.fullPath" /> <component v-if="$store.state.keepAlive.routeShow" :is="Component" :key="$route.fullPath" />
</keep-alive> </keep-alive>
</router-view> </router-view>
@ -96,7 +96,7 @@
<Tags v-if="!ismobile && layoutTags" :vue="this"></Tags> <Tags v-if="!ismobile && layoutTags" :vue="this"></Tags>
<div class="adminui-main" id="adminui-main"> <div class="adminui-main" id="adminui-main">
<router-view v-slot="{ Component }" :key="routerViewKey"> <router-view v-slot="{ Component }" :key="routerViewKey">
<keep-alive> <keep-alive :max="5">
<component v-if="$store.state.keepAlive.routeShow" :is="Component" :key="$route.fullPath" /> <component v-if="$store.state.keepAlive.routeShow" :is="Component" :key="$route.fullPath" />
</keep-alive> </keep-alive>
</router-view> </router-view>
@ -138,7 +138,7 @@
<Tags v-if="!ismobile && layoutTags" :vue="this"></Tags> <Tags v-if="!ismobile && layoutTags" :vue="this"></Tags>
<div class="adminui-main" id="adminui-main"> <div class="adminui-main" id="adminui-main">
<router-view v-slot="{ Component }" :key="routerViewKey"> <router-view v-slot="{ Component }" :key="routerViewKey">
<keep-alive> <keep-alive :max="5">
<component v-if="$store.state.keepAlive.routeShow" :is="Component" :key="$route.fullPath" /> <component v-if="$store.state.keepAlive.routeShow" :is="Component" :key="$route.fullPath" />
</keep-alive> </keep-alive>
</router-view> </router-view>
@ -197,7 +197,7 @@
<Tags v-if="!ismobile && layoutTags" :vue="this"></Tags> <Tags v-if="!ismobile && layoutTags" :vue="this"></Tags>
<div class="adminui-main" id="adminui-main"> <div class="adminui-main" id="adminui-main">
<router-view v-slot="{ Component }" :key="routerViewKey"> <router-view v-slot="{ Component }" :key="routerViewKey">
<keep-alive> <keep-alive :max="5">
<component v-if="$store.state.keepAlive.routeShow" :is="Component" :key="$route.fullPath" /> <component v-if="$store.state.keepAlive.routeShow" :is="Component" :key="$route.fullPath" />
</keep-alive> </keep-alive>
</router-view> </router-view>

View File

@ -150,7 +150,7 @@ export default {
executionCron: [ executionCron: [
{ {
required: true, required: true,
pattern: this.$GLOBAL.chars.RGX_CRON, pattern: this.$GLOBAL.chars.RGXL_CRON,
message: this.$t('执行计划不正确'), message: this.$t('执行计划不正确'),
}, },
], ],

View File

@ -293,7 +293,7 @@ export default {
email: [ email: [
{ {
message: '您的电子邮箱', message: '您的电子邮箱',
pattern: this.$GLOBAL.chars.RGX_EMAIL, pattern: this.$GLOBAL.chars.RGXL_EMAIL,
}, },
], ],
passwordText: [ passwordText: [