|
|
using Estsh.Core.Controllers;
|
|
|
using Estsh.Core.Model.Result;
|
|
|
using Estsh.Core.Models;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Util;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using System.Collections;
|
|
|
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:页面功能管理
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Web.Controllers
|
|
|
{
|
|
|
public class PageFunctionManageController : BaseController
|
|
|
{
|
|
|
private IPageFunctionService service;
|
|
|
public PageFunctionManageController(IPageFunctionService _service)
|
|
|
{
|
|
|
service = _service;
|
|
|
}
|
|
|
//
|
|
|
// GET: /PageFunctionManage/
|
|
|
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 页面功能管理
|
|
|
/// </summary>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="menuName"></param>
|
|
|
/// <param name="enabled"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult getListByPage(Pager pager, string menuName, String enabled = "Y")
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<SysProgramFunOp> dt = service.getListByPage(ref pager, menuName, enabled);
|
|
|
|
|
|
if (dt != null)
|
|
|
{
|
|
|
result.Add("rows", dt);
|
|
|
result.Add("pager.totalRows", pager.totalRows);
|
|
|
|
|
|
}
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
public ActionResult GetWebMenuList(string q)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> dt = service.GetWebMenuList(q);
|
|
|
if (dt != null)
|
|
|
{
|
|
|
result.Add("list", dt);
|
|
|
}
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
public ActionResult GetOpType()
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
List<KeyValueResult> dt = service.GetOpType();
|
|
|
if (dt != null)
|
|
|
{
|
|
|
result.Add("list", dt);
|
|
|
}
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
public ActionResult SaveOp(string ruid, string program, string funName, string gridName,
|
|
|
string opName, string opClass, string opMethod, string opParams, string opType, string sortNum,
|
|
|
string enabled, string editType)
|
|
|
{
|
|
|
bool result = false;
|
|
|
Hashtable ht = new Hashtable();
|
|
|
string msg = string.Empty;
|
|
|
|
|
|
SysProgramFunOp sysProgram = new SysProgramFunOp();
|
|
|
sysProgram.Program = program;
|
|
|
sysProgram.FunName = funName;
|
|
|
sysProgram.GridName = gridName;
|
|
|
sysProgram.OpName = opName;
|
|
|
sysProgram.OpClass = opClass;
|
|
|
sysProgram.OpMethod = opMethod;
|
|
|
sysProgram.OpParams = opParams;
|
|
|
sysProgram.OpType = opType;
|
|
|
sysProgram.SortNum = Convert.ToInt32(sortNum);
|
|
|
sysProgram.Enabled = enabled;
|
|
|
if (editType == "Edit")
|
|
|
{
|
|
|
string where = string.Format(" WHERE ruid = {0}", ruid);
|
|
|
sysProgram.UpdateUserId = CurrentEmp.EmpId;
|
|
|
result = service.SaveOp(where, sysProgram);
|
|
|
if (result == false)
|
|
|
{
|
|
|
msg = "数据修改失败……";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
msg = "数据修改成功!";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result = service.ExitOp(program, funName, gridName, opName);
|
|
|
if (result == false)
|
|
|
{
|
|
|
sysProgram.CreateUserId = CurrentEmp.EmpId;
|
|
|
result = service.AddOp(sysProgram);
|
|
|
if (result == false)
|
|
|
{
|
|
|
msg = "数据添加失败……";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
msg = "数据添加成功!";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result = false;
|
|
|
msg = "已存在该数据!不可重复出现……";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
ht.Add("result", result);
|
|
|
ht.Add("msg", msg);
|
|
|
return Json(ht);
|
|
|
|
|
|
}
|
|
|
|
|
|
public ActionResult EditPageFunction(string ruid)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
if (string.IsNullOrEmpty(ruid) == false)
|
|
|
{
|
|
|
List<SysProgramFunOp> dt = service.GetFunctionByRuid(ruid);
|
|
|
if (dt != null && dt.Count == 1)
|
|
|
{
|
|
|
SysProgramFunOp dr = dt[0];
|
|
|
ViewData.Add("editType", "Edit");
|
|
|
ViewData.Add("program", dr.Program);
|
|
|
ViewData.Add("funName", dr.FunName);
|
|
|
ViewData.Add("gridName", dr.GridName);
|
|
|
ViewData.Add("opName", dr.OpName);
|
|
|
ViewData.Add("opClass", dr.OpClass);
|
|
|
ViewData.Add("opMethod", dr.OpMethod);
|
|
|
ViewData.Add("opParams", dr.OpParams);
|
|
|
ViewData.Add("opType", dr.OpType);
|
|
|
ViewData.Add("sortNum", dr.SortNum);
|
|
|
ViewData.Add("enabled", dr.Enabled);
|
|
|
ViewData.Add("ruid", dr.Ruid);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ViewData.Add("editType", "New");
|
|
|
}
|
|
|
return View("EditPageFunction");
|
|
|
|
|
|
}
|
|
|
|
|
|
public bool DeleteByRuid(string ruidStr)
|
|
|
{
|
|
|
if (ruidStr.EndsWith(","))
|
|
|
{
|
|
|
ruidStr = ruidStr.Substring(0, ruidStr.Length - 1);
|
|
|
}
|
|
|
return service.DeleteByRuid(ruidStr);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 启用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult onEnable(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.EnableData(ids);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 禁用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public ActionResult onDisable(String ids)
|
|
|
{
|
|
|
int delCount = 0;
|
|
|
try
|
|
|
{
|
|
|
delCount = this.service.DisableData(ids);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
delCount = -1;
|
|
|
}
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("status", delCount);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|