Files
HTCloud/HT.Cloud.Web/Areas/SystemManage/Controllers/CoderuleController.cs

103 lines
3.0 KiB
C#
Raw Permalink Normal View History

2023-03-03 16:07:50 +08:00
using System;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using HT.Cloud.Code;
using HT.Cloud.Domain.SystemManage;
using HT.Cloud.Service;
using Microsoft.AspNetCore.Authorization;
using HT.Cloud.Service.SystemManage;
using static Serenity.Web.PropertyItemsScript;
namespace HT.Cloud.Web.Areas.SystemManage.Controllers
{
/// <summary>
/// 创 建:超级管理员
/// 日 期2022-10-06 11:25
/// 描 述:条码规则控制器类
/// </summary>
[Area("SystemManage")]
public class CoderuleController : BaseController
{
public CoderuleService _service {get;set;}
#region
[HandlerAjaxOnly]
[IgnoreAntiforgeryToken]
public async Task<ActionResult> GetGridJson(SoulPage<CoderuleEntity> pagination, string keyword)
{
if (string.IsNullOrEmpty(pagination.field))
{
pagination.field = "F_Id";
pagination.order = "desc";
}
var data = await _service.GetLookList(pagination,keyword);
return Content(pagination.setData(data).ToJson());
}
[HttpGet]
[HandlerAjaxOnly]
public async Task<ActionResult> GetListJson(string keyword)
{
var data = await _service.GetList(keyword);
return Content(data.ToJson());
}
[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(CoderuleEntity entity, string keyValue)
{
try
{
await _service.SubmitForm(entity, keyValue);
return await Success("操作成功。", "", keyValue);
}
catch (Exception ex)
{
return await Error(ex.Message, "", keyValue);
}
}
[HttpPost]
[HandlerAjaxOnly]
public async Task<ActionResult> CreateForm(string keyValue,int count = 1,bool needPrint = false)
{
try
{
var data = await _service.CreateForm(keyValue, count, needPrint);
return Success("操作成功。", data);
}
catch (Exception ex)
{
return await Error(ex.Message, "", keyValue);
}
}
[HttpPost]
[HandlerAjaxOnly]
[HandlerAuthorize]
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
}
}