diff --git a/SolarPower/Controllers/PowerStationController.cs b/SolarPower/Controllers/PowerStationController.cs index b017a3e..eb63f51 100644 --- a/SolarPower/Controllers/PowerStationController.cs +++ b/SolarPower/Controllers/PowerStationController.cs @@ -2472,9 +2472,9 @@ namespace SolarPower.Controllers /// 其他電站下拉式選單 /// /// - public async Task>> GetPowerstationOption(int stationId) + public async Task>> GetPowerstationOption(int stationId) { - ApiResult> apiResult = new ApiResult>(); + ApiResult> apiResult = new ApiResult>(); try { var powerStation = await powerStationRepository.GetOneAsync(stationId); @@ -2497,9 +2497,9 @@ namespace SolarPower.Controllers /// /// /// - public async Task>> GetDeviceUIDList(int stationId) + public async Task>> GetDeviceUIDList(int stationId) { - ApiResult> apiResult = new ApiResult>(); + ApiResult> apiResult = new ApiResult>(); try { var powerStation = await powerStationRepository.GetOneAsync(stationId); diff --git a/SolarPower/Models/PowerStation.cs b/SolarPower/Models/PowerStation.cs index ba42f78..c37bcde 100644 --- a/SolarPower/Models/PowerStation.cs +++ b/SolarPower/Models/PowerStation.cs @@ -574,6 +574,12 @@ namespace SolarPower.Models.PowerStation public string Text { get; set; } public string Value { get; set; } } + public class PowerstationOptionAndName + { + public string Text { get; set; } + public string Value { get; set; } + public string Name { get; set; } + } /// /// 共享設備 /// diff --git a/SolarPower/Repository/Implement/PowerStationRepository.cs b/SolarPower/Repository/Implement/PowerStationRepository.cs index 63d8644..f68a67e 100644 --- a/SolarPower/Repository/Implement/PowerStationRepository.cs +++ b/SolarPower/Repository/Implement/PowerStationRepository.cs @@ -1760,16 +1760,16 @@ namespace SolarPower.Repository.Implement /// 其餘電站列表 /// /// - public async Task> GetPowerstationOptionAsync(string db_name, int stationId) + public async Task> GetPowerstationOptionAsync(string db_name, int stationId) { - List result; + List result; using (IDbConnection conn = this._databaseHelper.GetConnection()) { try { - var sql = $@"SELECT Id AS Value, Code AS Text FROM {db_name}.power_station WHERE Deleted = 0 AND Id !={stationId}"; + var sql = $@"SELECT Id AS Value, Code AS Text ,Name FROM {db_name}.power_station WHERE Deleted = 0 AND Id !={stationId}"; - result = (await conn.QueryAsync(sql)).ToList(); + result = (await conn.QueryAsync(sql)).ToList(); } catch (Exception exception) { @@ -1808,16 +1808,16 @@ namespace SolarPower.Repository.Implement /// /// /// - public async Task> GetDeviceUIDListAsync(string db_name, int stationId) + public async Task> GetDeviceUIDListAsync(string db_name, int stationId) { - List result; + List result; using (IDbConnection conn = this._databaseHelper.GetConnection()) { try { - var sql = $@"SELECT Id AS Value, UID AS Text FROM {db_name}.device WHERE Deleted = 0 AND PowerStationId ={stationId}"; + var sql = $@"SELECT Id AS Value, UID AS Text, Name FROM {db_name}.device WHERE Deleted = 0 AND PowerStationId ={stationId}"; - result = (await conn.QueryAsync(sql)).ToList(); + result = (await conn.QueryAsync(sql)).ToList(); } catch (Exception exception) { diff --git a/SolarPower/Repository/Interface/IPowerStationRepository.cs b/SolarPower/Repository/Interface/IPowerStationRepository.cs index fa85721..6a09846 100644 --- a/SolarPower/Repository/Interface/IPowerStationRepository.cs +++ b/SolarPower/Repository/Interface/IPowerStationRepository.cs @@ -405,14 +405,14 @@ namespace SolarPower.Repository.Interface /// 電站下拉式選單 /// /// - Task> GetPowerstationOptionAsync(string db_name, int stationId); + Task> GetPowerstationOptionAsync(string db_name, int stationId); /// /// 設備編號下拉式選單 /// /// /// /// - Task> GetDeviceUIDListAsync(string db_name, int stationId); + Task> GetDeviceUIDListAsync(string db_name, int stationId); /// /// 新增共享設備 /// diff --git a/SolarPower/Views/PowerStation/PowerStationEdit.cshtml b/SolarPower/Views/PowerStation/PowerStationEdit.cshtml index 21888d5..8142cae 100644 --- a/SolarPower/Views/PowerStation/PowerStationEdit.cshtml +++ b/SolarPower/Views/PowerStation/PowerStationEdit.cshtml @@ -796,7 +796,7 @@ $("#ShareDevice_PowerStationId_modal").empty(); $.each(rel.data, function (index, val) { - $("#ShareDevice_PowerStationId_modal").append($("