Merge pull request #240 feature-NEWDWH2021-1153 into develop
This commit is contained in:
commit
4fc66bf48d
@ -73,7 +73,8 @@ class BioViewModel(BaseModel):
|
||||
if self.form_data.rec_whs_cd is None:
|
||||
return ''
|
||||
|
||||
form_wholesaler_full_name = f'{self.form_data.rec_whs_cd}-{self.form_data.rec_whs_sub_cd}:{self.form_data.whs_name}'
|
||||
form_wholesaler_full_name = \
|
||||
f'{self.form_data.rec_whs_cd}-{self.form_data.rec_whs_sub_cd}:{self.form_data.whs_name}'
|
||||
|
||||
return form_wholesaler_full_name
|
||||
|
||||
@ -81,7 +82,8 @@ class BioViewModel(BaseModel):
|
||||
if not self.is_form_submitted():
|
||||
return ''
|
||||
|
||||
form_wholesaler_full_name = f'{self.form_data.rec_whs_cd}-{self.form_data.rec_whs_sub_cd}:{self.form_data.whs_name}'
|
||||
form_wholesaler_full_name = \
|
||||
f'{self.form_data.rec_whs_cd}-{self.form_data.rec_whs_sub_cd}:{self.form_data.whs_name}'
|
||||
|
||||
return self._selected_value(form_wholesaler_full_name, selected_wholesaler)
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ from src.model.request.ultmarc_doctor import UltmarcDoctorSearchModel
|
||||
from src.system_var import environment
|
||||
|
||||
|
||||
class UltmarcDoctorViewModel(BaseModel):
|
||||
class UltmarcDoctorSearchViewModel(BaseModel):
|
||||
subtitle: str = '医師検索一覧'
|
||||
is_batch_processing: Optional[bool]
|
||||
prefc_models: list[PrefcMasterModel]
|
||||
@ -17,9 +17,21 @@ class UltmarcDoctorViewModel(BaseModel):
|
||||
form_data: Optional[UltmarcDoctorSearchModel]
|
||||
|
||||
def ultmarc_data_json_str(self):
|
||||
"""アルトマーク医師データの検索結果を指定された件数ごとに分割しながら返す"""
|
||||
def date_handler(obj):
|
||||
"""json.dumpsの日付項目のフォーマットハンドラ"""
|
||||
return obj.isoformat() if hasattr(obj, 'isoformat') else obj
|
||||
return json.dumps([model.dict() for model in self.doctor_data], ensure_ascii=False, default=date_handler)
|
||||
|
||||
search_data_list = [model.dict() for model in self.doctor_data]
|
||||
search_data_len = len(search_data_list)
|
||||
# 呼び出し一回あたりの分割数
|
||||
part_size = 50
|
||||
for i in range(0, search_data_len, part_size):
|
||||
json_str = json.dumps(search_data_list[i:i + part_size], ensure_ascii=False, default=date_handler)
|
||||
# JavaScriptに埋め込むため、クォートをエスケープ
|
||||
json_str = json_str.replace("'", "\\'")
|
||||
json_str = json_str.replace('\\"', '\\\\"')
|
||||
yield json_str
|
||||
|
||||
# ページネーションのページ番号
|
||||
# 検索時は最初のページを表示する
|
||||
@ -10,7 +10,7 @@ from src.model.request.ultmarc_inst import UltmarcInstSearchModel
|
||||
from src.system_var import environment
|
||||
|
||||
|
||||
class UltmarcInstViewModel(BaseModel):
|
||||
class UltmarcInstSearchViewModel(BaseModel):
|
||||
subtitle: str = '施設検索一覧'
|
||||
is_batch_processing: Optional[bool]
|
||||
prefc_models: list[PrefcMasterModel]
|
||||
@ -19,9 +19,21 @@ class UltmarcInstViewModel(BaseModel):
|
||||
form_data: Optional[UltmarcInstSearchModel]
|
||||
|
||||
def ultmarc_data_json_str(self):
|
||||
"""アルトマーク施設データの検索結果を指定された件数ごとに分割しながら返す"""
|
||||
def date_handler(obj):
|
||||
"""json.dumpsの日付項目のフォーマットハンドラ"""
|
||||
return obj.isoformat() if hasattr(obj, 'isoformat') else obj
|
||||
return json.dumps([model.dict() for model in self.inst_data], ensure_ascii=False, default=date_handler)
|
||||
|
||||
search_data_list = [model.dict() for model in self.inst_data]
|
||||
search_data_len = len(search_data_list)
|
||||
# 呼び出し一回あたりの分割数
|
||||
part_size = 50
|
||||
for i in range(0, search_data_len, part_size):
|
||||
json_str = json.dumps(search_data_list[i:i + part_size], ensure_ascii=False, default=date_handler)
|
||||
# JavaScriptに埋め込むため、クォートをエスケープ
|
||||
json_str = json_str.replace("'", "\\'")
|
||||
json_str = json_str.replace('\\"', '\\\\"')
|
||||
yield json_str
|
||||
|
||||
# ページネーションのページ番号
|
||||
# 検索時は最初のページを表示する
|
||||
@ -3,10 +3,12 @@ from src.model.request.ultmarc_doctor import UltmarcDoctorSearchModel
|
||||
from src.model.request.ultmarc_inst import UltmarcInstSearchModel
|
||||
from src.model.view.ultmarc_doctor_info_view_model import \
|
||||
UltmarcDoctorInfoViewModel
|
||||
from src.model.view.ultmarc_doctor_view_model import UltmarcDoctorViewModel
|
||||
from src.model.view.ultmarc_doctor_search_view_model import \
|
||||
UltmarcDoctorSearchViewModel
|
||||
from src.model.view.ultmarc_inst_info_view_model import \
|
||||
UltmarcInstInfoViewModel
|
||||
from src.model.view.ultmarc_inst_view_model import UltmarcInstViewModel
|
||||
from src.model.view.ultmarc_inst_search_view_model import \
|
||||
UltmarcInstSearchViewModel
|
||||
from src.repositories.base_repository import BaseRepository
|
||||
from src.repositories.inst_master_repository import InstDivMasterRepository
|
||||
from src.repositories.prefc_master_repository import PrefcMasterRepository
|
||||
@ -70,12 +72,12 @@ class UltmarcViewService(BaseService):
|
||||
#########################
|
||||
def prepare_ultmarc_doctor_search_view(
|
||||
self
|
||||
) -> UltmarcDoctorViewModel:
|
||||
) -> UltmarcDoctorSearchViewModel:
|
||||
# 医師一覧画面の表示データ取得
|
||||
# 都道府県リストを取得
|
||||
prefcs = self.prefc_repository.fetch_all()
|
||||
|
||||
ultmarc = UltmarcDoctorViewModel(
|
||||
ultmarc = UltmarcDoctorSearchViewModel(
|
||||
prefc_models=prefcs
|
||||
)
|
||||
return ultmarc
|
||||
@ -118,14 +120,14 @@ class UltmarcViewService(BaseService):
|
||||
#########################
|
||||
def prepare_ultmarc_inst_search_view(
|
||||
self
|
||||
) -> UltmarcInstViewModel:
|
||||
) -> UltmarcInstSearchViewModel:
|
||||
# 施設一覧画面の表示データ取得
|
||||
# 都道府県リストを取得
|
||||
prefcs = self.prefc_repository.fetch_all()
|
||||
# 施設区分リストを取得
|
||||
inst_div = self.inst_div_repository.fetch_all()
|
||||
|
||||
ultmarc = UltmarcInstViewModel(
|
||||
ultmarc = UltmarcInstSearchViewModel(
|
||||
prefc_models=prefcs,
|
||||
inst_div_models=inst_div
|
||||
)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/* Bootstrap 5.10以降、box-sizingのデフォルト値によってテーブルがずれるため、このページ限定的にリセット */
|
||||
/* @see https://bootstrap-guide.com/content/reboot#page-defaults */
|
||||
*, ::after, ::before {
|
||||
box-sizing: initial;
|
||||
box-sizing: revert;
|
||||
}
|
||||
|
||||
body {
|
||||
|
||||
@ -164,14 +164,8 @@
|
||||
<script type="text/javascript">
|
||||
// <! --ページネーションの作成-- >
|
||||
$(function() {
|
||||
let searchResultData = [];
|
||||
// {% if not ultmarc.is_data_overflow_max_length() and not ultmarc.is_data_empty() %}
|
||||
// スピナー出さない場合は以下、エスケープせず埋め込む
|
||||
// {% autoescape False%}
|
||||
const searchResultString = '{{ultmarc.ultmarc_data_json_str()}}';
|
||||
// {% endautoescape%}
|
||||
searchResultData = JSON.parse(searchResultString);
|
||||
// {% endif %}
|
||||
const searchResultData = generateSearchResult();
|
||||
if (searchResultData.length == 0) return;
|
||||
|
||||
// 検索条件をセッションに入れる
|
||||
sessionStorage.clear();
|
||||
@ -191,9 +185,7 @@
|
||||
let pagination_page_number = Number('{{ultmarc.init_pagination_page_number()}}');
|
||||
|
||||
$(".pagination").pagination({
|
||||
dataSource: function(done) {
|
||||
done(searchResultData)
|
||||
},
|
||||
dataSource: searchResultData,
|
||||
pageNumber: pagination_page_number, // 初期ページ番号
|
||||
pageSize: 50, //表示するコンテンツ数
|
||||
pageRange: 1, //選択されているページネーション番号の両隣に表示する個数
|
||||
@ -205,6 +197,22 @@
|
||||
callback: function(data, pagination) {
|
||||
sessionStorage.setItem('pagination_page_number',pagination.pageNumber);
|
||||
$('#result_data').html(pagination_content(data));
|
||||
$('.paginationjs-pages > ul > li').not('.disabled,.active').each(function(index, val) {
|
||||
// paginationにtabindexをつける
|
||||
$(val).attr('tabindex', '0')
|
||||
// Enterキー押下時に要素をクリックできるようにイベントを付加する
|
||||
$(val).on('keypress', function(e) {
|
||||
if (e.code === 'Enter') {
|
||||
$(e.target).click()
|
||||
$(val).off('keypress')
|
||||
return false
|
||||
}
|
||||
$(val).off('keypress')
|
||||
})
|
||||
})
|
||||
// ページ送りしたときにヘッダがずれるのを修正
|
||||
FixedMidashi.remove();
|
||||
FixedMidashi.create();
|
||||
}
|
||||
})
|
||||
});
|
||||
@ -247,6 +255,19 @@
|
||||
})
|
||||
}
|
||||
|
||||
function generateSearchResult(){
|
||||
const searchResultData = []
|
||||
// {% if ultmarc.is_form_submitted() and not (ultmarc.is_data_overflow_max_length() or ultmarc.is_data_empty()) %}
|
||||
// {% autoescape False%}
|
||||
// ジェネレータですこしずつ取得してリストに詰める
|
||||
// {% for ultmarc_data_json_str in ultmarc.ultmarc_data_json_str() %}
|
||||
searchResultData.push(...JSON.parse('{{ultmarc_data_json_str}}'))
|
||||
// {% endfor %}
|
||||
// {% endautoescape%}
|
||||
// {% endif %}
|
||||
return searchResultData
|
||||
}
|
||||
|
||||
// チェックボックスのチェックされている場合、医師情報ボタンを活性化させる
|
||||
function resultBtDisabled(){
|
||||
var checkboxes = $('input[name="data"]:checked').length;
|
||||
|
||||
@ -165,15 +165,8 @@
|
||||
// <! --ページネーションの作成-- >
|
||||
$(function() {
|
||||
|
||||
let searchResultData = [];
|
||||
// {% if not ultmarc.is_data_overflow_max_length() and not ultmarc.is_data_empty() %}
|
||||
// スピナー出さない場合は以下、エスケープせず埋め込む
|
||||
// {% autoescape False%}
|
||||
const searchResultString = '{{ultmarc.ultmarc_data_json_str()}}';
|
||||
// {% endautoescape%}
|
||||
searchResultData = JSON.parse(searchResultString);
|
||||
// {% endif %}
|
||||
|
||||
const searchResultData = generateSearchResult();
|
||||
if (searchResultData.length == 0) return;
|
||||
|
||||
// 検索条件をセッションに入れる
|
||||
sessionStorage.clear();
|
||||
@ -189,11 +182,8 @@
|
||||
|
||||
// ページネーションのページ番号取得
|
||||
let pagination_page_number = Number('{{ultmarc.init_pagination_page_number()}}');
|
||||
|
||||
$(".pagination").pagination({
|
||||
dataSource: function(done) {
|
||||
done(searchResultData)
|
||||
},
|
||||
dataSource: searchResultData,
|
||||
pageNumber: pagination_page_number, // 初期ページ番号
|
||||
pageSize: 50, //表示するコンテンツ数
|
||||
pageRange: 2, //選択されているページネーション番号の両隣に表示する個数
|
||||
@ -205,6 +195,22 @@
|
||||
callback: function(data, pagination) {
|
||||
sessionStorage.setItem('pagination_page_number',pagination.pageNumber);
|
||||
$('#result_data').html(pagination_content(data))
|
||||
$('.paginationjs-pages > ul > li').not('.disabled,.active').each(function(index, val) {
|
||||
// paginationにtabindexをつける
|
||||
$(val).attr('tabindex', '0')
|
||||
// Enterキー押下時に要素をクリックできるようにイベントを付加する
|
||||
$(val).on('keypress', function(e) {
|
||||
if (e.code === 'Enter') {
|
||||
$(e.target).click()
|
||||
$(val).off('keypress')
|
||||
return false
|
||||
}
|
||||
$(val).off('keypress')
|
||||
})
|
||||
})
|
||||
// ページ送りしたときにヘッダがずれるのを修正
|
||||
FixedMidashi.remove();
|
||||
FixedMidashi.create();
|
||||
}
|
||||
})
|
||||
});
|
||||
@ -243,6 +249,19 @@
|
||||
})
|
||||
}
|
||||
|
||||
function generateSearchResult(){
|
||||
const searchResultData = []
|
||||
// {% if ultmarc.is_form_submitted() and not (ultmarc.is_data_overflow_max_length() or ultmarc.is_data_empty()) %}
|
||||
// {% autoescape False%}
|
||||
// ジェネレータですこしずつ取得してリストに詰める
|
||||
// {% for ultmarc_data_json_str in ultmarc.ultmarc_data_json_str() %}
|
||||
searchResultData.push(...JSON.parse('{{ultmarc_data_json_str}}'))
|
||||
// {% endfor %}
|
||||
// {% endautoescape%}
|
||||
// {% endif %}
|
||||
return searchResultData
|
||||
}
|
||||
|
||||
// チェックボックスのチェックされている場合、施設情報ボタンを活性化させる
|
||||
function resultBtDisabled(){
|
||||
var checkboxes = $('input[name="data"]:checked').length;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user