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')
|
@route.post("/case/replace/", url_name='case-replace')
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def replace_case_step_content(self, payload: ReplaceCaseSchema):
|
def replace_case_step_content(self, payload: ReplaceCaseSchema):
|
||||||
|
print(payload)
|
||||||
# 1.首先查询项目
|
# 1.首先查询项目
|
||||||
project_obj: Project = get_object_or_404(Project, id=payload.project_id)
|
project_obj: Project = get_object_or_404(Project, id=payload.project_id)
|
||||||
# 2.查询[所有轮次]的selectRows的id
|
# 2.查询[所有轮次]的selectRows的id
|
||||||
@@ -301,7 +302,8 @@ class CaseController(ControllerBase):
|
|||||||
# 批量更新 operation 和 expect
|
# 批量更新 operation 和 expect
|
||||||
step_count = caseStep_qs.update(
|
step_count = caseStep_qs.update(
|
||||||
operation=Replace(F('operation'), Value(payload.originText), Value(payload.replaceText)),
|
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.提交更新
|
# 5.提交更新
|
||||||
replace_count = case_qs.update(**replace_kwargs)
|
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.models import Design, Dut, Round, TestDemand, TestDemandContent, TestDemandContentStep
|
||||||
from apps.project.schemas.testDemand import DeleteSchema, TestDemandModelOutSchema, TestDemandFilterSchema, \
|
from apps.project.schemas.testDemand import DeleteSchema, TestDemandModelOutSchema, TestDemandFilterSchema, \
|
||||||
TestDemandTreeReturnSchema, TestDemandTreeInputSchema, TestDemandCreateOutSchema, \
|
TestDemandTreeReturnSchema, TestDemandTreeInputSchema, TestDemandCreateOutSchema, \
|
||||||
TestDemandCreateInputSchema, ReplaceDemandContentSchema, \
|
TestDemandCreateInputSchema, ReplaceDemandContentSchema, PriorityReplaceSchema, \
|
||||||
TestDemandRelatedSchema, TestDemandExistRelatedSchema, DemandCopyToDesignSchema
|
TestDemandRelatedSchema, TestDemandExistRelatedSchema, DemandCopyToDesignSchema
|
||||||
# 导入ORM
|
# 导入ORM
|
||||||
from apps.project.models import Project
|
from apps.project.models import Project
|
||||||
@@ -320,3 +320,11 @@ class TestDemandController(ControllerBase):
|
|||||||
# 5.提交更新
|
# 5.提交更新
|
||||||
replace_count = demand_qs.update(**replace_kwargs)
|
replace_count = demand_qs.update(**replace_kwargs)
|
||||||
return {'count': replace_count + step_count}
|
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
|
testPerson: str
|
||||||
monitorPerson: str
|
monitorPerson: str
|
||||||
|
|
||||||
# 事件替换Schema
|
# 时间替换Schema
|
||||||
class ExetimeReplaceSchema(Schema):
|
class ExetimeReplaceSchema(Schema):
|
||||||
selectRows: List[int] = None
|
selectRows: List[int] = None
|
||||||
exetime: str
|
exetime: str
|
||||||
|
|||||||
@@ -125,3 +125,8 @@ class ReplaceDemandContentSchema(Schema):
|
|||||||
replaceText: str
|
replaceText: str
|
||||||
selectRows: List[int]
|
selectRows: List[int]
|
||||||
selectColumn: List[str]
|
selectColumn: List[str]
|
||||||
|
|
||||||
|
# 优先级替换Schema
|
||||||
|
class PriorityReplaceSchema(Schema):
|
||||||
|
selectRows: List[int] = None
|
||||||
|
priority: str
|
||||||
@@ -27,3 +27,19 @@
|
|||||||
[WARNING][2025-05-17 15:36:12,935][log.py:248]Unauthorized: /api/system/getInfo
|
[WARNING][2025-05-17 15:36:12,935][log.py:248]Unauthorized: /api/system/getInfo
|
||||||
[WARNING][2025-05-17 15:36:13,000][log.py:248]Unauthorized: /api/system/logout
|
[WARNING][2025-05-17 15:36:13,000][log.py:248]Unauthorized: /api/system/logout
|
||||||
[WARNING][2025-05-17 15:36:20,760][backend.py:91]Caught LDAPError looking up user: SERVER_DOWN({'result': -1, 'desc': "Can't contact LDAP server", 'ctrls': []})
|
[WARNING][2025-05-17 15:36:20,760][backend.py:91]Caught LDAPError looking up user: SERVER_DOWN({'result': -1, 'desc': "Can't contact LDAP server", 'ctrls': []})
|
||||||
|
[WARNING][2025-05-23 10:36:33,307][log.py:248]Not Found: /
|
||||||
|
[WARNING][2025-05-23 10:36:33,430][log.py:248]Not Found: /favicon.ico
|
||||||
|
[WARNING][2025-05-26 15:15:24,703][backend.py:91]Caught LDAPError looking up user: SERVER_DOWN({'result': -1, 'desc': "Can't contact LDAP server", 'ctrls': []})
|
||||||
|
[WARNING][2025-05-26 15:19:25,390][log.py:248]Not Found: /
|
||||||
|
[WARNING][2025-05-26 15:19:25,513][log.py:248]Not Found: /favicon.ico
|
||||||
|
[WARNING][2025-05-27 09:11:32,138][log.py:248]Not Found: /
|
||||||
|
[WARNING][2025-05-27 09:11:32,616][log.py:248]Not Found: /favicon.ico
|
||||||
|
[WARNING][2025-05-27 09:13:04,921][log.py:248]Not Found: /
|
||||||
|
[WARNING][2025-05-27 09:50:50,827][log.py:248]Unauthorized: /api/system/getInfo
|
||||||
|
[WARNING][2025-05-27 09:50:50,894][log.py:248]Unauthorized: /api/system/logout
|
||||||
|
[WARNING][2025-05-27 09:50:59,888][backend.py:91]Caught LDAPError looking up user: SERVER_DOWN({'result': -1, 'desc': "Can't contact LDAP server", 'ctrls': []})
|
||||||
|
[WARNING][2025-05-28 09:24:15,443][log.py:248]Unauthorized: /api/system/getInfo
|
||||||
|
[WARNING][2025-05-28 09:24:15,480][log.py:248]Unauthorized: /api/system/logout
|
||||||
|
[WARNING][2025-05-28 09:24:26,068][backend.py:91]Caught LDAPError looking up user: SERVER_DOWN({'result': -1, 'desc': "Can't contact LDAP server", 'ctrls': []})
|
||||||
|
[WARNING][2025-05-28 18:35:30,083][log.py:248]Not Found: /api/project/testDemand/priorityReplace/
|
||||||
|
[WARNING][2025-05-28 18:35:42,929][log.py:248]Not Found: /api/project/testDemand/priorityReplace/
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ django-ninja-extra~=0.30.0
|
|||||||
django-ninja-jwt~=5.3.7
|
django-ninja-jwt~=5.3.7
|
||||||
django-tinymce~=4.1.0
|
django-tinymce~=4.1.0
|
||||||
PyJWT~=2.10.1
|
PyJWT~=2.10.1
|
||||||
cryptography~=44.0.3
|
cryptography~=45.0.3
|
||||||
ninja-schema~=0.14.2
|
ninja-schema~=0.14.2
|
||||||
user-agents~=2.2.0
|
user-agents~=2.2.0
|
||||||
numpy~=2.2.5
|
numpy~=2.2.5
|
||||||
|
|||||||
Reference in New Issue
Block a user