[儀錶板] 取得契約容量 API 調整 前端串接API調整
This commit is contained in:
parent
500c2badfe
commit
de4136c301
@ -348,10 +348,8 @@
|
||||
}
|
||||
// 取得 自動須量
|
||||
function getAutDemVal() {
|
||||
let url = baseApiUrl + "/api/Energe/GetAutDemVal";
|
||||
let sendData = {
|
||||
building_tag: pageAct.buiTag,
|
||||
};
|
||||
let url = baseApiUrl + "/api/Dashboard/GetContractValue";
|
||||
let sendData = pageAct.buiTag
|
||||
objSendData.Data = sendData;
|
||||
ytAjax = new YourTeam.Ajax(
|
||||
url,
|
||||
@ -359,11 +357,7 @@
|
||||
function (res) {
|
||||
if (!res || res.code != "0000" || !res.data) {
|
||||
} else {
|
||||
let setKeyValue = {};
|
||||
$.each(res.data || [], (idx, data) => {
|
||||
setKeyValue[data.system_key] = data.system_value || 0;
|
||||
})
|
||||
contractCapacity = setKeyValue["contract_capacity"];
|
||||
contractCapacity = (res.data || [])[0]?.contract_value ?? 0;
|
||||
getFirstEletric()
|
||||
}
|
||||
},
|
||||
@ -1030,7 +1024,6 @@
|
||||
|
||||
onEvent("click", "button[id^=sysSubCardBtn]", function () {
|
||||
let subSysTag = $(this).data("id");
|
||||
debugger
|
||||
$(`#subSysBtn${subSysTag}[data-building-tag='${buildingTagOnJquery(pageAct.buiTag)}']`).click();
|
||||
});
|
||||
</script>
|
||||
|
@ -97,5 +97,39 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
return Ok(apiResult);
|
||||
}
|
||||
|
||||
#region 取得各棟契約容量 (儀錶板用)
|
||||
[HttpPost]
|
||||
[Route("api/Dashboard/GetContractValue")]
|
||||
public async Task<ActionResult<ApiResult<List<ContractValue>>>> GetContractValue([FromBody] string building_tag)
|
||||
{
|
||||
ApiResult<List<ContractValue>> apiResult = new ApiResult<List<ContractValue>>();
|
||||
try
|
||||
{
|
||||
var sqlString = $@"SELECT
|
||||
system_key AS 'building_tag',
|
||||
system_value AS 'contract_value',
|
||||
system_remark AS 'remark'
|
||||
FROM variable
|
||||
WHERE
|
||||
system_type = 'dashboard_contract_value'
|
||||
AND deleted = '0'
|
||||
AND (@building_tag IS NULL OR @building_tag = system_key)";
|
||||
var ess = await backendRepository.GetAllAsync<ContractValue>(sqlString,new { building_tag = building_tag });
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Data = ess;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
return Ok(apiResult);
|
||||
}
|
||||
return Ok(apiResult);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -14,4 +14,11 @@
|
||||
public string device_number { get; set; }
|
||||
public string remark { get; set; }
|
||||
}
|
||||
|
||||
public class ContractValue
|
||||
{
|
||||
public string building_tag { get; set; }
|
||||
public string contract_value { get; set; }
|
||||
public string remark { get; set; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user