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 9af59b70
authored
Nov 18, 2026
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
新增车况信息页面及相关样式和配置
1 parent
6b00df2c
Pipeline
#521
for
9af59b70
failed
in 0 seconds
Changes
5
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
732 additions
and
3 deletions
apps/web/subapps/usedcar/src/App.tsx
apps/web/subapps/usedcar/src/pages/Condition/ConditionDetail.tsx
apps/web/subapps/usedcar/src/pages/Condition/condition.css
apps/web/subapps/usedcar/src/pages/Condition/conditionConfig.ts
apps/web/subapps/usedcar/src/pages/Condition/index.tsx
apps/web/subapps/usedcar/src/App.tsx
View file @
9af59b7
...
...
@@ -26,6 +26,7 @@ import Ledger from './pages/Ledger';
import Handover from './pages/Handover';
import Reports from './pages/Reports';
import Condition from './pages/Condition';
import ConditionDetail from './pages/Condition/ConditionDetail';
import CustomerGroup from './pages/CustomerGroup';
import type { PageParams, RouteDef } from './routes';
import { matchRoute } from './routes';
...
...
@@ -55,6 +56,7 @@ const ROUTES: RouteDef[] = [
{ path: 'handover', Page: Handover },
{ path: 'reports', Page: Reports },
{ path: 'condition', Page: Condition },
{ path: 'condition/:id', Page: ConditionDetail },
{ path: 'customer-group', Page: CustomerGroup },
];
...
...
apps/web/subapps/usedcar/src/pages/Condition/ConditionDetail.tsx
0 → 100644
View file @
9af59b7
This diff is collapsed.
Click to expand it.
apps/web/subapps/usedcar/src/pages/Condition/condition.css
0 → 100644
View file @
9af59b7
.uc-condition-status
{
display
:
inline-flex
;
align-items
:
center
;
gap
:
8px
;
color
:
var
(
--uj-text-2
);
}
.uc-inline
{
display
:
inline-block
;
}
.uc-condition-status
::before
{
content
:
''
;
width
:
6px
;
height
:
6px
;
border-radius
:
50%
;
background
:
var
(
--uj-text-4
);
}
.uc-condition-status--success
::before
{
background
:
var
(
--uj-primary
);
}
.uc-condition-status--pending
::before
{
background
:
var
(
--uj-text-4
);
}
.uc-condition-status--progress
::before
{
background
:
var
(
--uj-warning
);
}
.uc-condition-status--failed
::before
{
background
:
var
(
--uj-error
);
}
.uc-condition-drawer
.ant-drawer-body
{
padding
:
0
;
background
:
var
(
--uj-bg
);
}
.uc-condition-detail
{
min-height
:
100%
;
}
.uc-condition-detail__header
{
display
:
flex
;
justify-content
:
space-between
;
gap
:
16px
;
padding
:
16px
20px
;
background
:
var
(
--uj-surface
);
border-bottom
:
1px
solid
var
(
--uj-border
);
}
.uc-condition-detail__header-left
{
display
:
flex
;
align-items
:
center
;
flex-wrap
:
wrap
;
gap
:
10px
12px
;
}
.uc-condition-detail__title
{
margin
:
0
;
color
:
var
(
--uj-text-1
);
font-size
:
20px
;
}
.uc-condition-source
{
display
:
inline-flex
;
align-items
:
center
;
height
:
24px
;
padding
:
0
10px
;
font-size
:
12px
;
font-weight
:
normal
;
color
:
#5584f2
;
background
:
#ecf5ff
;
border
:
1px
solid
#d9ecff
;
border-radius
:
4px
;
line-height
:
1
;
white-space
:
nowrap
;
}
.uc-condition-detail__meta
{
margin-top
:
8px
;
color
:
var
(
--uj-text-3
);
}
.uc-condition-detail__body
{
display
:
grid
;
grid-template-columns
:
minmax
(
280px
,
32%
)
minmax
(
0
,
1
fr
);
align-items
:
start
;
background
:
var
(
--uj-surface
);
}
.uc-condition-detail__left
{
padding
:
16px
;
border-right
:
1px
solid
var
(
--uj-border
);
}
.uc-condition-detail__right
{
min-width
:
0
;
}
.uc-condition-detail__block
{
margin-bottom
:
20px
;
}
.uc-condition-detail__block-title
,
.uc-condition-detail__section-title
{
margin
:
0
0
12px
;
color
:
var
(
--uj-text-1
);
font-size
:
16px
;
font-weight
:
600
;
}
.uc-condition-detail__section-head
{
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
gap
:
12px
;
}
.uc-condition-detail__section-head
.uc-condition-detail__section-title
{
margin-bottom
:
12px
;
}
.uc-condition-detail__model-reference
{
margin
:
0
0
12px
;
padding
:
10px
14px
;
color
:
var
(
--uj-warning
);
background
:
var
(
--uj-warning-soft
);
border
:
1px
solid
var
(
--uj-warning-border
);
border-radius
:
4px
;
}
.uc-condition-detail__description
{
white-space
:
pre-wrap
;
line-height
:
1.6
;
color
:
var
(
--uj-text-2
);
}
.uc-condition-detail__photos
{
display
:
grid
;
grid-template-columns
:
repeat
(
2
,
minmax
(
0
,
1
fr
));
gap
:
16px
;
}
.uc-condition-detail__photo
{
margin
:
0
;
min-width
:
0
;
overflow
:
hidden
;
}
.uc-condition-detail__photo
.ant-image
{
display
:
block
;
width
:
100%
;
height
:
110px
;
overflow
:
hidden
;
border
:
1px
solid
var
(
--uj-border
);
border-radius
:
6px
;
background
:
var
(
--uj-bg
);
}
.uc-condition-detail__photo
.ant-image
img
,
.uc-condition-detail__video
{
width
:
100%
;
height
:
110px
;
object-fit
:
cover
;
}
.uc-condition-detail__photo
figcaption
{
margin-top
:
6px
;
color
:
var
(
--uj-text-3
);
font-size
:
12px
;
}
.uc-condition-detail__video-button
{
position
:
relative
;
width
:
100%
;
padding
:
0
;
border
:
0
;
background
:
transparent
;
cursor
:
pointer
;
}
.uc-condition-detail__video-button
span
{
position
:
absolute
;
inset
:
0
;
display
:
grid
;
place-items
:
center
;
color
:
var
(
--uj-on-primary
);
background
:
color-mix
(
in
srgb
,
var
(
--uj-brand-1
)
45%
,
transparent
);
}
.uc-condition-detail__video-preview
{
display
:
block
;
width
:
100%
;
max-height
:
70vh
;
background
:
var
(
--uj-brand-1
);
}
.uc-condition-detail__right
section
{
padding
:
16px
20px
;
border-bottom
:
6px
solid
var
(
--uj-bg
);
}
.uc-condition-detail__form
{
display
:
grid
;
grid-template-columns
:
repeat
(
2
,
minmax
(
0
,
1
fr
));
gap
:
0
24px
;
}
.uc-condition-detail__compound
{
display
:
grid
;
grid-template-columns
:
repeat
(
2
,
minmax
(
0
,
1
fr
));
gap
:
8px
;
width
:
100%
;
}
.uc-condition-detail__third
{
padding
:
14px
16px
;
color
:
var
(
--uj-text-2
);
background
:
var
(
--uj-primary-soft
);
border-radius
:
6px
;
}
.uc-condition-detail__third-warning
{
margin-top
:
8px
;
color
:
var
(
--uj-warning
);
}
.uc-condition-detail__third-success
{
margin-top
:
8px
;
color
:
var
(
--uj-success
);
}
.uc-condition-detail__footer
{
display
:
flex
;
justify-content
:
center
;
padding
:
24px
;
background
:
var
(
--uj-surface
);
}
@media
(
max-width
:
900px
)
{
.uc-condition-detail__body
{
grid-template-columns
:
1
fr
;
}
.uc-condition-detail__left
{
border-right
:
0
;
border-bottom
:
1px
solid
var
(
--uj-border
);
}
.uc-condition-detail__form
{
grid-template-columns
:
1
fr
;
}
}
apps/web/subapps/usedcar/src/pages/Condition/conditionConfig.ts
0 → 100644
View file @
9af59b7
import
type
{
FieldOption
,
FieldSchema
}
from
'@/components'
;
export
type
ConditionValues
=
Record
<
string
,
unknown
>
;
export
const
CONDITION_STATUS
:
FieldOption
[]
=
[
{
value
:
0
,
label
:
'待处理'
},
{
value
:
1
,
label
:
'已生成评估单'
},
];
export
const
AI_REPORT_STATUS
:
FieldOption
[]
=
[
{
value
:
0
,
label
:
'未生成'
},
{
value
:
1
,
label
:
'生成中'
},
{
value
:
2
,
label
:
'已生成'
},
{
value
:
3
,
label
:
'生成失败'
},
];
export
const
YES_NO
:
FieldOption
[]
=
[
{
value
:
0
,
label
:
'否'
},
{
value
:
1
,
label
:
'是'
},
];
const
COLORS
:
FieldOption
[]
=
[
'黑色'
,
'白色'
,
'银色'
,
'灰色'
,
'红色'
,
'蓝色'
,
'绿色'
,
'棕色'
,
'金色'
,
'橙色'
,
'紫色'
,
'黄色'
,
'香槟色'
,
'其他'
,
].
map
((
label
,
index
)
=>
({
label
,
value
:
String
(
index
+
1
)
}));
export
const
colorLabel
=
(
value
:
unknown
)
=>
COLORS
.
find
((
item
)
=>
String
(
item
.
value
)
===
String
(
value
))?.
label
;
const
required
=
(
label
:
string
)
=>
[{
required
:
true
,
message
:
`请选择
${
label
}
`
}];
const
requiredInput
=
(
label
:
string
)
=>
[
{
required
:
true
,
whitespace
:
true
,
message
:
`请填写
${
label
}
`
},
];
export
const
BASE_FIELDS
:
FieldSchema
<
ConditionValues
>
[]
=
[
{
name
:
'licensePlate'
,
label
:
'车牌号'
,
type
:
'input'
,
rules
:
requiredInput
(
'车牌号'
),
inputProps
:
{
maxLength
:
10
},
},
{
name
:
'registrationDate'
,
label
:
'上牌时间'
,
type
:
'date'
,
rules
:
required
(
'上牌时间'
)
},
{
name
:
'brandModel'
,
label
:
'车型'
,
type
:
'input'
,
rules
:
requiredInput
(
'车型'
),
inputProps
:
{
maxLength
:
100
},
},
{
name
:
'vin'
,
label
:
'车架号'
,
type
:
'input'
,
rules
:
[
{
required
:
true
,
pattern
:
/^
[
A-HJ-NPR-Z0-9
]{17}
$/i
,
message
:
'请输入 17 位有效车架号'
},
],
inputProps
:
{
maxLength
:
17
},
normalize
:
(
value
)
=>
String
(
value
??
''
)
.
toUpperCase
()
.
replace
(
/
[^
A-HJ-NPR-Z0-9
]
/g
,
''
)
.
slice
(
0
,
17
),
},
{
name
:
'engineNumber'
,
label
:
'发动机号'
,
type
:
'input'
,
inputProps
:
{
maxLength
:
20
}
},
{
name
:
'registrationCityName'
,
label
:
'上牌城市'
,
type
:
'input'
,
rules
:
requiredInput
(
'上牌城市'
),
inputProps
:
{
maxLength
:
100
},
},
{
name
:
'carCityName'
,
label
:
'车辆所在地'
,
type
:
'input'
,
rules
:
requiredInput
(
'车辆所在地'
),
inputProps
:
{
maxLength
:
100
},
},
{
name
:
'displayMileage'
,
label
:
'表显里程'
,
type
:
'input'
,
rules
:
[{
required
:
true
,
pattern
:
/^
\d{1,6}
$/
,
message
:
'表显里程须为不超过 6 位的数字'
}],
inputProps
:
{
maxLength
:
6
},
},
{
name
:
'vehicleCategory'
,
label
:
'车辆类别'
,
type
:
'select'
,
options
:
[
{
value
:
1
,
label
:
'置换车'
},
{
value
:
2
,
label
:
'报废车'
},
],
rules
:
required
(
'车辆类别'
),
},
{
name
:
'emissionStandard'
,
label
:
'排放标准'
,
type
:
'select'
,
options
:
[
3
,
4
,
5
,
6
].
map
((
value
)
=>
({
value
,
label
:
`国
${
value
}
`
})),
rules
:
required
(
'排放标准'
),
},
{
name
:
'productionDate'
,
label
:
'生产日期'
,
type
:
'date'
,
rules
:
required
(
'生产日期'
)
},
{
name
:
'guidePrice'
,
label
:
'指导价(元)'
,
type
:
'input'
,
rules
:
[{
required
:
true
,
pattern
:
/^
\d
+
(\.\d{1,2})?
$/
,
message
:
'请输入有效指导价'
}],
inputProps
:
{
maxLength
:
10
},
},
{
name
:
'sunroof'
,
label
:
'天窗'
,
type
:
'select'
,
options
:
[
{
value
:
1
,
label
:
'无天窗'
},
{
value
:
2
,
label
:
'普通天窗'
},
{
value
:
3
,
label
:
'全景天窗'
},
],
rules
:
required
(
'天窗'
),
},
{
name
:
'interiorColor'
,
label
:
'内饰颜色'
,
type
:
'select'
,
options
:
COLORS
,
rules
:
required
(
'内饰颜色'
),
},
{
name
:
'exteriorColor'
,
label
:
'外观颜色'
,
type
:
'select'
,
options
:
COLORS
,
rules
:
required
(
'外观颜色'
),
},
{
name
:
'sellerMerchantName'
,
label
:
'门店'
,
type
:
'input'
,
disabled
:
true
},
{
name
:
'sellerName'
,
label
:
'销售顾问'
,
type
:
'input'
,
inputProps
:
{
maxLength
:
50
}
},
{
name
:
'conversionName'
,
label
:
'驻店人员'
,
type
:
'input'
,
inputProps
:
{
maxLength
:
50
}
},
{
name
:
'ownerName'
,
label
:
'原车主名称'
,
type
:
'input'
,
rules
:
requiredInput
(
'原车主名称'
),
inputProps
:
{
maxLength
:
50
},
},
{
name
:
'previousOwnerPhone'
,
label
:
'原车主电话'
,
type
:
'input'
,
rules
:
[{
pattern
:
/^$|^
\d{11}
$/
,
message
:
'请输入 11 位手机号'
}],
inputProps
:
{
maxLength
:
11
},
normalize
:
(
value
)
=>
String
(
value
??
''
)
.
replace
(
/
\D
/g
,
''
)
.
slice
(
0
,
11
),
},
{
name
:
'previousOwnerAddress'
,
label
:
'原车主住址'
,
type
:
'textarea'
,
itemStyle
:
{
gridColumn
:
'span 2'
},
textareaProps
:
{
maxLength
:
200
,
rows
:
2
,
showCount
:
true
},
},
{
name
:
'keyCount'
,
label
:
'钥匙数量'
,
type
:
'input'
,
rules
:
[{
required
:
true
,
pattern
:
/^
\d
$/
,
message
:
'钥匙数量须为 0~9 的整数'
}],
inputProps
:
{
maxLength
:
1
},
},
{
name
:
'transferCount'
,
label
:
'过户次数'
,
type
:
'input'
,
rules
:
[{
required
:
true
,
pattern
:
/^
\d
$/
,
message
:
'过户次数须为 0~9 的整数'
}],
inputProps
:
{
maxLength
:
1
},
},
{
name
:
'compulsoryInsuranceExpiry'
,
label
:
'交强险到期'
,
type
:
'date'
},
{
name
:
'annualInspectionExpiry'
,
label
:
'年审到期日'
,
type
:
'date'
},
{
name
:
'commercialInsuranceExpiry'
,
label
:
'商业险到期'
,
type
:
'date'
},
{
name
:
'usageType'
,
label
:
'使用性质'
,
type
:
'select'
,
options
:
[
{
value
:
1
,
label
:
'非营运'
},
{
value
:
2
,
label
:
'营运'
},
{
value
:
3
,
label
:
'营转非'
},
],
rules
:
required
(
'使用性质'
),
},
{
name
:
'ownerType'
,
label
:
'所有人性质'
,
type
:
'select'
,
options
:
[
{
value
:
1
,
label
:
'个人'
},
{
value
:
2
,
label
:
'单位'
},
],
rules
:
required
(
'所有人性质'
),
},
{
name
:
'overallRating'
,
label
:
'综合评价'
,
type
:
'select'
,
options
:
[
'优'
,
'良'
,
'中'
,
'差'
].
map
((
label
,
index
)
=>
({
value
:
index
+
1
,
label
})),
rules
:
required
(
'综合评价'
),
},
{
name
:
'hasAccident'
,
label
:
'是否事故车'
,
type
:
'select'
,
options
:
YES_NO
,
rules
:
required
(
'是否事故车'
),
},
{
name
:
'buyNewCar'
,
label
:
'是否购买新车'
,
type
:
'select'
,
options
:
YES_NO
,
rules
:
required
(
'是否购买新车'
),
},
{
name
:
'conditionDescription'
,
label
:
'车况描述'
,
type
:
'textarea'
,
itemStyle
:
{
gridColumn
:
'span 2'
},
textareaProps
:
{
maxLength
:
200
,
rows
:
3
,
showCount
:
true
},
},
];
export
const
PRICE_FIELDS
:
FieldSchema
<
ConditionValues
>
[]
=
[
{
name
:
'targetPrice'
,
label
:
'目标收车价(元)'
,
type
:
'input'
,
rules
:
[{
required
:
true
,
pattern
:
/^
\d{1,9}
$/
,
message
:
'请输入不超过 9 位的正整数'
}],
},
{
name
:
'maxReservedPrice'
,
label
:
'最高保留价(元)'
,
type
:
'input'
,
rules
:
[{
required
:
true
,
pattern
:
/^
\d{1,9}
$/
,
message
:
'请输入不超过 9 位的正整数'
}],
},
{
name
:
'newCarPriceDrop'
,
label
:
'是否新车降价'
,
type
:
'select'
,
options
:
YES_NO
,
rules
:
required
(
'是否新车降价'
),
},
{
name
:
'interiorCondition'
,
label
:
'车辆内饰'
,
type
:
'select'
,
options
:
[
{
value
:
1
,
label
:
'新'
},
{
value
:
0
,
label
:
'旧'
},
],
rules
:
required
(
'车辆内饰'
),
},
{
name
:
'mileageKm'
,
label
:
'车辆公里数'
,
type
:
'input'
,
rules
:
[{
required
:
true
,
pattern
:
/^
\d{1,9}
$/
,
message
:
'请输入有效车辆公里数'
}],
},
{
name
:
'reportConditionDescription'
,
label
:
'车况描述(瑕疵/维保详述)'
,
type
:
'textarea'
,
itemStyle
:
{
gridColumn
:
'span 2'
},
rules
:
requiredInput
(
'车况描述'
),
textareaProps
:
{
maxLength
:
500
,
rows
:
4
,
showCount
:
true
},
},
{
name
:
'frameStructure'
,
label
:
'骨架与结构(一票否决)'
,
type
:
'textarea'
,
itemStyle
:
{
gridColumn
:
'span 2'
},
rules
:
requiredInput
(
'骨架与结构'
),
textareaProps
:
{
maxLength
:
100
,
rows
:
3
,
showCount
:
true
},
},
{
name
:
'historyStatus'
,
label
:
'历史与状态(隐形风险)'
,
type
:
'textarea'
,
itemStyle
:
{
gridColumn
:
'span 2'
},
rules
:
requiredInput
(
'历史与状态'
),
textareaProps
:
{
maxLength
:
100
,
rows
:
3
,
showCount
:
true
},
},
{
name
:
'prepCost'
,
label
:
'整备成本预估(元)'
,
type
:
'input'
,
inputProps
:
{
maxLength
:
9
}
},
{
name
:
'marketRisk'
,
label
:
'市场与行情风险'
,
type
:
'input'
,
inputProps
:
{
maxLength
:
100
}
},
];
export
const
labelOf
=
(
options
:
FieldOption
[],
value
:
unknown
)
=>
options
.
find
((
item
)
=>
String
(
item
.
value
)
===
String
(
value
))?.
label
??
'-'
;
apps/web/subapps/usedcar/src/pages/Condition/index.tsx
View file @
9af59b7
import { RoutePlaceholder } from '@/features/shared/RoutePlaceholder';
import { useMemo, useState } from 'react';
import { useQuery } from '@tanstack/react-query';
import { UAlert, UButton, UCard, UResult, useUMessage } from '@uj/ui';
import {
DataTable,
PageShell,
SearchForm,
type FieldOption,
type FieldSchema,
type RowActionSchema,
} from '@/components';
import { carConditionApi } from '@/api';
import { useAccess } from '@/access';
import { UC } from '@/permissions/codes';
import { loadUsedcarRemoteConfig } from '../../api/core/config-center';
import { errorDetail } from '@/utils/error';
import { goTo } from '../Leads/navigate';
import { AI_REPORT_STATUS, CONDITION_STATUS, labelOf } from './conditionConfig';
import './condition.css';
type Filters = Record<string, unknown> & {
ownerName?: string;
licensePlate?: string;
sellerMerchantId?: string | number;
status?: string | number;
aiReportStatus?: string | number;
};
type Row = Record<string, unknown> & {
id: string | number;
status?: string | number;
aiReportStatus?: string | number;
carConditionCode?: string;
};
type PageResult = { records: Row[]; total: number };
const text = (value: unknown) =>
value === undefined || value === null || value === '' ? '-' : String(value);
const statusTone = (value: unknown, success: string, failed?: string) => {
if (String(value) === success) return 'success';
if (failed !== undefined && String(value) === failed) return 'failed';
if (String(value) === '0') return 'pending';
return 'progress';
};
/** menu_code 1002610 · 车况信息 · usedcar:condition:view */
export default function Condition() {
return <RoutePlaceholder title="车况信息" route="/usedcar/condition" />;
const { canPoint } = useAccess();
const message = useUMessage();
const [filters, setFilters] = useState<Filters>({});
const [page, setPage] = useState({ current: 1, size: 10 });
const merchants = useQuery({
queryKey: ['usedcar-condition-merchants'],
queryFn: () =>
carConditionApi.getCarConditionMerchantPageList<{ records: Array<Record<string, unknown>> }>({
currentPage: 1,
pageSize: 9_999_999,
t: {},
}),
enabled: canPoint(UC.CONDITION_VIEW),
});
const merchantOptions = useMemo<FieldOption[]>(() => {
const used = new Set<string>();
return (merchants.data?.records ?? []).flatMap((item) => {
const value = item.sellerMerchantId;
const key = String(value ?? '');
if (value === undefined || value === null || value === '' || used.has(key)) return [];
used.add(key);
return [{ value: value as string | number, label: text(item.sellerMerchantName) }];
});
}, [merchants.data]);
const list = useQuery({
queryKey: ['usedcar-condition-list', filters, page],
queryFn: () =>
carConditionApi.getVehicleConditionInfoPage<PageResult>({
currentPage: page.current,
pageSize: page.size,
t: filters,
}),
enabled: canPoint(UC.CONDITION_VIEW),
});
const fields: FieldSchema<Filters>[] = [
{
name: 'ownerName',
label: '车主姓名',
type: 'input',
essential: true,
inputProps: { maxLength: 50 },
},
{
name: 'licensePlate',
label: '车牌号',
type: 'input',
essential: true,
inputProps: { maxLength: 50 },
},
{
name: 'sellerMerchantId',
label: '所属门店',
type: 'select',
essential: true,
options: merchantOptions,
selectProps: { loading: merchants.isFetching, showSearch: true, optionFilterProp: 'label' },
},
{ name: 'status', label: '车况单状态', type: 'select', options: CONDITION_STATUS },
{ name: 'aiReportStatus', label: '收车报告状态', type: 'select', options: AI_REPORT_STATUS },
];
const columns = [
{ title: '车主姓名', dataIndex: 'ownerName', width: 120, line: 1, render: text },
{ title: '车牌号', dataIndex: 'licensePlate', width: 120, line: 1, render: text },
{ title: '车型', dataIndex: 'brandModel', width: 180, line: 1, render: text },
{ title: '所属门店', dataIndex: 'sellerMerchantName', width: 140, line: 1, render: text },
{ title: '销售顾问', dataIndex: 'sellerName', width: 120, line: 1, render: text },
{
title: '车况单状态',
dataIndex: 'status',
width: 130,
render: (value: unknown) => (
<span className={`uc-condition-status uc-condition-status--${statusTone(value, '1')}`}>
{labelOf(CONDITION_STATUS, value)}
</span>
),
},
{
title: '收车报告状态',
dataIndex: 'aiReportStatus',
width: 130,
render: (value: unknown) => (
<span className={`uc-condition-status uc-condition-status--${statusTone(value, '2', '3')}`}>
{labelOf(AI_REPORT_STATUS, value)}
</span>
),
},
{ title: '提交时间', dataIndex: 'entryTime', width: 170, line: 1, render: text },
{ title: '创建人', dataIndex: 'createdBy', width: 120, line: 1, render: text },
];
const openAiReport = async (row: Row) => {
try {
const config = await loadUsedcarRemoteConfig();
const baseUrl = String(config.aiPurchase ?? '').trim();
if (!baseUrl) {
message.warning('未配置 AI 收车报告地址');
return;
}
const join = baseUrl.includes('?') ? '&' : '?';
window.open(
`${baseUrl}${join}source=1&carConditionCode=${encodeURIComponent(String(row.carConditionCode ?? ''))}`,
'_blank',
'noopener,noreferrer',
);
} catch (error) {
message.error(errorDetail(error));
}
};
const rowActions: RowActionSchema<Row>[] = [
{ label: '详情', permission: UC.CONDITION_EDIT, onClick: (row) => goTo(`condition/${row.id}`) },
{
label: 'AI收车报告',
permission: UC.CONDITION_AI_REPORT,
visible: (row) => Number(row.aiReportStatus) === 2,
onClick: (row) => void openAiReport(row),
},
];
if (!canPoint(UC.CONDITION_VIEW))
return (
<UResult status="403" title="无访问车况信息的权限" subTitle="请联系管理员开通访问权限。" />
);
return (
<PageShell fill title="车况信息">
<UCard className="uj-filter-card" size="small">
<SearchForm
fields={fields}
onSearch={(values) => {
setFilters(values);
setPage((current) => ({ ...current, current: 1 }));
}}
onReset={() => {
setFilters({});
setPage((current) => ({ ...current, current: 1 }));
}}
/>
</UCard>
{list.isError ? (
<UAlert
type="error"
showIcon
title="车况信息加载失败"
description={errorDetail(list.error)}
action={
<UButton type="link" onClick={() => void list.refetch()}>
重试
</UButton>
}
/>
) : null}
<UCard size="small" fill>
<DataTable<Row>
rowKey="id"
fillHeight
columns={columns}
dataSource={list.data?.records ?? []}
loading={list.isPending || list.isFetching}
rowActions={rowActions}
pagination={{
current: page.current,
pageSize: page.size,
total: list.data?.total ?? 0,
onChange: (current, size) => setPage({ current, size }),
}}
/>
</UCard>
</PageShell>
);
}
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