对比报告增加4.2配时方案表
Signed-off-by: yinzijian <yinzijian@haomozhixing.onaliyun.com>
This commit is contained in:
parent
2739f5a6b5
commit
6a43b0b79f
Binary file not shown.
|
|
@ -348,9 +348,8 @@ class DocDocumentContrastCtx:
|
|||
case 'part4':
|
||||
if self.tpl_paragraph[part_key]['visible'] == 0:
|
||||
continue
|
||||
i += 1
|
||||
table_sort = 0
|
||||
table_sort += 1
|
||||
i += 1
|
||||
table_data = []
|
||||
context[part_key] = table_data
|
||||
context['part4_key'] = str(i)
|
||||
|
|
@ -365,9 +364,36 @@ class DocDocumentContrastCtx:
|
|||
if self.tpl_paragraph[part_key]['part4_2'] == 1:
|
||||
item_data = {
|
||||
'part_name': self.tpl_paragraph_map['part4_2'],
|
||||
'part_n': 'part4_1',
|
||||
'data': [],
|
||||
'part_n': 'part4_2',
|
||||
'table_1': [],
|
||||
'table_1_sort': 1,
|
||||
'table_2': [],
|
||||
'max': 0
|
||||
}
|
||||
#优化前
|
||||
for item_table_value in self.tpl_data['part4_2'].table1:
|
||||
item_table_data = {
|
||||
'title': item_table_value.item1,
|
||||
'cycle': item_table_value.item2,
|
||||
'stage': item_table_value.table1,
|
||||
'stage_time': item_table_value.table2,
|
||||
}
|
||||
max_len = len(item_table_value.table1)
|
||||
if max_len > item_data['max']:
|
||||
item_data['max'] = max_len
|
||||
item_data['table_1'].append(item_table_data)
|
||||
#优化后
|
||||
for item_table_value in self.tpl_data['part4_2'].table2:
|
||||
item_table_data = {
|
||||
'title': item_table_value.item1,
|
||||
'cycle': item_table_value.item2,
|
||||
'stage': item_table_value.table1,
|
||||
'stage_time': item_table_value.table2,
|
||||
}
|
||||
max_len = len(item_table_value.table1)
|
||||
if max_len > item_data['max']:
|
||||
item_data['max'] = max_len
|
||||
item_data['table_2'].append(item_table_data)
|
||||
table_data.append(item_data)
|
||||
case 'part5':
|
||||
if self.tpl_paragraph[part_key]['visible'] == 0:
|
||||
|
|
@ -428,6 +454,7 @@ class DocDocumentContrastCtx:
|
|||
# set_font(para, para.text, '仿宋_GB2312', 30,font_color=(255, 0, 0), bg_color='FFFF00')
|
||||
# for para in self.doc.paragraphs:
|
||||
# set_font(para, para.text, '仿宋', 14)
|
||||
# print(context['part4'])
|
||||
# self.doc.save(self.get_static_file_path() + f"/{file_name}.docx")
|
||||
# return f"/api/phase_template_download?nodeid={self.nodeid}&type=report&file_name={file_name}"
|
||||
|
||||
|
|
@ -471,7 +498,7 @@ def doc_demo_contrast():
|
|||
doc1.tpl_paragraph['part5']['visible'] = 1
|
||||
doc1.title = '清盛大道与龙江路交叉口'
|
||||
#自动截图
|
||||
doc1.cut_image = 1 #开启
|
||||
doc1.cut_image = 0 #开启
|
||||
doc1.area_id = 530101
|
||||
doc1.crossid = "CR_10264777_2509810"
|
||||
doc1.cross_name = "玉峰路与陈家营路交叉口"
|
||||
|
|
@ -561,7 +588,28 @@ def doc_demo_contrast():
|
|||
doc1.tpl_data['part3_1'].table = [detail1, detail2]
|
||||
|
||||
#==========4优化方案=============
|
||||
|
||||
item_table1 = PartDetail()
|
||||
item_table1.item1 = '06:30-07:30'
|
||||
item_table1.item2 = '46'
|
||||
item_table1.table1 = ['西直左', '西直行', '北直行', '东直行', '南北直行']
|
||||
item_table1.table2 = ['30', '20', '11', '12', '13', '24', '3','4','5','6','7','8','16','17','18']
|
||||
item_table2 = PartDetail()
|
||||
item_table2.item1 = '07:30-09:30'
|
||||
item_table2.item2 = '38'
|
||||
item_table2.table1 = ['西直左', '西直行', '北直行', '东直行']
|
||||
item_table2.table2 = ['30', '20', '11', '12', '13', '24', '3','4','5','6','7','9']
|
||||
item_table3 = PartDetail()
|
||||
item_table3.item1 = '06:30-07:30'
|
||||
item_table3.item2 = '129'
|
||||
item_table3.table1 = ['西直左', '西直行', '北直行', '东直行']
|
||||
item_table3.table2 = ['3', '4', '5', '6', '7', '8', '9','10','11','12','13','14']
|
||||
item_table4 = PartDetail()
|
||||
item_table4.item1 = '07:30-09:30'
|
||||
item_table4.item2 = '138'
|
||||
item_table4.table1 = ['西直左', '西直行', '北直行', '东直行']
|
||||
item_table4.table2 = ['1', '2', '3', '4', '5', '6', '7','8','9','10','11','12']
|
||||
doc1.tpl_data['part4_2'].table1 = [item_table1, item_table2] #优化前
|
||||
doc1.tpl_data['part4_2'].table2 = [item_table3, item_table4] #优化后
|
||||
#==========5优化后效果对比==========
|
||||
detail5_1_1 = PartDetail()
|
||||
detail5_1_1.detail = '路口服务水平由?级提升为?级,提升?个等级;'
|
||||
|
|
|
|||
|
|
@ -985,7 +985,7 @@ if __name__ == '__main__':
|
|||
attrs = []
|
||||
attrs.append(CutReportImgColumn(
|
||||
crossid='CR_10264777_2509810',
|
||||
cross_name='玉峰路与陈家营路交叉口',
|
||||
cross_name='104国道与178县道交叉口',
|
||||
time_list=[['2026-05-01', '2026-05-04'],['2026-05-06', '2026-05-09']],
|
||||
tp_name='02:00-03:00',
|
||||
walk=1,
|
||||
|
|
|
|||
Loading…
Reference in New Issue