Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ujia
/
uj-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4fccd7b5
authored
Nov 20, 2026
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化时间筛选组件,添加禁用未来日期的功能,并更新仪表板使用的时间选项
1 parent
e7c74a00
Pipeline
#583
for
4fccd7b5
failed
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
apps/web/subapps/usedcar/src/features/shared/PeriodFilter.tsx
apps/web/subapps/usedcar/src/pages/Dashboard/index.tsx
apps/web/subapps/usedcar/src/features/shared/PeriodFilter.tsx
View file @
4fccd7b
...
...
@@ -8,7 +8,7 @@
* 外观只取 @uj/design-tokens 的 --uj-* 语义令牌,不写死色值。
* 状态矩阵:default / hover / active(aria-pressed) / focus-visible / disabled。
*/
import
type {
Dayjs } from 'dayjs';
import
dayjs, { type
Dayjs } from 'dayjs';
import { UDatePicker } from '@uj/ui';
import './PeriodFilter.css';
...
...
@@ -77,6 +77,7 @@ export function PeriodFilter<T extends string | number>({
next && next[0] && next[1] ? [next[0], next[1]] : null,
)
}
disabledDate={(date) => date.isAfter(dayjs(), 'day')}
allowClear
/>
) : null}
...
...
apps/web/subapps/usedcar/src/pages/Dashboard/index.tsx
View file @
4fccd7b
...
...
@@ -22,8 +22,15 @@ import { dashboardApi, type TrendPoint } from '@/api';
import { errorDetail } from '@/utils/error';
import './index.css';
/** 指标卡与趋势卡共用同一组档位定义,文案与后端 dateType 的实际含义保持一致。 */
const PERIODS: ReadonlyArray<PeriodOption<number>> = [
/** 顶部指标的 dateType:今日 / 昨日 / 本月 / 上月。 */
const BOARD_PERIODS: ReadonlyArray<PeriodOption<number>> = [
{ value: 1, label: '今日' },
{ value: 2, label: '昨日' },
{ value: 3, label: '本月' },
{ value: 4, label: '上月' },
];
/** 趋势接口的 dateType:近 7 日 / 本月 / 上月 / 近 30 日。 */
const TREND_PERIODS: ReadonlyArray<PeriodOption<number>> = [
{ value: 1, label: '近7日' },
{ value: 2, label: '本月' },
{ value: 3, label: '上月' },
...
...
@@ -126,7 +133,7 @@ function Trend({ title, load }: { title: string; load: (type: number) => Promise
<UText strong>{title}趋势</UText>
<PeriodFilter
value={type}
options={PERIODS}
options={
TREND_
PERIODS}
onChange={setType}
ariaLabel={`${title}趋势时间筛选`}
/>
...
...
@@ -202,7 +209,7 @@ export default function Dashboard() {
<div>
<PeriodFilter
value={dateType}
options={PERIODS}
options={
BOARD_
PERIODS}
onChange={setDateType}
range={range}
onRangeChange={setRange}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment