feat: レビュー指摘対応

This commit is contained in:
高木要 2023-07-18 17:58:22 +09:00
parent 34e5be3e68
commit e7c78ec8ae
4 changed files with 10 additions and 3 deletions

View File

@ -136,8 +136,10 @@ async def inst_emp_csv_upload(
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail=constants.LOGOUT_REASON_BACKUP_PROCESSING)
# 画面表示用のモデル
csv_buf = await csv_upload_form.csv_file.read()
mainte_csv_up = master_mainte_service.prepare_mainte_csv_up_view(
TextIOWrapper(BytesIO(await csv_upload_form.csv_file.read()), encoding='utf-8'),
TextIOWrapper(BytesIO(csv_buf), encoding='utf-8'),
len(csv_buf),
csv_upload_form.csv_file.filename,
csv_upload_form)
# セッション書き換え

View File

@ -59,6 +59,7 @@ class MasterMainteService(BaseService):
def prepare_mainte_csv_up_view(self,
file: TextIOWrapper,
file_size: int,
csv_file_name: str,
csv_upload_form: MasterMainteCsvUpModel) -> InstEmpCsvUploadViewModel:
@ -83,6 +84,8 @@ class MasterMainteService(BaseService):
# CSVファイル0件(ヘッダ行のみ)チェック
if len(csv_items.lines) == 0:
error_message_list.append('選択されたExcelファイルの2行目以降に値が記入されておりません。')
elif file_size >= constants.MENTE_CSV_UPLOAD_MAX_FILE_SIZE:
error_message_list.append('選択されたCSVファイルサイズが大きいです。100MB未満にしてください。')
else:
for row_item in csv_items:
error_message_list.extend([data for data in row_item.validate()])

View File

@ -249,3 +249,5 @@ MENTE_CSV_DOWNLOAD_HEADER = [
]
MENTE_CSV_DOWNLOAD_FILE_NAME = 'instEmpData.csv'
MENTE_CSV_UPLOAD_MAX_FILE_SIZE = 104857600

View File

@ -14,13 +14,13 @@
formBtDisabled();
// DatePickerを有効化
enableDatePicker();
{% if mainte_csv_dl.is_search and mainte_csv_dl.data_count > 0 and mainte_csv_dl.is_download_file_url_empty() == False %}
// CSV自動ダウンロード処理
{% if mainte_csv_dl.is_search and mainte_csv_dl.data_count > 0 and mainte_csv_dl.is_download_file_url_empty == False %}
var link_tag = document.createElement("a");
link_tag.Target="_blank";
link_tag.id = "download_url_link";
link_tag.style.display = 'none';
link_tag.setAttribute("href", "{{mainte_csv_dl.download_file_url | safe}}");
link_tag.setAttribute("type", "hidden");
link_tag.setAttribute("download", "{{mainte_csv_dl.file_name}}");
document.getElementById("notification").appendChild(link_tag);
document.getElementById("download_url_link").click();