You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
321 lines
10 KiB
321 lines
10 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using QMFrameWork.WebUI.Attribute;
|
|
using QMAPP.Web.Models.Sys;
|
|
using QMFrameWork.Data;
|
|
using QMAPP.Entity.Sys;
|
|
using QMAPP.Common.Web.Controllers;
|
|
using QMFrameWork.WebUI.DataSource;
|
|
|
|
namespace QMAPP.Web.Controllers
|
|
{
|
|
public class ParaAuthorityPortController : QController
|
|
{
|
|
|
|
/// <summary>
|
|
/// 加载参数列表
|
|
/// </summary>
|
|
/// <returns>结果</returns>
|
|
[HandleException]
|
|
public ActionResult ParaList()
|
|
{
|
|
ParaAuthorityPortModel seachModel = new ParaAuthorityPortModel();
|
|
|
|
TryGetSelectBuffer<ParaAuthorityPortModel>(out seachModel);
|
|
seachModel.rownumbers = false;
|
|
seachModel.url = "/ParaAuthorityPort/GetList";
|
|
|
|
return View("ParaList", seachModel);
|
|
}
|
|
/// <summary>
|
|
/// 获取用户信息列表
|
|
/// </summary>
|
|
/// <param name="callBack">是否回调</param>
|
|
/// <returns>用户信息列表</returns>
|
|
[HandleException]
|
|
public ActionResult GetList(bool? callBack)
|
|
{
|
|
List<ParaAuthorityPortModel> paras = new List<ParaAuthorityPortModel>();
|
|
ParaAuthorityPortModel seachModel = null;
|
|
DataPage page = new DataPage();
|
|
//ParaAuthorityPortManageBLL paraBll = null;
|
|
ParaAuthorityPort condition = null;
|
|
try
|
|
{
|
|
//获取查询对象
|
|
seachModel = GetModel<ParaAuthorityPortModel>();
|
|
|
|
#region 获取缓存值
|
|
if (callBack != null)
|
|
{
|
|
TryGetSelectBuffer<ParaAuthorityPortModel>(out seachModel);
|
|
}
|
|
else
|
|
{
|
|
//保存搜索条件
|
|
SetSelectBuffer<ParaAuthorityPortModel>(seachModel);
|
|
}
|
|
|
|
#endregion
|
|
|
|
//获取前台分页控件的分页大小
|
|
page = this.GetDataPage(seachModel);
|
|
|
|
|
|
condition = CopyToModel<ParaAuthorityPort, ParaAuthorityPortModel>(seachModel);
|
|
|
|
//paraBll = BLLFactory.CreateBLL<ParaAuthorityPortManageBLL>();
|
|
if (AccountController.GetLoginInfo().LoginUserID != "admin")
|
|
{
|
|
//condition.OrgaID = AccountController.GetLoginInfo().OrganID;
|
|
}
|
|
//page = paraBll.GetList(condition, page);
|
|
|
|
|
|
DataGridResult<ParaAuthorityPort> result = new DataGridResult<ParaAuthorityPort>();
|
|
result.Total = page.RecordCount;
|
|
result.Rows = (List<ParaAuthorityPort>)page.Result;
|
|
foreach (ParaAuthorityPort pap in result.Rows)
|
|
{
|
|
//if (pap.ParaType.ToString() == "1")
|
|
//{
|
|
// pap.ParaType = "仓库";
|
|
|
|
//}
|
|
//if (pap.ParaType.ToString() == "2")
|
|
//{
|
|
// pap.ParaType = "物料类型";
|
|
|
|
//}
|
|
}
|
|
|
|
return Content(result.GetJsonSource());
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
|
|
#region 编辑
|
|
|
|
/// <summary>
|
|
/// 编辑载入
|
|
/// </summary>
|
|
/// <returns>处理结果</returns>
|
|
[HandleException]
|
|
public ActionResult ParaEdit()
|
|
{
|
|
ParaAuthorityPortModel model = new ParaAuthorityPortModel();
|
|
string paraID = Request.Params["ParaID"];
|
|
ParaAuthorityPort pap = new ParaAuthorityPort();
|
|
//ParaAuthorityPortManageBLL paraBll = null;
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(paraID) == false)
|
|
{
|
|
|
|
//修改获取原数据
|
|
|
|
//pap.ParaID = paraID;
|
|
//paraBll = BLLFactory.CreateBLL<ParaAuthorityPortManageBLL>();
|
|
//pap = paraBll.Get(pap);
|
|
|
|
model = CopyToModel<ParaAuthorityPortModel, ParaAuthorityPort>(pap);
|
|
model.isEdit = "true";
|
|
}
|
|
return View(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#region 组织机构信息树
|
|
/// <summary>
|
|
/// 组织机构信息树
|
|
/// </summary>
|
|
/// <returns>处理结果</returns>
|
|
[HandleException]
|
|
public ActionResult OrgaizationTree()
|
|
{
|
|
ParaAuthorityPortModel model = new ParaAuthorityPortModel();
|
|
model.ParaID = Request.Form["ParaID"].Split(new Char[] { ',' })[0].ToString();
|
|
model.ParaDESC = Request.Form["ParaDESC"];
|
|
model.UserID = Request.Form["UserID"];
|
|
model.UserName = Request.Form["UserName"];
|
|
model.OrgaID = Request.Form["OrgaID"];
|
|
model.OrgaDESC = Request.Form["OrgaDESC"];
|
|
|
|
model.isEdit = Request.Form["isEdit"];
|
|
model.UpdateTime = Convert.ToDateTime(Request.Form["UpdateTime"]);
|
|
model.CreateTime = Convert.ToDateTime(Request.Form["CreateTime"]);
|
|
model.CreateUser = Request.Form["CreateUser"];
|
|
return View(model);
|
|
}
|
|
|
|
public ActionResult GetTreeData()
|
|
{
|
|
//OrgaizationManageBLL orgaBll = BLLFactory.CreateBLL<OrgaizationManageBLL>();
|
|
|
|
List<TreeNodeResult> list = new List<TreeNodeResult>();
|
|
OrgaizationModel orgaModel = new OrgaizationModel();
|
|
Orgaization orga = new Orgaization();
|
|
orga.OrgaParent = "0";
|
|
//orgaModel.OrgaList = orgaBll.GetSubTreeList(orga);
|
|
|
|
//添加第一级机构
|
|
foreach (Orgaization child in orgaModel.OrgaList)
|
|
{
|
|
TreeNodeResult treenode = new TreeNodeResult();
|
|
treenode.Tid = child.OrgaID.ToString();
|
|
treenode.Ttext = child.OrgaDESC.ToString();
|
|
|
|
|
|
//添加子机构
|
|
this.BuildChildItems(child, treenode, list);
|
|
list.Add(treenode);
|
|
}
|
|
|
|
return Content(TreeNodeResult.GetResultJosnS(list.ToArray()));
|
|
}
|
|
|
|
/// <summary>
|
|
/// 创建子组织机构
|
|
/// </summary>
|
|
/// <param name="parentNode">父节点</param>
|
|
/// <param name="childPowers">子权限</param>
|
|
private void BuildChildItems(Orgaization orga, TreeNodeResult tnr, List<TreeNodeResult> list)
|
|
{
|
|
|
|
//OrgaizationManageBLL orgaBll = BLLFactory.CreateBLL<OrgaizationManageBLL>();
|
|
|
|
Orgaization corga = new Orgaization();
|
|
OrgaizationModel corgaModel = new OrgaizationModel();
|
|
|
|
corga.OrgaParent = orga.OrgaID;
|
|
//corgaModel.OrgaList = orgaBll.GetSubTreeList(corga);
|
|
if (corgaModel.OrgaList.Count > 0)
|
|
{
|
|
|
|
foreach (Orgaization child in corgaModel.OrgaList)
|
|
{
|
|
TreeNodeResult cTreeNode = new TreeNodeResult();
|
|
cTreeNode.Tid = child.OrgaID.ToString();
|
|
cTreeNode.Ttext = child.OrgaDESC.ToString();
|
|
|
|
tnr.AddchildNode(cTreeNode);
|
|
|
|
//添加子菜单
|
|
this.BuildChildItems(child, cTreeNode, list);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存树结构数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public ActionResult SaveTree()
|
|
{
|
|
ParaAuthorityPortModel model = new ParaAuthorityPortModel();
|
|
|
|
model.isEdit = Request.Form["isEdit"];
|
|
model.UserID = Request.Form["UserID"];
|
|
model.ParaID = Request.Form["ParaID"];
|
|
model.ParaDESC = Request.Form["ParaDESC"];
|
|
model.UserName = Request.Form["UserName"];
|
|
model.OrgaID = Request.Form["selectKey"].Split(new Char[] { ':' })[0].ToString();
|
|
model.OrgaDESC = Request.Form["selectKey"].Split(new Char[] { ':' })[1].ToString();
|
|
|
|
model.UpdateTime = Convert.ToDateTime(Request.Form["UpdateTime"]);
|
|
model.CreateTime = Convert.ToDateTime(Request.Form["CreateTime"]);
|
|
model.CreateUser = Request.Form["CreateUser"];
|
|
return View("ParaEdit", model);
|
|
}
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 保存
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns>处理结果</returns>
|
|
[HttpPost]
|
|
[HandleException]
|
|
public ActionResult ParaSave(ParaAuthorityPortModel saveModel)
|
|
{
|
|
ParaAuthorityPort pap = null;
|
|
//ParaAuthorityPortManageBLL paraBll = null;
|
|
try
|
|
{
|
|
pap = CopyToModel<ParaAuthorityPort, ParaAuthorityPortModel>(saveModel);
|
|
|
|
//paraBll = BLLFactory.CreateBLL<ParaAuthorityPortManageBLL>();
|
|
//pap.ParaDESC = pap.ParaDESC.Split(new Char[] { ',' })[0].ToString();
|
|
if (string.IsNullOrEmpty(saveModel.isEdit) == true)
|
|
{
|
|
//新增
|
|
//paraBll.Insert(pap);
|
|
}
|
|
else
|
|
{
|
|
//修改
|
|
//paraBll.Update(pap);
|
|
}
|
|
|
|
return this.GetJsViewResult(string.Format("parent.List(1);parent.showTitle('{0}');parent.closeAppWindow1();"
|
|
, AppResource.SaveMessge));
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 删除
|
|
|
|
/// <summary>
|
|
/// 删除用户信息
|
|
/// </summary>
|
|
/// <returns>结果</returns>
|
|
[HttpPost]
|
|
[HandleException]
|
|
public ActionResult ParaDelete()
|
|
{
|
|
string selectKey = Request.Form["selectKey"];
|
|
string[] list = selectKey.Split(":".ToCharArray());
|
|
//ParaAuthorityPortManageBLL papBll = null;
|
|
try
|
|
{
|
|
//papBll = BLLFactory.CreateBLL<ParaAuthorityPortManageBLL>();
|
|
//papBll.Delete(list);
|
|
|
|
SetMessage(AppResource.DeleteMessage);
|
|
|
|
return ParaList();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|