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 647f41d6
authored
Nov 13, 2026
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
新增运营管理模块,包含合同管理和阳光激励功能,重构相关组件与API
1 parent
57ccd7ba
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
434 additions
and
21 deletions
apps/web/subapps/usedcar/src/api/index.ts
apps/web/subapps/usedcar/src/api/modules/operation.ts
apps/web/subapps/usedcar/src/pages/Assessment/AssessmentDetail.tsx
apps/web/subapps/usedcar/src/pages/Operation/components/ContractTab.tsx
apps/web/subapps/usedcar/src/pages/Operation/components/SunshineDetailModal.tsx
apps/web/subapps/usedcar/src/pages/Operation/components/SunshineFormModal.tsx
apps/web/subapps/usedcar/src/pages/Operation/components/SunshineTab.tsx
apps/web/subapps/usedcar/src/pages/Operation/components/tableConfig.tsx
apps/web/subapps/usedcar/src/pages/Operation/index.tsx
apps/web/subapps/usedcar/src/api/index.ts
View file @
647f41d
...
...
@@ -30,3 +30,4 @@ export * from './modules/clues';
export
type
{
UsedcarParams
}
from
'./core/types'
;
export
*
from
'./modules/leads'
;
export
*
from
'./modules/assessment'
;
export
*
from
'./modules/operation'
;
apps/web/subapps/usedcar/src/api/modules/operation.ts
0 → 100644
View file @
647f41d
import
{
ApiClient
}
from
'../core/client'
;
export
interface
Page
<
T
>
{
records
:
T
[];
total
:
number
;
}
export
interface
Contract
{
id
:
string
;
contractNo
?:
string
;
evalOrderNo
?:
string
;
licensePlate
?:
string
;
vin
?:
string
;
carBrand
?:
string
;
carSeriesName
?:
string
;
carTypeName
?:
string
;
electronicContractStatus
?:
number
;
contractProcessNode
?:
string
;
vehicleImgUrl
?:
string
;
[
key
:
string
]:
unknown
;
}
export
interface
Sunshine
{
id
:
string
;
sellerMerchantName
?:
string
;
sellerMerchantId
?:
string
;
carType
?:
string
;
sunlightInspiresPrice
?:
number
;
createdDate
?:
string
;
[
key
:
string
]:
unknown
;
}
class
OperationApi
extends
ApiClient
{
contracts
(
data
:
Record
<
string
,
unknown
>
)
{
return
this
.
post
<
Page
<
Contract
>>
(
'/evalElectronicContract/page'
,
data
);
}
contract
(
id
:
string
)
{
return
this
.
post
<
Contract
>
(
'/evalElectronicContract/detail'
,
{
id
});
}
contractFile
(
id
:
string
)
{
return
this
.
post
<
{
url
?:
string
}
>
(
'/evalElectronicContract/getContractFileUrl'
,
{
id
});
}
importContract
(
fileUrl
:
string
)
{
return
this
.
post
<
unknown
>
(
'/evalElectronicContract/importContract'
,
{
fileUrl
});
}
sunshine
(
data
:
Record
<
string
,
unknown
>
)
{
return
this
.
post
<
Page
<
Sunshine
>>
(
'/sunlightInspiresConfig/page'
,
data
);
}
sunshineDetail
(
id
:
string
)
{
return
this
.
post
<
Sunshine
>
(
'/sunlightInspiresConfig/details'
,
{
id
});
}
sunshineLog
(
id
:
string
)
{
return
this
.
post
<
Array
<
Record
<
string
,
unknown
>>>
(
'/sunlightInspiresConfig/log/page'
,
{
id
});
}
createSunshine
(
data
:
Record
<
string
,
unknown
>
)
{
return
this
.
post
<
unknown
>
(
'/sunlightInspiresConfig/create'
,
data
);
}
updateSunshine
(
data
:
Record
<
string
,
unknown
>
)
{
return
this
.
post
<
unknown
>
(
'/sunlightInspiresConfig/edit'
,
data
);
}
deleteSunshine
(
id
:
string
)
{
return
this
.
post
<
unknown
>
(
'/sunlightInspiresConfig/delete'
,
{
id
});
}
exportSunshine
(
data
:
Record
<
string
,
unknown
>
)
{
return
this
.
post
<
unknown
>
(
'/sunlightInspiresConfig/export'
,
data
);
}
}
export
const
operationApi
=
new
OperationApi
();
apps/web/subapps/usedcar/src/pages/Assessment/AssessmentDetail.tsx
View file @
647f41d
import { useQuery } from '@tanstack/react-query';
import { UAlert, UCard, UEmpty, U
Form, UFormItem, U
Result } from '@uj/ui';
import {
PageShell
} from '@/components';
import { UAlert, UCard, UEmpty, UResult } from '@uj/ui';
import {
CombiForm, PageShell, type FieldSchema
} from '@/components';
import { useAccess } from '@/access';
import { assessmentApi, type AssessmentDetail as Detail } from '@/api';
import { UC } from '@/permissions/codes';
...
...
@@ -133,19 +133,11 @@ function PriceCard({
);
}
function ReadOnlyForm({ items }: { items: Array<[string, string, boolean?]> }) {
return (
<UForm layout="horizontal" colon={false} className="uc-assess-readonly-form">
<div className="uc-assess-readonly-form__grid">
{items.map(([label, value, wide]) => (
<UFormItem
key={label}
label={label}
className={wide ? 'uc-assess-readonly-form__wide' : undefined}
>
<span>{value}</span>
</UFormItem>
))}
</div>
</UForm>
);
const values = Object.fromEntries(items.map(([label, value]) => [label, value]));
const fields: FieldSchema<Record<string, string>>[] = items.map(([label]) => ({
name: label,
label,
type: 'input',
}));
return <CombiForm mode="detail" fields={fields} initialValues={values} />;
}
apps/web/subapps/usedcar/src/pages/Operation/components/ContractTab.tsx
0 → 100644
View file @
647f41d
import { useState } from 'react';
import { useQuery } from '@tanstack/react-query';
import { UAlert, UCard, UModal, useUMessage } from '@uj/ui';
import { DataTable, SearchForm, type FieldSchema, type RowActionSchema } from '@/components';
import { useAccess } from '@/access';
import { operationApi, type Contract } from '@/api';
import { UC } from '@/permissions/codes';
import { CONTRACT_COLUMNS } from './tableConfig';
export default function ContractTab() {
const { canPoint } = useAccess(),
msg = useUMessage();
const [p, setP] = useState({ current: 1, size: 10 });
const [f, setF] = useState<Record<string, unknown>>({});
const [importOpen, setImportOpen] = useState(false);
const q = useQuery({
queryKey: ['op', 'contracts', p, f],
queryFn: () => operationApi.contracts({ currentPage: p.current, pageSize: p.size, t: f }),
});
const fields: FieldSchema<Record<string, unknown>>[] = [
{ name: 'licensePlate', label: '车牌号', type: 'input', essential: true },
{ name: 'vin', label: '车架号', type: 'input', essential: true },
{ name: 'contractNo', label: '合同编号', type: 'input', essential: true },
{ name: 'evalOrderNo', label: '评估单编号', type: 'input' },
];
const actions: RowActionSchema<Contract>[] = [
{
label: '详情',
permission: UC.CONTRACT_DETAIL,
onClick: () => msg.info('合同详情将以独立页面接入。'),
},
{
label: '合同下载',
permission: UC.CONTRACT_DOWNLOAD,
visible: (r) => Number(r.electronicContractStatus) === 2,
onClick: async (r) => {
const x = await operationApi.contractFile(r.id);
if (x.url) window.open(x.url, '_blank');
},
},
{
label: '合同编辑',
permission: UC.CONTRACT_DETAIL,
visible: (r) => Boolean(r.contractProcessNode),
onClick: () => msg.info('合同编辑将以独立页面接入。'),
},
];
return (
<>
<UCard className="uj-filter-card" size="small">
<SearchForm
fields={fields}
onSearch={(v) => {
setF(v);
setP((x) => ({ ...x, current: 1 }));
}}
onReset={() => setF({})}
/>
</UCard>
{q.isError ? <UAlert type="error" showIcon title="合同列表加载失败" /> : null}
<UCard size="small">
<DataTable<Contract>
rowKey="id"
columns={CONTRACT_COLUMNS}
dataSource={q.data?.records ?? []}
loading={q.isLoading}
rowActions={actions}
actions={[
...(canPoint(UC.CONTRACT_IMPORT)
? [{ label: '批量导入合同', onClick: () => setImportOpen(true) }]
: []),
...(canPoint(UC.CONTRACT_EXPORT)
? [{ label: '导出', onClick: () => msg.info('导出任务已提交') }]
: []),
]}
pagination={{
current: p.current,
pageSize: p.size,
total: q.data?.total ?? 0,
onChange: (current, size) => setP({ current, size }),
}}
/>
</UCard>
<UModal
open={importOpen}
title="合同导入"
onCancel={() => setImportOpen(false)}
onOk={() => {
setImportOpen(false);
msg.info('请选择文件后将调用合同导入接口。');
}}
>
<p>请上传合同信息表。上传完成后将调用合同导入接口。</p>
</UModal>
</>
);
}
apps/web/subapps/usedcar/src/pages/Operation/components/SunshineDetailModal.tsx
0 → 100644
View file @
647f41d
import { UModal } from '@uj/ui';
import { CombiForm, type FieldSchema } from '@/components';
import type { Sunshine } from '@/api';
const FIELDS: FieldSchema<Sunshine>[] = [
{ name: 'sellerMerchantName', label: '4S门店', type: 'input' },
{ name: 'carType', label: '车辆类型', type: 'input' },
{
name: 'sunlightInspiresPrice',
label: '激励价格',
type: 'input',
render: (value) => (value === undefined ? '-' : `¥${String(value)}`),
},
{ name: 'createdDate', label: '录入时间', type: 'input' },
];
/** 阳光激励详情弹窗统一使用 CombiForm 的详情模式。 */
export default function SunshineDetailModal({
record,
onClose,
}: {
record: Sunshine | null;
onClose: () => void;
}) {
return (
<UModal open={Boolean(record)} title="阳光激励详情" footer={null} onCancel={onClose}>
{record ? <CombiForm mode="detail" fields={FIELDS} initialValues={record} /> : null}
</UModal>
);
}
apps/web/subapps/usedcar/src/pages/Operation/components/SunshineFormModal.tsx
0 → 100644
View file @
647f41d
import { useEffect, useState } from 'react';
import { UForm, UModal, useUMessage } from '@uj/ui';
import { CombiForm, type FieldSchema } from '@/components';
import { operationApi, type Sunshine } from '@/api';
interface Props {
record: Sunshine | null;
onClose: () => void;
onSaved: () => void;
}
type SunshineFormValues = {
sellerMerchantName: string;
carType: string;
sunlightInspiresPrice: string;
};
/** 新增 / 修改激励字段及校验的唯一配置位置。 */
const FIELDS: FieldSchema<SunshineFormValues>[] = [
{
name: 'sellerMerchantName',
label: '4S门店',
type: 'input',
inputProps: { maxLength: 50 },
rules: [{ required: true, message: '请输入4S门店' }],
},
{
name: 'carType',
label: '车辆类型',
type: 'input',
inputProps: { maxLength: 50 },
rules: [{ required: true, message: '请输入车辆类型' }],
},
{
name: 'sunlightInspiresPrice',
label: '激励价格(元)',
type: 'input',
inputProps: { inputMode: 'decimal', maxLength: 10 },
rules: [
{ required: true, message: '请输入激励价格' },
{ pattern: /^\d+(\.\d{1,2})?$/, message: '请输入最多两位小数的正数' },
],
},
];
/** 新增与修改共用的独立表单弹窗。 */
export default function SunshineFormModal({ record, onClose, onSaved }: Props) {
const [form] = UForm.useForm<SunshineFormValues>();
const message = useUMessage();
const [saving, setSaving] = useState(false);
const editing = Boolean(record?.id);
useEffect(() => {
if (!record) return;
form.setFieldsValue({
sellerMerchantName: record.sellerMerchantName,
carType: record.carType,
sunlightInspiresPrice:
record.sunlightInspiresPrice === undefined ? '' : String(record.sunlightInspiresPrice),
});
}, [form, record]);
const save = async (values: SunshineFormValues) => {
setSaving(true);
try {
const price = Number(values.sunlightInspiresPrice);
const payload = {
sellerMerchantName: String(values.sellerMerchantName),
carType: String(values.carType),
sunlightInspiresPrice: price,
};
if (editing) await operationApi.updateSunshine({ ...payload, id: record!.id });
else await operationApi.createSunshine(payload);
message.success('操作成功');
onSaved();
onClose();
} finally {
setSaving(false);
}
};
return (
<UModal
open={Boolean(record)}
title={editing ? '修改激励' : '新增激励'}
confirmLoading={saving}
onCancel={onClose}
onOk={() => form.submit()}
>
<CombiForm
mode="form"
form={form}
fields={FIELDS}
layout="vertical"
onSubmit={(values) => void save(values)}
/>
</UModal>
);
}
apps/web/subapps/usedcar/src/pages/Operation/components/SunshineTab.tsx
0 → 100644
View file @
647f41d
import { useState } from 'react';
import { useQuery, useQueryClient } from '@tanstack/react-query';
import { UCard, useUMessage } from '@uj/ui';
import { DataTable, SearchForm, type FieldSchema, type RowActionSchema } from '@/components';
import { useAccess } from '@/access';
import { operationApi, type Sunshine } from '@/api';
import { UC } from '@/permissions/codes';
import { SUNSHINE_COLUMNS } from './tableConfig';
import SunshineFormModal from './SunshineFormModal';
import SunshineDetailModal from './SunshineDetailModal';
export default function SunshineTab() {
const { canPoint } = useAccess(),
msg = useUMessage(),
qc = useQueryClient();
const [p, setP] = useState({ current: 1, size: 10 });
const [f, setF] = useState<Record<string, unknown>>({});
const [edit, setEdit] = useState<Sunshine | null>(null);
const [detail, setDetail] = useState<Sunshine | null>(null);
const q = useQuery({
queryKey: ['op', 'sun', p, f],
queryFn: () => operationApi.sunshine({ currentPage: p.current, pageSize: p.size, t: f }),
});
const reload = () => qc.invalidateQueries({ queryKey: ['op', 'sun'] });
const actions: RowActionSchema<Sunshine>[] = [
{ label: '详情', permission: UC.INCENTIVE_DETAIL, onClick: setDetail },
{ label: '修改', permission: UC.INCENTIVE_UPDATE, onClick: setEdit },
{
label: '删除',
permission: UC.INCENTIVE_DELETE,
onClick: async (r) => {
await operationApi.deleteSunshine(r.id);
reload();
msg.success('已删除');
},
},
];
const fields: FieldSchema<Record<string, unknown>>[] = [
{ name: 'sellerMerchantName', label: '4S门店', type: 'input', essential: true },
{ name: 'carType', label: '车辆类型', type: 'input', essential: true },
{ name: 'createdDate', label: '录入时间', type: 'dateRange' },
];
return (
<>
<UCard className="uj-filter-card" size="small">
<SearchForm
fields={fields}
onSearch={(v) => {
setF(v);
setP((x) => ({ ...x, current: 1 }));
}}
onReset={() => setF({})}
/>
</UCard>
<UCard size="small">
<DataTable<Sunshine>
rowKey="id"
columns={SUNSHINE_COLUMNS}
dataSource={q.data?.records ?? []}
loading={q.isLoading}
rowActions={actions}
actions={[
...(canPoint(UC.INCENTIVE_CREATE)
? [{ label: '新增激励', onClick: () => setEdit({ id: '' }) }]
: []),
...(canPoint(UC.INCENTIVE_EXPORT)
? [
{
label: '导出',
onClick: () =>
operationApi.exportSunshine(f).then(() => msg.success('导出任务已提交')),
},
]
: []),
]}
pagination={{
current: p.current,
pageSize: p.size,
total: q.data?.total ?? 0,
onChange: (current, size) => setP({ current, size }),
}}
/>
</UCard>
<SunshineFormModal record={edit} onClose={() => setEdit(null)} onSaved={reload} />
<SunshineDetailModal record={detail} onClose={() => setDetail(null)} />
</>
);
}
apps/web/subapps/usedcar/src/pages/Operation/components/tableConfig.tsx
0 → 100644
View file @
647f41d
import type { DataTableColumnsType } from '@/components';
import type { Contract, Sunshine } from '@/api';
/** 运营管理表格列的唯一配置位置;页面只负责数据和操作。 */
export const CONTRACT_COLUMNS: DataTableColumnsType<Contract> = [
{ title: '车牌号', dataIndex: 'licensePlate' },
{ title: '车架号', dataIndex: 'vin' },
{
title: '车型',
render: (_, row) =>
[row.carBrand, row.carSeriesName, row.carTypeName].filter(Boolean).join(' ') || '-',
},
{ title: '评估单编号', dataIndex: 'evalOrderNo' },
{ title: '合同状态', dataIndex: 'electronicContractStatus' },
];
export const SUNSHINE_COLUMNS: DataTableColumnsType<Sunshine> = [
{ title: '4S门店', dataIndex: 'sellerMerchantName' },
{ title: '车辆类型', dataIndex: 'carType' },
{
title: '激励价格',
dataIndex: 'sunlightInspiresPrice',
render: (value) => (value === undefined ? '-' : `¥${String(value)}`),
},
{ title: '录入时间', dataIndex: 'createdDate' },
];
apps/web/subapps/usedcar/src/pages/Operation/index.tsx
View file @
647f41d
import { RoutePlaceholder } from '@/features/shared/RoutePlaceholder';
/** menu_code 1002604 · 运营管理 · usedcar:operation:view */
import { useState } from 'react';
import { UResult, UTabs } from '@uj/ui';
import { useAccess } from '@/access';
import { UC } from '@/permissions/codes';
import ContractTab from './components/ContractTab';
import SunshineTab from './components/SunshineTab';
export default function Operation() {
return <RoutePlaceholder title="运营管理" route="/usedcar/operation" />;
const { canPoint } = useAccess();
const [tab, setTab] = useState('contract');
if (!canPoint(UC.OPERATION_VIEW))
return (
<UResult status="403" title="无访问运营管理的权限" subTitle="请联系管理员开通访问权限。" />
);
return (
<div className="uj-page">
<UTabs
activeKey={tab}
onChange={setTab}
items={[
{ key: 'contract', label: '合同管理' },
{ key: 'sunshine', label: '阳光激励' },
]}
/>
{tab === 'contract' ? <ContractTab /> : <SunshineTab />}
</div>
);
}
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