解決衝突

This commit is contained in:
Kai 2021-06-26 14:23:56 +08:00
commit 89345bee79
7 changed files with 2478 additions and 129 deletions

View File

@ -253,7 +253,7 @@ namespace SolarPower.Models
{
get
{
if(!string.IsNullOrEmpty(StartTime) || !string.IsNullOrEmpty(EndTime))
if (!string.IsNullOrEmpty(StartTime) || !string.IsNullOrEmpty(EndTime))
{
return StartTime + " ~ " + EndTime;
}

View File

@ -63,19 +63,28 @@ namespace SolarPower.Repository.Implement
List<OperationPlanTable> result;
var count = 0;
string Wheresql = "oc.PowerStationId = ";
foreach (int too in id)
if( id.Count > 0 )
{
foreach (int too in id)
{
if(count == id.Count-1)
{
Wheresql += too.ToString();
if (count == id.Count - 1)
{
Wheresql += too.ToString();
}
else
{
Wheresql += too.ToString() + " OR oc.PowerStationId = ";
}
count++;
}
else
{
Wheresql += too.ToString() + " OR oc.PowerStationId = ";
}
count++;
}
else
{
Wheresql += "0";
}
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
@ -209,6 +218,7 @@ namespace SolarPower.Repository.Implement
if (filter.WorkType > 0)
{
filter.WorkType -= 1;
sql += @" AND opr.WorkType = @WorkType";
if (!string.IsNullOrEmpty(filter.Range))
@ -219,18 +229,18 @@ namespace SolarPower.Repository.Implement
else
{
sql += @" AND opr.WorkType IN (0, 1)";
sql += @" UNION";
sql += @" SELECT
opr.*,
ps.Name AS PowerStationName,
u.Name AS WorkPersonName
FROM operation_record opr
LEFT JOIN power_station ps ON opr.PowerStationId = ps.Id
LEFT JOIN user u ON opr.WorkPersonId = u.ID
WHERE opr.Deleted = 0
AND ps.CityId IN @CityIds
AND ps.Id IN @PowerStationIds
AND opr.WorkType = 2";
//sql += @" UNION";
//sql += @" SELECT
// opr.*,
// ps.Name AS PowerStationName,
// u.Name AS WorkPersonName
// FROM operation_record opr
// LEFT JOIN power_station ps ON opr.PowerStationId = ps.Id
// LEFT JOIN user u ON opr.WorkPersonId = u.ID
// WHERE opr.Deleted = 0
// AND ps.CityId IN @CityIds
// AND ps.Id IN @PowerStationIds
// AND opr.WorkType = 2";
}
result = (await conn.QueryAsync<OperationRecodeDataTable>(sql, filter)).ToList();

View File

@ -36,7 +36,7 @@
<div class="row mb-3 d-flex align-items-center px-3">
<div class="pr-3">
<button type="button" class="btn btn-secondary waves-effect waves-themed">全部縣市</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="Allcity()">全部縣市</button>
</div>
<div class="pr-3">
<div class="frame-wrap" id="citytest" style="display:none">
@ -44,22 +44,6 @@
新北市
<span class="badge bg-success-700 ml-2" id="acount">4</span>
</button>
@*<button type="button" class="btn btn-outline-success waves-effect waves-themed">
台北市
<span class="badge bg-success-700 ml-2">4</span>
</button>
<button type="button" class="btn btn-success waves-effect waves-themed">
新竹市
<span class="badge bg-success-700 ml-2">4</span>
</button>
<button type="button" class="btn btn-outline-success waves-effect waves-themed">
苗栗縣
<span class="badge bg-success-700 ml-2">4</span>
</button>
<button type="button" class="btn btn-outline-success waves-effect waves-themed">
台中市
<span class="badge bg-success-700 ml-2">4</span>
</button>*@
</div>
<div class="frame-wrap" id="city">
@ -69,34 +53,11 @@
<div class="row mb-5 d-flex align-items-center px-3">
<div class="pr-3">
<button type="button" class="btn btn-secondary waves-effect waves-themed">全選</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="Allpowerstation()">全選</button>
</div>
<div class="pr-3">
<div class="frame-wrap">
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" class="custom-control-input" id="defaultInline6">
<label class="custom-control-label" for="defaultInline6">新竹交大站</label>
</div>
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" class="custom-control-input" id="defaultInline7" checked="">
<label class="custom-control-label" for="defaultInline7">新竹巨城站</label>
</div>
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" class="custom-control-input" id="defaultInline8" checked="">
<label class="custom-control-label" for="defaultInline8">新竹動物園站</label>
</div>
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" class="custom-control-input" id="defaultInline9" checked="">
<label class="custom-control-label" for="defaultInline9">新竹城隍廟站</label>
</div>
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" class="custom-control-input" id="defaultInline10" checked="">
<label class="custom-control-label" for="defaultInline10">新竹清大站</label>
</div>
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" class="custom-control-input" id="defaultInline11" checked="">
<label class="custom-control-label" for="defaultInline11">新竹高鐵站</label>
</div>
<div class="frame-wrap" id="CheckPowerStation">
</div>
</div>
</div>
@ -145,17 +106,6 @@
</tr>
</thead>
<tbody id="NoViewbody">
<tr>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
</tbody>
</table>
</div>
@ -179,14 +129,14 @@
<div class="modal-body">
<form class="operation-form" id="Operation-form">
<div class="row mb-3">
<div class="col-lg-6">
<div class="col-lg-7">
<div class="form-group">
<label class="form-label" for="operation_powerStationselect_modal">電站名</label>
<select class="form-control" id="operation_powerStationselect_modal">
</select>
</div>
</div>
<div class="col-lg-6">
<div class="col-lg-5">
<div class="form-group">
<label class="form-label" for="operation_type_modal">項目</label>
<select class="form-control" id="operation_type_modal">
@ -197,7 +147,7 @@
</div>
</div>
<div class="row mb-3">
<div class="col-lg-6">
<div class="col-lg-7">
<div class="form-group">
<div class="row d-flex justify-content-start align-items-center">
<div class="col-4">自動排程 每</div>
@ -228,7 +178,7 @@
<div class="form-group">
<div class="row d-flex justify-content-start align-items-center">
<div class="col-3">開始時間</div>
<div class="col">
<div class="col-5">
<input type="date" id="operation_startTime_modal" class="form-control" placeholder="2000-01-01">
</div>
<div class="col">~<span id="operation_endTime_modal"></span></div>
@ -236,7 +186,7 @@
</div>
</div>
</div>
<div class="col-lg-6">
<div class="col-lg-5">
<div class="form-group">
<label class="form-label" for="operation_description_modal">描述</label>
<textarea class="form-control" id="operation_description_modal" rows="5"></textarea>
@ -244,7 +194,7 @@
</div>
</div>
<div class="row mb-3">
<div class="col-lg-6">
<div class="col-lg-7">
<div class="form-group">
<label class="form-label" for="operation_emailType_modal">email提醒</label>
<select class="form-control" id="operation_emailType_modal">
@ -272,23 +222,77 @@
<script>
var selected_id = 0;
var type = 9;
var type = 9;//全部,清洗,巡檢
var ids = new Array(0);//當前選擇縣市
var powerids = new Array(0);//當前選擇電站
var Allids = new Array(0);//全部縣市
var Allpowerids = new Array(0);//全部電站
//#region Array.Remove
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
//#endregion
$(function () {
//#region 電站下拉式選單select_option
var url_operation_select_option = "/Operation/GetPowerStationSelectOption";
$.get(url_operation_select_option, function (rel) {
if (rel.data.code != "0000") {
if (rel.code != "0000") {
toast_error(rel.data.msg);
return;
}
$("#operation_powerStationselect_modal").empty();
$.each(rel.data.data, function (index, val) {
$.each(rel.data, function (index, val) {
$("#operation_powerStationselect_modal").append($("<option />").val(val.value).text(val.text));
});
});
//#endregion
//#region 載入縣市
var Nurl = "/PowerStation/GetSolarCitySummary";
$.post(Nurl, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
for (var i = 0; i < rel.data.length; i++) {
$('#city').append("<button type='button' class='btn btn-success waves-effect waves-themed ml-2' id='" + 'cityID_' + rel.data[i].cityId + "'>" +
rel.data[i].city +
"<span class= 'badge bg-success-700 ml-2' >" + rel.data[i].amount + "</span >" +
"</button >");
ids.push(String(rel.data[i].cityId));
Allids.push(String(rel.data[i].cityId));
}
var send_data = {
cityid: ids
}
ids.sort();
var Nurl = "/PowerStation/GetSolarByCity";
$.post(Nurl, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
$('#CheckPowerStation').empty();
$.each(rel.data, function (index, val) {
$('#CheckPowerStation').append("<div class='custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "' checked>");
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
powerids.push(String(val.id));
Allpowerids.push(String(val.id));
});
OperationPlanTable.ajax.reload();
})
})
//#endregion
//#region 定時計畫列表 DataTable
OperationPlanTable = $("#OperationPlan_table").DataTable({
"pageLength": 20,
@ -356,7 +360,8 @@
"url": "/Operation/OperationPlanTable",
"type": "POST",
"data": function (d) {
d.id = [1, 2],
d.id = powerids,
/* d.id = [1],*/
d.type = type
},
"dataSrc": function (rel) {
@ -373,38 +378,128 @@
}
});
//#endregion
var Nurl = "/PowerStation/GetSolarCitySummary";
var ids = new Array(0);
$.post(Nurl, function (rel)
{
})
//#region 縣市全選
function Allcity()
{
var Newpowerids = new Array(0);
ids = [];
$.each(Allids, function (index, val) {
var cityid = 'cityID_' + val;
document.getElementById(cityid).setAttribute("class", 'btn btn-success waves-effect waves-themed ml-2');
ids.push(val);
});
var send_data = {
cityid: ids
}
var Nurl = "/PowerStation/GetSolarByCity";
$.post(Nurl, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
$('#CheckPowerStation').empty();
Allpowerids = [];
$.each(rel.data, function (index, val) {
ids.push(val.cityId);
$('#citytest').find('button').attr('id', 'cityID' + val.cityId).clone().appendTo($('#city'));
var name = 'cityID' + val.cityId;
document.getElementById(name).innerHTML = val.city;
/* $('#cityID1').text = val.city;*/
$('#cityID' + val.cityId).find('#acount').text(val.amount);
document.getElementById('cityspan' + String(val.cityId)).innerHTML = val.amount;
if (powerids.includes(String(val.id))) {
$('#CheckPowerStation').append("<div class='custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "' checked>");
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
Newpowerids.push(String(val.id));
}
else {
$('#CheckPowerStation').append("<div class='custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "'>");
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
}
Allpowerids.push(String(val.id));
});
powerids = [];
powerids = Newpowerids;
})
//for (var i = 0; i < rel.data.length; i++)
//{
}
//#endregion
//#region 電站全選
function Allpowerstation() {
powerids = [];
$.each(Allpowerids, function (index,val) {
$('#check_' + val).prop("checked", true);
powerids.push(val);
})
OperationPlanTable.ajax.reload();
}
//#endregion
// $('#city').append(h[i]);
// //$('#city').append("<button type='button' class='btn btn-outline-success waves-effect waves-themed ' style='margin - right: 40px;' >" +
// // rel.data[i].city +
// // "<span class= 'badge bg-success-700 ml-2' >" + rel.data[i].amount + "</span >" +
// // "</button >");
//}
//#region 選擇縣市
$('#city').on("click", "button", function () {
var clickid = $(this).attr('id');
var classid = clickid.split("_");
var Newpowerids = new Array(0);
var value = document.getElementById(clickid).className;
ids.sort(function (a, b) {
return a - b;
});
var send_data = {
cityid: ids
}
if (value == 'btn btn-outline-success waves-effect waves-themed ml-2') { //選擇
document.getElementById(clickid).setAttribute("class", 'btn btn-success waves-effect waves-themed ml-2');
ids.push(classid[1]);
}
else { //取消
document.getElementById(clickid).setAttribute("class", 'btn btn-outline-success waves-effect waves-themed ml-2');
ids.remove(classid[1]);
}
ids.sort();
var Nurl = "/PowerStation/GetSolarByCity";
$.post(Nurl, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
$('#CheckPowerStation').empty();
Allpowerids = [];
$.each(rel.data, function (index, val) {
if (powerids.includes(String(val.id))) {
$('#CheckPowerStation').append("<div class='custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "' checked>");
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
Newpowerids.push(String(val.id));
}
else
{
$('#CheckPowerStation').append("<div class='custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "'>");
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
}
Allpowerids.push(String(val.id));
});
powerids = [];
powerids = Newpowerids;
})
})
//#endregion
//#region 選擇電站checkbox
$('#CheckPowerStation').on("click", "input", function () {
var clickid = $(this).attr('id');
var classid = clickid.split("_");
var job = document.getElementById(clickid);
if (job.checked == true) {
powerids.push(classid[1]); }
else
{
powerids.remove(classid[1]);
}
OperationPlanTable.ajax.reload();
})
//#endregion
//#region 更改項目
function ChangeType(Num) {
type = Num;
OperationPlanTable.ajax.reload();
@ -427,6 +522,7 @@
document.getElementById("button9").setAttribute("class", "btn btn-secondary waves-effect waves-themed");
}
}
//#endregion
//#region 新增計畫基本資料
function AddOperationPlan() {
@ -437,13 +533,41 @@
$("#Operation-modal").modal();
}
//#endregion
//#region 結束時間顯示
$('#operation_startTime_modal').change(function () {
var dat = new Date($('#operation_startTime_modal').val());
var day = new Date(dat.setDate(dat.getDate() + Number($('#operation_workDay_modal').val()))).toISOString().split("T");
var day = new Date(dat.setDate(dat.getDate() + Number($('#operation_workDay_modal').val()) - 1)).toISOString().split("T");
document.getElementById("operation_endTime_modal").innerHTML = day[0];
//var type = $('#operation_scheduleType_modal').val();
//if (type == '0') {
// var dat = new Date($('#operation_startTime_modal').val());
// var day = new Date(dat.setDate(dat.getDate() + Number($('#operation_workDay_modal').val()))).toISOString().split("T");
// document.getElementById("operation_endTime_modal").innerHTML = day[0];
//}
//else if (type == '1') {
// var dat = new Date($('#operation_startTime_modal').val());
// var day = new Date(dat.setDate(dat.getDate() + Number($('#operation_workDay_modal').val()) * 7 )).toISOString().split("T");
// document.getElementById("operation_endTime_modal").innerHTML = day[0];
//}
//else if (type == '2') {
// var dat = new Date($('#operation_startTime_modal').val());
// var day = new Date(dat.setMonth(dat.getMonth() + Number($('#operation_workDay_modal').val()))).toISOString().split("T");
// document.getElementById("operation_endTime_modal").innerHTML = day[0];
//}
//else if (type == '3') {
// var dat = new Date($('#operation_startTime_modal').val());
// var day = new Date(dat.setMonth(dat.getMonth() + Number($('#operation_workDay_modal').val()) * 3 )).toISOString().split("T");
// document.getElementById("operation_endTime_modal").innerHTML = day[0];
//}
//else if (type == '4') {
// var dat = new Date($('#operation_startTime_modal').val());
// var day = new Date(dat.setYear(dat.getYear() + Number($('#operation_workDay_modal').val()))).toISOString().split("T");
// document.getElementById("operation_endTime_modal").innerHTML = day[0];
//}
});
//#endregion
//#region 儲存定時計畫資料
function SaveOperationPlan() {
var url = "/Operation/SaveOperationPlan";
@ -472,6 +596,7 @@
}, 'json');
}
//#endregion
//#region 刪除定時計畫資料
$('#OperationPlan_table').on("click", "button.del-btn", function () {
@ -504,6 +629,7 @@
});
});
//#endregion
//#region 取一筆定時計畫
$('#OperationPlan_table').on("click", "button.edit-btn", function () {
$("#Operation-modal .modal-title").html("定時計劃 - 編輯");
@ -544,6 +670,7 @@
});
//#endregion
//#region 儲存Excel
function saveToExcel() {
var url = "/Operation/OperationPlanTable";
@ -590,6 +717,8 @@
}
//#endregion
</script>
}

View File

@ -19,13 +19,13 @@
<div id="panel-5" class="panel">
<div class="panel-container show">
<div class="panel-content">
<div class="row mb-5 d-flex justify-content-start">
<div class="row mb-3 d-flex justify-content-start px-3">
<div class="pr-3">
<div class="btn-group btn-group-md">
<button type="button" class="btn btn-success waves-effect waves-themed">全部</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed">維修</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed">巡檢</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed">清洗</button>
<button type="button" class="btn btn-success waves-effect waves-themed" onclick="ChangeType(0)" id="button0">全部</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeType(3)" id="button3">維修</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeType(2)" id="button2">巡檢</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeType(1)" id="button1">清洗</button>
</div>
</div>
<div class="pr-3">
@ -33,11 +33,37 @@
</div>
<div class="pr-3">
<div class="form-group">
<input class="form-control" id="example-date" type="date" name="date" value="2023-07-23">
<input class="form-control" id="example-date" type="text" name="date" value="2023-07-23">
</div>
</div>
</div>
<div class="row mb-3 d-flex align-items-center px-3">
<div class="pr-3">
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="Allcity()">全部縣市</button>
</div>
<div class="pr-3">
<div class="frame-wrap" id="citytest" style="display:none">
<button type="button" class="btn btn-outline-success waves-effect waves-themed">
新北市
<span class="badge bg-success-700 ml-2" id="acount">4</span>
</button>
</div>
<div class="frame-wrap" id="city">
</div>
</div>
</div>
<div class="row mb-5 d-flex align-items-center px-3">
<div class="pr-3">
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="Allpowerstation()">全選</button>
</div>
<div class="pr-3">
<div class="frame-wrap" id="CheckPowerStation">
</div>
</div>
</div>
<div class="row d-flex justify-content-end px-3">
<button type="button" class="btn btn-info waves-effect waves-themed mb-3 mr-2" onclick="ExportExcel()">
@ -79,7 +105,7 @@
<th>狀態</th>
<th>執行人員</th>
<th>本次作業預計</th>
<th>照片</th>
@*<th>照片</th>*@
<th>完成時間</th>
</tr>
</thead>
@ -217,11 +243,66 @@
var recode;
var countOperationRecodeFile = 0;
var recodeFileDropzone;
var ids = new Array(0);//當前選擇縣市
var powerids = new Array(0);//當前選擇電站
var Allids = new Array(0);//全部縣市
var Allpowerids = new Array(0);//全部電站
var Type = 0; // 項目
//#region Array.Remove
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
//#endregion
$(function () {
$('input[id="example-date"]').daterangepicker({
opens: 'left'
}, function (start, end, label) {
console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
});
//#region 預設載入該使用者可以選擇的電站
GetPowerStation();
//#region 載入縣市
var Nurl = "/PowerStation/GetSolarCitySummary";
$.post(Nurl, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
for (var i = 0; i < rel.data.length; i++) {
$('#city').append("<button type='button' class='btn btn-success waves-effect waves-themed ml-2' id='" + 'cityID_' + rel.data[i].cityId + "'>" +
rel.data[i].city +
"<span class= 'badge bg-success-700 ml-2' >" + rel.data[i].amount + "</span >" +
"</button >");
ids.push(String(rel.data[i].cityId));
Allids.push(String(rel.data[i].cityId));
}
var send_data = {
cityid: ids
}
ids.sort();
var Nurl = "/PowerStation/GetSolarByCity";
$.post(Nurl, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
$('#CheckPowerStation').empty();
$.each(rel.data, function (index, val) {
$('#CheckPowerStation').append("<div class='custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "' checked>");
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
powerids.push(String(val.id));
Allpowerids.push(String(val.id));
});
operationRecodeTable.ajax.reload();
})
})
//#endregion
//#endregion
//#region 切換電站時,載入該電站運維人員
@ -251,8 +332,6 @@
$("#work_person_select_modal").val(recode.workPersonId);
}
}
//#endregion
});
});
//#endregion
@ -282,9 +361,12 @@
"data": "workPersonName"
}, {
"data": "operationPredict"
}, {
"data": "fileList"
}, {
},
//{
//"data": "fileList"
//}
//,
{
"data": "finishTime"
}],
"language": {
@ -318,8 +400,8 @@
"type": "POST",
"data": function (d) {
d.CityIds = [3];
d.PowerStationIds = [1];
d.WorkType = $('#company_phone').val();
d.PowerStationIds = powerids;
d.WorkType = Type;
d.Range = $('#company_taxIDNumber').val();
},
"dataSrc": function (rel) {
@ -339,8 +421,25 @@
}
});
//#endregion
});
//#region 改變項目
function ChangeType(type)
{
Type = type;
for (var i = 0; i < 4; i++)
{
var name = "button" + i;
document.getElementById(name).setAttribute("class", "btn btn-secondary waves-effect waves-themed");
}
document.getElementById("button" + type).setAttribute("class", "btn btn-success waves-effect waves-themed");
operationRecodeTable.ajax.reload();
}
//#endregion
//#region 新增維修單
function AddRecode() {
selected_id = 0;
@ -355,6 +454,123 @@
}
//#endregion
//#region 縣市全選
function Allcity() {
var Newpowerids = new Array(0);
ids = [];
$.each(Allids, function (index, val) {
var cityid = 'cityID_' + val;
document.getElementById(cityid).setAttribute("class", 'btn btn-success waves-effect waves-themed ml-2');
ids.push(val);
});
var send_data = {
cityid: ids
}
var Nurl = "/PowerStation/GetSolarByCity";
$.post(Nurl, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
$('#CheckPowerStation').empty();
Allpowerids = [];
$.each(rel.data, function (index, val) {
if (powerids.includes(String(val.id))) {
$('#CheckPowerStation').append("<div class='custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "' checked>");
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
Newpowerids.push(String(val.id));
}
else {
$('#CheckPowerStation').append("<div class='custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "'>");
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
}
Allpowerids.push(String(val.id));
});
powerids = [];
powerids = Newpowerids;
})
}
//#endregion
//#region 電站全選
function Allpowerstation() {
powerids = [];
$.each(Allpowerids, function (index, val) {
$('#check_' + val).prop("checked", true);
powerids.push(val);
})
OperationPlanTable.ajax.reload();
}
//#endregion
//#region 選擇縣市
$('#city').on("click", "button", function () {
var clickid = $(this).attr('id');
var classid = clickid.split("_");
var Newpowerids = new Array(0);
var value = document.getElementById(clickid).className;
ids.sort(function (a, b) {
return a - b;
});
var send_data = {
cityid: ids
}
if (value == 'btn btn-outline-success waves-effect waves-themed ml-2') { //選擇
document.getElementById(clickid).setAttribute("class", 'btn btn-success waves-effect waves-themed ml-2');
ids.push(classid[1]);
}
else { //取消
document.getElementById(clickid).setAttribute("class", 'btn btn-outline-success waves-effect waves-themed ml-2');
ids.remove(classid[1]);
}
ids.sort();
var Nurl = "/PowerStation/GetSolarByCity";
$.post(Nurl, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
$('#CheckPowerStation').empty();
Allpowerids = [];
$.each(rel.data, function (index, val) {
if (powerids.includes(String(val.id))) {
$('#CheckPowerStation').append("<div class='custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "' checked>");
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
Newpowerids.push(String(val.id));
}
else {
$('#CheckPowerStation').append("<div class='custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "'>");
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
}
Allpowerids.push(String(val.id));
});
powerids = [];
powerids = Newpowerids;
})
})
//#endregion
//#region 選擇電站checkbox
$('#CheckPowerStation').on("click", "input", function () {
var clickid = $(this).attr('id');
var classid = clickid.split("_");
var job = document.getElementById(clickid);
if (job.checked == true) {
powerids.push(classid[1]);
}
else {
powerids.remove(classid[1]);
}
OperationPlanTable.ajax.reload();
})
//#endregion
//#region 編輯表單內容
$('#operation_recode_table').on("click", "a.edit-btn", function () {
@ -481,12 +697,12 @@
operationRecodeTable.ajax.reload();
});
} else {
$('#recode-form-modal').modal('hide');
myDropzone.removeAllFiles();
//} else {
// $('#recode-form-modal').modal('hide');
// myDropzone.removeAllFiles();
operationRecodeTable.ajax.reload();
}
// operationRecodeTable.ajax.reload();
//}
}
});
}

