大表功能完成
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,6 +5,7 @@ from typing import List, Union, Optional
|
||||
from datetime import date
|
||||
# 关联问题单
|
||||
from apps.project.schemas.problem import ProblemModelOutSchema
|
||||
from apps.project.schemas.testDemand import TestDemandModelOutSchemaOrigin
|
||||
|
||||
# 删除schema
|
||||
class DeleteSchema(Schema):
|
||||
@@ -31,12 +32,25 @@ class CaseModelOutSchemaWithoutProblem(ModelSchema):
|
||||
model = Case
|
||||
model_exclude = ['project', 'round', 'dut', 'design', 'test', 'remark', 'sort']
|
||||
|
||||
# 输出case:关联问题单
|
||||
class CaseModelOutSchemaOrigin(ModelSchema):
|
||||
testStep: List[CaseStepSchema]
|
||||
testType: str # 用例额外字段,用于测试类型FT的标识给前端
|
||||
# 新增:关联的问题单
|
||||
problem: Optional[ProblemModelOutSchema] = None
|
||||
|
||||
class Config:
|
||||
model = Case
|
||||
model_exclude = ['project', 'round', 'dut', 'design', 'test', 'remark', 'sort']
|
||||
|
||||
# 输出case:关联问题单
|
||||
class CaseModelOutSchema(ModelSchema):
|
||||
testStep: List[CaseStepSchema]
|
||||
testType: str # 用例额外字段,用于测试类型FT的标识给前端
|
||||
# 新增:关联的问题单
|
||||
problem: Optional[ProblemModelOutSchema] = None
|
||||
# 2025年5月10日新增上级字段
|
||||
test: Optional[TestDemandModelOutSchemaOrigin] = None
|
||||
|
||||
class Config:
|
||||
model = Case
|
||||
@@ -119,3 +133,24 @@ class DemandNodeSchema(Schema):
|
||||
isLeaf: bool = False
|
||||
key: str = Field(None, alias='nodekey')
|
||||
title: str = Field(None)
|
||||
|
||||
# 替换文本输入Schema
|
||||
class ReplaceCaseSchema(Schema):
|
||||
project_id: int
|
||||
round_key: str
|
||||
originText: str
|
||||
replaceText: str
|
||||
selectRows: List[int]
|
||||
selectColumn: List[str]
|
||||
|
||||
# 人员替换Schema
|
||||
class PersonReplaceSchema(Schema):
|
||||
selectRows: List[int] = None
|
||||
designPerson: str
|
||||
testPerson: str
|
||||
monitorPerson: str
|
||||
|
||||
# 事件替换Schema
|
||||
class ExetimeReplaceSchema(Schema):
|
||||
selectRows: List[int] = None
|
||||
exetime: str
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
from typing import Optional
|
||||
from apps.project.models import Design
|
||||
from ninja import Field, Schema, ModelSchema
|
||||
from typing import List, Union
|
||||
from pydantic import AliasChoices
|
||||
# 上级dut-schema
|
||||
from apps.project.schemas.dut import DutModelOutSchema
|
||||
|
||||
# 删除schema
|
||||
class DeleteSchema(Schema):
|
||||
@@ -18,7 +21,16 @@ class DesignFilterSchema(Schema):
|
||||
# 新增字段 - chapter
|
||||
chapter: str = Field(None, alias='chapter')
|
||||
|
||||
# 2025年改为2个输出,因为下级需要上级,原始不再嵌套上级
|
||||
class DesignModelOutSchemaOrigin(ModelSchema):
|
||||
class Config:
|
||||
model = Design
|
||||
model_exclude = ['project', 'round', 'dut', 'remark', 'sort']
|
||||
|
||||
class DesignModelOutSchema(ModelSchema):
|
||||
# 新增字段 - 上级的dut对象
|
||||
dut: Optional[DutModelOutSchema] = None
|
||||
|
||||
class Config:
|
||||
model = Design
|
||||
model_exclude = ['project', 'round', 'dut', 'remark', 'sort']
|
||||
@@ -72,3 +84,12 @@ class MultiDesignCreateInputSchema(Schema):
|
||||
project_id: int = Field(..., alias="projectId")
|
||||
dut_key: str = Field(..., alias="key")
|
||||
data: List[SingleDesignSchema]
|
||||
|
||||
# 批量替换design的接口Schema
|
||||
class ReplaceDesignContentSchema(Schema):
|
||||
project_id: int
|
||||
round_key: str
|
||||
originText: str
|
||||
replaceText: str
|
||||
selectRows: List[int]
|
||||
selectColumn: List[str]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from apps.project.models import TestDemand, TestDemandContent, TestDemandContentStep
|
||||
from apps.project.schemas.design import DesignModelOutSchemaOrigin # 注意导入的是不含上级的Schema
|
||||
from ninja import Field, Schema, ModelSchema
|
||||
from typing import List, Union, Optional
|
||||
from pydantic import AliasChoices
|
||||
@@ -20,8 +21,18 @@ class TestContentSchema(ModelSchema):
|
||||
model = TestDemandContent
|
||||
fields = ["subName"]
|
||||
|
||||
# 2025年修改为两个,一个含上级一个不含
|
||||
class TestDemandModelOutSchemaOrigin(ModelSchema):
|
||||
testContent: List[TestContentSchema] # 下级对象
|
||||
|
||||
class Meta:
|
||||
model = TestDemand
|
||||
exclude = ['project', 'round', 'dut', 'design', 'remark', 'sort']
|
||||
|
||||
class TestDemandModelOutSchema(ModelSchema):
|
||||
testContent: List[TestContentSchema]
|
||||
testContent: List[TestContentSchema] # 下级对象
|
||||
# 2025年5月9日新增上级字段design
|
||||
design: Optional[DesignModelOutSchemaOrigin] = None
|
||||
|
||||
class Meta:
|
||||
model = TestDemand
|
||||
@@ -38,6 +49,9 @@ class TestDemandFilterSchema(Schema):
|
||||
testType: str = Field(None, alias='testType')
|
||||
name: str = Field(None, alias='name')
|
||||
priority: str = Field(None, alias="priority")
|
||||
# 新增查询字段,给大表的查询
|
||||
testDesciption: str = Field(None, alias="testDesciption")
|
||||
testContent: str = Field(None, alias="testContent")
|
||||
|
||||
# 处理树状结构的schema
|
||||
class TestDemandTreeReturnSchema(Schema):
|
||||
@@ -102,3 +116,12 @@ class DemandCopyToDesignSchema(Schema):
|
||||
design_id: int
|
||||
demand_key: str
|
||||
depth: bool = False
|
||||
|
||||
# 替换文本输入Schema
|
||||
class ReplaceDemandContentSchema(Schema):
|
||||
project_id: int
|
||||
round_key: str
|
||||
originText: str
|
||||
replaceText: str
|
||||
selectRows: List[int]
|
||||
selectColumn: List[str]
|
||||
|
||||
Reference in New Issue
Block a user