新增:影响域分析-软件更改部分
This commit is contained in:
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
from pathlib import Path
|
||||
from copy import deepcopy
|
||||
from typing import Union
|
||||
from typing import Union, TypedDict, Optional
|
||||
from ninja_extra import api_controller, ControllerBase, route
|
||||
from django.db import transaction
|
||||
from django.shortcuts import get_object_or_404
|
||||
@@ -240,26 +240,31 @@ class GenerateControllerHSM(ControllerBase):
|
||||
## 先查找是否有影响域分析填写
|
||||
area_qs = InfluenceArea.objects.filter(round=hround)
|
||||
## 如果存在则查询items
|
||||
item_render_list = []
|
||||
if area_qs.exists():
|
||||
area_obj = area_qs.first()
|
||||
items_qs = area_obj.influence_items.all()
|
||||
if items_qs.exists():
|
||||
# 遍历items
|
||||
item_render_list = []
|
||||
index = 1
|
||||
for item in items_qs:
|
||||
# 1.处理关联case - 找第一轮cases
|
||||
case_str_list = []
|
||||
for case in project_obj.pcField.filter(key__in=item.effect_cases):
|
||||
case_ident_index = str(int(case.key.split("-")[-1]) + 1).zfill(3)
|
||||
case_str_list.append("_".join(["YL", get_str_abbr(case.test.testType, "testType"), case.ident, case_ident_index]))
|
||||
# 2.处理富文本框
|
||||
parser = RichParser(item.change_des)
|
||||
item_dict = {
|
||||
"change_type": item.change_type,
|
||||
"change_influ": item.change_influ,
|
||||
"case_str_list": case_str_list,
|
||||
"change_des": item.change_des, # 富文本未处理
|
||||
"change_des": parser.get_final_list(doc, img_size=40, height=30), # 富文本未处理
|
||||
"index": str(index),
|
||||
}
|
||||
index = index + 1
|
||||
item_render_list.append(item_dict)
|
||||
|
||||
# 将影响域分析加入context
|
||||
context_round['influence'] = item_render_list # noqa
|
||||
# 如果存在这个轮次的需求文档,则查询上个版本
|
||||
last_xq_version = ""
|
||||
if xq_dut:
|
||||
|
||||
Binary file not shown.
@@ -7,7 +7,7 @@ from bs4.element import Tag, NavigableString
|
||||
import base64
|
||||
import io
|
||||
from docxtpl import InlineImage
|
||||
from docx.shared import Mm, Cm
|
||||
from docx.shared import Mm
|
||||
import re
|
||||
|
||||
# text.replace('\xa0', ' '))
|
||||
@@ -82,11 +82,12 @@ class RichParser:
|
||||
if isinstance(oneline, list):
|
||||
final_list.append({'isTable': True, 'data': oneline})
|
||||
continue
|
||||
if oneline.startswith("data:image/png;base64"):
|
||||
if oneline.startswith("data:image/png;base64") or oneline.startswith("data:image/jpeg;base64,") or oneline.startswith(
|
||||
"data:image/jpg;base64,"):
|
||||
base64_bytes = base64.b64decode(oneline.replace("data:image/png;base64,", ""))
|
||||
# ~~~设置了固定宽度、高度~~~
|
||||
final_list.append(
|
||||
InlineImage(doc, io.BytesIO(base64_bytes), width=Mm(img_size), height=Mm(height)))
|
||||
inline_image = InlineImage(doc, io.BytesIO(base64_bytes), width=Mm(img_size), height=Mm(height))
|
||||
final_list.append(inline_image)
|
||||
else:
|
||||
final_list.append(oneline)
|
||||
if len(final_list) <= 0:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -405,7 +405,7 @@ class CaseController(ControllerBase):
|
||||
# dut -> design
|
||||
data_list = []
|
||||
for dut in previous_round_obj.rdField.all():
|
||||
dut_dict = {'label': dut.name, 'value': dut.id, 'children': []}
|
||||
dut_dict = {'label': dut.name, 'value': dut.id, 'key': dut.key, 'children': []}
|
||||
for design in dut.rsField.all():
|
||||
design_dict = {'label': design.name, 'value': design.id, 'key': design.key, 'children': []}
|
||||
for case in design.dcField.all():
|
||||
@@ -413,4 +413,4 @@ class CaseController(ControllerBase):
|
||||
design_dict['children'].append(case_dict)
|
||||
dut_dict['children'].append(design_dict)
|
||||
data_list.append(dut_dict)
|
||||
return ChenResponse(message='获取成功', data=data_list)
|
||||
return ChenResponse(message='获取成功', data=data_list)
|
||||
|
||||
@@ -114,7 +114,6 @@ class RoundController(ControllerBase):
|
||||
@route.post("/round/create_influence", url_name="round-influence-create")
|
||||
@transaction.atomic
|
||||
def post_influence(self, data: InfluenceInputSchema):
|
||||
print(data)
|
||||
round_obj = Round.objects.filter(project_id=data.id, key=data.round_key).first()
|
||||
influence_area_qs = InfluenceArea.objects.filter(round=round_obj)
|
||||
if influence_area_qs.exists():
|
||||
|
||||
Reference in New Issue
Block a user