Crud表格批量修改替换
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -283,6 +283,7 @@ class CaseController(ControllerBase):
|
||||
@route.post("/case/replace/", url_name='case-replace')
|
||||
@transaction.atomic
|
||||
def replace_case_step_content(self, payload: ReplaceCaseSchema):
|
||||
print(payload)
|
||||
# 1.首先查询项目
|
||||
project_obj: Project = get_object_or_404(Project, id=payload.project_id)
|
||||
# 2.查询[所有轮次]的selectRows的id
|
||||
@@ -301,7 +302,8 @@ class CaseController(ControllerBase):
|
||||
# 批量更新 operation 和 expect
|
||||
step_count = caseStep_qs.update(
|
||||
operation=Replace(F('operation'), Value(payload.originText), Value(payload.replaceText)),
|
||||
expect=Replace(F('expect'), Value(payload.originText), Value(payload.replaceText))
|
||||
expect=Replace(F('expect'), Value(payload.originText), Value(payload.replaceText)),
|
||||
result=Replace(F('result'), Value(payload.originText), Value(payload.replaceText))
|
||||
)
|
||||
# 5.提交更新
|
||||
replace_count = case_qs.update(**replace_kwargs)
|
||||
|
||||
@@ -16,7 +16,7 @@ from utils.codes import HTTP_INDEX_ERROR
|
||||
from apps.project.models import Design, Dut, Round, TestDemand, TestDemandContent, TestDemandContentStep
|
||||
from apps.project.schemas.testDemand import DeleteSchema, TestDemandModelOutSchema, TestDemandFilterSchema, \
|
||||
TestDemandTreeReturnSchema, TestDemandTreeInputSchema, TestDemandCreateOutSchema, \
|
||||
TestDemandCreateInputSchema, ReplaceDemandContentSchema, \
|
||||
TestDemandCreateInputSchema, ReplaceDemandContentSchema, PriorityReplaceSchema, \
|
||||
TestDemandRelatedSchema, TestDemandExistRelatedSchema, DemandCopyToDesignSchema
|
||||
# 导入ORM
|
||||
from apps.project.models import Project
|
||||
@@ -320,3 +320,11 @@ class TestDemandController(ControllerBase):
|
||||
# 5.提交更新
|
||||
replace_count = demand_qs.update(**replace_kwargs)
|
||||
return {'count': replace_count + step_count}
|
||||
|
||||
# 批量替换优先级-priority
|
||||
@route.post("/testDemand/priorityReplace/", url_name='demand-priority-replace')
|
||||
@transaction.atomic
|
||||
def multiple_modify_demand_priority(self, payload: PriorityReplaceSchema):
|
||||
# 替换优先级
|
||||
demand_qs = TestDemand.objects.filter(id__in=payload.selectRows)
|
||||
demand_qs.update(priority=payload.priority)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -150,7 +150,7 @@ class PersonReplaceSchema(Schema):
|
||||
testPerson: str
|
||||
monitorPerson: str
|
||||
|
||||
# 事件替换Schema
|
||||
# 时间替换Schema
|
||||
class ExetimeReplaceSchema(Schema):
|
||||
selectRows: List[int] = None
|
||||
exetime: str
|
||||
|
||||
@@ -125,3 +125,8 @@ class ReplaceDemandContentSchema(Schema):
|
||||
replaceText: str
|
||||
selectRows: List[int]
|
||||
selectColumn: List[str]
|
||||
|
||||
# 优先级替换Schema
|
||||
class PriorityReplaceSchema(Schema):
|
||||
selectRows: List[int] = None
|
||||
priority: str
|
||||
Reference in New Issue
Block a user