89 lines
2.6 KiB
C#
89 lines
2.6 KiB
C#
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;
|
||
|
||
namespace HT.Cloud.Web.Areas.SystemManage.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 创 建:超级管理员
|
||
/// 日 期:2022-10-06 14:11
|
||
/// 描 述:打印模板控制器类
|
||
/// </summary>
|
||
[Area("SystemManage")]
|
||
public class TemplateController : BaseController
|
||
{
|
||
public TemplateService _service {get;set;}
|
||
|
||
#region 获取数据
|
||
[HandlerAjaxOnly]
|
||
[IgnoreAntiforgeryToken]
|
||
public async Task<ActionResult> GetGridJson(SoulPage<TemplateEntity> 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(TemplateEntity entity, string keyValue)
|
||
{
|
||
try
|
||
{
|
||
await _service.SubmitForm(entity, keyValue);
|
||
return await Success("操作成功。", "", keyValue);
|
||
}
|
||
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
|
||
}
|
||
}
|