98 lines
3.0 KiB
C#
98 lines
3.0 KiB
C#
using System;
|
||
using System.Linq;
|
||
using System.Threading.Tasks;
|
||
using System.Collections.Generic;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
using WaterCloud.Code;
|
||
using WaterCloud.Domain.QualityManage;
|
||
using WaterCloud.Service;
|
||
using Microsoft.AspNetCore.Authorization;
|
||
using WaterCloud.Service.QualityManage;
|
||
|
||
namespace WaterCloud.Web.Areas.QualityManage.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 创 建:超级管理员
|
||
/// 日 期:2021-04-23 15:23
|
||
/// 描 述:质检参数控制器类
|
||
/// </summary>
|
||
[Area("QualityManage")]
|
||
public class CheckoutDescriptionController : BaseController
|
||
{
|
||
public CheckoutDescriptionService _service {get;set;}
|
||
|
||
#region 获取数据
|
||
[HttpGet]
|
||
[HandlerAjaxOnly]
|
||
public async Task<ActionResult> GetTreeGridJson(string keyword)
|
||
{
|
||
var data = await _service.GetLookList(keyword);
|
||
if (!string.IsNullOrEmpty(keyword))
|
||
{
|
||
//此处需修改
|
||
data = data.TreeWhere(t => t.F_Description.Contains(keyword));
|
||
}
|
||
return Success(data.Count, data);
|
||
}
|
||
|
||
[HttpGet]
|
||
[HandlerAjaxOnly]
|
||
public async Task<ActionResult> GetTreeSelectJson()
|
||
{
|
||
var data = await _service.GetList();
|
||
var treeList = new List<TreeSelectModel>();
|
||
foreach (var item in data)
|
||
{
|
||
//此处需修改
|
||
TreeSelectModel treeModel = new TreeSelectModel();
|
||
treeModel.id = item.F_Id;
|
||
treeModel.text = item.F_Description;
|
||
treeModel.parentId = item.F_ParentId;
|
||
treeList.Add(treeModel);
|
||
}
|
||
return Content(treeList.TreeSelectJson());
|
||
}
|
||
[HttpGet]
|
||
[HandlerAjaxOnly]
|
||
public async Task<ActionResult> GetFormJson(string keyValue)
|
||
{
|
||
var data = await _service.GetLookForm(keyValue);
|
||
return Content(data.ToJson());
|
||
}
|
||
#endregion
|
||
|
||
#region 提交数据
|
||
[HttpPost]
|
||
[HandlerAjaxOnly]
|
||
public async Task<ActionResult> SubmitForm(CheckoutDescriptionEntity entity, string keyValue)
|
||
{
|
||
try
|
||
{
|
||
await _service.SubmitForm(entity, keyValue);
|
||
return await Success("操作成功。", "", keyValue);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return await Error(ex.Message, "", keyValue);
|
||
}
|
||
}
|
||
|
||
[HttpPost]
|
||
[HandlerAjaxOnly]
|
||
[ServiceFilter(typeof(HandlerAuthorizeAttribute))]
|
||
public async Task<ActionResult> DeleteForm(string keyValue)
|
||
{
|
||
try
|
||
{
|
||
await _service.DeleteForm(keyValue);
|
||
return await Success("操作成功。", "", keyValue, DbLogType.Delete);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return await Error(ex.Message, "", keyValue, DbLogType.Delete);
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
}
|