123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Web;
- using System.Web.Mvc;
- using PMS.BusinessModels.SysManager;
- using PMS.EntityModels.SysManager;
- using PMS.Interface;
- using PMS.Interface.SysManager;
- using QWPlatform.SystemLibrary;
- namespace PMS.WebUI.Controllers
- {
- /// <summary>
- /// 创 建 人:王海洋
- /// 创建日期:2018-12-10
- /// 功能描述:系统管理模块控制器
- /// </summary>
- public class SysManagerController : BaseController
- {
- ISystemModule systemModule = InterfaceFactory.CreateBusinessInstance<ISystemModule>();
- IButton button = InterfaceFactory.CreateBusinessInstance<IButton>();
- //配置服务
- ISysConfig sys_config = InterfaceFactory.CreateBusinessInstance<ISysConfig>();
- #region 模块管理
- // GET: SysManager
- public ActionResult ModuleList()
- {
- //toolbar
- ViewBag.toolbar = this.GetToolbar("toolbar");
- return View();
- }
- [HttpGet]
- public ActionResult ModuleQueryList()
- {
- var json = systemModule.GetTreeGridView();
- return Content(json, "application/json");
- }
- //获取module的树型json(所有菜单,包含未启用的菜单)
- public ActionResult GetModuleTree()
- {
- var json = systemModule.GetEasyUIJson();
- return Content(json, "application/json");
- }
- //获取所有菜单的目录(可用的)
- public ActionResult GetModuleTreeActive()
- {
- var json = systemModule.GetActiveTreemenu();
- return Content(json, "application/json");
- }
- //模块信息页面
- public ActionResult ModuleInfo(string id)
- {
- ViewBag.id = id;
- return View();
- }
- /// <summary>
- /// 获取模块信息(根据ID信息获取对应的json对象)
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- [HttpGet]
- public ActionResult GetModuleInfo(string id)
- {
- var dt = systemModule.GetModuleInfo(int.Parse(id));
- return this.ResponseJson(System.Net.HttpStatusCode.OK, "读取成功", dt);
- }
- //编辑数据并保存(可能是新增加)
- [HttpPost]
- public ActionResult PostSaveModule(form_menu_model model)
- {
- //调用业务接口进行保存
- var r = systemModule.SaveInfo(model);
- if (r)
- {//保存成功
- return this.ResponseJson(System.Net.HttpStatusCode.OK, "保存成功");
- }
- else
- {//保存失败
- return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "保存失败");
- }
- }
- //根据ID删除模块记录
- [HttpPost]
- public ActionResult DeleteModule(int id)
- {
- var r = systemModule.DeleteModule(id);
- if (r)
- {
- return this.ResponseJson(System.Net.HttpStatusCode.OK, "删除成功");
- }
- return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "删除失败");
- }
- //模块按钮
- public ActionResult ModuleButtonList(int id)
- {
- ViewBag.id = id;
- return View();
- }
- //获取所有按钮列表(已启用)
- [HttpGet]
- public ActionResult ButtonListActive(int id)
- {
- DataTable dt = null;
- if (id <= 0)
- {//加载所有的功能清单
- dt = button.GetListJson(true);
- }
- else
- {//加载已授权的功能列表(模块ID)
- dt = systemModule.GetButtonListByID(id);
- }
- return Content(dt.ToEasyUIGridJson(0, null));
- }
- //对指定的模块进行授权(分配按钮到模块上)
- [HttpPost]
- public ActionResult PostAuthButtons(int id, string buttonids, string group)
- {
- bool r = systemModule.AuthButtons(id, buttonids, group);
- if (r)
- {
- return ResponseJson(System.Net.HttpStatusCode.OK, "分配按钮成功");
- }
- else
- {
- return ResponseJson(System.Net.HttpStatusCode.Forbidden, "分配按钮失败,填写数据不完整");
- }
- }
- //移除模块的指定按钮
- [HttpPost]
- public ActionResult PostRemoveAuthButtons(string ids)
- {
- bool r = systemModule.RemoveAuthButtons(ids);
- if (r)
- {
- return ResponseJson(System.Net.HttpStatusCode.OK, "撤销分配成功");
- }
- else
- {
- return ResponseJson(System.Net.HttpStatusCode.Forbidden, "分配按钮成功");
- }
- }
- //验证是否存在相同的模块名称
- public ActionResult CheckModuleNameExists(string name, int id)
- {
- var r = systemModule.CheckNameExists(name, id);
- if (r)
- {//存在,验证失败
- return Content("false");
- }
- //不存在,验证成功
- return Content("true");
- }
- #endregion
- #region 按钮管理
- public ActionResult Buttons()
- {//系统按钮
- ViewBag.toolbar = this.GetToolbar("toolbar");
- return View();
- }
- //编辑按钮页面
- public ActionResult ButtonInfo(string id)
- {
- ViewBag.id = id;
- return View();
- }
- //获取按钮信息
- [HttpGet]
- public ActionResult GetButtonInfo(int id)
- {
- string json = button.GetButtonInfoJson(id);
- return this.ResponseJson(System.Net.HttpStatusCode.OK, "加载成功", json);
- }
- //获取所有按钮列表
- [HttpGet]
- public ActionResult ButtonList()
- {
- var dt = button.GetListJson(false);
- return Content(dt.ToEasyUIGridJson(0, null));
- }
- //提交保存
- [HttpPost]
- public ActionResult PostButtonInfo(form_button_model model)
- {
- var r = button.PostSaveInfo(model);
- if (r)
- {//执行成功
- return this.ResponseJson(System.Net.HttpStatusCode.OK, "保存成功");
- }
- else
- {
- return this.ResponseJson(System.Net.HttpStatusCode.InternalServerError, "保存失败");
- }
- }
- //根据Button tag检查是否重复
- [HttpGet]
- public ActionResult GetButtonTag(string tag, string id)
- {
- return Content("");
- }
- #endregion
- #region 系统日志
- //返回系统日志信息
- public ActionResult SysLogIndex()
- {
- //读取当前目录下的log-data文件夹
- var logpath = Path.Combine(QWPlatform.SystemLibrary.Utils.Strings.AppDomainPath, "../log-data", DateTime.Now.ToString("yyyy-MM-dd") + ".log");
- if (System.IO.File.Exists(logpath))
- {//文件存在
- var textlines = System.IO.File.ReadAllLines(logpath, Encoding.Default);
- ViewBag.log = textlines;
- }
- return View();
- }
- #endregion
- #region 系统参数
- public ActionResult SystemSettigns()
- {
- var model = sys_config.GetEmailConfig();
- if (model == null)
- {
- model = new emailConfig();
- }
- return View(model);
- }
- //保存邮件配置信息
- public ActionResult SaveEmailConfig(emailConfig config)
- {
- var r = sys_config.SaveEmailConfig(config);
- return Content(r ? "1" : "0");
- }
- //返回配置信息的json
- public ActionResult GetEmailConfig1()
- {
- var model = sys_config.GetEmailConfig();
- return Content(model.ToJson(),"text/json");
- }
- #endregion
- #region 环节超时配置
- //返回问题流环节程配置
- [HttpPost]
- public ActionResult RingInfo()
- {
- return Content(sys_config.RingInfo(), "application/json");
- }
- //配置超时时间
- [HttpPost]
- public ActionResult TimeOutConfig(string id, string minute, string dealtime, string state)
- {
- return Content(sys_config.TimeOutConfig(id,minute,dealtime,state), "application/json");
- }
- public ActionResult Time_Window(string id )
- {
- ViewBag.id = id;
- return View();
- }
- public ActionResult LoadTime(string id)
- {
- return Content(sys_config.LoadTime(id), "application/json");
- }
-
- #endregion
- }
- }
|