@@ -768,7 +768,7 @@ def gen_antd_pages(project_name_settings, user_label_list, focus_model=None, tem
768768 opera = opera .replace ("$时间处理占位$" , "" .join (date_row_list ))
769769 columns .append (opera )
770770 dest_path = f'{ os .path .dirname (__file__ )} /antd_page_templates/{ template_type } '
771- with open (f'{ dest_path } /index.jsx' ) as fr :
771+ with open (f'{ dest_path } /index.jsx' , encoding = 'utf-8' ) as fr :
772772
773773 content = fr .read ()
774774 if fileds_num > 8 :
@@ -872,7 +872,7 @@ def gen_antd_pages(project_name_settings, user_label_list, focus_model=None, tem
872872 new_content = new_content .replace ("$Password占位$" , '' )
873873 new_content = new_content .replace ("$更新密码方法占位$" , '' )
874874 new_content = new_content .replace ("$Password更新Form$" , '' )
875- with open (f'{ dest_path } /service.js' ) as fr :
875+ with open (f'{ dest_path } /service.js' , encoding = 'utf-8' ) as fr :
876876 content = fr .read ()
877877
878878 new_services = content .replace ("$占位path$" , get_lower_case_name (model_name ))
@@ -889,21 +889,21 @@ def gen_antd_pages(project_name_settings, user_label_list, focus_model=None, tem
889889}""" )
890890 else :
891891 new_services = new_services .replace ("$更新密码service占位$" , "" )
892- with open (f'{ dest_path } /components/CreateForm.jsx' ) as fr :
892+ with open (f'{ dest_path } /components/CreateForm.jsx' , encoding = 'utf-8' ) as fr :
893893 create_form = fr .read ()
894894 create_form = create_form .replace ("$占位模型显示名$" , str (model_ver_name ))
895895 if fileds_num > 8 :
896896 create_form = create_form .replace ("$宽度占位$" , 'width={1200}' )
897897 else :
898898 create_form = create_form .replace ("$宽度占位$" , "width={800}" )
899- with open (f'{ dest_path } /components/UpdateForm.jsx' ) as fr :
899+ with open (f'{ dest_path } /components/UpdateForm.jsx' , encoding = 'utf-8' ) as fr :
900900 update_form = fr .read ()
901901 update_form = update_form .replace ("$占位模型显示名$" , str (model_ver_name ))
902902 if fileds_num > 8 :
903903 update_form = update_form .replace ("$宽度占位$" , 'width={1200}' )
904904 else :
905905 update_form = update_form .replace ("$宽度占位$" , "width={800}" )
906- with open (f'{ dest_path } /components/UpdatePasswordForm.jsx' ) as fr :
906+ with open (f'{ dest_path } /components/UpdatePasswordForm.jsx' , encoding = 'utf-8' ) as fr :
907907 change_password_form = fr .read ()
908908
909909 target_path = f'{ settings .BASE_DIR } /tyadmin/src/pages/AutoGenPage'
@@ -913,16 +913,16 @@ def gen_antd_pages(project_name_settings, user_label_list, focus_model=None, tem
913913 cur_path_co = f'{ target_path } /{ model_name } List/components'
914914 if not os .path .exists (cur_path_co ):
915915 os .mkdir (cur_path_co )
916- with open (f'{ target_path } /{ model_name } List/index.jsx' , 'w' ) as fw :
916+ with open (f'{ target_path } /{ model_name } List/index.jsx' , 'w' , encoding = 'utf-8' ) as fw :
917917 fw .write (new_content )
918- with open (f'{ target_path } /{ model_name } List/service.js' , 'w' ) as fw :
918+ with open (f'{ target_path } /{ model_name } List/service.js' , 'w' , encoding = 'utf-8' ) as fw :
919919 fw .write (new_services )
920- with open (f'{ target_path } /{ model_name } List/components/CreateForm.jsx' , 'w' ) as fw :
920+ with open (f'{ target_path } /{ model_name } List/components/CreateForm.jsx' , 'w' , encoding = 'utf-8' ) as fw :
921921 fw .write (create_form )
922- with open (f'{ target_path } /{ model_name } List/components/UpdateForm.jsx' , 'w' ) as fw :
922+ with open (f'{ target_path } /{ model_name } List/components/UpdateForm.jsx' , 'w' , encoding = 'utf-8' ) as fw :
923923 fw .write (update_form )
924924 if one ._meta .app_label == user ._meta .app_label :
925- with open (f'{ target_path } /{ model_name } List/components/UpdatePasswordForm.jsx' , 'w' ) as fw :
925+ with open (f'{ target_path } /{ model_name } List/components/UpdatePasswordForm.jsx' , 'w' , encoding = 'utf-8' ) as fw :
926926 fw .write (change_password_form )
927927
928928
0 commit comments