View File

@ -36,6 +36,8 @@
<!--Custome CSS-->
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" type="text/css" media="all" href="~/css/daterangepicker.css">
</head>
<body class="mod-bg-1">
@ -1115,7 +1117,11 @@
<!-- Custome JS -->
<script src="~/js/site.js" asp-append-version="true"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<!--<script src="~/js/daterangepicker.js"></script>-->
@*各頁面的JavaScript*@
@RenderSection("Scripts", required: false)
</body>
</html>
</html>

View File

@ -0,0 +1,410 @@
.daterangepicker {
position: absolute;
color: inherit;
background-color: #fff;
border-radius: 4px;
border: 1px solid #ddd;
width: 278px;
max-width: none;
padding: 0;
margin-top: 7px;
top: 100px;
left: 20px;
z-index: 3001;
display: none;
font-family: arial;
font-size: 15px;
line-height: 1em;
}
.daterangepicker:before, .daterangepicker:after {
position: absolute;
display: inline-block;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.daterangepicker:before {
top: -7px;
border-right: 7px solid transparent;
border-left: 7px solid transparent;
border-bottom: 7px solid #ccc;
}
.daterangepicker:after {
top: -6px;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
}
.daterangepicker.opensleft:before {
right: 9px;
}
.daterangepicker.opensleft:after {
right: 10px;
}
.daterangepicker.openscenter:before {
left: 0;
right: 0;
width: 0;
margin-left: auto;
margin-right: auto;
}
.daterangepicker.openscenter:after {
left: 0;
right: 0;
width: 0;
margin-left: auto;
margin-right: auto;
}
.daterangepicker.opensright:before {
left: 9px;
}
.daterangepicker.opensright:after {
left: 10px;
}
.daterangepicker.drop-up {
margin-top: -7px;
}
.daterangepicker.drop-up:before {
top: initial;
bottom: -7px;
border-bottom: initial;
border-top: 7px solid #ccc;
}
.daterangepicker.drop-up:after {
top: initial;
bottom: -6px;
border-bottom: initial;
border-top: 6px solid #fff;
}
.daterangepicker.single .daterangepicker .ranges, .daterangepicker.single .drp-calendar {
float: none;
}
.daterangepicker.single .drp-selected {
display: none;
}
.daterangepicker.show-calendar .drp-calendar {
display: block;
}
.daterangepicker.show-calendar .drp-buttons {
display: block;
}
.daterangepicker.auto-apply .drp-buttons {
display: none;
}
.daterangepicker .drp-calendar {
display: none;
max-width: 270px;
}
.daterangepicker .drp-calendar.left {
padding: 8px 0 8px 8px;
}
.daterangepicker .drp-calendar.right {
padding: 8px;
}
.daterangepicker .drp-calendar.single .calendar-table {
border: none;
}
.daterangepicker .calendar-table .next span, .daterangepicker .calendar-table .prev span {
color: #fff;
border: solid black;
border-width: 0 2px 2px 0;
border-radius: 0;
display: inline-block;
padding: 3px;
}
.daterangepicker .calendar-table .next span {
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
}
.daterangepicker .calendar-table .prev span {
transform: rotate(135deg);
-webkit-transform: rotate(135deg);
}
.daterangepicker .calendar-table th, .daterangepicker .calendar-table td {
white-space: nowrap;
text-align: center;
vertical-align: middle;
min-width: 32px;
width: 32px;
height: 24px;
line-height: 24px;
font-size: 12px;
border-radius: 4px;
border: 1px solid transparent;
white-space: nowrap;
cursor: pointer;
}
.daterangepicker .calendar-table {
border: 1px solid #fff;
border-radius: 4px;
background-color: #fff;
}
.daterangepicker .calendar-table table {
width: 100%;
margin: 0;
border-spacing: 0;
border-collapse: collapse;
}
.daterangepicker td.available:hover, .daterangepicker th.available:hover {
background-color: #eee;
border-color: transparent;
color: inherit;
}
.daterangepicker td.week, .daterangepicker th.week {
font-size: 80%;
color: #ccc;
}
.daterangepicker td.off, .daterangepicker td.off.in-range, .daterangepicker td.off.start-date, .daterangepicker td.off.end-date {
background-color: #fff;
border-color: transparent;
color: #999;
}
.daterangepicker td.in-range {
background-color: #ebf4f8;
border-color: transparent;
color: #000;
border-radius: 0;
}
.daterangepicker td.start-date {
border-radius: 4px 0 0 4px;
}
.daterangepicker td.end-date {
border-radius: 0 4px 4px 0;
}
.daterangepicker td.start-date.end-date {
border-radius: 4px;
}
.daterangepicker td.active, .daterangepicker td.active:hover {
background-color: #357ebd;
border-color: transparent;
color: #fff;
}
.daterangepicker th.month {
width: auto;
}
.daterangepicker td.disabled, .daterangepicker option.disabled {
color: #999;
cursor: not-allowed;
text-decoration: line-through;
}
.daterangepicker select.monthselect, .daterangepicker select.yearselect {
font-size: 12px;
padding: 1px;
height: auto;
margin: 0;
cursor: default;
}
.daterangepicker select.monthselect {
margin-right: 2%;
width: 56%;
}
.daterangepicker select.yearselect {
width: 40%;
}
.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect {
width: 50px;
margin: 0 auto;
background: #eee;
border: 1px solid #eee;
padding: 2px;
outline: 0;
font-size: 12px;
}
.daterangepicker .calendar-time {
text-align: center;
margin: 4px auto 0 auto;
line-height: 30px;
position: relative;
}
.daterangepicker .calendar-time select.disabled {
color: #ccc;
cursor: not-allowed;
}
.daterangepicker .drp-buttons {
clear: both;
text-align: right;
padding: 8px;
border-top: 1px solid #ddd;
display: none;
line-height: 12px;
vertical-align: middle;
}
.daterangepicker .drp-selected {
display: inline-block;
font-size: 12px;
padding-right: 8px;
}
.daterangepicker .drp-buttons .btn {
margin-left: 8px;
font-size: 12px;
font-weight: bold;
padding: 4px 8px;
}
.daterangepicker.show-ranges.single.rtl .drp-calendar.left {
border-right: 1px solid #ddd;
}
.daterangepicker.show-ranges.single.ltr .drp-calendar.left {
border-left: 1px solid #ddd;
}
.daterangepicker.show-ranges.rtl .drp-calendar.right {
border-right: 1px solid #ddd;
}
.daterangepicker.show-ranges.ltr .drp-calendar.left {
border-left: 1px solid #ddd;
}
.daterangepicker .ranges {
float: none;
text-align: left;
margin: 0;
}
.daterangepicker.show-calendar .ranges {
margin-top: 8px;
}
.daterangepicker .ranges ul {
list-style: none;
margin: 0 auto;
padding: 0;
width: 100%;
}
.daterangepicker .ranges li {
font-size: 12px;
padding: 8px 12px;
cursor: pointer;
}
.daterangepicker .ranges li:hover {
background-color: #eee;
}
.daterangepicker .ranges li.active {
background-color: #08c;
color: #fff;
}
/* Larger Screen Styling */
@media (min-width: 564px) {
.daterangepicker {
width: auto;
}
.daterangepicker .ranges ul {
width: 140px;
}
.daterangepicker.single .ranges ul {
width: 100%;
}
.daterangepicker.single .drp-calendar.left {
clear: none;
}
.daterangepicker.single .ranges, .daterangepicker.single .drp-calendar {
float: left;
}
.daterangepicker {
direction: ltr;
text-align: left;
}
.daterangepicker .drp-calendar.left {
clear: left;
margin-right: 0;
}
.daterangepicker .drp-calendar.left .calendar-table {
border-right: none;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.daterangepicker .drp-calendar.right {
margin-left: 0;
}
.daterangepicker .drp-calendar.right .calendar-table {
border-left: none;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.daterangepicker .drp-calendar.left .calendar-table {
padding-right: 8px;
}
.daterangepicker .ranges, .daterangepicker .drp-calendar {
float: left;
}
}
@media (min-width: 730px) {
.daterangepicker .ranges {
width: auto;
}
.daterangepicker .ranges {
float: left;
}
.daterangepicker.rtl .ranges {
float: right;
}
.daterangepicker .drp-calendar.left {
clear: none !important;
}
}

File diff suppressed because it is too large Load Diff