Merge branch 'master' into Willy
This commit is contained in:
commit
9357117770
@ -42,31 +42,49 @@ namespace SolarPower.Controllers
|
||||
|
||||
var siteDBNamePowerStationId = new Dictionary<string, List<int>>();
|
||||
|
||||
var powerStation_Group = powerStations.GroupBy(x => x.SiteDB).ToList();
|
||||
foreach (var stations in powerStation_Group)
|
||||
var powerStation_siteDB_Group = powerStations.GroupBy(x => x.SiteDB).ToList();
|
||||
foreach (var siteDB_Group in powerStation_siteDB_Group)
|
||||
{
|
||||
var powerStationIds = stations.Select(x => x.Id).ToList();
|
||||
siteDBNamePowerStationId.Add(stations.Key, powerStationIds);
|
||||
var powerStationIds = siteDB_Group.Select(x => x.Id).ToList();
|
||||
siteDBNamePowerStationId.Add(siteDB_Group.Key, powerStationIds);
|
||||
}
|
||||
|
||||
var powerStationDevices = await powerStationRepository.GetPowerStationDevice(siteDBNamePowerStationId, filter);
|
||||
|
||||
powerStationDevices = powerStationDevices.Where(x => x.DeviceId != null).ToList();
|
||||
|
||||
var powerStationDevice_Group = powerStationDevices.GroupBy(x => x.CityName).ToList();
|
||||
var powerStationDevice_cityName_Group = powerStationDevices.GroupBy(x => x.CityName).ToList();
|
||||
|
||||
var deviceCollapse = new Dictionary<string, Dictionary<string, List<PowerStationDevice>>>();
|
||||
foreach (var powerStationDevice in powerStationDevice_Group)
|
||||
foreach (var cityName_Group in powerStationDevice_cityName_Group)
|
||||
{
|
||||
var device_Group = powerStationDevice.GroupBy(x => x.PowerStationName).ToList();
|
||||
var device_psName_Group = cityName_Group.GroupBy(x => x.PowerStationName).ToList();
|
||||
|
||||
var deviceDic = new Dictionary<string, List<PowerStationDevice>>();
|
||||
foreach (var inverter in device_Group)
|
||||
|
||||
foreach (var psName_Group in device_psName_Group)
|
||||
{
|
||||
deviceDic.Add(inverter.Key, inverter.ToList());
|
||||
//電站總覽
|
||||
PowerStationDevice powerStation = new PowerStationDevice()
|
||||
{
|
||||
CityName = cityName_Group.Key,
|
||||
PowerStationName = psName_Group.Key,
|
||||
PowerStationId = psName_Group.First().PowerStationId,
|
||||
DeviceName = "電站總覽",
|
||||
DeviceType = "PWS",
|
||||
DeviceId = psName_Group.First().PowerStationId.ToString()
|
||||
};
|
||||
|
||||
var temp = new List<PowerStationDevice>();
|
||||
temp.Add(powerStation);
|
||||
foreach(var device in psName_Group)
|
||||
{
|
||||
temp.Add(device);
|
||||
}
|
||||
deviceDic.Add(psName_Group.Key, temp);
|
||||
}
|
||||
|
||||
deviceCollapse.Add(powerStationDevice.Key, deviceDic);
|
||||
deviceCollapse.Add(cityName_Group.Key, deviceDic);
|
||||
}
|
||||
|
||||
apiResult.Code = "0000";
|
||||
@ -83,5 +101,48 @@ namespace SolarPower.Controllers
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<AnalysisDevice>> GetAnalysisByDeviceIds(PostAnalysisStation post)
|
||||
{
|
||||
ApiResult<AnalysisDevice> apiResult = new ApiResult<AnalysisDevice>();
|
||||
try
|
||||
{
|
||||
AnalysisDevice analysisDevice = new AnalysisDevice();
|
||||
|
||||
//先將欲查詢的設備找出設備的資料庫欄位
|
||||
var device_powerStationId_Group = post.DeviceIdInfos.GroupBy(x => x.PowerStationId).ToList();
|
||||
List<Device> devices = new List<Device>();
|
||||
foreach(var psId_Group in device_powerStationId_Group)
|
||||
{
|
||||
var powerStation = await powerStationRepository.GetOneAsync(psId_Group.Key);
|
||||
|
||||
var selected_device = psId_Group.Where(x => x.DeviceType != "PWS").Select(x => x.DeviceId).ToList();
|
||||
|
||||
//var temp_device = await powerStationRepository.GetDeviceByPowerStationIdAndDeviceIds(powerStation.SiteDB, powerStation.Id, selected_device);
|
||||
|
||||
//devices.AddRange(temp_device);
|
||||
}
|
||||
|
||||
if(post.SearchType == 0)
|
||||
{ //單日
|
||||
|
||||
}
|
||||
|
||||
|
||||
apiResult.Code = "0000";
|
||||
|
||||
apiResult.Data = analysisDevice;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】");
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
}
|
||||
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
return apiResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,6 @@ namespace SolarPower.Models
|
||||
public class AnalysisInverter
|
||||
{
|
||||
public List<string> XAxis { get; set; } //時間
|
||||
public List<string> XAxisOnTime { get; set; } //時間(整點)
|
||||
public Dictionary<string, string> MultipleYaxes { get; set; } //Y軸名稱
|
||||
public List<InverterHistoryInfo> Series { get; set; } //數組
|
||||
}
|
||||
|
||||
@ -18,4 +18,32 @@ namespace SolarPower.Models
|
||||
public string DeviceType { get; set; }
|
||||
public string DeviceId { get; set; }
|
||||
}
|
||||
|
||||
public class PostAnalysisStation
|
||||
{
|
||||
public byte SearchType { get; set; }
|
||||
public string SelectedDate { get; set; }
|
||||
public List<DeviceIdInfo> DeviceIdInfos { get; set; }
|
||||
}
|
||||
|
||||
public class DeviceIdInfo
|
||||
{
|
||||
public int PowerStationId { get; set; }
|
||||
public string DeviceType { get; set; }
|
||||
public string DeviceId { get; set; }
|
||||
}
|
||||
|
||||
public class AnalysisDevice
|
||||
{
|
||||
public List<string> XAxis { get; set; } //時間
|
||||
public Dictionary<string, string> MultipleYaxes { get; set; } //Y軸名稱
|
||||
public List<DeviceHistoryInfo> Series { get; set; } //數組
|
||||
}
|
||||
|
||||
public class DeviceHistoryInfo
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string YaxesKey { get; set; }
|
||||
public List<double> Values { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -2323,10 +2323,10 @@ namespace SolarPower.Repository.Implement
|
||||
|
||||
foreach (var device in deviceInfos)
|
||||
{
|
||||
var str = @$"SELECT DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/ 1000), '%Y-%m-%d %H') AS TIMESTAMP, s.SITEID, AVG(s.{device.ColName}) AS SENSOR
|
||||
var str = @$"SELECT DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/ 1000), '%Y-%m-%d %H') AS TIMESTAMP, s.SITEID, CASE WHEN AVG(CASE WHEN s.{device.ColName} != 0 THEN s.{device.ColName} END) IS NOT NULL THEN AVG(CASE WHEN s.{device.ColName} != 0 THEN s.{device.ColName} END)
|
||||
ELSE 0 END AS SENSOR
|
||||
FROM {device.DBName}.{device.TableName} s
|
||||
WHERE s.{device.ColName} != 0
|
||||
AND DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/ 1000), '%Y-%m-%d %H') = @DateTime
|
||||
WHERE DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/ 1000), '%Y-%m-%d %H') = @DateTime
|
||||
GROUP BY DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/ 1000), '%Y-%m-%d %H')";
|
||||
|
||||
sql_per_device.Add(str);
|
||||
@ -3951,5 +3951,47 @@ namespace SolarPower.Repository.Implement
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//public async Task<List<Device>> GetDeviceByPowerStationIdAndDeviceIds(string db_name, int powerStationId, List<string> deviceIds)
|
||||
//{
|
||||
// List<Device> result;
|
||||
// using (IDbConnection conn = this._databaseHelper.GetConnection())
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// var sql = @$"SELECT FROM {db_name}.device d
|
||||
// WHERE d.";
|
||||
|
||||
|
||||
// result = (await conn.QueryAsync<PowerStationIdAndCity>(sql, new { Filter = filter })).ToList();
|
||||
// }
|
||||
// catch (Exception exception)
|
||||
// {
|
||||
// throw exception;
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
//}
|
||||
|
||||
//public async Task<List<Device>> GetSensorAvgByDevices(List<Device> devices)
|
||||
//{
|
||||
// //List<Device> result;
|
||||
// //using (IDbConnection conn = this._databaseHelper.GetConnection())
|
||||
// //{
|
||||
// // try
|
||||
// // {
|
||||
// // //var sql = @$"SELECT FROM {db_name}.device d
|
||||
// // // WHERE d.";
|
||||
|
||||
|
||||
// // //result = (await conn.QueryAsync<PowerStationIdAndCity>(sql, new { Filter = filter })).ToList();
|
||||
// // }
|
||||
// // catch (Exception exception)
|
||||
// // {
|
||||
// // throw exception;
|
||||
// // }
|
||||
// // return result;
|
||||
// //}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@ -554,5 +554,7 @@ namespace SolarPower.Repository.Interface
|
||||
Task<List<InverterHistory>> GetInverterHistoryByYear(string year, List<StationIdWithInverterIds> entities);
|
||||
Task<List<PowerStationIdAndCity>> GetPowerStationsByCompanyIdWithfilter(int companyId,string filter);
|
||||
Task<List<PowerStationIdAndCity>> GetPowerStationsAllWithfilter(string filter);
|
||||
//Task<List<Device>> GetDeviceByPowerStationIdAndDeviceIds(string db_name, int powerStationId, List<string> deviceIds);
|
||||
//Task<List<Device>> GetSensorAvgByDevices(List<Device> devices);
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<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="GetAnalysisStationInfo()">查詢</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -74,31 +74,32 @@
|
||||
<div class="pr-3">
|
||||
<div class="btn-group" id="js-demo-nesting" role="group" aria-label="Button group with nested dropdown">
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown">選擇比較欄位 </button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="javascript:void(0)">2021 四月</a>
|
||||
<a class="dropdown-item" href="javascript:void(0)">2021 三月</a>
|
||||
</div>
|
||||
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown">選擇比較欄位</button>
|
||||
<ul class="dropdown-menu" id="compare-dropdown-menu" style="width:10vw;overflow-x:hidden; max-height:50vh">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pr-3">
|
||||
<div class="btn-group" id="js-demo-nesting" role="group" aria-label="Button group with nested dropdown">
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown">下載 </button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="javascript:void(0)">2021 四月</a>
|
||||
<a class="dropdown-item" href="javascript:void(0)">2021 三月</a>
|
||||
@*<div class="pr-3">
|
||||
<div class="btn-group" id="js-demo-nesting" role="group" aria-label="Button group with nested dropdown">
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown">下載 </button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="javascript:void(0)">2021 四月</a>
|
||||
<a class="dropdown-item" href="javascript:void(0)">2021 三月</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pr-3">
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed"><i class="fal fa-expand fs-md"></i></button>
|
||||
</div>
|
||||
<div class="pr-3">
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed"><i class="fal fa-expand fs-md"></i></button>
|
||||
</div>*@
|
||||
|
||||
</div>
|
||||
<p>放圖表</p>
|
||||
<figure class="highcharts-figure">
|
||||
<div id="container"></div>
|
||||
|
||||
</figure>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -116,11 +117,12 @@
|
||||
var datepicker;
|
||||
var timerange;//選取時間
|
||||
var selected_device = [];
|
||||
var PYR_select_col = [{ name: "日照度", type: "PYR", value: "Irradiance" }];
|
||||
var ETR_select_col = [{ name: "環境溫度計", type: "ETR", value: "Temperature" }];
|
||||
var EMM_select_col = [{ name: "濕度", type: "EMM", value: "Humidity" }];
|
||||
var VAN_select_col = [{ name: "風速", type: "VAN", value: "Vane" }];
|
||||
var FOM_select_col = [{ name: "落塵%", type: "FOM", value: "Dust" }];
|
||||
var PWS_compare_col = [{ key: "KWH", title: "發電量" }, { key: "Irradiance", title: "日照度" }]
|
||||
var PYR_compare_col = [{ key: "Irradiance", title: "日照度" }];
|
||||
var ETR_compare_col = [{ key: "Temperature", title: "環境溫度計" }];
|
||||
var EMM_compare_col = [{ key: "Humidity", title: "濕度" }];
|
||||
var VAN_compare_col = [{ key: "Vane", title: "風速" }];
|
||||
var FOM_compare_col = [{ key: "Dust", title: "落塵%" }];
|
||||
var all_selected_compare_col = [];
|
||||
var checked_compare_col = [];
|
||||
|
||||
@ -297,103 +299,88 @@
|
||||
|
||||
$('#js_list_accordion').on("change", 'input[name="selectedDeviceId[]"]', function (event) {
|
||||
if (this.checked) {
|
||||
if ($.inArray(this.value, selected_device) < 0) {
|
||||
selected_device.push(this.value);
|
||||
if (!selected_device.some(x => x.deviceId == this.value)) {
|
||||
var type = $(this).attr("data-type");
|
||||
|
||||
var temp_obj = {
|
||||
powerStationId: $(this).attr("data-power-station-id"),
|
||||
deviceType: type,
|
||||
deviceId: this.value
|
||||
}
|
||||
|
||||
selected_device.push(temp_obj);
|
||||
|
||||
switch (type) {
|
||||
case 'PWS':
|
||||
PushAllSelectedCompareCol(PWS_compare_col);
|
||||
break;
|
||||
case 'PWR': //電錶
|
||||
|
||||
break;
|
||||
case 'PYR': //日照計
|
||||
PushAllSelectedCompareCol(PYR_compare_col);
|
||||
break;
|
||||
case 'ETR': //環境溫度計
|
||||
PushAllSelectedCompareCol(ETR_compare_col);
|
||||
break;
|
||||
case 'VAN': //風速計
|
||||
PushAllSelectedCompareCol(VAN_compare_col);
|
||||
break;
|
||||
case 'FOM': //落塵計
|
||||
PushAllSelectedCompareCol(FOM_compare_col);
|
||||
break;
|
||||
case 'EMM': //環境濕度計
|
||||
PushAllSelectedCompareCol(EMM_compare_col);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (selected_device.some(x => x.deviceId == this.value)) {
|
||||
|
||||
var temp_index;
|
||||
selected_device.find(function (obj, index) {
|
||||
if (obj.deviceId == this.value) {
|
||||
temp_index = index;
|
||||
}
|
||||
});
|
||||
|
||||
selected_device.splice(temp_index, 1);
|
||||
|
||||
var type = $(this).attr("data-type");
|
||||
|
||||
switch (type) {
|
||||
case 'PWR': //電錶
|
||||
|
||||
case 'PWS':
|
||||
RemoveAllSelectedCompareCol(PWS_compare_col);
|
||||
break;
|
||||
case 'PYR': //日照計
|
||||
$.each(PYR_select_col, function (index, item) {
|
||||
if (!all_selected_compare_col.includes(item)) {
|
||||
all_selected_compare_col.push(item);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'ETR': //環境溫度計
|
||||
$.each(ETR_select_col, function (index, item) {
|
||||
if (!all_selected_compare_col.includes(item)) {
|
||||
all_selected_compare_col.push(item);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'VAN': //風速計
|
||||
$.each(VAN_select_col, function (index, item) {
|
||||
if (!all_selected_compare_col.includes(item)) {
|
||||
all_selected_compare_col.push(item);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'FOM': //落塵計
|
||||
$.each(FOM_select_col, function (index, item) {
|
||||
if (!all_selected_compare_col.includes(item)) {
|
||||
all_selected_compare_col.push(item);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case 'EMM': //環境濕度計
|
||||
$.each(EMM_select_col, function (index, item) {
|
||||
if (!all_selected_compare_col.includes(item)) {
|
||||
all_selected_compare_col.push(item);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
console.log(all_selected_compare_col);
|
||||
}
|
||||
} else {
|
||||
if ($.inArray(this.value, selected_device) > -1) {
|
||||
selected_device.splice($.inArray(this.value, selected_device), 1);
|
||||
|
||||
switch (type) {
|
||||
case 'PWR': //電錶
|
||||
|
||||
break;
|
||||
case 'PYR': //日照計
|
||||
$.each(PYR_select_col, function (index, item) {
|
||||
if (all_selected_compare_col.includes(item)) {
|
||||
all_selected_compare_col($.inArray(item, all_selected_compare_col), 1);
|
||||
}
|
||||
});
|
||||
RemoveAllSelectedCompareCol(PYR_compare_col);
|
||||
break;
|
||||
case 'ETR': //環境溫度計
|
||||
$.each(ETR_select_col, function (index, item) {
|
||||
if (all_selected_compare_col.includes(item)) {
|
||||
all_selected_compare_col($.inArray(item, all_selected_compare_col), 1);
|
||||
}
|
||||
});
|
||||
RemoveAllSelectedCompareCol(ETR_compare_col);
|
||||
|
||||
break;
|
||||
case 'VAN': //風速計
|
||||
$.each(VAN_select_col, function (index, item) {
|
||||
if (all_selected_compare_col.includes(item)) {
|
||||
all_selected_compare_col($.inArray(item, all_selected_compare_col), 1);
|
||||
}
|
||||
});
|
||||
RemoveAllSelectedCompareCol(VAN_compare_col);
|
||||
break;
|
||||
case 'FOM': //落塵計
|
||||
$.each(FOM_select_col, function (index, item) {
|
||||
if (all_selected_compare_col.includes(item)) {
|
||||
all_selected_compare_col($.inArray(item, all_selected_compare_col), 1);
|
||||
}
|
||||
});
|
||||
RemoveAllSelectedCompareCol(VAN_compare_col);
|
||||
break;
|
||||
case 'EMM': //環境濕度計
|
||||
$.each(EMM_select_col, function (index, item) {
|
||||
if (all_selected_compare_col.includes(item)) {
|
||||
all_selected_compare_col($.inArray(item, all_selected_compare_col), 1);
|
||||
}
|
||||
});
|
||||
RemoveAllSelectedCompareCol(EMM_compare_col);
|
||||
break;
|
||||
}
|
||||
|
||||
all_selected_compare_col = all_selected_compare_col.filter(x => x.count > 0);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(selected_device);
|
||||
console.log("all_selected_compare_col", all_selected_compare_col);
|
||||
ChangeCompareSelectOption()
|
||||
|
||||
console.log("selected_device", selected_device);
|
||||
});
|
||||
|
||||
$('#js_list_accordion').on("change", 'input[name="selectedDeviceLayer2[]"]', function (event) {
|
||||
@ -454,6 +441,9 @@
|
||||
$.each(deviceCollapse[key][powerStationkey], function (index, device) {
|
||||
var device_icon = "";
|
||||
switch (device.deviceType) {
|
||||
case "PWS": //電站總覽
|
||||
device_icon = '<i class="fal fa-charging-station"></i>';
|
||||
break;
|
||||
case 'PWR': //電錶
|
||||
device_icon = '<i class="fal fa-tachometer-alt-slow"></i>';
|
||||
break;
|
||||
@ -474,8 +464,8 @@
|
||||
break;
|
||||
}
|
||||
str += '<li class="list-group-item pr-0 d-flex justify-content-between">' +
|
||||
'<a href="#">' + device_icon + ' ' + device.deviceName + '</a>' +
|
||||
'<div class=""><input type="checkbox" class="" name="selectedDeviceId[]" data-type="' + device.deviceType + '" value="' + device.deviceId + '">' + '</div>'
|
||||
'<a href="javascript:void(0)">' + device_icon + ' ' + device.deviceName + '</a>' +
|
||||
'<div class=""><input type="checkbox" class="" name="selectedDeviceId[]" data-power-station-id="' + device.powerStationId + '" data-type="' + device.deviceType + '" value="' + device.deviceId + '">' + '</div>'
|
||||
'</li>';
|
||||
});
|
||||
str += '</ul>' +
|
||||
@ -491,9 +481,9 @@
|
||||
$('#js_list_accordion').append(str);
|
||||
$('#js_list_accordion').find('.card').first().addClass(" border-top-left-radius-0 border-top-right-radius-0");
|
||||
|
||||
if (selected_device.length <= 0) {
|
||||
|
||||
selected_device.push(Object.values(Object.values(deviceCollapse)[0])[0][0].deviceId)
|
||||
if (selected_device.length <= 0) {
|
||||
$('input[name="selectedDeviceId[]"]').first().trigger("click");
|
||||
}
|
||||
|
||||
$('input[name="selectedDeviceId[]"]').each(function () {
|
||||
@ -508,8 +498,85 @@
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
function ChangeColSelectOption() {
|
||||
//#region 將設備欄位加入要顯示得比較欄位
|
||||
function PushAllSelectedCompareCol(compare_col) {
|
||||
$.each(compare_col, function (index, item) {
|
||||
if (!all_selected_compare_col.some(x => x.key == item.key)) {
|
||||
item.count = 1;
|
||||
all_selected_compare_col.push(item);
|
||||
} else {
|
||||
all_selected_compare_col.find(function (obj, index) {
|
||||
if (obj.key == item.key) {
|
||||
all_selected_compare_col[index].count += 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 將設備欄位移除要顯示得比較欄位
|
||||
function RemoveAllSelectedCompareCol(compare_col) {
|
||||
$.each(compare_col, function (index, item) {
|
||||
all_selected_compare_col.find(function (obj, index) {
|
||||
if (obj.key == item.key) {
|
||||
all_selected_compare_col[index].count -= 1;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
//#endregion
|
||||
|
||||
function ChangeCompareSelectOption() {
|
||||
$("#compare-dropdown-menu").empty();
|
||||
var str = "";
|
||||
$.each(all_selected_compare_col, function (index, item) {
|
||||
str += '<li><a href="javascript:void(0)" class="dropdown-item" tabIndex="-1">' + item.title + '<input type="checkbox" class="float-right" name="compare_col[]" value="' + item.key + '" /></a></li>'
|
||||
});
|
||||
$("#compare-dropdown-menu").append(str);
|
||||
}
|
||||
|
||||
function GetAnalysisStationInfo() {
|
||||
var date;
|
||||
if (searchType != 1) {
|
||||
date = $('#DateGet').val();
|
||||
} else {
|
||||
date = $('#DateGettext').val();
|
||||
}
|
||||
|
||||
var url = "/AnalysisStationInfo/GetAnalysisByDeviceIds";
|
||||
|
||||
var send_data = {
|
||||
SearchType: searchType,
|
||||
SelectedDate: date,
|
||||
DeviceIdInfos: selected_device
|
||||
}
|
||||
|
||||
$.post(url, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
analysisStationInfo = rel.data;
|
||||
|
||||
if (searchType != 0) {
|
||||
$('input[name="compare_col[]"]').each(function () {
|
||||
if ($.inArray(this.value, default_compare_date) > -1) {
|
||||
$(this).prop('checked', true).trigger('change');
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
$('input[name="compare_col[]"]').each(function () {
|
||||
if ($.inArray(this.value, default_compare_row_data) > -1) {
|
||||
$(this).prop('checked', true).trigger('change');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@*ReloadHighCharts();*@
|
||||
}, 'json');
|
||||
}
|
||||
</script>
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user