維修單 -- 防呆
This commit is contained in:
parent
6103f55001
commit
3275cfbaee
@ -148,15 +148,16 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label" for="power_station_select_modal">電站</label>
|
<label class="form-label" for="power_station_select_modal"><span class="text-danger">*</span>電站</label>
|
||||||
<select class="form-control" id="power_station_select_modal">
|
<select class="form-control" id="power_station_select_modal">
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label" for="work_time_modal">作業日期</label>
|
<label class="form-label" for="work_time_modal"><span class="text-danger">*</span>作業日期</label>
|
||||||
<input class="form-control" id="work_time_modal" type="date" name="work_time_modal" />
|
<input class="form-control" id="work_time_modal" type="date" name="work_time_modal" />
|
||||||
|
<label id="work_time_modal-error" class="" style="z-index:1;color:red;display:none">此為必填欄位</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -164,7 +165,7 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label" for="example-select">狀態</label>
|
<label class="form-label" for="example-select"><span class="text-danger">*</span>狀態</label>
|
||||||
<div>
|
<div>
|
||||||
<div class="custom-control custom-radio custom-control-inline">
|
<div class="custom-control custom-radio custom-control-inline">
|
||||||
<input type="radio" class="custom-control-input ml-auto" id="status_none_complete" name="status_modal" value="0" />
|
<input type="radio" class="custom-control-input ml-auto" id="status_none_complete" name="status_modal" value="0" />
|
||||||
@ -179,9 +180,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="">
|
<div class="">
|
||||||
<label class="form-label" for="work_person_select_modal">執行人員</label>
|
<label class="form-label" for="work_person_select_modal"><span class="text-danger">*</span>執行人員</label>
|
||||||
<select class="form-control" id="work_person_select_modal" multiple="multiple">
|
<select class="form-control" id="work_person_select_modal" multiple="multiple">
|
||||||
</select>
|
</select>
|
||||||
|
<label id="work_person_select_modal-error" class="" style="z-index:1;color:red;display:none">此為必填欄位</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -291,6 +293,7 @@
|
|||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
//#region Date-Picker
|
//#region Date-Picker
|
||||||
|
|
||||||
datepicker = $('#date-range').daterangepicker({
|
datepicker = $('#date-range').daterangepicker({
|
||||||
autoUpdateInput: false,
|
autoUpdateInput: false,
|
||||||
locale: { format: 'YYYY/MM/DD' },
|
locale: { format: 'YYYY/MM/DD' },
|
||||||
@ -597,6 +600,20 @@
|
|||||||
//#endregion
|
//#endregion
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#work_person_select_modal').change(function () {
|
||||||
|
if ($('#work_person_select_modal').val().length == 0) {
|
||||||
|
$('#work_person_select_modal-error').show();
|
||||||
|
} else {
|
||||||
|
$('#work_person_select_modal-error').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#work_time_modal').change(function () {
|
||||||
|
$("#work_time_modal-error").hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getPowerStationCheckBox() {
|
function getPowerStationCheckBox() {
|
||||||
var send_data = {
|
var send_data = {
|
||||||
cityIds: ids
|
cityIds: ids
|
||||||
@ -685,7 +702,8 @@
|
|||||||
$("input[name=status_modal][value='" + 0 + "']").prop('checked', true); //狀態
|
$("input[name=status_modal][value='" + 0 + "']").prop('checked', true); //狀態
|
||||||
$("#record_files_div > .row").empty();
|
$("#record_files_div > .row").empty();
|
||||||
|
|
||||||
|
$('#work_person_select_modal-error').hide();
|
||||||
|
$("#work_time_modal-error").hide();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1026,7 +1044,7 @@
|
|||||||
//#region 表單驗證
|
//#region 表單驗證
|
||||||
$("#record-form").validate({
|
$("#record-form").validate({
|
||||||
rules: {
|
rules: {
|
||||||
work_person_select_modal: {
|
work_time_modal: {
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1035,6 +1053,7 @@
|
|||||||
|
|
||||||
//#region 儲存表單資料
|
//#region 儲存表單資料
|
||||||
function SaveRecord() {
|
function SaveRecord() {
|
||||||
|
if ($('#work_person_select_modal').val().length > 0 && $("#work_time_modal").val() != "") {
|
||||||
Swal.fire(
|
Swal.fire(
|
||||||
{
|
{
|
||||||
title: "儲存",
|
title: "儲存",
|
||||||
@ -1123,12 +1142,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($('#work_person_select_modal').val().length == 0)
|
||||||
|
{
|
||||||
|
$('#work_person_select_modal-error').show();
|
||||||
|
}
|
||||||
|
if ($("#work_time_modal").val() == "")
|
||||||
|
{
|
||||||
|
$("#work_time_modal-error").show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user