Browse Source

ssss

Signed-off-by: Binren Zhnag <zhangbr@elab-plus.com>
Binren Zhnag 4 năm trước cách đây
mục cha
commit
de721e459f
2 tập tin đã thay đổi với 6 bổ sung6 xóa
  1. 3 3
      jianye_report.py
  2. 3 3
      report_file_utils.py

+ 3 - 3
jianye_report.py

@@ -258,15 +258,15 @@ class JianYeReport(object):
                                                     table_1[32], table_1[33], table_1[34], table_1[35]
                                                     )
                     table_2.sort(key=lambda obj: obj[2])
-                    rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], save_path)
+                    rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path)
                 elif customer_type == 1:
                     # 项目
                     table_2 = self.house_data(self.get_house_ids(ids))
-                    rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], save_path)
+                    rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path)
                 elif customer_type == 3:
                     # 区域
                     table_2 = self.house_data(self.get_house_ids(ids))
-                    rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], save_path)
+                    rfu.create_excel_file(table_2, self.sheet_names_1, title, [self.head_1, self.head_1, self.head_1], file_path)
                 else:
                     pass
                 send_mail_info.append([title, content, mail, file_path, title + '.xlsx', name])

+ 3 - 3
report_file_utils.py

@@ -113,7 +113,7 @@ class ReportFileUtils:
         """
         self.horizontal_cell_merge(ws, start_row, end_row, start_col, end_col, '')
 
-    def create_excel_file(self, data, sheet_names, title, headers, save_path):
+    def create_excel_file(self, data, sheet_names, title, headers, file_path):
         """
             生成excel文件, data, sheet_names,headers 三者在数量上要对应
         :param data: 数据
@@ -168,7 +168,7 @@ class ReportFileUtils:
             # 写入数据
             start_row = 2
             self.insert_cells(ws, d, start_row, 0, len(d[0]))
-        self.wb.save(save_path + '/' + title)
+        self.wb.save(file_path)
 
 
 if __name__ == '__main__':
@@ -185,4 +185,4 @@ if __name__ == '__main__':
     headers = [['区域', '城市', '项目名称', '推荐人id', '姓名', '手机号', '火电', '注册', '宝贝'],
                ['区域', '城市', '项目名称', '推荐人id', '姓名', '手机号', '火电', '注册', '宝贝'],
                ['区域', '城市', '项目名称', '推荐人id', '姓名', '手机号', '火电', '注册', '宝贝']]
-    rf.create_excel_file(data, sheet_names, title, headers, r'D:\elab\elab_mvp\test')
+    rf.create_excel_file(data, sheet_names, title, headers, r'D:\elab-code\elab_mvp\resources\report_jian\测ss试.xlsx')