修改即時->今日 新增Email通知勾選
This commit is contained in:
parent
781bf9e660
commit
e426559bde
@ -659,82 +659,83 @@ namespace SolarPower.Controllers
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (post.WorkPersonIds != null)
|
if(post.Emailcheck == 1)
|
||||||
{
|
{
|
||||||
var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
if (post.WorkPersonIds != null)
|
||||||
List<NoticeSchedule> noticeSchedules = new List<NoticeSchedule>();
|
|
||||||
foreach (var person in post.WorkPersonIds)
|
|
||||||
{
|
{
|
||||||
var fixtype = post.WorkType switch
|
var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
||||||
|
List<NoticeSchedule> noticeSchedules = new List<NoticeSchedule>();
|
||||||
|
foreach (var person in post.WorkPersonIds)
|
||||||
|
{
|
||||||
|
var fixtype = post.WorkType switch
|
||||||
|
{
|
||||||
|
0 => "清洗",
|
||||||
|
1 => "巡檢",
|
||||||
|
2 => "維修",
|
||||||
|
_ => ""
|
||||||
|
};
|
||||||
|
var user = await userRepository.GetOneAsync(person);
|
||||||
|
NoticeSchedule schedule = new NoticeSchedule()
|
||||||
|
{
|
||||||
|
EmailType = 3,
|
||||||
|
Type = 1,
|
||||||
|
UserId = person,
|
||||||
|
RecipientName = user.Name,
|
||||||
|
RecipientEmail = user.Email,
|
||||||
|
Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime,
|
||||||
|
Content = "維修項目" + post.FixDo + "</br>注意事項 :" + post.Notice,
|
||||||
|
};
|
||||||
|
noticeSchedules.Add(schedule);
|
||||||
|
}
|
||||||
|
properties = new List<string>()
|
||||||
|
{
|
||||||
|
"UserId",
|
||||||
|
"EmailType",
|
||||||
|
"RecipientEmail",
|
||||||
|
"Subject",
|
||||||
|
"Content",
|
||||||
|
"RecipientName",
|
||||||
|
"Type",
|
||||||
|
"ExceptionId"
|
||||||
|
};
|
||||||
|
await noticeScheduleRepository.AddAnyThing<List<NoticeSchedule>>(noticeSchedules, properties, "notice_schedule");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (post.FixFirm != 0)
|
||||||
|
{
|
||||||
|
var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
||||||
|
var fixtype = operationRecord.WorkType switch
|
||||||
{
|
{
|
||||||
0 => "清洗",
|
0 => "清洗",
|
||||||
1 => "巡檢",
|
1 => "巡檢",
|
||||||
2 => "維修",
|
2 => "維修",
|
||||||
_ => ""
|
_ => ""
|
||||||
};
|
};
|
||||||
var user = await userRepository.GetOneAsync(person);
|
var powerstation = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
||||||
|
var firm = await operationRepository.GetOneWithCustomDBNameAndTableAsync<OperationInfo>(post.FixFirm, powerstations.SiteDB, "operation_firm");
|
||||||
NoticeSchedule schedule = new NoticeSchedule()
|
NoticeSchedule schedule = new NoticeSchedule()
|
||||||
{
|
{
|
||||||
EmailType = 3,
|
EmailType = 3,
|
||||||
Type = 1,
|
Type = 1,
|
||||||
UserId = person,
|
RecipientName = firm.Name,
|
||||||
RecipientName = user.Name,
|
RecipientEmail = firm.Email,
|
||||||
RecipientEmail = user.Email,
|
|
||||||
Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime,
|
Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime,
|
||||||
Content = "維修項目" + post.FixDo + "</br>注意事項 :" + post.Notice,
|
Content = "維修項目" + post.FixDo + "</br>注意事項 :" + post.Notice,
|
||||||
};
|
};
|
||||||
noticeSchedules.Add(schedule);
|
properties = new List<string>()
|
||||||
|
{
|
||||||
|
"UserId",
|
||||||
|
"EmailType",
|
||||||
|
"RecipientEmail",
|
||||||
|
"Subject",
|
||||||
|
"Content",
|
||||||
|
"RecipientName",
|
||||||
|
"Type",
|
||||||
|
"ExceptionId"
|
||||||
|
};
|
||||||
|
await noticeScheduleRepository.AddAnyThing<NoticeSchedule>(schedule, properties, "notice_schedule");
|
||||||
}
|
}
|
||||||
properties = new List<string>()
|
|
||||||
{
|
|
||||||
"UserId",
|
|
||||||
"EmailType",
|
|
||||||
"RecipientEmail",
|
|
||||||
"Subject",
|
|
||||||
"Content",
|
|
||||||
"RecipientName",
|
|
||||||
"Type",
|
|
||||||
"ExceptionId"
|
|
||||||
};
|
|
||||||
await noticeScheduleRepository.AddAnyThing<List<NoticeSchedule>>(noticeSchedules, properties, "notice_schedule");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (post.FixFirm != 0)
|
|
||||||
{
|
|
||||||
var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
|
||||||
var fixtype = operationRecord.WorkType switch
|
|
||||||
{
|
|
||||||
0 => "清洗",
|
|
||||||
1 => "巡檢",
|
|
||||||
2 => "維修",
|
|
||||||
_ => ""
|
|
||||||
};
|
|
||||||
var powerstation = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
|
||||||
var firm = await operationRepository.GetOneWithCustomDBNameAndTableAsync<OperationInfo>(post.FixFirm, powerstations.SiteDB, "operation_firm");
|
|
||||||
NoticeSchedule schedule = new NoticeSchedule()
|
|
||||||
{
|
|
||||||
EmailType = 3,
|
|
||||||
Type = 1,
|
|
||||||
RecipientName = firm.Name,
|
|
||||||
RecipientEmail = firm.Email,
|
|
||||||
Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime,
|
|
||||||
Content = "維修項目" + post.FixDo + "</br>注意事項 :" + post.Notice,
|
|
||||||
};
|
|
||||||
properties = new List<string>()
|
|
||||||
{
|
|
||||||
"UserId",
|
|
||||||
"EmailType",
|
|
||||||
"RecipientEmail",
|
|
||||||
"Subject",
|
|
||||||
"Content",
|
|
||||||
"RecipientName",
|
|
||||||
"Type",
|
|
||||||
"ExceptionId"
|
|
||||||
};
|
|
||||||
await noticeScheduleRepository.AddAnyThing<NoticeSchedule>(schedule, properties, "notice_schedule");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Suppress))
|
//using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Suppress))
|
||||||
//{
|
//{
|
||||||
|
|
||||||
@ -880,83 +881,89 @@ namespace SolarPower.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
if (post.Emailcheck == 1)
|
||||||
if (post.WorkPersonIds != null)
|
|
||||||
{
|
{
|
||||||
var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
if (post.WorkPersonIds != null)
|
||||||
List<NoticeSchedule> noticeSchedules = new List<NoticeSchedule>();
|
|
||||||
foreach (var person in post.WorkPersonIds)
|
|
||||||
{
|
{
|
||||||
var fixtype = operationRecord.WorkType switch
|
var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
||||||
|
List<NoticeSchedule> noticeSchedules = new List<NoticeSchedule>();
|
||||||
|
foreach (var person in post.WorkPersonIds)
|
||||||
|
{
|
||||||
|
var fixtype = operationRecord.WorkType switch
|
||||||
|
{
|
||||||
|
0 => "清洗",
|
||||||
|
1 => "巡檢",
|
||||||
|
2 => "維修",
|
||||||
|
_ => ""
|
||||||
|
};
|
||||||
|
var user = await userRepository.GetOneAsync(person);
|
||||||
|
NoticeSchedule schedule = new NoticeSchedule()
|
||||||
|
{
|
||||||
|
EmailType = 3,
|
||||||
|
Type = 1,
|
||||||
|
UserId = person,
|
||||||
|
RecipientName = user.Name,
|
||||||
|
RecipientEmail = user.Email,
|
||||||
|
Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime,
|
||||||
|
Content = "維修項目:" + post.FixDo + "</br>注意事項 :" + post.Notice,
|
||||||
|
};
|
||||||
|
noticeSchedules.Add(schedule);
|
||||||
|
}
|
||||||
|
properties = new List<string>()
|
||||||
|
{
|
||||||
|
"UserId",
|
||||||
|
"EmailType",
|
||||||
|
"RecipientEmail",
|
||||||
|
"Subject",
|
||||||
|
"Content",
|
||||||
|
"RecipientName",
|
||||||
|
"Type",
|
||||||
|
"ExceptionId"
|
||||||
|
};
|
||||||
|
await noticeScheduleRepository.AddAnyThing<List<NoticeSchedule>>(noticeSchedules, properties, "notice_schedule");
|
||||||
|
}
|
||||||
|
if (post.FixFirm != 0)
|
||||||
|
{
|
||||||
|
var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
||||||
|
var fixtype = post.WorkType switch
|
||||||
{
|
{
|
||||||
0 => "清洗",
|
0 => "清洗",
|
||||||
1 => "巡檢",
|
1 => "巡檢",
|
||||||
2 => "維修",
|
2 => "維修",
|
||||||
_ => ""
|
_ => ""
|
||||||
};
|
};
|
||||||
var user = await userRepository.GetOneAsync(person);
|
var powerstation = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
||||||
|
var firm = await operationRepository.GetOneWithCustomDBNameAndTableAsync<OperationInfo>(post.FixFirm, powerstations.SiteDB, "operation_firm");
|
||||||
NoticeSchedule schedule = new NoticeSchedule()
|
NoticeSchedule schedule = new NoticeSchedule()
|
||||||
{
|
{
|
||||||
EmailType = 3,
|
EmailType = 3,
|
||||||
Type = 1,
|
Type = 1,
|
||||||
UserId = person,
|
RecipientName = firm.Name,
|
||||||
RecipientName = user.Name,
|
RecipientEmail = firm.Email,
|
||||||
RecipientEmail = user.Email,
|
|
||||||
Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime,
|
Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime,
|
||||||
Content = "維修項目:" + post.FixDo + "</br>注意事項 :" + post.Notice,
|
Content = "維修項目:" + post.FixDo + "</br>注意事項 :" + post.Notice,
|
||||||
};
|
};
|
||||||
noticeSchedules.Add(schedule);
|
properties = new List<string>()
|
||||||
|
{
|
||||||
|
"UserId",
|
||||||
|
"EmailType",
|
||||||
|
"RecipientEmail",
|
||||||
|
"Subject",
|
||||||
|
"Content",
|
||||||
|
"RecipientName",
|
||||||
|
"Type",
|
||||||
|
"ExceptionId"
|
||||||
|
};
|
||||||
|
await noticeScheduleRepository.AddAnyThing<NoticeSchedule>(schedule, properties, "notice_schedule");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
properties = new List<string>()
|
|
||||||
{
|
|
||||||
"UserId",
|
|
||||||
"EmailType",
|
|
||||||
"RecipientEmail",
|
|
||||||
"Subject",
|
|
||||||
"Content",
|
|
||||||
"RecipientName",
|
|
||||||
"Type",
|
|
||||||
"ExceptionId"
|
|
||||||
};
|
|
||||||
await noticeScheduleRepository.AddAnyThing<List<NoticeSchedule>>(noticeSchedules, properties, "notice_schedule");
|
|
||||||
}
|
}
|
||||||
if (post.FixFirm != 0)
|
|
||||||
{
|
|
||||||
var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
|
||||||
var fixtype = post.WorkType switch
|
|
||||||
{
|
|
||||||
0 => "清洗",
|
|
||||||
1 => "巡檢",
|
|
||||||
2 => "維修",
|
|
||||||
_ => ""
|
|
||||||
};
|
|
||||||
var powerstation = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
|
||||||
var firm = await operationRepository.GetOneWithCustomDBNameAndTableAsync<OperationInfo>(post.FixFirm, powerstations.SiteDB, "operation_firm");
|
|
||||||
NoticeSchedule schedule = new NoticeSchedule()
|
|
||||||
{
|
|
||||||
EmailType = 3,
|
|
||||||
Type = 1,
|
|
||||||
RecipientName = firm.Name,
|
|
||||||
RecipientEmail = firm.Email,
|
|
||||||
Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime,
|
|
||||||
Content = "維修項目:" + post.FixDo + "</br>注意事項 :" + post.Notice,
|
|
||||||
};
|
|
||||||
properties = new List<string>()
|
|
||||||
{
|
|
||||||
"UserId",
|
|
||||||
"EmailType",
|
|
||||||
"RecipientEmail",
|
|
||||||
"Subject",
|
|
||||||
"Content",
|
|
||||||
"RecipientName",
|
|
||||||
"Type",
|
|
||||||
"ExceptionId"
|
|
||||||
};
|
|
||||||
await noticeScheduleRepository.AddAnyThing<NoticeSchedule>(schedule, properties, "notice_schedule");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -293,6 +293,7 @@ namespace SolarPower.Models
|
|||||||
public string Notice { get; set; }
|
public string Notice { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public IFormFile[] RecordFiles { get; set; }
|
public IFormFile[] RecordFiles { get; set; }
|
||||||
|
public byte Emailcheck { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateOperationRecord : Updated
|
public class UpdateOperationRecord : Updated
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<p>即時總發電量</p>
|
<p>今日總發電量</p>
|
||||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_kwh">0.00</span></p>
|
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_kwh">0.00</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
@ -36,7 +36,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<p>即時日照度</p>
|
<p>今日日照度</p>
|
||||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_irradiance">0.00</span></p>
|
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_irradiance">0.00</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
@ -279,7 +279,7 @@
|
|||||||
'<div class="row">' +
|
'<div class="row">' +
|
||||||
'<div class="col-12">' +
|
'<div class="col-12">' +
|
||||||
'<div>今日發電量(kW h):' + item.today_kWh.toFixed(2) + '</div>'+
|
'<div>今日發電量(kW h):' + item.today_kWh.toFixed(2) + '</div>'+
|
||||||
'<div>即時日照度(k W/m<sup>2</sup>):' + item.today_irradiance + '</div>'+
|
'<div>今日日照度(k W/m<sup>2</sup>):' + item.today_irradiance + '</div>'+
|
||||||
'<div>有效日照時數(kwh/kwp):' + item.today_kwhkwp.toFixed(2) + '</div>' +
|
'<div>有效日照時數(kwh/kwp):' + item.today_kwhkwp.toFixed(2) + '</div>' +
|
||||||
'<div>裝置容量(kWp):' + item.generatingCapacity.toFixed(3) + '</div>' +
|
'<div>裝置容量(kWp):' + item.generatingCapacity.toFixed(3) + '</div>' +
|
||||||
'<div>掛錶日期:' + item.electricityMeterAt + '</div>' +
|
'<div>掛錶日期:' + item.electricityMeterAt + '</div>' +
|
||||||
|
|||||||
@ -211,8 +211,13 @@
|
|||||||
<select class="form-control" id="fix_firm_select_modal"></select>
|
<select class="form-control" id="fix_firm_select_modal"></select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-lg-6 mt-5">
|
||||||
|
<div class="custom-control custom-checkbox d-flex align-content-center">
|
||||||
|
<input type="checkbox" class="custom-control-input" id="EmailcheckBox">
|
||||||
|
<label class="custom-control-label" for="EmailcheckBox">發送Email通知</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@ -707,7 +712,7 @@
|
|||||||
$("#work_time_modal-error").hide();
|
$("#work_time_modal-error").hide();
|
||||||
|
|
||||||
|
|
||||||
|
$("#EmailcheckBox").prop("checked", false);
|
||||||
$("#record-form-modal").modal();
|
$("#record-form-modal").modal();
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -1038,7 +1043,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$("#EmailcheckBox").prop("checked", false);
|
||||||
$("#record-form-modal").modal();
|
$("#record-form-modal").modal();
|
||||||
}, 'json');
|
}, 'json');
|
||||||
});
|
});
|
||||||
@ -1057,94 +1062,87 @@
|
|||||||
//#region 儲存表單資料
|
//#region 儲存表單資料
|
||||||
function SaveRecord() {
|
function SaveRecord() {
|
||||||
if ($('#work_person_select_modal').val().length > 0 && $("#work_time_modal").val() != "") {
|
if ($('#work_person_select_modal').val().length > 0 && $("#work_time_modal").val() != "") {
|
||||||
Swal.fire(
|
if ($("#record-form").valid())
|
||||||
{
|
{
|
||||||
title: "儲存",
|
var url = "/Operation/SaveOperationRecord";
|
||||||
text: "你確定是否儲存此筆資料?\r\n 儲存成功後將會發送Email至負責人員及廠商",
|
|
||||||
type: "warning",
|
|
||||||
icon: 'warning',
|
|
||||||
showCancelButton: true,
|
|
||||||
confirmButtonText: "是",
|
|
||||||
cancelButtonText: "否"
|
|
||||||
}).then(function (result) {
|
|
||||||
if (result.value) {
|
|
||||||
if ($("#record-form").valid()) {
|
|
||||||
var url = "/Operation/SaveOperationRecord";
|
|
||||||
|
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
|
|
||||||
@*var work_person_ids = $.map($("#work_person_select_modal").val(), function (item) {
|
@*var work_person_ids = $.map($("#work_person_select_modal").val(), function (item) {
|
||||||
return parseInt(item);
|
return parseInt(item);
|
||||||
}) *@
|
}) *@
|
||||||
|
|
||||||
formData.append("Id", selected_id);
|
formData.append("Id", selected_id);
|
||||||
formData.append("PowerStationId", $("#power_station_select_modal").val());
|
formData.append("PowerStationId", $("#power_station_select_modal").val());
|
||||||
formData.append("WorkType", selected_work_type);
|
formData.append("WorkType", selected_work_type);
|
||||||
formData.append("ErrorCode", $("#error_code_modal").val());
|
formData.append("ErrorCode", $("#error_code_modal").val());
|
||||||
formData.append("FixDo", $("#fix_do_modal").val());
|
formData.append("FixDo", $("#fix_do_modal").val());
|
||||||
formData.append("FixFirm", $("#fix_firm_select_modal").val());
|
formData.append("FixFirm", $("#fix_firm_select_modal").val());
|
||||||
formData.append("Status", $("input[name=status_modal]:checked").val());
|
formData.append("Status", $("input[name=status_modal]:checked").val());
|
||||||
$("#work_person_select_modal").val().forEach(function (item) {
|
$("#work_person_select_modal").val().forEach(function (item) {
|
||||||
formData.append("WorkPersonIds", parseInt(item));
|
formData.append("WorkPersonIds", parseInt(item));
|
||||||
});
|
});
|
||||||
formData.append("WorkTime", $("#work_time_modal").val());
|
formData.append("WorkTime", $("#work_time_modal").val());
|
||||||
formData.append("Notice", $("#notice_textarea_modal").val());
|
formData.append("Notice", $("#notice_textarea_modal").val());
|
||||||
formData.append("Description", $("#description_textarea_modal").val());
|
formData.append("Description", $("#description_textarea_modal").val());
|
||||||
|
if (document.querySelector('[id=EmailcheckBox]:checked')) {
|
||||||
|
formData.append("Emailcheck", 1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
formData.append("Emailcheck", 0);
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: url,
|
||||||
|
data: formData,
|
||||||
|
cache: false,
|
||||||
|
contentType: false,
|
||||||
|
processData: false,
|
||||||
|
success: function (rel) {
|
||||||
|
if (rel.code != "0000") {
|
||||||
|
toast_error(rel.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax({
|
var myDropzone = Dropzone.forElement("#record-file-form");
|
||||||
type: "POST",
|
|
||||||
url: url,
|
|
||||||
data: formData,
|
|
||||||
cache: false,
|
|
||||||
contentType: false,
|
|
||||||
processData: false,
|
|
||||||
success: function (rel) {
|
|
||||||
if (rel.code != "0000") {
|
|
||||||
toast_error(rel.msg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var myDropzone = Dropzone.forElement("#record-file-form");
|
if (myDropzone.files.length > 0) {
|
||||||
|
|
||||||
if (myDropzone.files.length > 0) {
|
selected_id = rel.data;
|
||||||
|
|
||||||
selected_id = rel.data;
|
myDropzone.processQueue();
|
||||||
|
|
||||||
myDropzone.processQueue();
|
myDropzone.on("successmultiple", function (file, rel) {
|
||||||
|
if (rel.code != "0000") {
|
||||||
myDropzone.on("successmultiple", function (file, rel) {
|
toast_error(rel.msg);
|
||||||
if (rel.code != "0000") {
|
return;
|
||||||
toast_error(rel.msg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
toast_ok(rel.msg);
|
|
||||||
$('#record-form-modal').modal('hide');
|
|
||||||
recordFileDropzone.removeAllFiles();
|
|
||||||
if (status == 2) {
|
|
||||||
operationRecordTable.column(10).visible(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
operationRecordTable.column(10).visible(false);
|
|
||||||
}
|
|
||||||
operationRecordTable.ajax.reload();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$('#record-form-modal').modal('hide');
|
|
||||||
myDropzone.removeAllFiles();
|
|
||||||
if (status == 2) {
|
|
||||||
operationRecordTable.column(10).visible(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
operationRecordTable.column(10).visible(false);
|
|
||||||
}
|
|
||||||
operationRecordTable.ajax.reload();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toast_ok(rel.msg);
|
||||||
|
$('#record-form-modal').modal('hide');
|
||||||
|
recordFileDropzone.removeAllFiles();
|
||||||
|
if (status == 2) {
|
||||||
|
operationRecordTable.column(10).visible(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
operationRecordTable.column(10).visible(false);
|
||||||
|
}
|
||||||
|
operationRecordTable.ajax.reload();
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
$('#record-form-modal').modal('hide');
|
||||||
|
myDropzone.removeAllFiles();
|
||||||
|
if (status == 2) {
|
||||||
|
operationRecordTable.column(10).visible(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
operationRecordTable.column(10).visible(false);
|
||||||
|
}
|
||||||
|
operationRecordTable.ajax.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -94,7 +94,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<p>即時日照度</p>
|
<p>今日日照度</p>
|
||||||
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_irradiance">0.00</span></p>
|
<p><span class="color-info-700 fs-xl font-weight-bold" id="today_irradiance">0.00</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
|
|||||||
@ -951,6 +951,32 @@
|
|||||||
$("#work_person_select_modal").val(record.workPersonId);
|
$("#work_person_select_modal").val(record.workPersonId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$("#work_person_select_modal").select2({ dropdownParent: $('#record-form-modal') });
|
||||||
|
});
|
||||||
|
|
||||||
|
//查詢該電站的廠商
|
||||||
|
var url_power_station_firm = "/PowerStation/GetFirmSelectOptionList";
|
||||||
|
|
||||||
|
$.post(url_power_station_firm, send_data, function (rel) {
|
||||||
|
if (rel.code != "0000") {
|
||||||
|
toast_error(rel.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#fix_firm_select_modal").empty();
|
||||||
|
if (rel.data.length > 0) {
|
||||||
|
|
||||||
|
$.each(rel.data, function (index, val) {
|
||||||
|
$("#fix_firm_select_modal").append($("<option />").val(val.value).text(val.text));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#fix_firm_select_modal").val($("#fix_firm_select_modal option:first").val()).trigger('change');
|
||||||
|
|
||||||
|
if (record != undefined && record != null) {
|
||||||
|
$("#fix_firm_select_modal").val(record.fixFirm)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
//#endregion
|
//#endregion
|
||||||
@ -1510,7 +1536,7 @@
|
|||||||
status = 1;
|
status = 1;
|
||||||
}
|
}
|
||||||
$("input[name=status_modal_opRecord][value='" + status + "']").prop('checked', true); //狀態
|
$("input[name=status_modal_opRecord][value='" + status + "']").prop('checked', true); //狀態
|
||||||
$('#work_person_select_modal').val(record.workPersonId);
|
$('#work_person_select_modal').val(record.workPersonId).trigger("change");;
|
||||||
if (work_type != 2) {
|
if (work_type != 2) {
|
||||||
$(".fix-div").hide();
|
$(".fix-div").hide();
|
||||||
} else {
|
} else {
|
||||||
@ -1518,6 +1544,7 @@
|
|||||||
$("#error_code_modal").val(record.errorCode);
|
$("#error_code_modal").val(record.errorCode);
|
||||||
$("#fix_do_modal").val(record.fixDo);
|
$("#fix_do_modal").val(record.fixDo);
|
||||||
}
|
}
|
||||||
|
$("#fix_firm_select_modal").val(record.fixFirm).trigger("change");
|
||||||
$("#notice_textarea_modal").val(record.notice);
|
$("#notice_textarea_modal").val(record.notice);
|
||||||
$("#description_textarea_modal").val(record.description);
|
$("#description_textarea_modal").val(record.description);
|
||||||
|
|
||||||
@ -1528,12 +1555,22 @@
|
|||||||
record.recordFiles.forEach(function (value, index) {
|
record.recordFiles.forEach(function (value, index) {
|
||||||
CreateRecordFileBox(RecordFileBox, value, true);
|
CreateRecordFileBox(RecordFileBox, value, true);
|
||||||
});
|
});
|
||||||
|
$("#EmailcheckBox").prop("checked", false);
|
||||||
$("#record-form-modal").modal();
|
$("#record-form-modal").modal();
|
||||||
}, 'json');
|
}, 'json');
|
||||||
});
|
});
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
//#region 表單驗證
|
||||||
|
$("#record-form").validate({
|
||||||
|
rules: {
|
||||||
|
work_time_modal: {
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
//#endregion
|
||||||
|
|
||||||
//#region 表單檔案資料(運維)
|
//#region 表單檔案資料(運維)
|
||||||
Dropzone.autoDiscover = false;
|
Dropzone.autoDiscover = false;
|
||||||
recordFileDropzone = new Dropzone("#record-file-form", {
|
recordFileDropzone = new Dropzone("#record-file-form", {
|
||||||
@ -1582,65 +1619,96 @@
|
|||||||
}
|
}
|
||||||
//#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();
|
||||||
|
});
|
||||||
|
|
||||||
//#region 儲存表單資料(運維)
|
//#region 儲存表單資料(運維)
|
||||||
function SaveRecord() {
|
function SaveRecord() {
|
||||||
|
if ($('#work_person_select_modal').val().length > 0 && $("#work_time_modal").val() != "")
|
||||||
|
{
|
||||||
|
if ($("#record-form").valid()) {
|
||||||
|
var url = "/Operation/SaveOperationRecord";
|
||||||
|
|
||||||
if ($("#record-form").valid()) {
|
var formData = new FormData();
|
||||||
var url = "/Operation/SaveOperationRecord";
|
|
||||||
|
|
||||||
var formData = new FormData();
|
formData.append("Id", selected_id);
|
||||||
|
formData.append("PowerStationId", $("#power_station_select_modal").val());
|
||||||
|
formData.append("WorkType", selected_work_type);
|
||||||
|
formData.append("ErrorCode", $("#error_code_modal").val());
|
||||||
|
formData.append("FixDo", $("#fix_do_modal").val());
|
||||||
|
formData.append("FixFirm", $("#fix_firm_select_modal").val());
|
||||||
|
formData.append("Status", $("input[name=status_modal_opRecord]:checked").val());
|
||||||
|
$("#work_person_select_modal").val().forEach(function (item) {
|
||||||
|
formData.append("WorkPersonIds", parseInt(item));
|
||||||
|
});
|
||||||
|
formData.append("WorkTime", $("#work_time_modal").val());
|
||||||
|
formData.append("Notice", $("#notice_textarea_modal").val());
|
||||||
|
formData.append("Description", $("#description_textarea_modal").val());
|
||||||
|
if (document.querySelector('[id=EmailcheckBox]:checked')) {
|
||||||
|
formData.append("Emailcheck", 1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
formData.append("Emailcheck", 0);
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: url,
|
||||||
|
data: formData,
|
||||||
|
cache: false,
|
||||||
|
contentType: false,
|
||||||
|
processData: false,
|
||||||
|
success: function (rel) {
|
||||||
|
if (rel.code != "0000") {
|
||||||
|
toast_error(rel.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
formData.append("Id", selected_id);
|
var myDropzone = Dropzone.forElement("#record-file-form");
|
||||||
formData.append("PowerStationId", $("#power_station_select_modal").val());
|
|
||||||
formData.append("WorkType", selected_work_type);
|
|
||||||
formData.append("ErrorCode", $("#error_code_modal").val());
|
|
||||||
formData.append("FixDo", $("#fix_do_modal").val());
|
|
||||||
formData.append("Status", $("input[name=status_modal_opRecord]:checked").val());
|
|
||||||
formData.append("WorkPersonId", $("#work_person_select_modal").val());
|
|
||||||
formData.append("WorkTime", $("#work_time_modal").val());
|
|
||||||
formData.append("Notice", $("#notice_textarea_modal").val());
|
|
||||||
formData.append("Description", $("#description_textarea_modal").val());
|
|
||||||
|
|
||||||
$.ajax({
|
if (myDropzone.files.length > 0) {
|
||||||
type: "POST",
|
selected_id = rel.data;
|
||||||
url: url,
|
myDropzone.processQueue();
|
||||||
data: formData,
|
|
||||||
cache: false,
|
|
||||||
contentType: false,
|
|
||||||
processData: false,
|
|
||||||
success: function (rel) {
|
|
||||||
if (rel.code != "0000") {
|
|
||||||
toast_error(rel.msg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var myDropzone = Dropzone.forElement("#record-file-form");
|
myDropzone.on("successmultiple", function (file, rel) {
|
||||||
|
if (rel.code != "0000") {
|
||||||
|
toast_error(rel.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (myDropzone.files.length > 0) {
|
toast_ok(rel.msg);
|
||||||
selected_id = rel.data;
|
$('#record-form-modal').modal('hide');
|
||||||
myDropzone.processQueue();
|
recordFileDropzone.removeAllFiles();
|
||||||
|
|
||||||
myDropzone.on("successmultiple", function (file, rel) {
|
operationRecordTable.ajax.reload();
|
||||||
if (rel.code != "0000") {
|
});
|
||||||
toast_error(rel.msg);
|
} else {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
toast_ok(rel.msg);
|
|
||||||
$('#record-form-modal').modal('hide');
|
$('#record-form-modal').modal('hide');
|
||||||
recordFileDropzone.removeAllFiles();
|
myDropzone.removeAllFiles();
|
||||||
|
|
||||||
operationRecordTable.ajax.reload();
|
operationRecordTable.ajax.reload();
|
||||||
});
|
}
|
||||||
} else {
|
|
||||||
$('#record-form-modal').modal('hide');
|
|
||||||
myDropzone.removeAllFiles();
|
|
||||||
|
|
||||||
operationRecordTable.ajax.reload();
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
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
|
||||||
|
|
||||||
|
|||||||
@ -79,7 +79,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="power_station_select_modal">電站</label>
|
<label class="form-label" for="power_station_select_modal"><span class="text-danger">*</span>電站</label>
|
||||||
@*<input class="form-control" id="power_station_select_modal" type="text" name="power_station_select_modal" />*@
|
@*<input class="form-control" id="power_station_select_modal" type="text" name="power_station_select_modal" />*@
|
||||||
<select class="form-control" id="power_station_select_modal">
|
<select class="form-control" id="power_station_select_modal">
|
||||||
</select>
|
</select>
|
||||||
@ -87,8 +87,9 @@
|
|||||||
</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>
|
||||||
@ -96,7 +97,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_opRecord" value="0" />
|
<input type="radio" class="custom-control-input ml-auto" id="status_none_complete" name="status_modal_opRecord" value="0" />
|
||||||
@ -111,11 +112,13 @@
|
|||||||
</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_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">
|
<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>
|
||||||
|
|
||||||
<div class="row mb-3 fix-div">
|
<div class="row mb-3 fix-div">
|
||||||
@ -123,7 +126,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label" for="error_code_modal">異常編號</label>
|
<label class="form-label" for="error_code_modal">異常編號</label>
|
||||||
<input class="form-control" id="error_code_modal" type="text" name="error_code_modal" />
|
<input class="form-control" id="error_code_modal" type="text" name="error_code_modal" disabled/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -135,10 +138,25 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="fix_firm_modal">負責廠商</label>
|
||||||
|
<select class="form-control" id="fix_firm_select_modal"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 mt-5">
|
||||||
|
<div class="custom-control custom-checkbox d-flex align-content-center">
|
||||||
|
<input type="checkbox" class="custom-control-input" id="EmailcheckBox">
|
||||||
|
<label class="custom-control-label" for="EmailcheckBox">發送Email通知</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label" for="notice_textarea_modal">巡檢注意事項</label>
|
<label class="form-label" for="notice_textarea_modal">項目內容</label>
|
||||||
<textarea class="form-control" id="notice_textarea_modal" rows="5"></textarea>
|
<textarea class="form-control" id="notice_textarea_modal" rows="5"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user