feat(new-feature): 人走五环编排壳页 NewFeatureShell(建模→recipe→compile→设计器→发布)
复用 ModelerFields(FieldTable)/ReferencePicker 在实体步内置 [+ 新建实体] Dialog(§B.9-4),
建含引用列的新实体在编排流里可达,建成用返回 {entityId,tablename} 回填进 recipe 步。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
142
src/pages/NewFeatureShell.test.tsx
Normal file
142
src/pages/NewFeatureShell.test.tsx
Normal file
@@ -0,0 +1,142 @@
|
||||
import '@testing-library/jest-dom';
|
||||
import { render, screen, waitFor, fireEvent } from '@testing-library/react';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import { NewFeatureShell } from './NewFeatureShell';
|
||||
|
||||
vi.mock('../auth/token', () => ({
|
||||
getProfile: () => ({ userId: 'ADMIN', account: 'admin', name: 'x', roles: [] }),
|
||||
}));
|
||||
|
||||
const listEntities = vi.fn();
|
||||
const createEntity = vi.fn();
|
||||
vi.mock('../api/meta', () => ({
|
||||
listEntities: (...a: unknown[]) => listEntities(...a),
|
||||
createEntity: (...a: unknown[]) => createEntity(...a),
|
||||
}));
|
||||
|
||||
// listRecipes 在模块加载期被 NewFeatureShell 同步调用(const RECIPES = listRecipes()),
|
||||
// 故 mock 工厂直接返回静态数组(不能引用尚未初始化的外层 const,否则 hoist 期 ReferenceError)。
|
||||
const compileRecipe = vi.fn();
|
||||
vi.mock('../api/recipe', () => ({
|
||||
listRecipes: () => [
|
||||
{ id: 'maintenance-crud-v1', label: '维护型 CRUD' },
|
||||
{ id: 'tree-crud-v1', label: '树型 CRUD' },
|
||||
],
|
||||
compileRecipe: (...a: unknown[]) => compileRecipe(...a),
|
||||
}));
|
||||
|
||||
const publishFeature = vi.fn();
|
||||
vi.mock('../api/publish', () => ({ publishFeature: (...a: unknown[]) => publishFeature(...a) }));
|
||||
|
||||
const fetchMenu = vi.fn();
|
||||
vi.mock('../api/menu', () => ({ fetchMenu: (...a: unknown[]) => fetchMenu(...a), collectLeaves: vi.fn() }));
|
||||
|
||||
function renderShell() {
|
||||
return render(
|
||||
<MemoryRouter>
|
||||
<NewFeatureShell />
|
||||
</MemoryRouter>,
|
||||
);
|
||||
}
|
||||
|
||||
describe('NewFeatureShell happy path', () => {
|
||||
beforeEach(() => {
|
||||
listEntities.mockReset().mockResolvedValue([
|
||||
{ entityId: 'E1', tablename: 'OA_DEMO', name: '演示表' },
|
||||
]);
|
||||
createEntity.mockReset();
|
||||
compileRecipe.mockReset().mockResolvedValue({ templateId: 'TPL-NEW-1', etag: 'e1' });
|
||||
publishFeature.mockReset().mockResolvedValue({ menuId: 'M9', flows: ['OA_DEMO_ADD'] });
|
||||
fetchMenu.mockReset().mockResolvedValue({ roots: [] });
|
||||
});
|
||||
|
||||
it('选实体→选 recipe→compile→进设计器按钮可用→发布', async () => {
|
||||
const openSpy = vi.spyOn(window, 'open').mockImplementation(() => null);
|
||||
renderShell();
|
||||
|
||||
// step entity:等实体列表加载,选中第一个
|
||||
await waitFor(() => expect(screen.getByTestId('nf-entity-OA_DEMO')).toBeInTheDocument());
|
||||
fireEvent.click(screen.getByTestId('nf-entity-OA_DEMO'));
|
||||
fireEvent.click(screen.getByTestId('nf-next-entity'));
|
||||
|
||||
// step recipe:默认选了第一个 recipe;填标题;compile
|
||||
await waitFor(() => expect(screen.getByTestId('nf-recipe-maintenance-crud-v1')).toBeInTheDocument());
|
||||
fireEvent.change(screen.getByTestId('nf-title'), { target: { value: '演示功能' } });
|
||||
fireEvent.click(screen.getByTestId('nf-compile'));
|
||||
|
||||
await waitFor(() => expect(compileRecipe).toHaveBeenCalledWith({
|
||||
tableName: 'OA_DEMO',
|
||||
recipe: 'maintenance-crud-v1',
|
||||
title: '演示功能',
|
||||
}));
|
||||
|
||||
// compile 成功 → 进设计器按钮出现且可用
|
||||
const designBtn = await screen.findByTestId('nf-open-designer');
|
||||
expect(designBtn).not.toBeDisabled();
|
||||
fireEvent.click(designBtn);
|
||||
expect(openSpy).toHaveBeenCalledWith('/editor.html?templateId=TPL-NEW-1', '_blank');
|
||||
|
||||
// 发布
|
||||
fireEvent.change(screen.getByTestId('nf-menu-name'), { target: { value: '演示功能' } });
|
||||
fireEvent.click(screen.getByTestId('nf-publish'));
|
||||
await waitFor(() => expect(publishFeature).toHaveBeenCalledWith(expect.objectContaining({
|
||||
entityId: 'E1',
|
||||
tableName: 'OA_DEMO',
|
||||
templateId: 'TPL-NEW-1',
|
||||
menuName: '演示功能',
|
||||
})));
|
||||
await waitFor(() => expect(fetchMenu).toHaveBeenCalled());
|
||||
|
||||
openSpy.mockRestore();
|
||||
});
|
||||
|
||||
it('compile 之前进设计器按钮不存在/禁用', async () => {
|
||||
renderShell();
|
||||
await waitFor(() => expect(screen.getByTestId('nf-entity-OA_DEMO')).toBeInTheDocument());
|
||||
fireEvent.click(screen.getByTestId('nf-entity-OA_DEMO'));
|
||||
fireEvent.click(screen.getByTestId('nf-next-entity'));
|
||||
await waitFor(() => expect(screen.getByTestId('nf-recipe-maintenance-crud-v1')).toBeInTheDocument());
|
||||
// 还没 compile:进设计器按钮要么不存在要么 disabled
|
||||
const btn = screen.queryByTestId('nf-open-designer');
|
||||
expect(btn === null || (btn as HTMLButtonElement).disabled).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('NewFeatureShell §B.9-4 新建实体可达(含引用列)', () => {
|
||||
beforeEach(() => {
|
||||
listEntities.mockReset().mockResolvedValue([
|
||||
{ entityId: 'E1', tablename: 'OA_DEMO', name: '演示表' },
|
||||
]);
|
||||
createEntity.mockReset().mockResolvedValue({
|
||||
entityId: 'E-NEW',
|
||||
tablename: 'OA_FRESH',
|
||||
attributeCount: 1,
|
||||
indexCount: 0,
|
||||
listApi: '/api/entity/OA_FRESH/list',
|
||||
});
|
||||
compileRecipe.mockReset();
|
||||
publishFeature.mockReset();
|
||||
fetchMenu.mockReset();
|
||||
});
|
||||
|
||||
it('实体步有 [+ 新建实体] 按钮,建成后用返回的 entity 进入 recipe 步', async () => {
|
||||
renderShell();
|
||||
await waitFor(() => expect(screen.getByTestId('nf-new-entity')).toBeInTheDocument());
|
||||
|
||||
fireEvent.click(screen.getByTestId('nf-new-entity'));
|
||||
// Dialog 打开:复用 ModelerFields/ReferencePicker(建模器表单 → field-add 证明复用)
|
||||
await waitFor(() => expect(screen.getByTestId('nf-create-tablename')).toBeInTheDocument());
|
||||
expect(screen.getByTestId('field-add')).toBeInTheDocument();
|
||||
|
||||
fireEvent.change(screen.getByTestId('nf-create-tablename'), { target: { value: 'OA_FRESH' } });
|
||||
fireEvent.click(screen.getByTestId('nf-create-submit'));
|
||||
|
||||
await waitFor(() => expect(createEntity).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ tablename: 'OA_FRESH' }),
|
||||
));
|
||||
// 建成回填 selectedEntity 并进入 recipe 步
|
||||
await waitFor(() => expect(screen.getByTestId('nf-recipe-maintenance-crud-v1')).toBeInTheDocument());
|
||||
expect(screen.getAllByText(/OA_FRESH/).length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
361
src/pages/NewFeatureShell.tsx
Normal file
361
src/pages/NewFeatureShell.tsx
Normal file
@@ -0,0 +1,361 @@
|
||||
// 人走五环 · 编排壳 —— 从零搭建一个新功能页。
|
||||
// 步骤:① 选/建实体(元数据+表)→ ② 选 recipe + 填页面参数 → compileRecipe 写 standard 层拿 templateId
|
||||
// → ③ 可选「进设计器微调」(editor.html 是 edit-only,模板已存在才允许) → ④ 发布(menu+5默认流)。
|
||||
// 红线:发布恒人审;standard 写入恒走后端 PageSchemaWriter.upsertStandard(前端只调 compileRecipe)。
|
||||
// §B.9-4:实体步内置 [+ 新建实体] Dialog,复用 ModelerFields(FieldTable)/ReferencePicker,
|
||||
// 使「建含引用列的新实体」在编排流里可达;建成用返回 {entityId,tablename} 回填进入下一步。
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { getProfile } from '../auth/token';
|
||||
import { listEntities, createEntity, type EntityAttr } from '../api/meta';
|
||||
import { listRecipes, compileRecipe } from '../api/recipe';
|
||||
import { publishFeature } from '../api/publish';
|
||||
import { fetchMenu } from '../api/menu';
|
||||
import { toast } from '../components/ui/Toast';
|
||||
import { Dialog } from '../components/ui/Dialog';
|
||||
import { FieldTable, buildAttribute, type FieldRow } from './ModelerFields';
|
||||
import { validateTableName } from './ModelerPage';
|
||||
|
||||
interface EntityRow {
|
||||
entityId: string;
|
||||
tablename: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
type Step = 'entity' | 'recipe';
|
||||
|
||||
const RECIPES = listRecipes(); // 静态清单(maintenance-crud-v1 / tree-crud-v1)
|
||||
|
||||
export function NewFeatureShell() {
|
||||
const navigate = useNavigate();
|
||||
const profile = getProfile();
|
||||
const isAdmin = profile?.account === 'admin' || profile?.userId === 'ADMIN';
|
||||
|
||||
const [step, setStep] = useState<Step>('entity');
|
||||
const [entities, setEntities] = useState<EntityRow[]>([]);
|
||||
const [loadErr, setLoadErr] = useState('');
|
||||
const [selectedEntity, setSelectedEntity] = useState<EntityRow | null>(null);
|
||||
|
||||
const [recipe, setRecipe] = useState<string>(RECIPES[0]?.id ?? 'maintenance-crud-v1');
|
||||
const [title, setTitle] = useState('');
|
||||
const [displayField, setDisplayField] = useState('');
|
||||
const [pageSize, setPageSize] = useState<number | ''>('');
|
||||
|
||||
const [templateId, setTemplateId] = useState('');
|
||||
const [compiling, setCompiling] = useState(false);
|
||||
const [menuName, setMenuName] = useState('');
|
||||
const [publishing, setPublishing] = useState(false);
|
||||
|
||||
// §B.9-4 新建实体 Dialog 态
|
||||
const [createOpen, setCreateOpen] = useState(false);
|
||||
const [newTable, setNewTable] = useState('');
|
||||
const [newName, setNewName] = useState('');
|
||||
const [newRows, setNewRows] = useState<FieldRow[]>([]);
|
||||
const [creating, setCreating] = useState(false);
|
||||
const [createErr, setCreateErr] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
if (!isAdmin) return;
|
||||
let alive = true;
|
||||
listEntities()
|
||||
.then((rows) => alive && setEntities(rows))
|
||||
.catch((e: Error) => alive && setLoadErr(e.message ?? '实体加载失败'));
|
||||
return () => {
|
||||
alive = false;
|
||||
};
|
||||
}, [isAdmin]);
|
||||
|
||||
if (!isAdmin) {
|
||||
return <div style={{ padding: 24, color: 'var(--text-3)' }}>新建功能仅管理员可用。</div>;
|
||||
}
|
||||
|
||||
const newTableValid = validateTableName(newTable);
|
||||
const newRowsValid = newRows.every((r) => r.type !== '引用' || !!r.referenceTable);
|
||||
const canCreate = newTableValid && newRowsValid && !creating;
|
||||
|
||||
function openCreate() {
|
||||
setNewTable('');
|
||||
setNewName('');
|
||||
setNewRows([]);
|
||||
setCreateErr('');
|
||||
setCreateOpen(true);
|
||||
}
|
||||
|
||||
async function doCreateEntity() {
|
||||
setCreating(true);
|
||||
setCreateErr('');
|
||||
try {
|
||||
const attributes: EntityAttr[] = newRows.map(buildAttribute);
|
||||
const res = await createEntity({ tablename: newTable, name: newName || undefined, attributes });
|
||||
// 用返回的 {entityId,tablename} 回填,并进入 recipe 步
|
||||
const created: EntityRow = { entityId: res.entityId, tablename: res.tablename, name: newName || res.tablename };
|
||||
setCreateOpen(false);
|
||||
setSelectedEntity(created);
|
||||
setStep('recipe');
|
||||
// 刷新实体清单(后台异步,失败不阻塞)
|
||||
listEntities()
|
||||
.then((rows) => setEntities(rows))
|
||||
.catch(() => undefined);
|
||||
toast(`已新建实体 ${res.tablename}`, 'ok');
|
||||
} catch (e) {
|
||||
setCreateErr((e as Error).message ?? '建表失败');
|
||||
} finally {
|
||||
setCreating(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function doCompile() {
|
||||
if (!selectedEntity || !title.trim()) {
|
||||
toast('请先选实体并填写页面标题', 'warn');
|
||||
return;
|
||||
}
|
||||
setCompiling(true);
|
||||
try {
|
||||
const body: { tableName: string; recipe: string; title: string; displayField?: string; pageSize?: number } = {
|
||||
tableName: selectedEntity.tablename,
|
||||
recipe,
|
||||
title: title.trim(),
|
||||
};
|
||||
if (displayField.trim()) body.displayField = displayField.trim();
|
||||
if (pageSize !== '') body.pageSize = Number(pageSize);
|
||||
const res = await compileRecipe(body as Parameters<typeof compileRecipe>[0]);
|
||||
setTemplateId(res.templateId);
|
||||
if (!menuName.trim()) setMenuName(title.trim());
|
||||
toast('已生成页面,可进设计器微调或直接发布', 'ok');
|
||||
} catch (e) {
|
||||
toast((e as Error).message ?? '生成失败', 'err');
|
||||
} finally {
|
||||
setCompiling(false);
|
||||
}
|
||||
}
|
||||
|
||||
function openDesigner() {
|
||||
if (!templateId) return;
|
||||
window.open(`/editor.html?templateId=${encodeURIComponent(templateId)}`, '_blank');
|
||||
}
|
||||
|
||||
async function doPublish() {
|
||||
if (!selectedEntity || !templateId || !menuName.trim()) {
|
||||
toast('发布需先生成页面并填写菜单名', 'warn');
|
||||
return;
|
||||
}
|
||||
setPublishing(true);
|
||||
try {
|
||||
const res = await publishFeature({
|
||||
entityId: selectedEntity.entityId,
|
||||
tableName: selectedEntity.tablename,
|
||||
templateId,
|
||||
menuName: menuName.trim(),
|
||||
generateDeploymentPackage: true,
|
||||
});
|
||||
await fetchMenu(); // 刷新左侧菜单缓存(新节点)
|
||||
toast(`已发布:菜单 ${res.menuId},默认流 ${res.flows.join('、')}`, 'ok');
|
||||
} catch (e) {
|
||||
toast((e as Error).message ?? '发布失败', 'err');
|
||||
} finally {
|
||||
setPublishing(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ height: '100%', overflow: 'auto', padding: 'var(--pad-lg)' }} data-testid="new-feature-shell">
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 16 }}>
|
||||
<button className="btn btn-sm" onClick={() => navigate('/design-center')}>
|
||||
← 返回设计中心
|
||||
</button>
|
||||
<h2 style={{ margin: 0, fontSize: 18, fontWeight: 600 }}>新建功能 · 人走五环</h2>
|
||||
</div>
|
||||
|
||||
{/* 步骤指示 */}
|
||||
<div className="sub-text" style={{ marginBottom: 16 }}>
|
||||
{step === 'entity' ? '步骤 1 / 2 :选择或新建实体(元数据+表)' : '步骤 2 / 2 :选 recipe、生成页面、发布'}
|
||||
</div>
|
||||
|
||||
{loadErr ? <div style={{ padding: 12, color: 'var(--err)' }}>实体加载失败:{loadErr}</div> : null}
|
||||
|
||||
{step === 'entity' ? (
|
||||
<div className="card" style={{ padding: 16 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 10 }}>
|
||||
<div style={{ flex: 1, fontWeight: 600 }}>选择已有实体</div>
|
||||
<button className="btn btn-sm" data-testid="nf-new-entity" onClick={openCreate}>
|
||||
+ 新建实体
|
||||
</button>
|
||||
</div>
|
||||
<table style={{ width: '100%', borderCollapse: 'collapse' }}>
|
||||
<thead>
|
||||
<tr style={{ textAlign: 'left', color: 'var(--text-3)' }}>
|
||||
<th style={{ padding: '6px 8px' }}>名称</th>
|
||||
<th style={{ padding: '6px 8px' }}>表名</th>
|
||||
<th style={{ padding: '6px 8px', width: 80 }} />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{entities.map((en) => (
|
||||
<tr
|
||||
key={en.entityId}
|
||||
style={{
|
||||
borderTop: '1px solid var(--line)',
|
||||
background: selectedEntity?.entityId === en.entityId ? 'var(--hover)' : undefined,
|
||||
}}
|
||||
>
|
||||
<td style={{ padding: '6px 8px' }}>{en.name}</td>
|
||||
<td style={{ padding: '6px 8px' }} className="muted">{en.tablename}</td>
|
||||
<td style={{ padding: '6px 8px' }}>
|
||||
<button
|
||||
className="btn btn-sm"
|
||||
data-testid={`nf-entity-${en.tablename}`}
|
||||
onClick={() => setSelectedEntity(en)}
|
||||
>
|
||||
{selectedEntity?.entityId === en.entityId ? '已选' : '选择'}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
<div style={{ marginTop: 16, display: 'flex', gap: 8 }}>
|
||||
<button
|
||||
className="btn"
|
||||
data-testid="nf-next-entity"
|
||||
disabled={!selectedEntity}
|
||||
onClick={() => setStep('recipe')}
|
||||
>
|
||||
下一步:选 recipe
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="card" style={{ padding: 16 }}>
|
||||
<div style={{ marginBottom: 10 }}>
|
||||
实体:<b>{selectedEntity?.name}</b>{' '}
|
||||
<span className="muted">({selectedEntity?.tablename})</span>{' '}
|
||||
<span className="link" onClick={() => setStep('entity')}>更换</span>
|
||||
</div>
|
||||
|
||||
<div style={{ marginBottom: 12 }}>
|
||||
<div style={{ marginBottom: 6, fontWeight: 600 }}>页面模板 recipe</div>
|
||||
{RECIPES.map((r) => (
|
||||
<label key={r.id} style={{ marginRight: 16, cursor: 'pointer' }} data-testid={`nf-recipe-${r.id}`}>
|
||||
<input
|
||||
type="radio"
|
||||
name="recipe"
|
||||
checked={recipe === r.id}
|
||||
onChange={() => setRecipe(r.id)}
|
||||
/>{' '}
|
||||
{r.label}
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 12, marginBottom: 12 }}>
|
||||
<label>
|
||||
<div className="muted">页面标题 *</div>
|
||||
<input data-testid="nf-title" value={title} onChange={(e) => setTitle(e.target.value)} />
|
||||
</label>
|
||||
<label>
|
||||
<div className="muted">显示字段(可选)</div>
|
||||
<input
|
||||
data-testid="nf-display-field"
|
||||
value={displayField}
|
||||
onChange={(e) => setDisplayField(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
<div className="muted">页大小(可选)</div>
|
||||
<input
|
||||
data-testid="nf-page-size"
|
||||
type="number"
|
||||
value={pageSize}
|
||||
onChange={(e) => setPageSize(e.target.value === '' ? '' : Number(e.target.value))}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', gap: 8, marginBottom: 16 }}>
|
||||
<button className="btn" data-testid="nf-compile" disabled={compiling || !title.trim()} onClick={doCompile}>
|
||||
{compiling ? '生成中…' : templateId ? '重新生成页面' : '生成页面'}
|
||||
</button>
|
||||
<button
|
||||
className="btn"
|
||||
data-testid="nf-open-designer"
|
||||
disabled={!templateId}
|
||||
onClick={openDesigner}
|
||||
title={templateId ? '在新标签页打开设计器微调' : '先生成页面才能进设计器'}
|
||||
>
|
||||
进设计器微调
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{templateId ? (
|
||||
<div className="card" style={{ padding: 12, background: 'var(--surface-2)' }}>
|
||||
<div style={{ marginBottom: 8 }}>
|
||||
已生成模板:<code data-testid="nf-template-id">{templateId}</code>
|
||||
</div>
|
||||
<div style={{ display: 'flex', alignItems: 'flex-end', gap: 8 }}>
|
||||
<label>
|
||||
<div className="muted">菜单名 *</div>
|
||||
<input data-testid="nf-menu-name" value={menuName} onChange={(e) => setMenuName(e.target.value)} />
|
||||
</label>
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
data-testid="nf-publish"
|
||||
disabled={publishing || !menuName.trim()}
|
||||
onClick={doPublish}
|
||||
>
|
||||
{publishing ? '发布中…' : '发布'}
|
||||
</button>
|
||||
</div>
|
||||
<div className="sub-text" style={{ marginTop: 8 }}>
|
||||
发布 = 写标准页 + 触发 5 条默认流 + 注册菜单(当前后端立即可用);并生成生产部署包供人审上线。
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{createOpen ? (
|
||||
<Dialog
|
||||
title="新建实体(含引用列)"
|
||||
width={720}
|
||||
onClose={() => setCreateOpen(false)}
|
||||
foot={
|
||||
<>
|
||||
<button className="btn" onClick={() => setCreateOpen(false)}>取消</button>
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
data-testid="nf-create-submit"
|
||||
disabled={!canCreate}
|
||||
onClick={doCreateEntity}
|
||||
>
|
||||
{creating ? '建表中…' : '建表并使用'}
|
||||
</button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<div style={{ display: 'grid', gap: 12 }}>
|
||||
<label style={{ display: 'grid', gap: 4 }}>
|
||||
<span className="sub-text">表名(大写字母开头,仅大写字母/数字/下划线,3–41 位)</span>
|
||||
<input
|
||||
data-testid="nf-create-tablename"
|
||||
value={newTable}
|
||||
onChange={(ev) => setNewTable(ev.target.value.toUpperCase())}
|
||||
placeholder="OA_DEMO"
|
||||
/>
|
||||
{newTable && !newTableValid ? (
|
||||
<span style={{ color: 'var(--err)', fontSize: 11 }}>表名格式不合法</span>
|
||||
) : null}
|
||||
</label>
|
||||
<label style={{ display: 'grid', gap: 4 }}>
|
||||
<span className="sub-text">显示名(可选)</span>
|
||||
<input value={newName} onChange={(ev) => setNewName(ev.target.value)} placeholder="演示维护" />
|
||||
</label>
|
||||
|
||||
<FieldTable rows={newRows} onChange={setNewRows} />
|
||||
|
||||
{createErr ? <div style={{ color: 'var(--err)', fontSize: 12 }}>{createErr}</div> : null}
|
||||
</div>
|
||||
</Dialog>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user