docs: 统一测试数据生成器文档,移除 SQL/TypeScript 导出,修复接口命名不一致
- 移除所有文档中的 SQL 和 TypeScript 导出格式引用 - 统一数据导出格式为 JSON 和 CSV - 移除 GeneratorDefinition 中的 icon 字段 - 更新 generatorCategories 配置,包含所有 21 个生成器 - 统一 rule-management.md 和 technical-implementation.md 中的接口名称为 DataRule - 更新 ui-design.md 中的界面设计,移除 SQL/TypeScript 相关元素
This commit is contained in:
@@ -27,14 +27,14 @@
|
||||
### 规则模板
|
||||
|
||||
```typescript
|
||||
interface RuleTemplate {
|
||||
interface DataRule {
|
||||
id: string; // 唯一标识
|
||||
name: string; // 规则名称
|
||||
description?: string; // 规则描述
|
||||
fields: FieldConfig[]; // 字段配置
|
||||
options: {
|
||||
total: number; // 生成数量
|
||||
format: 'json' | 'csv' | 'sql' | 'typescript';
|
||||
format: 'json' | 'csv';
|
||||
defaultEmptyRate: number; // 默认空值率(0-100)
|
||||
};
|
||||
metadata: {
|
||||
@@ -170,7 +170,7 @@ interface FieldConfig {
|
||||
**实现方式**:
|
||||
|
||||
```typescript
|
||||
search(keyword: string): RuleTemplate[] {
|
||||
search(keyword: string): DataRule[] {
|
||||
const rules = this.getAll();
|
||||
const lowerKeyword = keyword.toLowerCase();
|
||||
|
||||
@@ -408,13 +408,13 @@ class RuleStorage {
|
||||
private readonly STORAGE_KEY = 'testDataGenerator_rules';
|
||||
|
||||
// 获取所有规则
|
||||
getAll(): RuleTemplate[] {
|
||||
getAll(): DataRule[] {
|
||||
const data = localStorage.getItem(this.STORAGE_KEY);
|
||||
return data ? JSON.parse(data) : [];
|
||||
}
|
||||
|
||||
// 保存规则
|
||||
save(rule: RuleTemplate): { success: boolean; message?: string } {
|
||||
save(rule: DataRule): { success: boolean; message?: string } {
|
||||
const rules = this.getAll();
|
||||
|
||||
// 规则数量限制:最多 20 条
|
||||
@@ -432,7 +432,7 @@ class RuleStorage {
|
||||
}
|
||||
|
||||
// 更新规则
|
||||
update(id: string, updates: Partial<RuleTemplate>): void {
|
||||
update(id: string, updates: Partial<DataRule>): void {
|
||||
const rules = this.getAll();
|
||||
const index = rules.findIndex((r) => r.id === id);
|
||||
if (index !== -1) {
|
||||
|
||||
Reference in New Issue
Block a user