datepickerとの戦い
This commit is contained in:
parent
d615b3bca2
commit
f3e6369f50
@ -5,73 +5,6 @@ from src.model.db.base_db_model import BaseDBModel
|
||||
|
||||
|
||||
class BioSalesViewModel(BaseDBModel):
|
||||
# conv_cd: Optional[int]
|
||||
# rec_data: Optional[str]
|
||||
# rec_whs_cd: Optional[str]
|
||||
# rec_whs_sub_cd: Optional[str]
|
||||
# rec_whs_org_cd: Optional[str]
|
||||
# rec_cust_cd: Optional[str]
|
||||
# rec_comm_cd: Optional[str]
|
||||
# rec_tran_kbn: Optional[str]
|
||||
# rev_hsdnymd_wrk: Optional[str]
|
||||
# rev_hsdnymd_srk: Optional[str]
|
||||
# rec_urag_num: Optional[str]
|
||||
# rec_comm_name: Optional[str]
|
||||
# rec_nonyu_fcl_name: Optional[str]
|
||||
# rec_nonyu_fcl_addr: Optional[str]
|
||||
# rec_lot_num: Optional[str]
|
||||
# qty: Optional[str]
|
||||
# rec_ymd: Optional[str]
|
||||
# sale_data_cat: Optional[str]
|
||||
# slip_file_name: Optional[str]
|
||||
# slip_mgt_num: Optional[str]
|
||||
# row_num: Optional[int]
|
||||
# hsdn_ymd: Optional[str]
|
||||
# exec_dt: Optional[str]
|
||||
# v_tran_cd: Optional[int]
|
||||
# tran_kbn_name: Optional[str]
|
||||
# whs_org_cd: Optional[str]
|
||||
# v_whsorg_cd: Optional[str]
|
||||
# whs_org_name: Optional[str]
|
||||
# whs_org_kn: Optional[str]
|
||||
# v_whs_cd: Optional[int]
|
||||
# whs_name: Optional[str]
|
||||
# nonyu_fcl_cd: Optional[str]
|
||||
# v_inst_cd: Optional[str]
|
||||
# v_inst_kn: Optional[str]
|
||||
# v_inst_nm: Optional[str]
|
||||
# v_inst_addr: Optional[str]
|
||||
# comm_cd: Optional[str]
|
||||
# product_name: Optional[str]
|
||||
# whs_rep_comm_name: Optional[str]
|
||||
# whs_rep_nonyu_fcl_name: Optional[str]
|
||||
# whs_rep_nonyu_fcl_addr: Optional[str]
|
||||
# mkr_inf_1: Optional[str]
|
||||
# mkr_cd: Optional[str]
|
||||
# htdnymd_err_kbn: Optional[str]
|
||||
# prd_exis_kbn: Optional[str]
|
||||
# fcl_exis_kbn: Optional[str]
|
||||
# amt: Optional[int]
|
||||
# slip_org_kbn: Optional[str]
|
||||
# bef_slip_mgt_num: Optional[str]
|
||||
# lot_no_err_flg: Optional[str]
|
||||
# iko_flg: Optional[str]
|
||||
# kjyo_ym: Optional[str]
|
||||
# tksnbk_kbn: Optional[str]
|
||||
# fcl_exec_kbn: Optional[str]
|
||||
# rec_sts_kbn: Optional[str]
|
||||
# ins_dt: Optional[datetime]
|
||||
# ins_usr: Optional[str]
|
||||
# dcf_inst_cd: Optional[str]
|
||||
# inst_cd: Optional[str]
|
||||
# inst_name_form: Optional[str]
|
||||
# address: Optional[str]
|
||||
# tel_num: Optional[str]
|
||||
# data_kbn: Optional[str]
|
||||
# ser_no: Optional[str]
|
||||
# lot_num: Optional[str]
|
||||
# expr_dt: Optional[date]
|
||||
# amt_fugo: Optional[str]
|
||||
slip_mgt_num: Optional[str]
|
||||
conv_cdR: Optional[int]
|
||||
rec_whs_cd: Optional[str]
|
||||
|
||||
@ -84,6 +84,7 @@ function selectDropDowList(id, selectedName){
|
||||
function enableDatePicker() {
|
||||
// カレンダーの表示を日曜日始まりに変更
|
||||
flatpickr.l10ns.ja.firstDayOfWeek = 0;
|
||||
|
||||
$('.date_picker').flatpickr(
|
||||
{
|
||||
locale: 'ja', // 日本語カレンダー
|
||||
@ -93,20 +94,22 @@ function enableDatePicker() {
|
||||
)
|
||||
}
|
||||
|
||||
function setDatePicker() {
|
||||
// カレンダーの表示を日曜日始まりに変更
|
||||
flatpickr.l10ns.ja.firstDayOfWeek = 0;
|
||||
|
||||
$(".date_picker").datepicker({
|
||||
locale: 'ja',
|
||||
dateFormat: 'YYY/mm/dd'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// 日付入力チェック
|
||||
// 引数:チェックするテキストボックスNo
|
||||
function autoModifyDate($this){
|
||||
// 日付フォーマットチェック
|
||||
|
||||
if($this.value === "" ||
|
||||
(!$this.value.match(/^\d{4}\/\d{2}\/\d{2}$/) && !$this.value.match(/^\d{4}\d{2}\d{2}$/)))
|
||||
{
|
||||
$this.value = "";
|
||||
return;
|
||||
}
|
||||
|
||||
/** @type { string }*/
|
||||
let strFormat = $this.value;;
|
||||
let strFormat = $this.value;
|
||||
// yyyyMMddの場合→yyyy/MM/dd
|
||||
const datePatternMatches = strFormat.match(/^(\d{4})(\d{2})(\d{2})$/);
|
||||
if (datePatternMatches){
|
||||
@ -117,15 +120,16 @@ function autoModifyDate($this){
|
||||
// 開始日の場合
|
||||
if ($this.name.includes('from')){
|
||||
strFormat = strFormat.replace("00/00", "01/01");
|
||||
strFormat = strFormat.replace("00", "01");
|
||||
strFormat = strFormat.replace("/00", "/01");
|
||||
}
|
||||
// 終了日の場合
|
||||
else if ($this.name.includes('to')){
|
||||
strFormat = strFormat.replace("00/00", "12/31");
|
||||
const date = new Date(strFormat.slice(0, 4), strFormat.slice(5, 7), 0).getDate();
|
||||
strFormat = strFormat.replace("00", date.toString());
|
||||
strFormat = strFormat.replace("/00", "/"+date.toString());
|
||||
}
|
||||
$this.value = strFormat;
|
||||
$this.value = strFormat;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -15,3 +15,5 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/flatpickr/dist/l10n/ja.min.js"></script>
|
||||
<script src="/static/function/businessLogicScript.js"></script>
|
||||
<script src="/static/lib/fixed_midashi.js"></script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/base/jquery-ui.min.css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
|
||||
@ -13,7 +13,8 @@
|
||||
// ボタン、テキストボックス初期化
|
||||
formBtDisabled();
|
||||
// DatePickerを有効化
|
||||
enableDatePicker();
|
||||
setDatePicker();
|
||||
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
@ -55,11 +56,13 @@
|
||||
<input type="text" id="shoribi_start" class="date_picker" name="ctrl_rec_ymd_from"
|
||||
value="{{bio.is_input_rec_ymd_from()}}"
|
||||
onchange="formBtDisabled()"
|
||||
onblur="autoModifyDate(this)"
|
||||
>
|
||||
~
|
||||
<input type="text" id="shoribi_end" class="date_picker" name="ctrl_rec_ymd_to"
|
||||
value="{{bio.is_input_rec_ymd_to()}}"
|
||||
onchange="formBtDisabled()"
|
||||
onblur="autoModifyDate(this)"
|
||||
>
|
||||
</td>
|
||||
</tr>
|
||||
@ -97,11 +100,13 @@
|
||||
<input type="text" id="hsdnymd_start" class="date_picker" name="ctrl_rev_hsdnymd_srk_from"
|
||||
value="{{bio.is_input_rev_hsdnymd_srk_from()}}"
|
||||
onchange="formBtDisabled()"
|
||||
onblur="autoModifyDate(this)"
|
||||
>
|
||||
~
|
||||
<input type="text" id="hsdnymd_end" class="date_picker" name="ctrl_rev_hsdnymd_srk_to"
|
||||
value="{{bio.is_input_rev_hsdnymd_srk_to()}}"
|
||||
onchange="formBtDisabled()"
|
||||
onblur="autoModifyDate(this)"
|
||||
>
|
||||
</td>
|
||||
<td colspan="2">
|
||||
@ -342,6 +347,7 @@
|
||||
`
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<!-- Excel出力モーダル -->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user