迭代 ONE-OS 多原型:租赁台账增强、合同模板 Word 导入,统一全局分页与筛选规范。
- 租赁业务台账:运维费汇总、明细钻取弹层、其他收入/减免批量导入 - 合同模板:Word 导入与 docx 预览,模板编辑增强 - 全局规范:TablePagination 统一为「共 x 条 → 页码 → 每页 N 条」,vm-checkbox 与筛选面板 - 新增车辆维修明细、还车应结款原型;车辆管理、收款记录、工作台、加氢站等同步对齐 - 更新侧栏、Legacy Shell、标注源与 to-prd 技能 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import React, { useEffect, useMemo } from 'react';
|
||||
import { ConfigProvider, Layout, Menu, Typography } from 'antd';
|
||||
import { defineHashPageRoute, useHashPage } from '../useHashPage';
|
||||
import { clearHostPrototypeRouteInfo, defineHashPageRoute, useHashPage } from '../useHashPage';
|
||||
import { ensureOneosWebLegacyGlobals } from './legacyGlobals';
|
||||
|
||||
import '../../resources/oneos-web-legacy/styles/oneos-app.css';
|
||||
@@ -28,13 +28,79 @@ const oneosTheme = {
|
||||
},
|
||||
};
|
||||
|
||||
export function OneosWebLegacyShell({
|
||||
function OneosWebLegacyPageLayout({
|
||||
children,
|
||||
moduleTitle,
|
||||
pages,
|
||||
activePageId,
|
||||
onSelectPage,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
moduleTitle: string;
|
||||
pages: OneosWebLegacyPage[];
|
||||
activePageId?: string;
|
||||
onSelectPage?: (pageId: string) => void;
|
||||
}) {
|
||||
const showMenu = pages.length > 1 && activePageId && onSelectPage;
|
||||
|
||||
return (
|
||||
<ConfigProvider theme={oneosTheme}>
|
||||
<Layout style={{ minHeight: '100vh', background: '#f5f7fa' }}>
|
||||
{showMenu ? (
|
||||
<Layout.Sider
|
||||
width={220}
|
||||
theme="light"
|
||||
style={{ borderRight: '1px solid #e5e7eb' }}
|
||||
>
|
||||
<div style={{ padding: '16px 16px 8px', fontWeight: 600 }}>{moduleTitle}</div>
|
||||
<Menu
|
||||
mode="inline"
|
||||
selectedKeys={[activePageId]}
|
||||
items={pages.map((item) => ({
|
||||
key: item.id,
|
||||
label: item.title,
|
||||
onClick: () => onSelectPage(item.id),
|
||||
}))}
|
||||
/>
|
||||
</Layout.Sider>
|
||||
) : null}
|
||||
<Layout.Content style={{ minHeight: '100vh', overflow: 'auto' }}>
|
||||
{children}
|
||||
</Layout.Content>
|
||||
</Layout>
|
||||
</ConfigProvider>
|
||||
);
|
||||
}
|
||||
|
||||
function OneosWebLegacySinglePageShell({ pages }: OneosWebLegacyShellProps) {
|
||||
const active = pages[0];
|
||||
|
||||
useEffect(() => {
|
||||
clearHostPrototypeRouteInfo();
|
||||
}, []);
|
||||
|
||||
if (!active) {
|
||||
return (
|
||||
<Typography.Text type="secondary">
|
||||
未配置可预览页面
|
||||
</Typography.Text>
|
||||
);
|
||||
}
|
||||
|
||||
const ActivePage = active.component;
|
||||
|
||||
return (
|
||||
<OneosWebLegacyPageLayout moduleTitle="" pages={pages}>
|
||||
<ActivePage />
|
||||
</OneosWebLegacyPageLayout>
|
||||
);
|
||||
}
|
||||
|
||||
function OneosWebLegacyMultiPageShell({
|
||||
moduleTitle,
|
||||
pages,
|
||||
defaultPageId,
|
||||
}: OneosWebLegacyShellProps) {
|
||||
ensureOneosWebLegacyGlobals();
|
||||
|
||||
const route = useMemo(
|
||||
() => defineHashPageRoute(
|
||||
pages.map((page) => ({ id: page.id, title: page.title })),
|
||||
@@ -54,33 +120,25 @@ export function OneosWebLegacyShell({
|
||||
}
|
||||
|
||||
const ActivePage = active.component;
|
||||
const showMenu = pages.length > 1;
|
||||
|
||||
return (
|
||||
<ConfigProvider theme={oneosTheme}>
|
||||
<Layout style={{ minHeight: '100vh', background: '#f5f7fa' }}>
|
||||
{showMenu ? (
|
||||
<Layout.Sider
|
||||
width={220}
|
||||
theme="light"
|
||||
style={{ borderRight: '1px solid #e5e7eb' }}
|
||||
>
|
||||
<div style={{ padding: '16px 16px 8px', fontWeight: 600 }}>{moduleTitle}</div>
|
||||
<Menu
|
||||
mode="inline"
|
||||
selectedKeys={[active.id]}
|
||||
items={pages.map((item) => ({
|
||||
key: item.id,
|
||||
label: item.title,
|
||||
onClick: () => setPage(item.id),
|
||||
}))}
|
||||
/>
|
||||
</Layout.Sider>
|
||||
) : null}
|
||||
<Layout.Content style={{ minHeight: '100vh', overflow: 'auto' }}>
|
||||
<ActivePage />
|
||||
</Layout.Content>
|
||||
</Layout>
|
||||
</ConfigProvider>
|
||||
<OneosWebLegacyPageLayout
|
||||
moduleTitle={moduleTitle}
|
||||
pages={pages}
|
||||
activePageId={active.id}
|
||||
onSelectPage={setPage}
|
||||
>
|
||||
<ActivePage />
|
||||
</OneosWebLegacyPageLayout>
|
||||
);
|
||||
}
|
||||
|
||||
export function OneosWebLegacyShell(props: OneosWebLegacyShellProps) {
|
||||
ensureOneosWebLegacyGlobals();
|
||||
|
||||
if (props.pages.length <= 1) {
|
||||
return <OneosWebLegacySinglePageShell {...props} />;
|
||||
}
|
||||
|
||||
return <OneosWebLegacyMultiPageShell {...props} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user