andon区域下拉
This commit is contained in:
@@ -103,13 +103,21 @@ namespace ZR.Admin.WebApi.Controllers.andon
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpGet("getPullDown")]
|
[HttpGet("getPullDownP")]
|
||||||
[ActionPermissionFilter(Permission = "business:andonalarmarea:list")]
|
[ActionPermissionFilter(Permission = "business:andonalarmarea:list")]
|
||||||
public ApiResult GetPullDown()
|
public ApiResult GetPullDownP()
|
||||||
{
|
{
|
||||||
var response = _AndonAlarmAreaService.GetPullDown();
|
var response = _AndonAlarmAreaService.GetPullDownP();
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpPost("getPullDownByPID")]
|
||||||
|
[ActionPermissionFilter(Permission = "business:andonalarmarea:list")]
|
||||||
|
public ApiResult GetPullDownByPID([FromBody] AlarmAreaPullDownDto parm)
|
||||||
|
{
|
||||||
|
var response = _AndonAlarmAreaService.GetPullDownByPID(parm);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,6 +80,16 @@ namespace ZR.Admin.WebApi.Controllers.andon
|
|||||||
public IActionResult UpdateAndonAlarmRecord([FromBody] AndonAlarmRecordDto parm)
|
public IActionResult UpdateAndonAlarmRecord([FromBody] AndonAlarmRecordDto parm)
|
||||||
{
|
{
|
||||||
var modal = parm.Adapt<AndonAlarmRecord>().ToUpdate(HttpContext);
|
var modal = parm.Adapt<AndonAlarmRecord>().ToUpdate(HttpContext);
|
||||||
|
if (parm.Area != null && parm.Area.Length > 0)
|
||||||
|
{
|
||||||
|
modal.Area1 = parm.Area.Length > 0 ? parm.Area[0] : string.Empty;
|
||||||
|
modal.Area2 = parm.Area.Length > 1 ? parm.Area[1] : string.Empty;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
modal.Area1 = string.Empty;
|
||||||
|
modal.Area2 = string.Empty;
|
||||||
|
}
|
||||||
var response = _AndonAlarmRecordService.UpdateAndonAlarmRecord(modal);
|
var response = _AndonAlarmRecordService.UpdateAndonAlarmRecord(modal);
|
||||||
|
|
||||||
return ToResponse(response);
|
return ToResponse(response);
|
||||||
|
|||||||
@@ -31,14 +31,6 @@ namespace ZR.Model.MES.andon.Dto
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class AlarmAreaPullDownDto
|
public class AlarmAreaPullDownDto
|
||||||
{
|
|
||||||
public string label { get; set; }
|
|
||||||
public int value { get; set; }
|
|
||||||
|
|
||||||
public List<AlarmAreaPullDown2Dto> children { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class AlarmAreaPullDown2Dto
|
|
||||||
{
|
{
|
||||||
public string label { get; set; }
|
public string label { get; set; }
|
||||||
public int value { get; set; }
|
public int value { get; set; }
|
||||||
|
|||||||
@@ -76,31 +76,36 @@ namespace ZR.Service.mes.andon
|
|||||||
return Update(model, true);
|
return Update(model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiResult GetPullDown()
|
public ApiResult GetPullDownP()
|
||||||
{
|
{
|
||||||
var response = Queryable()
|
var response = Queryable()
|
||||||
.Where(a => a.ParentId == null || a.ParentId == 0)
|
.Where(a => a.ParentId == null || a.ParentId == 0)
|
||||||
.Select(a => new AlarmAreaPullDownDto
|
.Select(a => new AlarmAreaPullDownDto
|
||||||
{
|
{
|
||||||
label = a.Area,
|
label = a.Area,
|
||||||
value = a.Id,
|
value = a.Id
|
||||||
children = new List<AlarmAreaPullDown2Dto>()
|
}).ToList();
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
foreach (var item in response)
|
|
||||||
{
|
|
||||||
item.children = Queryable()
|
|
||||||
.Where(a => a.ParentId == item.value)
|
|
||||||
.Select(a => new AlarmAreaPullDown2Dto
|
|
||||||
{
|
|
||||||
label = a.Area,
|
|
||||||
value = a.Id,
|
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
return ApiResult.Success("成功", response);
|
return ApiResult.Success("成功", response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ApiResult GetPullDownByPID(AlarmAreaPullDownDto parm)
|
||||||
|
{
|
||||||
|
if (parm != null)
|
||||||
|
{
|
||||||
|
var response = Queryable()
|
||||||
|
.Where(a => a.ParentId == parm.value)
|
||||||
|
.Select(a => new AlarmAreaPullDownDto
|
||||||
|
{
|
||||||
|
label = a.Area,
|
||||||
|
value = a.Id
|
||||||
|
}).ToList();
|
||||||
|
return ApiResult.Success("成功", response);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ApiResult.Error("参数错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,6 +19,7 @@ namespace ZR.Service.mes.andon.Iservice {
|
|||||||
AndonAlarmArea AddAndonAlarmArea(AndonAlarmArea parm);
|
AndonAlarmArea AddAndonAlarmArea(AndonAlarmArea parm);
|
||||||
|
|
||||||
int UpdateAndonAlarmArea(AndonAlarmArea parm);
|
int UpdateAndonAlarmArea(AndonAlarmArea parm);
|
||||||
ApiResult GetPullDown();
|
ApiResult GetPullDownP();
|
||||||
|
ApiResult GetPullDownByPID(AlarmAreaPullDownDto parm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user