Commit dabc4928 by liimin

Merge branch 'v1.0.0' of http://192.168.3.233:8090/ujia/uj-admin into v1.0.0

2 parents 4b4d68bb 05f66fda
Pipeline #474 for dabc4928 failed in 0 seconds
......@@ -279,11 +279,7 @@ export default function Assessment() {
]
: [];
return (
<PageShell
fill
title="评估管理"
description="查询评估单、查看车辆信息与评估进度。"
>
<PageShell fill title="评估管理">
<UCard className="uj-filter-card" size="small">
<SearchForm
fields={fields}
......@@ -322,7 +318,6 @@ export default function Assessment() {
rowActions={rowActions}
actions={actions}
actionColumnWidth={250}
toolbarTitle={`共 ${list.data?.total ?? 0} 条评估单`}
pagination={{
current: page.current,
pageSize: page.size,
......
......@@ -99,6 +99,39 @@ function toParams(
return { ...toFilters(filters, status), currentPage, pageSize } as LeadSearchParams;
}
/**
* 老系统异步导出要求完整保留筛选字段:未填写的字符串传空串,多选项传空数组。
* 下载中心会把业务 method 一并写入 exportParam,随后提交任务并按 uuid 查询结果。
*/
function toExportParams(filters: Filters, status: string): Record<string, unknown> {
const createTimeRange = filters.createTimeRange;
const lastFollowUpTimeRange = filters.lastFollowUpTimeRange;
return {
cluesNo: filters.cluesNo ?? '',
carOwnerName: filters.carOwnerName ?? '',
carOwnerPhone: filters.carOwnerPhone ?? '',
sellerMerchantIdList: filters.sellerMerchantIdList ?? [],
sellerName: filters.sellerName ?? '',
customerIntentLevelList: filters.customerIntentLevelList ?? [],
followTimeStatusList: filters.followTimeStatusList ?? [],
enterTimeStart: createTimeRange ? createTimeRange[0].format('YYYY-MM-DD HH:mm:ss') : '',
enterTimeEnd: createTimeRange ? createTimeRange[1].format('YYYY-MM-DD 23:59:59') : '',
latestFollowTimeStart: lastFollowUpTimeRange
? lastFollowUpTimeRange[0].format('YYYY-MM-DD HH:mm:ss')
: '',
latestFollowTimeEnd: lastFollowUpTimeRange
? lastFollowUpTimeRange[1].format('YYYY-MM-DD 23:59:59')
: '',
conversionName: filters.conversionName ?? '',
enterType: filters.enterType ?? '',
carModel: filters.carModel ?? '',
...(status ? { cluesStatusList: [status] } : {}),
currentPage: 1,
server_provider_type: 'gsc',
server_provider_name: 'gsc-vcp-web-facade',
};
}
/** menu_code 1002602 · 线索管理 · usedcar:lead:view */
export default function Leads() {
const { canPoint } = useAccess();
......@@ -142,21 +175,18 @@ export default function Leads() {
name: 'cluesNo',
label: '线索 ID',
type: 'input',
placeholder: '请输入线索 ID',
essential: true,
},
{
name: 'carOwnerName',
label: '车主姓名',
type: 'input',
placeholder: '请输入车主姓名',
essential: true,
},
{
name: 'carOwnerPhone',
label: '车主电话',
type: 'input',
placeholder: '请输入车主电话',
essential: true,
},
{
......@@ -169,7 +199,7 @@ export default function Leads() {
})),
essential: true,
},
{ name: 'sellerName', label: '销售顾问', type: 'input', placeholder: '请输入推荐销售顾问' },
{ name: 'sellerName', label: '销售顾问', type: 'input' },
{
name: 'customerIntentLevelList',
label: '意向等级',
......@@ -184,7 +214,7 @@ export default function Leads() {
},
{ name: 'createTimeRange', label: '创建时间', type: 'dateRange' },
{ name: 'lastFollowUpTimeRange', label: '最后跟进时间', type: 'dateRange' },
{ name: 'conversionName', label: '评估师', type: 'input', placeholder: '请输入评估师姓名' },
{ name: 'conversionName', label: '评估师', type: 'input' },
{
name: 'enterType',
label: '录线索人员',
......@@ -198,7 +228,6 @@ export default function Leads() {
name: 'carModel',
label: '评估品牌车型',
type: 'input',
placeholder: '请输入品牌车型关键词',
},
],
[merchants.data?.records],
......@@ -321,9 +350,9 @@ export default function Leads() {
downloadCenter.asyncExport({
source: 'usedcar',
sourceLabel: '二手车管理 / 线索管理 / 线索导出',
label: '线索导出',
label: '线索管理列表',
method: '/clues/exportAsync',
params: toParams(filters, status, 1, page.size),
params: toExportParams(filters, status),
dedupeKey: 'leads-export',
}),
},
......@@ -331,10 +360,7 @@ export default function Leads() {
: [];
return (
<PageShell
fill
title="线索管理"
>
<PageShell fill title="线索管理">
{reminders.data?.nearlyExpiredCount || reminders.data?.expiredCount ? (
<div className="uc-lead-reminder">
{reminders.data.nearlyExpiredCount ? (
......
......@@ -44,6 +44,15 @@ export function SearchForm<T extends Record<string, unknown>>({
defaultExpanded = false,
}: SearchFormProps<T>) {
const [form] = UForm.useForm();
// 普通单选下拉以空值代表「全部」。除了补选项外,也要把未指定的初始值设为空,
// 否则组件只会显示占位状态,看起来像没有选中「全部」。
const formInitialValues = fields.reduce<Record<string, unknown>>(
(values, field) => {
if (field.type === 'select' && values[field.name] === undefined) values[field.name] = '';
return values;
},
{ ...initialValues },
) as Partial<T>;
// 空数组 = 监听整张表单。用于「收起状态下已设条件」的角标计数:
// 收起了不等于没生效,用户必须看得见自己身上还挂着几个条件。
const values = UForm.useWatch([], form) as Partial<T> | undefined;
......@@ -83,25 +92,35 @@ export function SearchForm<T extends Record<string, unknown>>({
// 两个数字分开算:总数是「收了多少」,生效数是「其中填了几个」。
// 后者排除 initialValues 里的默认值,并按 filterGroup 把组合字段归并成 1 个业务条件。
const extraTotal = extraFields.length;
const activeExtraCount = countActiveConditions(extraFields, values, initialValues);
const activeExtraCount = countActiveConditions(extraFields, values, formInitialValues);
const control = (field: FieldSchema<T>) => {
const label = typeof field.label === 'string' ? field.label : '';
const isTextInput = field.type === 'input' || field.type === 'textarea';
const common = {
disabled: typeof field.disabled === 'boolean' ? field.disabled : false,
placeholder: field.placeholder,
placeholder:
field.placeholder ?? (isTextInput ? (label ? `请输入${label}` : '请输入') : undefined),
};
const width = field.width ?? '100%';
if (field.type === 'select' || field.type === 'selectMultiple')
if (field.type === 'select' || field.type === 'selectMultiple') {
const options = field.options ?? [];
const hasAllOption = options.some((option) => option.label === '全部' || option.value === '');
return (
<USelect
{...common}
allowClear={false}
style={{ width }}
options={field.options}
options={
field.type === 'select' && !hasAllOption
? [{ label: '全部', value: '' }, ...options]
: options
}
mode={field.type === 'selectMultiple' ? 'multiple' : undefined}
{...field.selectProps}
/>
);
}
if (field.type === 'cascader')
return <UCascader {...common} style={{ width }} options={field.options} allowClear={false} />;
if (field.type === 'date') return <UDatePicker {...common} style={{ width }} />;
......@@ -133,7 +152,7 @@ export function SearchForm<T extends Record<string, unknown>>({
return (
<UForm
form={form}
initialValues={initialValues}
initialValues={formInitialValues}
// 标签在左、控件在右:标签列宽固定,四组控件的左缘落在同一条竖线上。
// 竖排标签会把筛选区抬高一整行,横向排列后整条筛选带只占控件本身的高度。
layout="horizontal"
......@@ -188,14 +207,14 @@ export function SearchForm<T extends Record<string, unknown>>({
size="small"
onClick={() => {
const resetValues = fields.reduce<Record<string, unknown>>((acc, field) => {
const initialValue = initialValues?.[field.name];
const initialValue = formInitialValues?.[field.name];
acc[field.name] =
initialValue ??
(field.type === 'input' || field.type === 'textarea' ? '' : undefined);
return acc;
}, {});
form.setFieldsValue(resetValues);
onReset?.(initialValues ?? {}, searchPagination);
onReset?.(formInitialValues, searchPagination);
}}
>
重置
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!