添加项目文件。
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using WaterCloud.Code;
|
||||
using WaterCloud.Domain.SystemOrganize;
|
||||
using WaterCloud.Service.SystemOrganize;
|
||||
|
||||
namespace WaterCloud.Web.Areas.SystemOrganize.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 创 建:超级管理员
|
||||
/// 日 期:2020-06-01 09:44
|
||||
/// 描 述:数据权限控制器类
|
||||
/// </summary>
|
||||
[Area("SystemOrganize")]
|
||||
public class DataPrivilegeRuleController : BaseController
|
||||
{
|
||||
public DataPrivilegeRuleService _service { get; set; }
|
||||
|
||||
#region 获取数据
|
||||
|
||||
[HandlerAjaxOnly]
|
||||
[IgnoreAntiforgeryToken]
|
||||
public async Task<ActionResult> GetGridJson(SoulPage<DataPrivilegeRuleEntity> 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());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public virtual ActionResult RuleForm()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
#endregion 获取数据
|
||||
|
||||
#region 提交数据
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> SubmitForm(DataPrivilegeRuleEntity entity, string listData, string keyValue)
|
||||
{
|
||||
var filterList = JsonConvert.DeserializeObject<List<FilterList>>(listData);
|
||||
foreach (var item in filterList)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.Description))
|
||||
{
|
||||
entity.F_Description += item.Description + ",";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(entity.F_Description))
|
||||
{
|
||||
entity.F_Description = entity.F_Description.Substring(0, entity.F_Description.Length - 1);
|
||||
}
|
||||
entity.F_PrivilegeRules = filterList.ToJson();
|
||||
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 提交数据
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,312 @@
|
||||
/*******************************************************************************
|
||||
* Copyright © 2020 WaterCloud.Framework 版权所有
|
||||
* Author: WaterCloud
|
||||
* Description: WaterCloud快速开发平台
|
||||
* Website:
|
||||
*********************************************************************************/
|
||||
|
||||
using iTextSharp.text;
|
||||
using iTextSharp.text.pdf;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using MiniExcelLibs;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using WaterCloud.Code;
|
||||
using WaterCloud.Domain.SystemOrganize;
|
||||
using WaterCloud.Service.SystemOrganize;
|
||||
|
||||
namespace WaterCloud.Web.Areas.SystemOrganize.Controllers
|
||||
{
|
||||
[Area("SystemOrganize")]
|
||||
public class DutyController : BaseController
|
||||
{
|
||||
public DutyService _service { get; set; }
|
||||
public SystemSetService _setService { get; set; }
|
||||
|
||||
public virtual ActionResult Import()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HandlerAjaxOnly]
|
||||
[IgnoreAntiforgeryToken]
|
||||
public async Task<ActionResult> GetGridJson(SoulPage<RoleExtend> 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());
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> CheckFile()
|
||||
{
|
||||
try
|
||||
{
|
||||
//获取文件参数,创建临时文件,使用完成就删除
|
||||
var files = HttpContext.Request.Form.Files;
|
||||
long size = files.Sum(f => f.Length);
|
||||
if (size > 104857600)
|
||||
{
|
||||
throw new Exception("文件大小必须小于100M");
|
||||
}
|
||||
var file = files.First();
|
||||
var fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"');
|
||||
if (string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
throw new Exception("文件不存在");
|
||||
}
|
||||
if (!FileHelper.IsExcel(fileName))
|
||||
{
|
||||
throw new Exception("请上传Excel");
|
||||
}
|
||||
string filePath = GlobalContext.HostingEnvironment.WebRootPath + $@"/" + "file" + $@"/";
|
||||
fileName = Utils.CreateNo() + fileName.Substring(fileName.LastIndexOf("."));
|
||||
string fileFullName = filePath + fileName;
|
||||
if (!Directory.Exists(filePath))
|
||||
{
|
||||
Directory.CreateDirectory(filePath);
|
||||
}
|
||||
using (FileStream fs = System.IO.File.Create(fileFullName))
|
||||
{
|
||||
file.CopyTo(fs);
|
||||
fs.Flush();
|
||||
}
|
||||
var data = await _service.CheckFile(fileFullName);
|
||||
return Content(new { code = 0, msg = "操作成功", data = data }.ToJson());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Content(new { code = 400, msg = "操作失败," + ex.Message }.ToJson());
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> SubmitForm(RoleEntity roleEntity, string keyValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _service.SubmitForm(roleEntity, 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);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> ImportForm(string listData)
|
||||
{
|
||||
var filterList = JsonConvert.DeserializeObject<List<RoleEntity>>(listData);
|
||||
if (filterList == null || filterList.Count == 0)
|
||||
{
|
||||
return Error("导入数据不存在!");
|
||||
}
|
||||
if (filterList.Where(a => a.F_EnabledMark == false).Any())
|
||||
{
|
||||
return Error("导入数据存在错误!");
|
||||
}
|
||||
try
|
||||
{
|
||||
await _service.ImportForm(filterList);
|
||||
return await Success("导入成功。", "", "");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error("导入失败," + ex.Message, "", "");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<FileResult> Download()
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
string fileName = "岗位导入模板.xlsx";
|
||||
string fileValue = "model";
|
||||
string filePath = GlobalContext.HostingEnvironment.WebRootPath + $@"/" + fileValue + $@"/" + fileName;
|
||||
if (!FileHelper.IsExistFile(filePath))
|
||||
{
|
||||
throw new Exception("文件不存在");
|
||||
}
|
||||
//定义并实例化一个内存流,以存放图片的字节数组。
|
||||
MemoryStream ms = new MemoryStream();
|
||||
//图片读入FileStream
|
||||
FileStream f = new FileStream(filePath, FileMode.Open);
|
||||
//把FileStream写入MemoryStream
|
||||
ms.SetLength(f.Length);
|
||||
f.Read(ms.GetBuffer(), 0, (int)f.Length);
|
||||
ms.Flush();
|
||||
f.Close();
|
||||
var contentType = MimeMapping.GetMimeMapping(fileName);
|
||||
return File(ms, contentType, fileName);
|
||||
});
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<FileResult> ExportExcel(string keyword = "")
|
||||
{
|
||||
var list = await _service.GetList(keyword);
|
||||
string filename = "岗位信息" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".xls";
|
||||
var contentType = MimeMapping.GetMimeMapping(filename);
|
||||
var values = new List<Dictionary<string, object>>();
|
||||
var set = await _setService.GetForm(_service.currentuser.CompanyId);
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
var dic = new Dictionary<string, object> ();
|
||||
dic.Add("序号",i+1);
|
||||
dic.Add("岗位编号", list[i].F_EnCode);
|
||||
dic.Add("岗位名称", list[i].F_FullName);
|
||||
dic.Add("归属公司", set.F_CompanyName);
|
||||
dic.Add("有效状态", list[i].F_EnabledMark);
|
||||
dic.Add("创建时间", list[i].F_CreatorTime);
|
||||
dic.Add("备注", list[i].F_Description);
|
||||
values.Add(dic);
|
||||
}
|
||||
var memoryStream = new MemoryStream();
|
||||
memoryStream.SaveAs(values);
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
return new FileStreamResult(memoryStream, contentType)
|
||||
{
|
||||
FileDownloadName = filename
|
||||
};
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<FileResult> Export(string keyword = "")
|
||||
{
|
||||
var list = await _service.GetList(keyword);
|
||||
//生成pdf
|
||||
string fileName = "岗位信息" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".pdf";
|
||||
//步骤1
|
||||
Document Doc = new Document(PageSize.A4);
|
||||
Doc.SetMargins(60, 60, 20, 40);
|
||||
|
||||
MemoryStream stream = new MemoryStream();
|
||||
//步骤2
|
||||
PdfWriter pdfWriter = PdfWriter.GetInstance(Doc, stream);
|
||||
//步骤3
|
||||
Doc.Open();
|
||||
|
||||
#region 相关元素准备
|
||||
|
||||
BaseFont bfChinese;
|
||||
bfChinese = BaseFont.CreateFont(GlobalContext.HostingEnvironment.WebRootPath + "/fonts/simsun.ttc,1", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
||||
Font Font16 = new Font(bfChinese, 16);
|
||||
Font Font14 = new Font(bfChinese, 14);
|
||||
Font Font12 = new Font(bfChinese, 12);
|
||||
Font Font12Bold = new Font(bfChinese, 12, Font.BOLD);
|
||||
Font Font12Italic = new Font(bfChinese, 12, Font.BOLDITALIC);
|
||||
Font Font10Bold = new Font(bfChinese, 10, Font.BOLD);
|
||||
|
||||
Paragraph parag;
|
||||
//Chunk chunk;
|
||||
PdfPTable table;
|
||||
|
||||
#endregion 相关元素准备
|
||||
|
||||
#region 文件标题
|
||||
|
||||
Doc.Open();
|
||||
Doc.AddAuthor(_service.currentuser.UserName);
|
||||
Doc.AddTitle("岗位信息");
|
||||
|
||||
#endregion 文件标题
|
||||
|
||||
#region 正文
|
||||
|
||||
parag = new Paragraph("岗位信息\r\n\r\n", Font16);
|
||||
parag.Alignment = Element.ALIGN_CENTER;
|
||||
Doc.Add(parag);
|
||||
|
||||
table = new PdfPTable(new float[] { 5, 5, 5, 5, 5, 5, 5 });
|
||||
table.WidthPercentage = 100f;
|
||||
table.AddCell(new Phrase("序号", Font12Bold));
|
||||
table.AddCell(new Phrase("岗位编号", Font12Bold));
|
||||
table.AddCell(new Phrase("岗位名称", Font12Bold));
|
||||
table.AddCell(new Phrase("归属公司", Font12Bold));
|
||||
table.AddCell(new Phrase("有效状态", Font12Bold));
|
||||
table.AddCell(new Phrase("创建时间", Font12Bold));
|
||||
table.AddCell(new Phrase("备注", Font12Bold));
|
||||
Doc.Add(table);
|
||||
|
||||
int i = 0;
|
||||
foreach (var item in list)
|
||||
{
|
||||
i++;
|
||||
table = new PdfPTable(new float[] { 5, 5, 5, 5, 5, 5, 5 });
|
||||
table.WidthPercentage = 100f;
|
||||
table.AddCell(new Phrase(i.ToString(), Font12));
|
||||
table.AddCell(new Phrase(item.F_EnCode != null ? item.F_EnCode.ToString() : "", Font12));
|
||||
table.AddCell(new Phrase(item.F_FullName != null ? item.F_EnCode.ToString() : "", Font12));
|
||||
var set = await _setService.GetForm(_service.currentuser.CompanyId);
|
||||
table.AddCell(new Phrase(set != null ? set.F_CompanyName.ToString() : "", Font12));
|
||||
table.AddCell(new Phrase(item.F_EnabledMark != true ? "无效" : "有效", Font12));
|
||||
table.AddCell(new Phrase(item.F_CreatorTime != null ? ((DateTime)item.F_CreatorTime).ToString("yyyy-MM-dd") : "", Font12));
|
||||
table.AddCell(new Phrase(item.F_Description, Font12));
|
||||
Doc.Add(table);
|
||||
}
|
||||
table = new PdfPTable(new float[] { 35 });
|
||||
table.WidthPercentage = 100f;
|
||||
table.AddCell(new Phrase("合计:一共" + i + "项", Font12));
|
||||
table.AddCell(new Phrase("", Font12));
|
||||
Doc.Add(table);
|
||||
Doc.Close();
|
||||
|
||||
#endregion 正文
|
||||
|
||||
////页脚
|
||||
//PDFFooter footer = new PDFFooter();
|
||||
//footer.OnEndPage(pdfWriter, Doc);
|
||||
Doc.Close();
|
||||
var contentType = MimeMapping.GetMimeMapping(fileName);
|
||||
FileResult fileResult = new FileContentResult(stream.ToArray(), contentType);
|
||||
fileResult.FileDownloadName = fileName;
|
||||
return fileResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*******************************************************************************
|
||||
* Copyright © 2020 WaterCloud.Framework 版权所有
|
||||
* Author: WaterCloud
|
||||
* Description: WaterCloud快速开发平台
|
||||
* Website:
|
||||
*********************************************************************************/
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using WaterCloud.Code;
|
||||
using WaterCloud.Domain.SystemOrganize;
|
||||
using WaterCloud.Service.SystemOrganize;
|
||||
|
||||
namespace WaterCloud.Web.Areas.SystemOrganize.Controllers
|
||||
{
|
||||
[Area("SystemOrganize")]
|
||||
public class NoticeController : BaseController
|
||||
{
|
||||
public NoticeService _service { get; set; }
|
||||
|
||||
[HandlerAjaxOnly]
|
||||
[IgnoreAntiforgeryToken]
|
||||
public async Task<ActionResult> GetGridJson(SoulPage<NoticeEntity> 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());
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> SubmitForm(NoticeEntity noticeEntity, string keyValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _service.SubmitForm(noticeEntity, 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
/*******************************************************************************
|
||||
* Copyright © 2020 WaterCloud.Framework 版权所有
|
||||
* Author: WaterCloud
|
||||
* Description: WaterCloud快速开发平台
|
||||
* Website:
|
||||
*********************************************************************************/
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WaterCloud.Code;
|
||||
using WaterCloud.Domain.SystemOrganize;
|
||||
using WaterCloud.Service.SystemOrganize;
|
||||
|
||||
namespace WaterCloud.Web.Areas.SystemOrganize.Controllers
|
||||
{
|
||||
[Area("SystemOrganize")]
|
||||
public class OrganizeController : BaseController
|
||||
{
|
||||
public OrganizeService _service { get; set; }
|
||||
|
||||
[HttpGet]
|
||||
public virtual ActionResult AddForm()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> GetTreeSelectJson()
|
||||
{
|
||||
var data = await _service.GetList();
|
||||
var treeList = new List<TreeSelectModel>();
|
||||
foreach (OrganizeEntity item in data)
|
||||
{
|
||||
TreeSelectModel treeModel = new TreeSelectModel();
|
||||
treeModel.id = item.F_Id;
|
||||
treeModel.text = item.F_FullName;
|
||||
treeModel.parentId = item.F_ParentId;
|
||||
treeModel.data = item;
|
||||
treeList.Add(treeModel);
|
||||
}
|
||||
return Content(treeList.TreeSelectJson());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> GetSelectJson()
|
||||
{
|
||||
var data = await _service.GetList();
|
||||
data = data.Where(a => a.F_EnabledMark == true).ToList();
|
||||
var treeList = new List<TreeSelectModel>();
|
||||
foreach (OrganizeEntity item in data)
|
||||
{
|
||||
TreeSelectModel treeModel = new TreeSelectModel();
|
||||
treeModel.id = item.F_Id;
|
||||
treeModel.text = item.F_FullName;
|
||||
treeModel.parentId = item.F_ParentId;
|
||||
treeModel.data = item;
|
||||
treeList.Add(treeModel);
|
||||
}
|
||||
return Content(treeList.TreeSelectJson());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> GetTreeJson()
|
||||
{
|
||||
var data = await _service.GetList();
|
||||
var treeList = new List<TreeViewModel>();
|
||||
foreach (OrganizeEntity item in data)
|
||||
{
|
||||
TreeViewModel tree = new TreeViewModel();
|
||||
bool hasChildren = data.Count(t => t.F_ParentId == item.F_Id) == 0 ? false : true;
|
||||
tree.id = item.F_Id;
|
||||
tree.text = item.F_FullName;
|
||||
tree.value = item.F_EnCode;
|
||||
tree.parentId = item.F_ParentId;
|
||||
tree.isexpand = true;
|
||||
tree.complete = true;
|
||||
tree.hasChildren = hasChildren;
|
||||
treeList.Add(tree);
|
||||
}
|
||||
return Content(treeList.TreeViewJson());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> GetTreeGridJson(string keyword, string ids)
|
||||
{
|
||||
var data = await _service.GetLookList();
|
||||
if (!string.IsNullOrEmpty(keyword))
|
||||
{
|
||||
data = data.TreeWhere(t => t.F_FullName.Contains(keyword));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(ids))
|
||||
{
|
||||
var str = ids.Split(',');
|
||||
foreach (var item in str)
|
||||
{
|
||||
if (data.Where(a => a.F_Id == item).Any())
|
||||
{
|
||||
var temp = data.Find(a => a.F_Id == item);
|
||||
temp.LAY_CHECKED = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Success(data.Count, data);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> GetFormJson(string keyValue)
|
||||
{
|
||||
var data = await _service.GetLookForm(keyValue);
|
||||
return Content(data.ToJson());
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> SubmitForm(OrganizeEntity organizeEntity, string keyValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (organizeEntity.F_ParentId == "0")
|
||||
{
|
||||
organizeEntity.F_Layers = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
organizeEntity.F_Layers = (await _service.GetForm(organizeEntity.F_ParentId)).F_Layers + 1;
|
||||
}
|
||||
await _service.SubmitForm(organizeEntity, 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
/*******************************************************************************
|
||||
* Copyright © 2020 WaterCloud.Framework 版权所有
|
||||
* Author: WaterCloud
|
||||
* Description: WaterCloud快速开发平台
|
||||
* Website:
|
||||
*********************************************************************************/
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WaterCloud.Code;
|
||||
using WaterCloud.Domain.SystemManage;
|
||||
using WaterCloud.Domain.SystemOrganize;
|
||||
using WaterCloud.Service.SystemManage;
|
||||
using WaterCloud.Service.SystemOrganize;
|
||||
|
||||
namespace WaterCloud.Web.Areas.SystemOrganize.Controllers
|
||||
{
|
||||
[Area("SystemOrganize")]
|
||||
public class RoleAuthorizeController : BaseController
|
||||
{
|
||||
public RoleAuthorizeService _roleAuthorizeService { get; set; }
|
||||
public ModuleService _moduleService { get; set; }
|
||||
public ModuleButtonService _moduleButtonService { get; set; }
|
||||
public ModuleFieldsService _moduleFieldsService { get; set; }
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult> GetPermissionTree(string roleId)
|
||||
{
|
||||
var current = _moduleService.currentuser;
|
||||
string roleid = current.RoleId;
|
||||
var moduledata = new List<ModuleEntity>();
|
||||
var buttondata = new List<ModuleButtonEntity>();
|
||||
var authorizedata = new List<RoleAuthorizeEntity>();
|
||||
//隐藏系统菜单及字典管理
|
||||
if (roleid == null && current.IsAdmin)
|
||||
{
|
||||
moduledata = await _moduleService.GetList();
|
||||
buttondata = await _moduleButtonService.GetList();
|
||||
moduledata = moduledata.Where(a => a.F_EnabledMark == true).ToList();
|
||||
buttondata = buttondata.Where(a => a.F_EnabledMark == true).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
var rolelist = roleid.Split(',');
|
||||
foreach (var item in rolelist)
|
||||
{
|
||||
moduledata.AddRange(await _moduleService.GetListByRole(item));
|
||||
buttondata.AddRange(await _moduleButtonService.GetListByRole(item));
|
||||
}
|
||||
moduledata = moduledata.GroupBy(p => p.F_Id).Select(q => q.First()).ToList();
|
||||
buttondata = buttondata.GroupBy(p => p.F_Id).Select(q => q.First()).ToList();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(roleId))
|
||||
{
|
||||
authorizedata = await _roleAuthorizeService.GetList(roleId);
|
||||
}
|
||||
var treeList = new List<TreeGridModel>();
|
||||
foreach (ModuleEntity item in moduledata)
|
||||
{
|
||||
TreeGridModel tree = new TreeGridModel();
|
||||
tree.id = item.F_Id;
|
||||
tree.title = item.F_FullName;
|
||||
tree.parentId = item.F_ParentId;
|
||||
if (item.F_IsPublic == true)
|
||||
{
|
||||
tree.checkArr = "1";
|
||||
tree.disabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
tree.checkArr = authorizedata.Count(t => t.F_ItemId == item.F_Id) > 0 ? "1" : "0";
|
||||
}
|
||||
treeList.Add(tree);
|
||||
}
|
||||
foreach (ModuleButtonEntity item in buttondata)
|
||||
{
|
||||
TreeGridModel tree = new TreeGridModel();
|
||||
tree.id = item.F_Id;
|
||||
tree.title = item.F_FullName;
|
||||
tree.parentId = item.F_ParentId == "0" ? item.F_ModuleId : item.F_ParentId;
|
||||
if (item.F_IsPublic == true)
|
||||
{
|
||||
tree.checkArr = "1";
|
||||
tree.disabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
tree.checkArr = authorizedata.Count(t => t.F_ItemId == item.F_Id) > 0 ? "1" : "0";
|
||||
}
|
||||
treeList.Add(tree);
|
||||
}
|
||||
return DTreeResult(treeList.TreeList());
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[IgnoreAntiforgeryToken]
|
||||
public async Task<ActionResult> GetPermissionFieldsTree(string roleId, string moduleids)
|
||||
{
|
||||
var current = _moduleService.currentuser;
|
||||
string roleid = current.RoleId;
|
||||
var moduledata = new List<ModuleEntity>();
|
||||
var fieldsdata = new List<ModuleFieldsEntity>();
|
||||
var authorizedata = new List<RoleAuthorizeEntity>();
|
||||
//隐藏系统菜单及字典管理
|
||||
if (roleid == null && current.IsAdmin)
|
||||
{
|
||||
moduledata = await _moduleService.GetList();
|
||||
fieldsdata = await _moduleFieldsService.GetList();
|
||||
moduledata = moduledata.Where(a => a.F_EnabledMark == true).ToList();
|
||||
fieldsdata = fieldsdata.Where(a => a.F_EnabledMark == true).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
var rolelist = roleid.Split(',');
|
||||
foreach (var item in rolelist)
|
||||
{
|
||||
moduledata.AddRange(await _moduleService.GetListByRole(item));
|
||||
fieldsdata.AddRange(await _moduleFieldsService.GetListByRole(item));
|
||||
}
|
||||
moduledata = moduledata.GroupBy(p => p.F_Id).Select(q => q.First()).ToList();
|
||||
fieldsdata = fieldsdata.GroupBy(p => p.F_Id).Select(q => q.First()).ToList();
|
||||
}
|
||||
moduledata = moduledata.Where(a => a.F_IsFields == true || (a.F_Layers < 3 && a.F_IsExpand == true)).ToList();
|
||||
if (!string.IsNullOrEmpty(moduleids))
|
||||
{
|
||||
var list = moduleids.Split(',');
|
||||
moduledata = moduledata.Where(a => list.Contains(a.F_Id) || a.F_IsPublic == true).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
moduledata = moduledata.Where(a => a.F_IsPublic == true).ToList();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(roleId))
|
||||
{
|
||||
authorizedata = await _roleAuthorizeService.GetList(roleId);
|
||||
}
|
||||
var treeList = new List<TreeGridModel>();
|
||||
foreach (ModuleEntity item in moduledata)
|
||||
{
|
||||
TreeGridModel tree = new TreeGridModel();
|
||||
tree.id = item.F_Id;
|
||||
tree.title = item.F_FullName;
|
||||
tree.parentId = item.F_ParentId;
|
||||
if (item.F_IsPublic == true)
|
||||
{
|
||||
tree.checkArr = "1";
|
||||
tree.disabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
tree.checkArr = authorizedata.Count(t => t.F_ItemId == item.F_Id) > 0 ? "1" : "0";
|
||||
}
|
||||
treeList.Add(tree);
|
||||
}
|
||||
foreach (ModuleFieldsEntity item in fieldsdata)
|
||||
{
|
||||
TreeGridModel tree = new TreeGridModel();
|
||||
tree.id = item.F_Id;
|
||||
tree.title = item.F_FullName;
|
||||
tree.parentId = item.F_ModuleId;
|
||||
if (item.F_IsPublic == true)
|
||||
{
|
||||
tree.checkArr = "1";
|
||||
tree.disabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
tree.checkArr = authorizedata.Count(t => t.F_ItemId == item.F_Id) > 0 ? "1" : "0";
|
||||
}
|
||||
treeList.Add(tree);
|
||||
}
|
||||
return DTreeResult(treeList.TreeList());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/*******************************************************************************
|
||||
* Copyright © 2020 WaterCloud.Framework 版权所有
|
||||
* Author: WaterCloud
|
||||
* Description: WaterCloud快速开发平台
|
||||
* Website:
|
||||
*********************************************************************************/
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WaterCloud.Code;
|
||||
using WaterCloud.Domain.SystemOrganize;
|
||||
using WaterCloud.Service.SystemOrganize;
|
||||
|
||||
namespace WaterCloud.Web.Areas.SystemOrganize.Controllers
|
||||
{
|
||||
[Area("SystemOrganize")]
|
||||
public class RoleController : BaseController
|
||||
{
|
||||
public RoleService _service { get; set; }
|
||||
|
||||
[HttpGet]
|
||||
public virtual ActionResult AddForm()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[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> GetSelectJson(string keyword, string ids)
|
||||
{
|
||||
var data = await _service.GetList(keyword);
|
||||
data = data.Where(a => a.F_EnabledMark == true).ToList();
|
||||
if (!string.IsNullOrEmpty(ids))
|
||||
{
|
||||
foreach (var item in ids.Split(','))
|
||||
{
|
||||
var temp = data.Find(a => a.F_Id == item);
|
||||
if (temp != null)
|
||||
{
|
||||
temp.LAY_CHECKED = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Success(data.Count, data);
|
||||
}
|
||||
|
||||
[HandlerAjaxOnly]
|
||||
[IgnoreAntiforgeryToken]
|
||||
public async Task<ActionResult> GetGridJson(SoulPage<RoleExtend> 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> GetFormJson(string keyValue)
|
||||
{
|
||||
var data = await _service.GetLookForm(keyValue);
|
||||
return Content(data.ToJson());
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> SubmitForm(RoleEntity roleEntity, string permissionbuttonIds, string permissionfieldsIds, string keyValue)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(keyValue) && _service.currentuser.RoleId == keyValue)
|
||||
{
|
||||
return Error("操作失败,不能修改用户当前角色");
|
||||
}
|
||||
try
|
||||
{
|
||||
await _service.SubmitForm(roleEntity, string.IsNullOrEmpty(permissionbuttonIds) ? new string[0] : permissionbuttonIds.Split(','), string.IsNullOrEmpty(permissionfieldsIds) ? new string[0] : permissionfieldsIds.Split(','), 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
|
||||
{
|
||||
if (_service.currentuser.RoleId == keyValue)
|
||||
{
|
||||
return Error("操作失败,不能删除用户当前角色");
|
||||
}
|
||||
await _service.DeleteForm(keyValue);
|
||||
return await Success("操作成功。", "", keyValue, DbLogType.Delete);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error(ex.Message, "", keyValue, DbLogType.Delete);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WaterCloud.Code;
|
||||
using WaterCloud.Domain.SystemOrganize;
|
||||
using WaterCloud.Service.SystemOrganize;
|
||||
|
||||
namespace WaterCloud.Web.Areas.SystemOrganize.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 创 建:超级管理员
|
||||
/// 日 期:2020-06-12 13:50
|
||||
/// 描 述:系统设置控制器类
|
||||
/// </summary>
|
||||
[Area("SystemOrganize")]
|
||||
public class SystemSetController : BaseController
|
||||
{
|
||||
public SystemSetService _service { get; set; }
|
||||
|
||||
#region 获取数据
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAuthorize]
|
||||
[HandlerAdmin(false)]
|
||||
public virtual ActionResult SetForm()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
[HandlerAdmin]
|
||||
public async Task<ActionResult> GetGridJson(Pagination pagination, string keyword)
|
||||
{
|
||||
if (string.IsNullOrEmpty(pagination.field))
|
||||
{
|
||||
pagination.order = "desc";
|
||||
pagination.field = "F_Id";
|
||||
}
|
||||
//导出全部页使用
|
||||
if (pagination.rows == 0 && pagination.page == 0)
|
||||
{
|
||||
pagination.rows = 99999999;
|
||||
pagination.page = 1;
|
||||
}
|
||||
var data = await _service.GetLookList(pagination, keyword);
|
||||
return Success(pagination.records, data);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> GetListJson(string keyword)
|
||||
{
|
||||
var data = await _service.GetList(keyword);
|
||||
var currentuser = _service.currentuser;
|
||||
if (currentuser.UserId == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
data = data.Where(a => a.F_Id == _service.currentuser.CompanyId).ToList();
|
||||
foreach (var item in data)
|
||||
{
|
||||
item.F_AdminAccount = null;
|
||||
item.F_AdminPassword = null;
|
||||
item.F_DBProvider = null;
|
||||
item.F_DbString = null;
|
||||
item.F_HostUrl = null;
|
||||
item.F_PrincipalMan = null;
|
||||
item.F_MobilePhone = null;
|
||||
}
|
||||
return Content(data.ToJson());
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public ActionResult GetDbTypeJson()
|
||||
{
|
||||
var data = EnumHelper.EnumToList<DbType>();
|
||||
return Content(data.ToJson());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
[HandlerAdmin]
|
||||
public async Task<ActionResult> GetFormJson(string keyValue)
|
||||
{
|
||||
var data = await _service.GetForm(keyValue);
|
||||
return Content(data.ToJson());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
[HandlerAdmin(false)]
|
||||
public async Task<ActionResult> GetSetFormJson()
|
||||
{
|
||||
var data = await _service.GetForm(_service.currentuser.CompanyId);
|
||||
return Content(data.ToJson());
|
||||
}
|
||||
|
||||
#endregion 获取数据
|
||||
|
||||
#region 提交数据
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
[HandlerAdmin]
|
||||
public async Task<ActionResult> SubmitForm(SystemSetEntity entity, string permissionbuttonIds, string permissionfieldsIds, string keyValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _service.SubmitForm(entity, keyValue, string.IsNullOrEmpty(permissionbuttonIds) ? null : permissionbuttonIds.Split(','), string.IsNullOrEmpty(permissionfieldsIds) ? null : permissionfieldsIds.Split(','));
|
||||
return await Success("操作成功。", "", keyValue);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error(ex.Message, "", keyValue);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
[HandlerAdmin(false)]
|
||||
public async Task<ActionResult> SetSubmitForm(SystemSetEntity entity)
|
||||
{
|
||||
var keyValue = _service.currentuser.CompanyId;
|
||||
try
|
||||
{
|
||||
entity.F_DeleteMark = false;
|
||||
entity.F_EnabledMark = null;
|
||||
entity.F_EndTime = null;
|
||||
await _service.SubmitForm(entity, keyValue);
|
||||
return await Success("操作成功。", "", keyValue);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error(ex.Message, "", keyValue);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
[HandlerAuthorize]
|
||||
[HandlerAdmin]
|
||||
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 提交数据
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
/*******************************************************************************
|
||||
* Copyright © 2020 WaterCloud.Framework 版权所有
|
||||
* Author: WaterCloud
|
||||
* Description: WaterCloud快速开发平台
|
||||
* Website:
|
||||
*********************************************************************************/
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WaterCloud.Code;
|
||||
using WaterCloud.Domain.SystemOrganize;
|
||||
using WaterCloud.Service.SystemManage;
|
||||
using WaterCloud.Service.SystemOrganize;
|
||||
|
||||
namespace WaterCloud.Web.Areas.SystemOrganize.Controllers
|
||||
{
|
||||
[Area("SystemOrganize")]
|
||||
public class UserController : BaseController
|
||||
{
|
||||
public UserService _service { get; set; }
|
||||
public UserLogOnService _userLogOnService { get; set; }
|
||||
public ModuleService _moduleService { get; set; }
|
||||
public RoleService _roleService { get; set; }
|
||||
public OrganizeService _orgService { get; set; }
|
||||
|
||||
[HandlerAjaxOnly]
|
||||
[IgnoreAntiforgeryToken]
|
||||
public async Task<ActionResult> GetGridJson(SoulPage<UserExtend> pagination, string keyword)
|
||||
{
|
||||
if (string.IsNullOrEmpty(pagination.field))
|
||||
{
|
||||
pagination.field = "F_OrganizeId";
|
||||
pagination.order = "asc";
|
||||
}
|
||||
var data = await _service.GetLookList(pagination, keyword);
|
||||
return Content(pagination.setData(data).ToJson());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public virtual ActionResult AddForm()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> GetListJson(string keyword, string ids)
|
||||
{
|
||||
var data = await _service.GetList(keyword);
|
||||
data = data.Where(a => a.F_EnabledMark == true).ToList();
|
||||
if (!string.IsNullOrEmpty(ids))
|
||||
{
|
||||
foreach (var item in ids.Split(','))
|
||||
{
|
||||
var temp = data.Find(a => a.F_Id == item);
|
||||
if (temp != null)
|
||||
{
|
||||
temp.LAY_CHECKED = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Success(data.Count, data);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> GetFormJson(string keyValue)
|
||||
{
|
||||
var data = await _service.GetLookForm(keyValue);
|
||||
return Content(data.ToJson());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> GetUserFormJson()
|
||||
{
|
||||
var data = await _service.GetFormExtend(_service.currentuser.UserId);
|
||||
return Content(data.ToJson("yyyy-MM-dd"));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
[HandlerLock]
|
||||
public async Task<ActionResult> SubmitUserForm(string F_Account, string F_RealName, bool F_Gender, DateTime F_Birthday, string F_MobilePhone, string F_Email, string F_Description)
|
||||
{
|
||||
try
|
||||
{
|
||||
var userEntity = new UserEntity();
|
||||
userEntity.F_Account = F_Account;
|
||||
userEntity.F_RealName = F_RealName;
|
||||
userEntity.F_Gender = F_Gender;
|
||||
userEntity.F_Birthday = F_Birthday;
|
||||
userEntity.F_MobilePhone = F_MobilePhone;
|
||||
userEntity.F_Email = F_Email;
|
||||
userEntity.F_Description = F_Description;
|
||||
userEntity.F_Id = _service.currentuser.UserId;
|
||||
await _service.SubmitUserForm(userEntity);
|
||||
return await Success("操作成功。", "", userEntity.F_Id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error(ex.Message, "", _service.currentuser.UserId);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> SubmitForm(UserEntity userEntity, UserLogOnEntity userLogOnEntity, string keyValue)
|
||||
{
|
||||
if (string.IsNullOrEmpty(keyValue))
|
||||
{
|
||||
userEntity.F_IsAdmin = false;
|
||||
userEntity.F_DeleteMark = false;
|
||||
userEntity.F_IsBoss = false;
|
||||
userEntity.F_CompanyId = _service.currentuser.CompanyId;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_service.currentuser.UserId == keyValue)
|
||||
{
|
||||
return Error("操作失败,不能修改用户自身");
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
await _service.SubmitForm(userEntity, userLogOnEntity, keyValue);
|
||||
return await Success("操作成功。", "", keyValue);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error(ex.Message, "", keyValue);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAuthorize]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> DeleteForm(string keyValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_service.currentuser.UserId == keyValue)
|
||||
{
|
||||
return Error("操作失败,不能删除用户自身");
|
||||
}
|
||||
await _service.DeleteForm(keyValue);
|
||||
return await Success("操作成功。", "", keyValue, DbLogType.Delete);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error(ex.Message, "", keyValue, DbLogType.Delete);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult RevisePassword()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> SubmitRevisePassword(string F_UserPassword, string keyValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _userLogOnService.RevisePassword(F_UserPassword, keyValue);
|
||||
return await Success("重置密码成功。", "", keyValue);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error("重置密码失败," + ex.Message, "", keyValue);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult ReviseSelfPassword()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
public async Task<ActionResult> SubmitReviseSelfPassword(string F_UserPassword)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _userLogOnService.ReviseSelfPassword(F_UserPassword, _service.currentuser.UserId);
|
||||
return await Success("重置密码成功。", "", _service.currentuser.UserId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error("重置密码失败," + ex.Message, "", _service.currentuser.UserId);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
[HandlerAuthorize]
|
||||
public async Task<ActionResult> DisabledAccount(string keyValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
UserEntity userEntity = new UserEntity();
|
||||
userEntity.F_Id = keyValue;
|
||||
userEntity.F_EnabledMark = false;
|
||||
if (_service.currentuser.UserId == keyValue)
|
||||
{
|
||||
return Error("操作失败,不能修改用户自身");
|
||||
}
|
||||
await _service.UpdateForm(userEntity);
|
||||
return await Success("账户禁用成功。", "", keyValue);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error("账户禁用失败," + ex.Message, "", keyValue);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HandlerAjaxOnly]
|
||||
[HandlerAuthorize]
|
||||
public async Task<ActionResult> EnabledAccount(string keyValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
UserEntity userEntity = new UserEntity();
|
||||
userEntity.F_Id = keyValue;
|
||||
userEntity.F_EnabledMark = true;
|
||||
if (_service.currentuser.UserId == keyValue)
|
||||
{
|
||||
return Error("操作失败,不能修改用户自身");
|
||||
}
|
||||
await _service.UpdateForm(userEntity);
|
||||
return await Success("账户启用成功。", "", keyValue);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return await Error("账户启用失败," + ex.Message, "", keyValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
@{
|
||||
ViewBag.Title = "Form";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'table', 'form', 'commonTable', 'common', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common,
|
||||
table = layui.table,
|
||||
commonTable = layui.commonTable;
|
||||
var keyValue = $.request("keyValue");
|
||||
if (!!keyValue) {
|
||||
$('#F_ModuleId').prop('disabled', true);
|
||||
}
|
||||
//权限字段
|
||||
common.authorizeFields('adminform');
|
||||
$(function () {
|
||||
initControl();
|
||||
if (!!keyValue) {
|
||||
common.ajax({
|
||||
url: '/SystemOrganize/DataPrivilegeRule/GetFormJson',
|
||||
dataType: 'json',
|
||||
data: { keyValue: keyValue },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('adminform', data);
|
||||
var datas = JSON.parse(data.F_PrivilegeRules);
|
||||
for (var i = 0; i < datas.length; i++) {
|
||||
datas[i]["F_Id"] = uuid();
|
||||
}
|
||||
table.reload('currentTableId', {
|
||||
data: datas
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
if (!$('#F_ModuleId').val()) {
|
||||
$('#toolbar').addClass('layui-hide');
|
||||
}
|
||||
}
|
||||
form.render();
|
||||
});
|
||||
wcLoading.close();
|
||||
commonTable.rendertable({
|
||||
elem: '#currentTableId',
|
||||
id: 'currentTableId',
|
||||
data: [],
|
||||
search:false,
|
||||
limit: 9999,//每页数据 默认
|
||||
page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
|
||||
layout: ['count'] //自定义分页布局
|
||||
, first: false //不显示首页
|
||||
, last: false //不显示尾页
|
||||
},
|
||||
height: 'full-150',
|
||||
cols: [[
|
||||
{ type: "radio", width: 50 },
|
||||
{ field: 'Operation', title: '规则间条件', width: 120 },
|
||||
{ field: 'Filters', title: '规则内容', minWidth: 200 },
|
||||
{ field: 'Description', title: '规则备注', minWidth: 200 },
|
||||
{ title: '操作', width: 130, toolbar: '#currentTableBar', align: "center" }
|
||||
]]
|
||||
});
|
||||
//行点击事件监听,控制按钮显示
|
||||
var oneList = ["NF-edit", "NF-delete"];//选择1条显示
|
||||
commonTable.tableRowClick("radio", "currentTableFilter", "currentTableId", oneList);
|
||||
//toolbar监听事件
|
||||
table.on('toolbar(currentTableFilter)', function (obj) {
|
||||
var data = table.checkStatus('currentTableId').data;
|
||||
var id = data.length > 0 ? data[0].F_Id : null;
|
||||
var module = $('#F_ModuleId').val();
|
||||
if (obj.event === 'add') { // 监听删除操作
|
||||
if (!module) {
|
||||
common.modalMsg("未选中模块", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "添加规则",
|
||||
url: "/SystemOrganize/DataPrivilegeRule/RuleForm?module=" + module,
|
||||
width: "750px",
|
||||
height: "500px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'delete') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalConfirm("注:您确定要删除该项数据吗?", function (r) {
|
||||
if (r) {
|
||||
var index = parent.layer.load(0, {
|
||||
shade: [0.5, '#000'], //0.1透明度的背景
|
||||
});
|
||||
try {
|
||||
var cachedata = table.cache.currentTableId;
|
||||
for (var i = 0; i < cachedata.length; i++) {
|
||||
if (id == cachedata[i].F_Id) {
|
||||
cachedata.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
table.reload('currentTableId', {
|
||||
data: cachedata
|
||||
});
|
||||
entity = null;
|
||||
common.modalMsg("操作成功", "success");
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
}
|
||||
parent.layer.close(index);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
if (!module) {
|
||||
common.modalMsg("未选中模块", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "编辑规则",
|
||||
url: "/SystemOrganize/DataPrivilegeRule/RuleForm?keyValue=" + id + "&module=" + module,
|
||||
width: "750px",
|
||||
height: "500px",
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//toolrow监听事件
|
||||
table.on('tool(currentTableFilter)', function (obj) {
|
||||
var id = obj.data.F_Id;
|
||||
var module = $('#F_ModuleId').val();
|
||||
if (obj.event === 'delete') {
|
||||
common.modalConfirm("注:您确定要删除该项数据吗?", function (r) {
|
||||
if (r) {
|
||||
var index = parent.layer.load(0, {
|
||||
shade: [0.5, '#000'], //0.1透明度的背景
|
||||
});
|
||||
try {
|
||||
var cachedata = table.cache.currentTableId;
|
||||
for (var i = 0; i < cachedata.length; i++) {
|
||||
if (id == cachedata[i].F_Id) {
|
||||
cachedata.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
table.reload('currentTableId', {
|
||||
data: cachedata
|
||||
});
|
||||
entity = null;
|
||||
common.modalMsg("操作成功", "success");
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
}
|
||||
parent.layer.close(index);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
if (!module) {
|
||||
common.modalMsg("未选中模块", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "编辑规则",
|
||||
url: "/SystemOrganize/DataPrivilegeRule/RuleForm?keyValue=" + id + "&module=" + module,
|
||||
width: "750px",
|
||||
height: "500px",
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
function initControl() {
|
||||
//绑定数据源
|
||||
//类型为下拉框时
|
||||
if (!!keyValue) {
|
||||
$("#F_ModuleId").bindSelect({
|
||||
url: "/SystemManage/Module/GetSelectMunuJson",
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#F_ModuleId").bindSelect({
|
||||
url: "/SystemManage/Module/GetSelectMunuBesidesJson",
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
//select验证
|
||||
form.verify({
|
||||
required: function (value, item) {
|
||||
var msg = "必填项不能为空";
|
||||
value = $.trim(value);
|
||||
var isEmpty = !value || value.length < 1;
|
||||
// 当前验证元素是select且为空时,将页面定位至layui渲染的select处,或自定义想定位的位置
|
||||
if (item.tagName == 'SELECT' && isEmpty) {
|
||||
$("html").animate({
|
||||
scrollTop: $(item).siblings(".layui-form-select").offset().top - 74
|
||||
}, 50);
|
||||
}
|
||||
if (isEmpty) {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
});
|
||||
//监听select
|
||||
form.on('select(F_ModuleId)', function (data) {
|
||||
if (!!data.value) {
|
||||
$('#toolbar').removeClass('layui-hide');
|
||||
}
|
||||
else {
|
||||
$('#toolbar').addClass('layui-hide');
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//监听提交
|
||||
form.on('submit(saveBtn)', function (data) {
|
||||
var cachedata = table.cache.currentTableId
|
||||
if (cachedata.length == 0) {
|
||||
common.modalMsg("未添加规则", "warning");
|
||||
return false;
|
||||
}
|
||||
var postData = data.field;
|
||||
if (!postData["F_EnabledMark"]) postData["F_EnabledMark"] = false;
|
||||
postData.listData = JSON.stringify(cachedata);
|
||||
common.submitForm({
|
||||
url: '/SystemOrganize/DataPrivilegeRule/SubmitForm?keyValue=' + keyValue,
|
||||
param: postData,
|
||||
success: function () {
|
||||
common.reloadIframe("/SystemOrganize/DataPrivilegeRule/Index", 'data-search-btn');
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<fieldset class="table-search-fieldset">
|
||||
<div class="layui-form layuimini-form" lay-filter="adminform">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md4 layui-hide">
|
||||
<label class="layui-form-label required">模块编号</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_ModuleId" name="F_ModuleId" lay-filter="F_ModuleId" lay-verify="required" lay-search>
|
||||
<option value="">请选择</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md4 layui-hide">
|
||||
<label class="layui-form-label required">排序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" pattern="[0-9]*" id="F_SortCode" name="F_SortCode" lay-verify="required|number" oninput="if(value.length>8)value=value.slice(0,8)" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md4 layui-hide">
|
||||
<label class="layui-form-label">选项</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="F_EnabledMark" id="F_EnabledMark" checked="" value="true" title="有效标识">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item text-right">
|
||||
<button class="layui-btn site-demo-active" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container" id="toolbar">
|
||||
<button id="NF-add" authorize="yes" class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"></i>新增</button>
|
||||
<button id="NF-edit" name="NF-edit" authorize="yes" class="layui-btn layui-btn-sm layui-btn-warm layui-hide" lay-event="edit"><i class="layui-icon"></i>修改</button>
|
||||
<button id="NF-delete" name="NF-delete" authorize="yes" class="layui-btn layui-btn-sm layui-btn-danger layui-hide" lay-event="delete"> <i class="layui-icon"></i>删除</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="currentTableBar">
|
||||
<a id="NF-edit" authorize class="layui-btn layui-btn-xs layui-btn-warm" lay-event="edit">修改</a>
|
||||
<a id="NF-delete" authorize class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delete">删除</a>
|
||||
</script>
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<fieldset class="table-search-fieldset layui-hide" id="searchField">
|
||||
<div>
|
||||
<form class="layui-form layui-form-pane">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键字:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="txt_keyword" name="txt_keyword" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container" id="toolbar">
|
||||
<button id="NF-add" authorize="yes" class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"></i>新增</button>
|
||||
<button id="NF-edit" name="NF-edit" authorize="yes" class="layui-btn layui-btn-sm layui-btn-warm layui-hide" lay-event="edit"><i class="layui-icon"></i>修改</button>
|
||||
<button id="NF-delete" name="NF-delete" authorize="yes" class="layui-btn layui-btn-sm layui-btn-danger layui-hide" lay-event="delete"> <i class="layui-icon"></i>删除</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="currentTableBar">
|
||||
<a id="NF-edit" authorize class="layui-btn layui-btn-xs layui-btn-warm" lay-event="edit">修改</a>
|
||||
<a id="NF-delete" authorize class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delete">删除</a>
|
||||
</script>
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
layui.use(['form', 'table', 'common', 'commonTable', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
table = layui.table,
|
||||
commonTable = layui.commonTable,
|
||||
common = layui.common;
|
||||
wcLoading.close();
|
||||
//权限控制(js是值传递)
|
||||
currentTableBar.innerHTML = common.authorizeButtonNew(currentTableBar.innerHTML);
|
||||
toolbarDemo.innerHTML = common.authorizeButtonNew(toolbarDemo.innerHTML);
|
||||
commonTable.rendertable({
|
||||
elem: '#currentTableId',
|
||||
id: 'currentTableId',
|
||||
url: '/SystemOrganize/DataPrivilegeRule/GetGridJson',
|
||||
filter: {
|
||||
clearFilter: false
|
||||
},
|
||||
cols: [[
|
||||
{ type: "radio", width: 50, fixed: 'left' },
|
||||
{ field: 'F_ModuleCode', title: '模块编号', width: 120, sort: true, filter: true },
|
||||
{ field: 'F_PrivilegeRules', title: '权限规则', width: 200, sort: true, filter: true },
|
||||
{ field: 'F_SortCode', title: '排序号', width: 120, sort: true, filter: true },
|
||||
{
|
||||
field: 'F_EnabledMark', title: '状态', width: 80, sort: true, filter: true,
|
||||
templet: function (d) {
|
||||
if (d.F_EnabledMark == true) {
|
||||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>有效</span>";
|
||||
} else {
|
||||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>无效</span>";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'F_CreatorTime', title: '创建时间', width: 160, sort: true, filter: { type: 'date[yyyy/MM/dd HH:mm:ss]' }
|
||||
},
|
||||
{ field: 'F_Description', title: '备注', minWidth: 150, sort: true, filter: true },
|
||||
{ title: '操作', width: 120, toolbar: '#currentTableBar', align: "center", fixed: 'right' }
|
||||
]]
|
||||
});
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
//执行搜索重载
|
||||
commonTable.reloadtable({
|
||||
elem: 'currentTableId',
|
||||
curr: 1,
|
||||
where: { keyword: data.field.txt_keyword}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//行点击事件监听,控制按钮显示
|
||||
var oneList = ["NF-edit", "NF-delete"];//选择1条显示
|
||||
commonTable.tableRowClick("radio", "currentTableFilter", "currentTableId", oneList);
|
||||
//toolbar监听事件
|
||||
table.on('toolbar(currentTableFilter)', function (obj) {
|
||||
var data = table.checkStatus('currentTableId').data;
|
||||
var id = data.length > 0 ? data[0].F_Id : null;
|
||||
if (obj.event === 'add') { // 监听添加操作
|
||||
common.openNewTabByIframe({
|
||||
title: "新增规则",
|
||||
href: "/SystemOrganize/DataPrivilegeRule/Form",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'delete') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.deleteForm({
|
||||
url: "/SystemOrganize/DataPrivilegeRule/DeleteForm",
|
||||
param: { keyValue: id },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.openNewTabByIframe({
|
||||
title: "修改规则",
|
||||
href: "/SystemOrganize/DataPrivilegeRule/Form?keyValue=" + id,
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'TABLE_SEARCH') {
|
||||
var _that = $("#searchField");
|
||||
if (_that.hasClass("layui-hide")) {
|
||||
_that.removeClass('layui-hide');
|
||||
} else {
|
||||
_that.addClass('layui-hide');
|
||||
}
|
||||
table.resize();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//toolrow监听事件
|
||||
table.on('tool(currentTableFilter)', function (obj) {
|
||||
var id = obj.data.F_Id;
|
||||
if (obj.event === 'delete') {
|
||||
common.deleteForm({
|
||||
url: "/SystemOrganize/DataPrivilegeRule/DeleteForm",
|
||||
param: { keyValue: id },
|
||||
success: function () {
|
||||
obj.del();
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
common.openNewTabByIframe({
|
||||
title: "修改规则",
|
||||
href: "/SystemOrganize/DataPrivilegeRule/Form?keyValue=" + id,
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,259 @@
|
||||
@{
|
||||
ViewBag.Title = "Form";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'laydate', 'common', 'xmSelect', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common,
|
||||
xmSelect = layui.xmSelect;
|
||||
var keyValue = $.request("keyValue");
|
||||
var module = $.request("module");
|
||||
var cout = 0;
|
||||
$(function () {
|
||||
initControl();
|
||||
if (!!keyValue) {
|
||||
var tempdata = common.parentWindow().layui.table.cache.currentTableId;
|
||||
var Filters = [];
|
||||
for (var i = 0; i < tempdata.length; i++) {
|
||||
if (keyValue == tempdata[i].F_Id) {
|
||||
Filters = JSON.parse(tempdata[i].Filters);
|
||||
$('#Description').val(tempdata[i].Description);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < Filters.length; i++) {
|
||||
$('#NF-add').click();
|
||||
$('#fields' + i).val(Filters[i].Key);
|
||||
$('#symbol' + i).val(Filters[i].Contrast);
|
||||
$('#lookname' + i).val(Filters[i].Text);
|
||||
$('#values' + i).val(Filters[i].Value);
|
||||
}
|
||||
form.render();
|
||||
}
|
||||
else {
|
||||
$('#NF-add').click();
|
||||
form.render();
|
||||
}
|
||||
form.render();
|
||||
});
|
||||
wcLoading.close();
|
||||
function initControl() {
|
||||
$("#fields").bindSelect({
|
||||
url: "/SystemManage/ModuleFields/GetSelectJson?moduleId=" + module,
|
||||
});
|
||||
}
|
||||
$(document).on('click', '#NF-add', function () {
|
||||
var target = $('#ruledata');
|
||||
var html = $("#divInputTemplate").prop("outerHTML");
|
||||
html = html.replace(/rulecontext/g, "rulecontext" + cout); // 替换多个
|
||||
html = html.replace(/条件规则/g, "条件规则" + (cout + 1)); // 替换多个
|
||||
html = html.replace(/fields/g, "fields" + cout); // 替换多个
|
||||
html = html.replace(/symbol/g, "symbol" + cout); // 替换多个
|
||||
html = html.replace(/lookname/g, "lookname" + cout); // 替换多个
|
||||
html = html.replace(/condition/g, "condition" + cout); // 替换多个
|
||||
html = html.replace(/divInputTemplate/g, "divInput" + cout);
|
||||
html = html.replace(/values/g, "values" + cout);
|
||||
html = html.replace(/searchCout/g, cout);
|
||||
var obj = $(html);
|
||||
obj.removeClass("layui-hide");
|
||||
obj.appendTo(target);
|
||||
cout++;
|
||||
form.render();
|
||||
});
|
||||
//select验证
|
||||
form.verify({
|
||||
required: function (value, item) {
|
||||
var msg = "必填项不能为空";
|
||||
value = $.trim(value);
|
||||
var isEmpty = !value || value.length < 1;
|
||||
// 当前验证元素是select且为空时,将页面定位至layui渲染的select处,或自定义想定位的位置
|
||||
if (item.tagName == 'SELECT' && isEmpty) {
|
||||
$("html").animate({
|
||||
scrollTop: $(item).siblings(".layui-form-select").offset().top - 74
|
||||
}, 50);
|
||||
}
|
||||
if (isEmpty) {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
});
|
||||
//监听提交
|
||||
var lock = false;
|
||||
form.on('submit(saveBtn)', function (data) {
|
||||
if (!lock) {
|
||||
var index = parent.layer.load(0, {
|
||||
shade: [0.5, '#000'], //0.1透明度的背景
|
||||
});
|
||||
var postData = {};
|
||||
postData.Operation = data.field.Operation;
|
||||
postData.Description = data.field.Description;
|
||||
if (!!keyValue) {
|
||||
postData.F_Id = keyValue;
|
||||
}
|
||||
else {
|
||||
postData.F_Id = uuid();
|
||||
}
|
||||
var Filters = [];
|
||||
for (var i = 0; i < cout; i++) {
|
||||
var temp = {};
|
||||
temp["Key"] = $('#fields' + + i).val();
|
||||
temp["Contrast"] = $('#symbol' + + i).val();
|
||||
temp["Text"] = $('#lookname' + + i).val();
|
||||
temp["Value"] = $('#values' + + i).val();
|
||||
if(temp["Key"]!="{loginRole}" && temp["Key"]!="{loginUser}" && temp["Key"]!="{loginOrg}")
|
||||
{
|
||||
temp["Value"] = null;
|
||||
}
|
||||
if (!temp["Value"]) {
|
||||
temp["Value"] = temp["Text"];
|
||||
}
|
||||
if (!!temp["Key"]) {
|
||||
Filters.push(temp);
|
||||
}
|
||||
}
|
||||
postData.Filters = JSON.stringify(Filters);
|
||||
var tempdata = common.parentWindow().layui.table.cache.currentTableId;
|
||||
if (!!keyValue) {
|
||||
for (var i = 0; i < tempdata.length; i++) {
|
||||
if (keyValue == tempdata[i].F_Id) {
|
||||
tempdata[i].Filters = postData.Filters;
|
||||
tempdata[i].Description = postData.Description;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
tempdata.push(postData);
|
||||
}
|
||||
common.modalMsg("操作成功", "success");
|
||||
common.parentWindow().layui.table.reload('currentTableId', {
|
||||
data: tempdata
|
||||
});
|
||||
parent.layer.close(index);
|
||||
common.modalClose();
|
||||
lock = false;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
function deleteRule(data) {
|
||||
var obj = document.getElementById(data);//建议使用ID
|
||||
if (obj != null) {
|
||||
obj.parentNode.removeChild(obj);
|
||||
}
|
||||
layui.use(['jquery', 'form', 'laydate', 'common'], function () {
|
||||
layui.form.render();
|
||||
});
|
||||
}
|
||||
function search(data) {
|
||||
var fields = $('#fields' + data).val();
|
||||
if (fields != '{loginRole}' && fields != '{loginUser}' && fields != '{loginOrg}') {
|
||||
return false;
|
||||
}
|
||||
$('#lookname' + data).val(null);
|
||||
$('#values' + data).val(null);
|
||||
layui.use(['jquery', 'form', 'common'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common;
|
||||
//不同弹窗
|
||||
if (fields == '{loginRole}') {
|
||||
common.modalOpen({
|
||||
title: "选择角色",
|
||||
url: "/SystemOrganize/Role/AddForm?name=" + "lookname" + data + "&value=" + "values" + data,
|
||||
width: "650px",
|
||||
height: "600px",
|
||||
});
|
||||
}
|
||||
else if (fields == '{loginUser}') {
|
||||
common.modalOpen({
|
||||
title: "选择用户",
|
||||
url: "/SystemOrganize/User/AddForm?name=" + "lookname" + data + "&value=" + "values" + data,
|
||||
width: "650px",
|
||||
height: "600px",
|
||||
});
|
||||
}
|
||||
else if (fields == '{loginOrg}') {
|
||||
common.modalOpen({
|
||||
title: "选择组织",
|
||||
url: "/SystemOrganize/Organize/AddForm?name=" + "lookname" + data + "&value=" + "values" + data,
|
||||
width: "650px",
|
||||
height: "600px",
|
||||
});
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<body>
|
||||
<div class="layui-input-item layui-hide" id="divInputTemplate">
|
||||
<label class="layui-form-label required">条件规则</label>
|
||||
<div class="layui-input-block" style="padding-right: 70px;">
|
||||
<div class="layui-input-block" style="margin-left:0px">
|
||||
<select id="condition" name="condition" lay-verify="required" disabled lay-search>
|
||||
<option value="and" selected>并且</option>
|
||||
<option value="or">或者</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-input-inline" style="width:145px">
|
||||
<select id="fields" name="fields" lay-verify="required" lay-search>
|
||||
<option value="">请选择</option>
|
||||
<option value="{loginRole}">{当前登录用户的角色}</option>
|
||||
<option value="{loginUser}">{当前登录的用户}</option>
|
||||
<option value="{loginOrg}">{当前登录用户的部门}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-input-inline" style="width:100px">
|
||||
<select id="symbol" name="symbol" lay-verify="required" lay-search>
|
||||
<option value="">请选择</option>
|
||||
<option value=">=">大于等于</option>
|
||||
<option value="<=">小于等于</option>
|
||||
<option value="==">等于</option>
|
||||
<option value="!=">不等于</option>
|
||||
<option value="contains">包含</option>
|
||||
<option value="in">属于</option>
|
||||
<option value="intersect">含有任意一个</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-input-inline" style="width:180px">
|
||||
<input type="text" id="lookname" name="lookname" class="layui-input" lay-verify="required" maxlength="50" value="" placeholder="请输入值">
|
||||
<input type="text" id="values" name="values" class="layui-input layui-hide">
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-danger" style="position: absolute;top: 0;right: 6px;cursor: pointer;" onclick="deleteRule('divInputTemplate')"><i class="layui-icon"></i></button>
|
||||
<button class="layui-btn layui-btn-primary" style="position: absolute;top: 0;right: 6px;cursor: pointer;margin-top:40px" onclick="search(searchCout)">...</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<blockquote class="layui-elem-quote layui-text">
|
||||
当前登录的用户{loginUser},当前登录用户的角色{loginRole},当前用户的部门{loginOrg}
|
||||
</blockquote>
|
||||
<div class="layui-form layuimini-form" lay-filter="adminform">
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">规则备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="Description" name="Description" class="layui-textarea" placeholder="请输入规则备注"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">规则条件</label>
|
||||
<div class="layui-input-block" style="padding-right: 70px;">
|
||||
<input id="Operation" name="Operation" lay-verify="required" value="and" disabled class="layui-hide">
|
||||
<button id="NF-add" class="layui-btn"><i class="layui-icon"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ruledata">
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<button class="layui-btn" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
@{
|
||||
ViewBag.Title = "Details";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'common', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common;
|
||||
var keyValue = $.request("keyValue");
|
||||
//权限字段
|
||||
common.authorizeFields('adminform');
|
||||
$(function () {
|
||||
initControl();
|
||||
if (!!keyValue) {
|
||||
common.ajax({
|
||||
url: "/SystemOrganize/Duty/GetFormJson",
|
||||
dataType: "json",
|
||||
data: { keyValue: keyValue },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('adminform', data);
|
||||
common.setReadOnly('adminform');
|
||||
form.render();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
wcLoading.close();
|
||||
function initControl() {
|
||||
$("#F_CompanyId").bindSelect({
|
||||
url: "/SystemOrganize/SystemSet/GetListJson",
|
||||
id: "F_Id",
|
||||
text: "F_CompanyName"
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-form layuimini-form" lay-filter="adminform">
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">归属公司</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_CompanyId" name="F_CompanyId">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">岗位名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_FullName" name="F_FullName" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">岗位编号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_EnCode" name="F_EnCode" lay-verify="required" class="layui-input ">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">显示顺序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" pattern="[0-9]*" id="F_SortCode" name="F_SortCode" lay-verify="required" class="layui-input ">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">选项</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="F_EnabledMark" id="F_EnabledMark" title="有效标识">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text layui-hide">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="F_Description" name="F_Description" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
116
WaterCloud.Web/Areas/SystemOrganize/Views/Duty/Form.cshtml
Normal file
116
WaterCloud.Web/Areas/SystemOrganize/Views/Duty/Form.cshtml
Normal file
@@ -0,0 +1,116 @@
|
||||
@{
|
||||
ViewBag.Title = "Form";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'common', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common;
|
||||
var keyValue = $.request("keyValue");
|
||||
//权限字段
|
||||
common.authorizeFields('adminform');
|
||||
$(function () {
|
||||
initControl();
|
||||
if (!!keyValue) {
|
||||
common.ajax({
|
||||
url: "/SystemOrganize/Duty/GetFormJson",
|
||||
dataType: "json",
|
||||
data: { keyValue: keyValue },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('adminform', data);
|
||||
}
|
||||
});
|
||||
}
|
||||
form.render();
|
||||
});
|
||||
wcLoading.close();
|
||||
function initControl() {
|
||||
$("#F_CompanyId").bindSelect({
|
||||
url: "/SystemOrganize/SystemSet/GetListJson",
|
||||
id: "F_Id",
|
||||
text: "F_CompanyName"
|
||||
});
|
||||
}
|
||||
//select验证
|
||||
form.verify({
|
||||
required: function (value, item) {
|
||||
var msg = "必填项不能为空";
|
||||
value = $.trim(value);
|
||||
var isEmpty = !value || value.length < 1;
|
||||
// 当前验证元素是select且为空时,将页面定位至layui渲染的select处,或自定义想定位的位置
|
||||
if (item.tagName == 'SELECT' && isEmpty) {
|
||||
$("html").animate({
|
||||
scrollTop: $(item).siblings(".layui-form-select").offset().top - 74
|
||||
}, 50);
|
||||
}
|
||||
if (isEmpty) {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
});
|
||||
//监听提交
|
||||
form.on('submit(saveBtn)', function (data) {
|
||||
var postData = data.field;
|
||||
if (!postData["F_EnabledMark"]) postData["F_EnabledMark"] = false;
|
||||
common.submitForm({
|
||||
url: "/SystemOrganize/Duty/SubmitForm?keyValue=" + keyValue,
|
||||
param: postData,
|
||||
success: function () {
|
||||
common.parentreload("data-search-btn");
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-form layuimini-form" lay-filter="adminform">
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">归属公司</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_CompanyId" name="F_CompanyId" lay-verify="required" lay-search>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">岗位名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_FullName" name="F_FullName" maxlength="50" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">岗位编号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_EnCode" name="F_EnCode" maxlength="50" lay-verify="required" class="layui-input ">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">显示顺序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" pattern="[0-9]*" id="F_SortCode" name="F_SortCode" lay-verify="required|number" oninput="if(value.length>8)value=value.slice(0,8)" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">选项</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="F_EnabledMark" id="F_EnabledMark" checked="" value="true" title="有效标识">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text layui-hide">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="F_Description" name="F_Description" class="layui-textarea" placeholder="请输入备注"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<button class="layui-btn site-demo-active" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
181
WaterCloud.Web/Areas/SystemOrganize/Views/Duty/Import.cshtml
Normal file
181
WaterCloud.Web/Areas/SystemOrganize/Views/Duty/Import.cshtml
Normal file
@@ -0,0 +1,181 @@
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<form class="layui-form" action="">
|
||||
<button type="submit" class="layui-btn layui-btn-sm layui-btn-normal" lay-submit lay-filter="download"> <i class="layui-icon"></i>模板下载</button>
|
||||
<button type="button" id="import" class="layui-btn layui-btn-sm layui-btn-primary"><i class="layui-icon"></i>上传Excel</button>
|
||||
</form>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container" id="toolbar">
|
||||
<button type="button" id="NF-delete" name="NF-delete" class="layui-btn layui-btn-danger layui-btn-sm layui-hide" lay-event="delete"> <i class="layui-icon"></i>删除选中</button>
|
||||
<button id="submit" class="layui-btn layui-btn-sm data-import-btn site-demo-active layui-hide" lay-event="save"><i class="layui-icon"></i>保存提交</button>
|
||||
</div>
|
||||
</script>
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'table', 'upload', 'common', 'commonTable'], function () {
|
||||
var $ = layui.jquery,
|
||||
table = layui.table,
|
||||
form = layui.form,
|
||||
upload = layui.upload,
|
||||
commonTable = layui.commonTable,
|
||||
soulTable = layui.soulTable,
|
||||
common = layui.common;
|
||||
var dataJson = [];
|
||||
commonTable.rendertable({
|
||||
elem: '#currentTableId',
|
||||
id: 'currentTableId',
|
||||
data: dataJson,
|
||||
height: 'full-75',
|
||||
limit: 99999,//每页数据 默认
|
||||
page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
|
||||
layout: ['count'] //自定义分页布局
|
||||
, first: false //不显示首页
|
||||
, last: false //不显示尾页
|
||||
},
|
||||
search: false,
|
||||
cols: [[
|
||||
{ type: 'checkbox', fixed: "left", width: 70 },
|
||||
{ field: 'ErrorMsg', title: '错误信息', width: 150, sort: true, filter: true },
|
||||
{ field: 'F_FullName', title: '岗位名称', width: 120, sort: true, filter: true },
|
||||
{ field: 'F_EnCode', title: '岗位编号', width: 120, sort: true, filter: true },
|
||||
{
|
||||
field: 'F_EnabledMark', title: '状态', width: 80, sort: true, filter: true,
|
||||
templet: function (d) {
|
||||
if (d.F_EnabledMark == true) {
|
||||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>有效</span>";
|
||||
} else {
|
||||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>无效</span>";
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'F_Description', title: '备注', minWidth: 150, sort: true, filter: true },
|
||||
]]
|
||||
});
|
||||
//普通图片上传
|
||||
var index;
|
||||
var uploadInst = upload.render({
|
||||
elem: '#import'
|
||||
, url: "/SystemOrganize/Duty/CheckFile" //改成您自己的上传接口
|
||||
, size: 1024
|
||||
, accept: 'file'
|
||||
, headers: { 'X-CSRF-TOKEN': "" }
|
||||
, before: function (obj) {
|
||||
if ($('[name=__RequestVerificationToken]').length > 0) {
|
||||
// 1、动态添加headers中的参数
|
||||
this.headers['X-CSRF-TOKEN'] = $('[name=__RequestVerificationToken]').val();
|
||||
}
|
||||
// 2、动态添加的其它参数
|
||||
//this.data.type = outerType
|
||||
index = parent.layer.load(0, {
|
||||
shade: [0.5, '#000'], //0.1透明度的背景
|
||||
});
|
||||
}
|
||||
, done: function (res) {
|
||||
//如果上传失败
|
||||
if (res.code > 0) {
|
||||
//失败状态,并实现重传
|
||||
var demoText = $('#demoText');
|
||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
||||
demoText.find('.demo-reload').on('click', function () {
|
||||
uploadInst.upload();
|
||||
});
|
||||
common.modalMsg(res.msg, "warning");
|
||||
parent.layer.close(index);
|
||||
return false;
|
||||
}
|
||||
dataJson = res.data;
|
||||
//执行重载
|
||||
table.reload('currentTableId', {
|
||||
data: dataJson
|
||||
}, 'data');
|
||||
parent.layer.close(index);
|
||||
}
|
||||
, error: function () {
|
||||
//演示失败状态,并实现重传
|
||||
parent.layer.close(index);
|
||||
var demoText = $('#demoText');
|
||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
||||
demoText.find('.demo-reload').on('click', function () {
|
||||
uploadInst.upload();
|
||||
});
|
||||
}
|
||||
});
|
||||
wcLoading.close();
|
||||
//行点击事件监听,控制按钮显示
|
||||
var morerList = ["NF-delete"];//选中1条以上显示
|
||||
commonTable.tableRowClick("checkbox", "currentTableFilter", "currentTableId", null, morerList);
|
||||
//监听提交
|
||||
form.on('submit(download)', function (data) {
|
||||
window.open('/SystemOrganize/Duty/Download');
|
||||
return false;
|
||||
});
|
||||
//toolbar监听事件
|
||||
table.on('toolbar(currentTableFilter)', function (obj) {
|
||||
if (obj.event === 'save') {
|
||||
var postData = {};
|
||||
var cachedata = table.cache.currentTableId;
|
||||
if (cachedata.length == 0) {
|
||||
common.modalMsg("未导入数据", "warning");
|
||||
return false;
|
||||
}
|
||||
for (var i = 0; i < cachedata.length; i++) {
|
||||
if (cachedata[i].F_EnabledMark == false) {
|
||||
common.modalMsg("存在错误数据", "warning");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
postData.listData = JSON.stringify(cachedata);
|
||||
common.submitForm({
|
||||
url: '/SystemOrganize/Duty/ImportForm',
|
||||
param: postData,
|
||||
success: function () {
|
||||
common.parentreload('data-search-btn');
|
||||
}
|
||||
})
|
||||
return false;
|
||||
}
|
||||
else if (obj.event === 'delete') {
|
||||
var data = table.checkStatus('currentTableId').data;
|
||||
if (data.length == 0) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalConfirm("注:您确定要删除选中数据吗?", function (r) {
|
||||
if (r) {
|
||||
var index = parent.layer.load(0, {
|
||||
shade: [0.5, '#000'], //0.1透明度的背景
|
||||
});
|
||||
try {
|
||||
var cachedata = soulTable.cache['currentTableId'];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
for (let j = cachedata.length - 1; j >= 0; j--) {
|
||||
if (cachedata[j].F_Id === data[i].F_Id) {
|
||||
cachedata.splice(j, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
table.reload('currentTableId', {
|
||||
data: cachedata
|
||||
});
|
||||
entity = null;
|
||||
common.modalMsg("操作成功", "success");
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
}
|
||||
parent.layer.close(index);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
211
WaterCloud.Web/Areas/SystemOrganize/Views/Duty/Index.cshtml
Normal file
211
WaterCloud.Web/Areas/SystemOrganize/Views/Duty/Index.cshtml
Normal file
@@ -0,0 +1,211 @@
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'table', 'common','commonTable', 'optimizeSelectOption'], function () {
|
||||
var $ = layui.jquery,
|
||||
form = layui.form,
|
||||
table = layui.table,
|
||||
commonTable = layui.commonTable,
|
||||
common = layui.common;
|
||||
//权限控制(js是值传递)
|
||||
currentTableBar.innerHTML = common.authorizeButtonNew(currentTableBar.innerHTML);
|
||||
toolbarDemo.innerHTML = common.authorizeButtonNew(toolbarDemo.innerHTML);
|
||||
commonTable.rendertable({
|
||||
elem: '#currentTableId',
|
||||
id: 'currentTableId',
|
||||
url: '/SystemOrganize/Duty/GetGridJson',
|
||||
filter: {
|
||||
clearFilter: false
|
||||
},
|
||||
cols: [[
|
||||
{ type: "checkbox", width: 50, fixed: 'left' },
|
||||
{ field: 'F_FullName', title: '岗位名称', width: 120, sort: true, filter: true },
|
||||
{ field: 'F_EnCode', title: '岗位编号', width: 120, sort: true, filter: true },
|
||||
{
|
||||
field: 'F_CompanyName', title: '归属公司', width: 120, sort: true,
|
||||
},
|
||||
{
|
||||
field: 'F_EnabledMark', title: '状态', width: 80, sort: true, filter: true,
|
||||
templet: function (d) {
|
||||
if (d.F_EnabledMark == true) {
|
||||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>有效</span>";
|
||||
} else {
|
||||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>无效</span>";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'F_CreatorTime', title: '创建时间', width: 160, sort: true, filter: { type: 'date[yyyy/MM/dd HH:mm:ss]' }
|
||||
},
|
||||
{ field: 'F_Description', title: '备注', minWidth: 150, sort: true, filter: true },
|
||||
{ title: '操作', width: 160, toolbar: '#currentTableBar', align: "center", fixed: 'right' }
|
||||
]]
|
||||
});
|
||||
wcLoading.close();
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
//执行搜索重载
|
||||
commonTable.reloadtable({
|
||||
elem: 'currentTableId',
|
||||
curr: 1,
|
||||
where: { keyword: data.field.txt_keyword }
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//行点击事件监听,控制按钮显示
|
||||
var oneList = ["NF-edit", "NF-details"];//选择1条显示
|
||||
var morerList = ["NF-delete"];//选中1条以上显示
|
||||
commonTable.tableRowClick("checkbox", "currentTableFilter", "currentTableId", oneList, morerList);
|
||||
/**
|
||||
* toolbar监听事件
|
||||
*/
|
||||
table.on('toolbar(currentTableFilter)', function (obj) {
|
||||
var data = table.checkStatus('currentTableId').data;
|
||||
var id = data.length > 0 ? data[0].F_Id : null;
|
||||
if (obj.event === 'add') { // 监听删除操作
|
||||
common.modalOpen({
|
||||
title: "添加岗位",
|
||||
url: "/SystemOrganize/Duty/Form",
|
||||
width: "500px",
|
||||
height: "450px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'delete') {
|
||||
if (data.length == 0) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
var ids = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
ids.push(data[i].F_Id);
|
||||
}
|
||||
common.deleteForm({
|
||||
url: "/SystemOrganize/Duty/DeleteForm",
|
||||
param: { keyValue: ids.join(',') },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "编辑岗位",
|
||||
url: "/SystemOrganize/Duty/Form?keyValue=" + id,
|
||||
width: "500px",
|
||||
height: "450px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'details') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "查看岗位",
|
||||
url: "/SystemOrganize/Duty/Details?keyValue=" + id,
|
||||
width: "500px",
|
||||
height: "450px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'import') {
|
||||
common.modalOpen({
|
||||
title: "导入界面",
|
||||
url: "/SystemOrganize/Duty/Import",
|
||||
width: "650px",
|
||||
height: "650px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'export') {
|
||||
window.open('/SystemOrganize/Duty/Export?keyword=' + $('#txt_keyword').val());
|
||||
}
|
||||
else if (obj.event === 'TABLE_SEARCH') {
|
||||
var _that = $("#searchField");
|
||||
if (_that.hasClass("layui-hide")) {
|
||||
_that.removeClass('layui-hide');
|
||||
} else {
|
||||
_that.addClass('layui-hide');
|
||||
}
|
||||
table.resize();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//toolrow监听事件
|
||||
table.on('tool(currentTableFilter)', function (obj) {
|
||||
var id = obj.data.F_Id;
|
||||
if (obj.event === 'delete') {
|
||||
common.deleteForm({
|
||||
url: "/SystemOrganize/Duty/DeleteForm",
|
||||
param: { keyValue: id },
|
||||
success: function () {
|
||||
obj.del();
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
common.modalOpen({
|
||||
title: "编辑岗位",
|
||||
url: "/SystemOrganize/Duty/Form?keyValue=" + id,
|
||||
width: "500px",
|
||||
height: "450px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'details') {
|
||||
common.modalOpen({
|
||||
title: "查看岗位",
|
||||
url: "/SystemOrganize/Duty/Details?keyValue=" + id,
|
||||
width: "500px",
|
||||
height: "450px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<fieldset class="table-search-fieldset layui-hide" id="searchField">
|
||||
@*<legend>搜索信息</legend>*@
|
||||
<div>
|
||||
<form class="layui-form layui-form-pane" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键字:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="txt_keyword" name="txt_keyword" autocomplete="off" class="layui-input" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container" id="toolbar">
|
||||
<button id="NF-add" authorize="yes" class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"></i>新增</button>
|
||||
<button id="NF-edit" name="NF-edit" authorize="yes" class="layui-btn layui-btn-sm layui-btn-warm layui-hide" lay-event="edit"><i class="layui-icon"></i>修改</button>
|
||||
<button id="NF-delete" name="NF-delete" authorize="yes" class="layui-btn layui-btn-sm layui-btn-danger layui-hide" lay-event="delete"> <i class="layui-icon"></i>删除</button>
|
||||
<button id="NF-details" name="NF-details" authorize="yes" class="layui-btn layui-btn-sm layui-btn-normal layui-hide" lay-event="details"> <i class="layui-icon"></i>查看</button>
|
||||
<button id="NF-import" authorize class="layui-btn layui-btn-sm" lay-event="import"> <i class="layui-icon"></i>导入</button>
|
||||
<button id="NF-export" authorize class="layui-btn layui-btn-sm layui-btn-warm" lay-event="export"> <i class="layui-icon"></i>导出</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="currentTableBar">
|
||||
<a id="NF-edit" authorize class="layui-btn layui-btn-xs layui-btn-warm" lay-event="edit">修改</a>
|
||||
<a id="NF-delete" authorize class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delete">删除</a>
|
||||
<a id="NF-details" authorize class="layui-btn layui-btn-xs layui-btn-normal" lay-event="details">查看</a>
|
||||
</script>
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,58 @@
|
||||
@{
|
||||
ViewBag.Title = "Details";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'laydate', 'common', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common,
|
||||
laydate = layui.laydate;
|
||||
var keyValue = $.request("keyValue");
|
||||
//权限字段
|
||||
common.authorizeFields('adminform');
|
||||
$(function () {
|
||||
if (!!keyValue) {
|
||||
common.ajax({
|
||||
url: "/SystemOrganize/Notice/GetFormJson",
|
||||
dataType: "json",
|
||||
data: { keyValue: keyValue },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('adminform', data);
|
||||
common.setReadOnly('adminform');
|
||||
form.render();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
wcLoading.close();
|
||||
});
|
||||
</script>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-form layuimini-form" lay-filter="adminform">
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">标题</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_Title" name="F_Title" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text layui-hide">
|
||||
<label class="layui-form-label">内容</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="F_Content" name="F_Content" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">选项</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="F_EnabledMark" id="F_EnabledMark" checked="" value="true" title="有效标识">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
74
WaterCloud.Web/Areas/SystemOrganize/Views/Notice/Form.cshtml
Normal file
74
WaterCloud.Web/Areas/SystemOrganize/Views/Notice/Form.cshtml
Normal file
@@ -0,0 +1,74 @@
|
||||
@{
|
||||
ViewBag.Title = "Form";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'laydate', 'common', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common,
|
||||
laydate = layui.laydate;
|
||||
//权限字段
|
||||
common.authorizeFields('adminform');
|
||||
var keyValue = $.request("keyValue");
|
||||
$(function () {
|
||||
if (!!keyValue) {
|
||||
common.ajax({
|
||||
url: "/SystemOrganize/Notice/GetFormJson",
|
||||
dataType: "json",
|
||||
data: { keyValue: keyValue },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('adminform', data);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
form.render();
|
||||
});
|
||||
wcLoading.close();
|
||||
//监听提交
|
||||
form.on('submit(saveBtn)', function (data) {
|
||||
var postData = data.field;
|
||||
if (!postData["F_EnabledMark"]) postData["F_EnabledMark"] = false;
|
||||
common.submitForm({
|
||||
url: "/SystemOrganize/Notice/SubmitForm?keyValue=" + keyValue,
|
||||
param: postData,
|
||||
success: function () {
|
||||
common.parentreload("data-search-btn");
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-form layuimini-form" lay-filter="adminform">
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">标题</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_Title" name="F_Title" maxlength="50" lay-verify="required" class="layui-input" placeholder="请输入标题">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide layui-form-text">
|
||||
<label class="layui-form-label required">内容</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="F_Content" name="F_Content" class="layui-textarea" lay-verify="required" placeholder="请输入内容"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">选项</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="F_EnabledMark" id="F_EnabledMark" checked="" value="true" title="有效标识">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<button class="layui-btn site-demo-active" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
198
WaterCloud.Web/Areas/SystemOrganize/Views/Notice/Index.cshtml
Normal file
198
WaterCloud.Web/Areas/SystemOrganize/Views/Notice/Index.cshtml
Normal file
@@ -0,0 +1,198 @@
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['form', 'table', 'common', 'commonTable', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
table = layui.table,
|
||||
commonTable = layui.commonTable,
|
||||
common = layui.common;
|
||||
//加载数据
|
||||
wcLoading.close();
|
||||
//权限控制(js是值传递)
|
||||
currentTableBar.innerHTML = common.authorizeButtonNew(currentTableBar.innerHTML);
|
||||
toolbarDemo.innerHTML = common.authorizeButtonNew(toolbarDemo.innerHTML);
|
||||
commonTable.rendertable({
|
||||
elem: '#currentTableId',
|
||||
id: 'currentTableId',
|
||||
url: '/SystemOrganize/Notice/GetGridJson',
|
||||
filter: {
|
||||
clearFilter: false
|
||||
},
|
||||
cols: [[
|
||||
{ type: "checkbox", width: 50, fixed: 'left' },
|
||||
{ field: 'F_Title', title: '标题', Width: 120, sort: true, filter: true },
|
||||
{ field: 'F_Content', title: '内容', Width: 250, sort: true, filter: true},
|
||||
{
|
||||
field: 'F_EnabledMark', title: '状态', width: 80, sort: true, filter: true,
|
||||
templet: function (d) {
|
||||
if (d.F_EnabledMark == true) {
|
||||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>有效</span>";
|
||||
} else {
|
||||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>无效</span>";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'F_CreatorUserName', title: '创建人', Width: 100, sort: true, filter: true,
|
||||
},
|
||||
{
|
||||
field: 'F_CreatorTime', title: '创建时间', minWidth: 160, sort: true, filter: { type: 'date[yyyy/MM/dd HH:mm:ss]' }
|
||||
},
|
||||
{ title: '操作', width: 160, toolbar: '#currentTableBar', align: "center", fixed: 'right'}
|
||||
]]
|
||||
});
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
//执行搜索重载
|
||||
commonTable.reloadtable({
|
||||
elem: 'currentTableId',
|
||||
curr: 1,
|
||||
where: { keyword: data.field.txt_keyword}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//行点击事件监听,控制按钮显示
|
||||
var oneList = ["NF-edit", "NF-details"];//选择1条显示
|
||||
var morerList = ["NF-delete"];//选中1条以上显示
|
||||
commonTable.tableRowClick("checkbox", "currentTableFilter", "currentTableId", oneList, morerList);
|
||||
/**
|
||||
* toolbar监听事件
|
||||
*/
|
||||
table.on('toolbar(currentTableFilter)', function (obj) {
|
||||
var data = table.checkStatus('currentTableId').data;
|
||||
var id = data.length > 0 ? data[0].F_Id : null;
|
||||
if (obj.event === 'add') { // 监听删除操作
|
||||
common.modalOpen({
|
||||
title: "添加公告",
|
||||
url: "/SystemOrganize/Notice/Form",
|
||||
width: "400px",
|
||||
height: "350px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'delete') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
var ids = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
ids.push(data[i].F_Id);
|
||||
}
|
||||
common.deleteForm({
|
||||
url: "/SystemOrganize/Notice/DeleteForm",
|
||||
param: { keyValue: ids.join(',') },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "编辑公告",
|
||||
url: "/SystemOrganize/Notice/Form?keyValue=" + id,
|
||||
width: "400px",
|
||||
height: "350px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'details') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "查看公告",
|
||||
url: "/SystemOrganize/Notice/Details?keyValue=" + id,
|
||||
width: "400px",
|
||||
height: "350px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'TABLE_SEARCH'){
|
||||
var _that = $("#searchField");
|
||||
if (_that.hasClass("layui-hide")) {
|
||||
_that.removeClass('layui-hide');
|
||||
} else {
|
||||
_that.addClass('layui-hide');
|
||||
}
|
||||
table.resize();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//toolrow监听事件
|
||||
table.on('tool(currentTableFilter)', function (obj) {
|
||||
var id = obj.data.F_Id;
|
||||
if (obj.event === 'delete') {
|
||||
common.deleteForm({
|
||||
url: "/SystemOrganize/Notice/DeleteForm",
|
||||
param: { keyValue: id },
|
||||
success: function () {
|
||||
obj.del();
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
common.modalOpen({
|
||||
title: "编辑公告",
|
||||
url: "/SystemOrganize/Notice/Form?keyValue=" + id,
|
||||
width: "400px",
|
||||
height: "350px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'details') {
|
||||
common.modalOpen({
|
||||
title: "查看公告",
|
||||
url: "/SystemOrganize/Notice/Details?keyValue=" + id,
|
||||
width: "400px",
|
||||
height: "350px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<fieldset class="table-search-fieldset layui-hide" id="searchField">
|
||||
@*<legend>搜索信息</legend>*@
|
||||
<div>
|
||||
<form class="layui-form layui-form-pane" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键字:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="txt_keyword" name="txt_keyword" autocomplete="off" class="layui-input" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container" id="toolbar">
|
||||
<button id="NF-add" authorize="yes" class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"></i>新增</button>
|
||||
<button id="NF-edit" name="NF-edit" authorize="yes" class="layui-btn layui-btn-sm layui-btn-warm layui-hide" lay-event="edit"><i class="layui-icon"></i>修改</button>
|
||||
<button id="NF-delete" name="NF-delete" authorize="yes" class="layui-btn layui-btn-sm layui-btn-danger layui-hide" lay-event="delete"> <i class="layui-icon"></i>删除</button>
|
||||
<button id="NF-details" name="NF-details" authorize="yes" class="layui-btn layui-btn-sm layui-btn-normal layui-hide" lay-event="details"> <i class="layui-icon"></i>查看</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="currentTableBar">
|
||||
<a id="NF-edit" authorize class="layui-btn layui-btn-xs layui-btn-warm" lay-event="edit">修改</a>
|
||||
<a id="NF-delete" authorize class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delete">删除</a>
|
||||
<a id="NF-details" authorize class="layui-btn layui-btn-xs layui-btn-normal" lay-event="details">查看</a>
|
||||
</script>
|
||||
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,147 @@
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'table', 'common', 'commonTable', 'optimizeSelectOption'], function () {
|
||||
var $ = layui.jquery,
|
||||
form = layui.form,
|
||||
table = layui.table,
|
||||
commonTable = layui.commonTable,
|
||||
common = layui.common;
|
||||
//加载数据
|
||||
wcLoading.close();
|
||||
var value = $.request("value");
|
||||
var currentWindow = common.parentWindow();
|
||||
var name = $.request("name");
|
||||
var ids = $.request("ids");
|
||||
var options = {
|
||||
elem: '#currentTableId',
|
||||
url: '/SystemOrganize/Organize/GetTreeGridJson',
|
||||
where: {ids:ids},
|
||||
treeIdName: 'F_Id', // id字段名称
|
||||
treePidName: 'F_ParentId', // pid字段名称
|
||||
cols: [[
|
||||
{ type: 'checkbox' },
|
||||
{ field: 'F_FullName', title: '名称', width: 250 },
|
||||
{ field: 'F_EnCode', title: '编号', width: 200 },
|
||||
{
|
||||
field: 'F_CategoryId', title: '分类', width: 120,
|
||||
templet: function (d) {
|
||||
return top.clients.dataItems["OrganizeCategory"][d.F_CategoryId] == null ? "" : top.clients.dataItems["OrganizeCategory"][d.F_CategoryId];
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'F_ManagerName', title: '负责人', width: 120
|
||||
},
|
||||
{
|
||||
field: 'F_EnabledMark', title: '状态', width: 80,
|
||||
templet: function (d) {
|
||||
if (d.F_EnabledMark == true) {
|
||||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>有效</span>";
|
||||
} else {
|
||||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>无效</span>";
|
||||
}
|
||||
}
|
||||
}
|
||||
]],
|
||||
};
|
||||
commonTable.rendertreetable(options);
|
||||
commonTable.tableRowClick("checkbox", "currentTableFilter", "currentTableId");
|
||||
// 监听行双击事件
|
||||
table.on('rowDouble(currentTableFilter)', function (obj) {
|
||||
var pvalue = obj.data.F_Id;
|
||||
var pname = obj.data.F_FullName;
|
||||
var pcode = obj.data.F_EnCode;
|
||||
common.modalConfirm("注:您确定要选择{编号:" + pcode + ",名称:" + pname + "}的数据吗?", function (r) {
|
||||
if (r) {
|
||||
if (!!pvalue) {
|
||||
currentWindow.$('#' + value).val(pvalue);
|
||||
}
|
||||
if (!!pname) {
|
||||
currentWindow.$('#' + name).val(pname);
|
||||
}
|
||||
common.modalClose();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
//执行搜索重载
|
||||
options.where = { ids: (!!ids ? ids : ""), keyword: data.field.txt_keyword };
|
||||
commonTable.rendertreetable(options);
|
||||
return false;
|
||||
});
|
||||
// 监听清除操作
|
||||
form.on('submit(data-clear-btn)', function (data) {
|
||||
ids = "";
|
||||
//执行搜索重载
|
||||
options.where = { ids: (!!ids ? ids : ""), keyword: data.field.txt_keyword };
|
||||
commonTable.rendertreetable(options);
|
||||
return false;
|
||||
});
|
||||
// 监听提交操作
|
||||
form.on('submit(saveBtn)', function (data) {
|
||||
var checkStatus = table.checkStatus('currentTableId').data;
|
||||
var pvalue = [];
|
||||
var pname = [];
|
||||
var pcode = [];
|
||||
for (var i = 0; i < checkStatus.length; i++) {
|
||||
pvalue.push(checkStatus[i].F_Id);
|
||||
pname.push(checkStatus[i].F_FullName);
|
||||
pcode.push(checkStatus[i].F_EnCode);
|
||||
}
|
||||
if (pvalue.length == 0) {
|
||||
common.modalConfirm("注:您确定要清除选择的数据吗?", function (r) {
|
||||
if (r) {
|
||||
currentWindow.$('#' + name).val(null);
|
||||
currentWindow.$('#' + value).val(null);
|
||||
common.modalClose();
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
common.modalConfirm("注:您确定要选择{编号:" + pcode.join(",") + ",名称:" + pname.join(",") + "}的数据吗?", function (r) {
|
||||
if (r) {
|
||||
if (!!pvalue) {
|
||||
currentWindow.$('#' + value).val(pvalue.join(","));
|
||||
}
|
||||
if (!!pname) {
|
||||
currentWindow.$('#' + name).val(pname.join(","));
|
||||
}
|
||||
common.modalClose();
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<fieldset class="table-search-fieldset">
|
||||
@*<legend>搜索信息</legend>*@
|
||||
<div>
|
||||
<form class="layui-form layui-form-pane" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键字:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="txt_keyword" name="txt_keyword" autocomplete="off" class="layui-input" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||
<button type="submit" class="layui-btn layui-btn-danger" lay-submit lay-filter="data-clear-btn"><i class="layui-icon"></i> 清 除</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<button class="layui-btn" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,122 @@
|
||||
@{
|
||||
ViewBag.Title = "Details";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'laydate', 'common', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common,
|
||||
laydate = layui.laydate;
|
||||
var keyValue = $.request("keyValue");
|
||||
//权限字段
|
||||
common.authorizeFields('adminform');
|
||||
$(function () {
|
||||
initControl();
|
||||
if (!!keyValue) {
|
||||
common.ajax({
|
||||
url: "/SystemOrganize/Organize/GetFormJson",
|
||||
dataType: "json",
|
||||
data: { keyValue: keyValue },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('adminform', data);
|
||||
common.setReadOnly('adminform');
|
||||
}
|
||||
});
|
||||
}
|
||||
form.render();
|
||||
});
|
||||
wcLoading.close();
|
||||
function initControl() {
|
||||
$("#F_ParentId").bindSelect({
|
||||
url: "/SystemOrganize/Organize/GetTreeSelectJson",
|
||||
});
|
||||
$("#F_CategoryId").bindSelect({
|
||||
data: top.clients.dataItems["OrganizeCategory"],
|
||||
id: '',
|
||||
});
|
||||
}
|
||||
});
|
||||
function search(fileds) {
|
||||
layui.use(['jquery', 'form', 'common'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common;
|
||||
//不同弹窗
|
||||
if (fileds == '用户') {
|
||||
common.modalOpen({
|
||||
title: "选择用户",
|
||||
url: "/SystemOrganize/User/AddForm?name=" + "F_ManagerName" + "&value=" + "F_ManagerId" + "&ids=" + $('#F_ManagerId').val(),
|
||||
width: "650px",
|
||||
height: "600px",
|
||||
});
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-form layuimini-form" lay-filter="adminform">
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">上级</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_ParentId" name="F_ParentId">
|
||||
<option value="0">父节点</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">类型</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_CategoryId" name="F_CategoryId">
|
||||
<option value="">==请选择==</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_FullName" name="F_FullName" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">编号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_EnCode" name="F_EnCode" lay-verify="required" class="layui-input ">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">负责人</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_ManagerName" name="F_ManagerName" type="text" lay-verify="required" maxlength="50" autocomplete="off" class="layui-input" onclick="search('用户')" />
|
||||
<input id="F_ManagerId" name="F_ManagerId" type="text" hidden />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">显示顺序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" pattern="[0-9]*" id="F_SortCode" name="F_SortCode" lay-verify="required" class="layui-input ">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">选项</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="F_EnabledMark" id="F_EnabledMark" checked="" value="true" title="有效标识">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text layui-hide">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="F_Description" name="F_Description" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
163
WaterCloud.Web/Areas/SystemOrganize/Views/Organize/Form.cshtml
Normal file
163
WaterCloud.Web/Areas/SystemOrganize/Views/Organize/Form.cshtml
Normal file
@@ -0,0 +1,163 @@
|
||||
@{
|
||||
ViewBag.Title = "Form";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'laydate', 'common', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common,
|
||||
laydate = layui.laydate;
|
||||
var keyValue = $.request("keyValue");
|
||||
var event = $.request("event");
|
||||
//权限字段
|
||||
common.authorizeFields('adminform');
|
||||
$(function () {
|
||||
initControl();
|
||||
if (event == "edit") {
|
||||
common.ajax({
|
||||
url: "/SystemOrganize/Organize/GetFormJson",
|
||||
dataType: "json",
|
||||
data: { keyValue: keyValue },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('adminform', data);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
if (!!keyValue) {
|
||||
$('#F_ParentId').val(keyValue);
|
||||
}
|
||||
else {
|
||||
$('#F_ParentId').val("0");
|
||||
}
|
||||
}
|
||||
form.render();
|
||||
});
|
||||
wcLoading.close();
|
||||
function initControl() {
|
||||
$("#F_ParentId").bindSelect({
|
||||
url: "/SystemOrganize/Organize/GetTreeSelectJson",
|
||||
});
|
||||
$("#F_CategoryId").bindSelect({
|
||||
data: top.clients.dataItems["OrganizeCategory"],
|
||||
id:'',
|
||||
});
|
||||
}
|
||||
//select验证
|
||||
form.verify({
|
||||
required: function (value, item) {
|
||||
var msg = "必填项不能为空";
|
||||
value = $.trim(value);
|
||||
var isEmpty = !value || value.length < 1;
|
||||
// 当前验证元素是select且为空时,将页面定位至layui渲染的select处,或自定义想定位的位置
|
||||
if (item.tagName == 'SELECT' && isEmpty) {
|
||||
$("html").animate({
|
||||
scrollTop: $(item).siblings(".layui-form-select").offset().top - 74
|
||||
}, 50);
|
||||
}
|
||||
if (isEmpty) {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
});
|
||||
//监听提交
|
||||
form.on('submit(saveBtn)', function (data) {
|
||||
var postData = data.field;
|
||||
if (!postData["F_EnabledMark"]) postData["F_EnabledMark"] = false;
|
||||
common.submitForm({
|
||||
url: event == "edit" ? "/SystemOrganize/Organize/SubmitForm?keyValue=" + keyValue : "/SystemOrganize/Organize/SubmitForm",
|
||||
param: postData,
|
||||
success: function () {
|
||||
common.parentreload("data-search-btn");
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
});
|
||||
function search(fileds) {
|
||||
layui.use(['jquery', 'form', 'common'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common;
|
||||
//不同弹窗
|
||||
if (fileds == '用户') {
|
||||
common.modalOpen({
|
||||
title: "选择用户",
|
||||
url: "/SystemOrganize/User/AddForm?name=" + "F_ManagerName" + "&value=" + "F_ManagerId" + "&ids=" + $('#F_ManagerId').val(),
|
||||
width: "650px",
|
||||
height: "600px",
|
||||
});
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-form layuimini-form" lay-filter="adminform">
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">上级</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_ParentId" name="F_ParentId" lay-verify="required" lay-search>
|
||||
<option value="0" selected>父节点</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">类型</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_CategoryId" name="F_CategoryId" lay-verify="required">
|
||||
<option value="">==请选择==</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_FullName" name="F_FullName" maxlength="50" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">编号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_EnCode" name="F_EnCode" maxlength="50" lay-verify="required" class="layui-input ">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">负责人</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_ManagerName" name="F_ManagerName" type="text" lay-verify="required" maxlength="50" autocomplete="off" class="layui-input" onclick="search('用户')" />
|
||||
<input id="F_ManagerId" name="F_ManagerId" type="text" hidden />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">显示顺序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" pattern="[0-9]*" id="F_SortCode" name="F_SortCode" lay-verify="required|number" oninput="if(value.length>8)value=value.slice(0,8)" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">选项</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="F_EnabledMark" id="F_EnabledMark" checked="" value="true" title="有效标识">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text layui-hide">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="F_Description" name="F_Description" class="layui-textarea" placeholder="请输入备注"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<button class="layui-btn site-demo-active" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
197
WaterCloud.Web/Areas/SystemOrganize/Views/Organize/Index.cshtml
Normal file
197
WaterCloud.Web/Areas/SystemOrganize/Views/Organize/Index.cshtml
Normal file
@@ -0,0 +1,197 @@
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'table', 'common', 'commonTable', 'optimizeSelectOption'], function () {
|
||||
var $ = layui.jquery,
|
||||
form = layui.form,
|
||||
table = layui.table,
|
||||
commonTable = layui.commonTable,
|
||||
common = layui.common;
|
||||
//加载数据
|
||||
wcLoading.close();
|
||||
//权限控制(js是值传递)
|
||||
currentTableBar.innerHTML = common.authorizeButtonNew(currentTableBar.innerHTML);
|
||||
toolbarDemo.innerHTML = common.authorizeButtonNew(toolbarDemo.innerHTML);
|
||||
var options = {
|
||||
elem: '#currentTableId',
|
||||
url: '/SystemOrganize/Organize/GetTreeGridJson',
|
||||
treeIdName: 'F_Id', // id字段名称
|
||||
treePidName: 'F_ParentId', // pid字段名称
|
||||
cols: [[
|
||||
{ type: "radio", width: 50, fixed: 'left' },
|
||||
{ field: 'F_FullName', title: '名称', width: 250, filter: true },
|
||||
{ field: 'F_EnCode', title: '编号', width: 200, filter: true },
|
||||
{
|
||||
field: 'F_CategoryId', title: '分类', width: 120, filter: true,
|
||||
templet: function (d) {
|
||||
return top.clients.dataItems["OrganizeCategory"][d.F_CategoryId] == null ? "" : top.clients.dataItems["OrganizeCategory"][d.F_CategoryId];
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'F_ManagerName', title: '负责人', width: 120, sort: true, filter: true
|
||||
},
|
||||
{
|
||||
field: 'F_EnabledMark', title: '状态', width: 80, filter: true,
|
||||
templet: function (d) {
|
||||
if (d.F_EnabledMark == true) {
|
||||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>有效</span>";
|
||||
} else {
|
||||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>无效</span>";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'F_CreatorTime', title: '创建时间', width: 160, sort: true, filter: { type: 'date[yyyy/MM/dd HH:mm:ss]' }
|
||||
},
|
||||
{ field: 'F_Description', title: '备注', minWidth: 150, filter: true },
|
||||
{ title: '操作', width: 160, toolbar: '#currentTableBar', align: "center", fixed: 'right' }
|
||||
]],
|
||||
};
|
||||
commonTable.rendertreetable(options);
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
queryJson = data.field.txt_keyword;
|
||||
options.where = { keyword: queryJson };
|
||||
commonTable.rendertreetable(options);
|
||||
duty = null;
|
||||
return false;
|
||||
});
|
||||
//行点击事件监听,控制按钮显示
|
||||
var oneList = ["NF-edit", "NF-details", "NF-delete"];//选择1条显示
|
||||
commonTable.tableRowClick("radio", "currentTableFilter", "currentTableId", oneList);
|
||||
/**
|
||||
* toolbar监听事件
|
||||
*/
|
||||
table.on('toolbar(currentTableFilter)', function (obj) {
|
||||
var data = table.checkStatus('currentTableId').data;
|
||||
var keyValue = data.length > 0 ? data[0].F_Id : null;
|
||||
var duty = data.length > 0 ? data[0] : null;
|
||||
if (obj.event === 'add') { // 监听操作
|
||||
common.modalOpen({
|
||||
title: "添加机构",
|
||||
url: "/SystemOrganize/Organize/Form?event=add&keyValue=" + (!!keyValue ? keyValue : ""),
|
||||
width: "450px",
|
||||
height: "520px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'delete') {
|
||||
if (duty == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.deleteForm({
|
||||
url: "/SystemOrganize/Organize/DeleteForm",
|
||||
param: { keyValue: keyValue },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
if (duty == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "编辑机构",
|
||||
url: "/SystemOrganize/Organize/Form?event=edit&keyValue=" + keyValue,
|
||||
width: "450px",
|
||||
height: "520px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'details') {
|
||||
if (duty == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "查看机构",
|
||||
url: "/SystemOrganize/Organize/Details?keyValue=" + keyValue,
|
||||
width: "450px",
|
||||
height: "520px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'TABLE_SEARCH') {
|
||||
var _that = $("#searchField");
|
||||
if (_that.hasClass("layui-hide")) {
|
||||
_that.removeClass('layui-hide');
|
||||
} else {
|
||||
_that.addClass('layui-hide');
|
||||
}
|
||||
table.resize();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
table.on('tool(currentTableFilter)', function (obj) {
|
||||
var keyValue = obj.data.F_Id;
|
||||
if (obj.event === 'delete') {
|
||||
common.deleteForm({
|
||||
url: "/SystemOrganize/Organize/DeleteForm",
|
||||
param: { keyValue: keyValue },
|
||||
success: function () {
|
||||
obj.del();
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
common.modalOpen({
|
||||
title: "编辑机构",
|
||||
url: "/SystemOrganize/Organize/Form?event=edit&keyValue=" + keyValue,
|
||||
width: "450px",
|
||||
height: "520px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'details') {
|
||||
common.modalOpen({
|
||||
title: "查看机构",
|
||||
url: "/SystemOrganize/Organize/Details?keyValue=" + keyValue,
|
||||
width: "450px",
|
||||
height: "520px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<fieldset class="table-search-fieldset layui-hide" id="searchField">
|
||||
@*<legend>搜索信息</legend>*@
|
||||
<div>
|
||||
<form class="layui-form layui-form-pane" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键字:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="txt_keyword" name="txt_keyword" autocomplete="off" class="layui-input" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container" id="toolbar">
|
||||
<button id="NF-add" name="NF-add" authorize class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"></i>新增</button>
|
||||
<button id="NF-edit" name="NF-edit" authorize class="layui-btn layui-btn-sm layui-btn-warm layui-hide" lay-event="edit"><i class="layui-icon"></i>修改</button>
|
||||
<button id="NF-delete" name="NF-delete" authorize class="layui-btn layui-btn-sm layui-btn-danger layui-hide" lay-event="delete"> <i class="layui-icon"></i>删除</button>
|
||||
<button id="NF-details" name="NF-details" authorize class="layui-btn layui-btn-sm layui-btn-normal layui-hide" lay-event="details"> <i class="layui-icon"></i>查看</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="currentTableBar">
|
||||
<a id="NF-edit" authorize class="layui-btn layui-btn-xs layui-btn-warm" lay-event="edit">修改</a>
|
||||
<a id="NF-delete" authorize class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delete">删除</a>
|
||||
<a id="NF-details" authorize class="layui-btn layui-btn-xs layui-btn-normal" lay-event="details">查看</a>
|
||||
</script>
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
156
WaterCloud.Web/Areas/SystemOrganize/Views/Role/AddForm.cshtml
Normal file
156
WaterCloud.Web/Areas/SystemOrganize/Views/Role/AddForm.cshtml
Normal file
@@ -0,0 +1,156 @@
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'table', 'common', 'optimizeSelectOption', 'commonTable'], function () {
|
||||
var $ = layui.jquery,
|
||||
form = layui.form,
|
||||
table = layui.table,
|
||||
commonTable = layui.commonTable,
|
||||
common = layui.common;
|
||||
//加载数据
|
||||
wcLoading.close();
|
||||
var value = $.request("value");
|
||||
var currentWindow = common.parentWindow();
|
||||
var name = $.request("name");
|
||||
var ids = $.request("ids");
|
||||
commonTable.rendertable({
|
||||
elem: '#currentTableId',
|
||||
id: 'currentTableId',
|
||||
url: '/SystemOrganize/Role/GetSelectJson',
|
||||
where: { ids: (!!ids ? ids : "") },
|
||||
search: false,
|
||||
height: 'full-110',
|
||||
limit: 99999,//每页数据 默认
|
||||
page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
|
||||
layout: ['count'] //自定义分页布局
|
||||
, first: false //不显示首页
|
||||
, last: false //不显示尾页
|
||||
},
|
||||
toolbar: false,//工具栏
|
||||
cols: [[
|
||||
{ type: 'checkbox' },
|
||||
{ field: 'F_FullName', title: '角色名称', width: 200, sort: true },
|
||||
{
|
||||
field: 'F_Type', title: '角色类型', width: 200, sort: true,
|
||||
templet: function (d) {
|
||||
return top.clients.dataItems["RoleType"][d.F_Type] == undefined ? "" : top.clients.dataItems["RoleType"][d.F_Type];
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'F_CompanyName', title: '归属公司', width: 120, sort: true
|
||||
},
|
||||
{
|
||||
field: 'F_EnabledMark', title: '状态', width: 80, sort: true,
|
||||
templet: function (d) {
|
||||
if (d.F_EnabledMark == true) {
|
||||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>有效</span>";
|
||||
} else {
|
||||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>无效</span>";
|
||||
}
|
||||
}
|
||||
}
|
||||
]]
|
||||
});
|
||||
commonTable.tableRowClick("checkbox", "currentTableFilter", "currentTableId");
|
||||
// 监听双击事件
|
||||
table.on('rowDouble(currentTableFilter)', function (obj) {
|
||||
var pvalue = obj.data.F_Id;
|
||||
var pname = obj.data.F_FullName;
|
||||
common.modalConfirm("注:您确定要选择{名称:" + pname + "}的数据吗?", function (r) {
|
||||
if (r) {
|
||||
if (!!pvalue) {
|
||||
currentWindow.$('#' + value).val(pvalue);
|
||||
}
|
||||
if (!!pname) {
|
||||
currentWindow.$('#' + name).val(pname);
|
||||
}
|
||||
common.modalClose();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
//执行搜索重载
|
||||
commonTable.reloadtable({
|
||||
elem: 'currentTableId',
|
||||
page: false,
|
||||
where: { ids: (!!ids ? ids : ""), keyword: data.field.txt_keyword }
|
||||
});
|
||||
return false;
|
||||
});
|
||||
// 监听清除操作
|
||||
form.on('submit(data-clear-btn)', function (data) {
|
||||
ids ="";
|
||||
//执行搜索重载
|
||||
commonTable.reloadtable({
|
||||
elem: 'currentTableId',
|
||||
page: false,
|
||||
where: { ids: "", keyword: data.field.txt_keyword }
|
||||
});
|
||||
return false;
|
||||
});
|
||||
// 监听提交操作
|
||||
form.on('submit(saveBtn)', function (data) {
|
||||
var checkStatus = table.checkStatus("currentTableId").data;
|
||||
var pvalue = [];
|
||||
var pname = [];
|
||||
for (var i = 0; i < checkStatus.length; i++) {
|
||||
pvalue.push(checkStatus[i].F_Id);
|
||||
pname.push(checkStatus[i].F_FullName);
|
||||
}
|
||||
if (pvalue.length == 0) {
|
||||
common.modalConfirm("注:您确定要清除选择的数据吗?", function (r) {
|
||||
if (r) {
|
||||
currentWindow.$('#' + name).val(null);
|
||||
currentWindow.$('#' + value).val(null);
|
||||
common.modalClose();
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
common.modalConfirm("注:您确定要选择{名称:" + pname.join(",") + "}的数据吗?", function (r) {
|
||||
if (r) {
|
||||
if (!!pvalue) {
|
||||
currentWindow.$('#' + value).val(pvalue.join(","));
|
||||
}
|
||||
if (!!pname) {
|
||||
currentWindow.$('#' + name).val(pname.join(","));
|
||||
}
|
||||
common.modalClose();
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<fieldset class="table-search-fieldset">
|
||||
@*<legend>搜索信息</legend>*@
|
||||
<div>
|
||||
<form class="layui-form layui-form-pane" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键字:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="txt_keyword" name="txt_keyword" autocomplete="off" class="layui-input" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||
<button type="submit" class="layui-btn layui-btn-danger" lay-submit lay-filter="data-clear-btn"><i class="layui-icon"></i> 清 除</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<button class="layui-btn" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
</div>
|
||||
</div>
|
||||
219
WaterCloud.Web/Areas/SystemOrganize/Views/Role/Details.cshtml
Normal file
219
WaterCloud.Web/Areas/SystemOrganize/Views/Role/Details.cshtml
Normal file
@@ -0,0 +1,219 @@
|
||||
@{
|
||||
ViewBag.Title = "Details";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['form', 'step', 'common', 'dtree', 'optimizeSelectOption'], function () {
|
||||
var $ = layui.$,
|
||||
form = layui.form,
|
||||
dtree = layui.dtree,
|
||||
common = layui.common,
|
||||
step = layui.step;
|
||||
var keyValue = $.request("keyValue");
|
||||
//权限字段
|
||||
common.authorizeFields('stepForm');
|
||||
step.render({
|
||||
elem: '#stepForm',
|
||||
filter: 'stepForm',
|
||||
width: '85%', //设置容器宽度
|
||||
stepWidth: '300px',
|
||||
height: '450px',
|
||||
stepItems: [{
|
||||
title: '填写角色信息'
|
||||
}, {
|
||||
title: '设置功能权限'
|
||||
}, {
|
||||
title: '设置字段权限'
|
||||
}]
|
||||
});
|
||||
$(function () {
|
||||
initControl();
|
||||
if (!!keyValue) {
|
||||
common.ajax({
|
||||
url: "/SystemOrganize/Role/GetFormJson",
|
||||
dataType: "json",
|
||||
data: { keyValue: keyValue },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('stepForm', data);
|
||||
common.setReadOnly('stepForm');
|
||||
}
|
||||
});
|
||||
}
|
||||
form.render();
|
||||
});
|
||||
wcLoading.close();
|
||||
// 初始化树
|
||||
var DemoTree1 = dtree.render({
|
||||
elem: "#demoTree1",
|
||||
width: '200px',
|
||||
method: "GET",
|
||||
async: false,
|
||||
checkbar: true,
|
||||
line: true, // 显示树线
|
||||
initLevel: 0,
|
||||
icon: "-1", // 隐藏二级图标
|
||||
checkbarType: "p-casc",
|
||||
scroll: "#toolbarDiv1", // 绑定div元素
|
||||
url: "/SystemOrganize/RoleAuthorize/GetPermissionTree?v=" + new Date().Format("yyyy-MM-dd hh:mm:ss"), // 使用url加载(可与data加载同时存在)
|
||||
request: { roleId: keyValue }
|
||||
});
|
||||
function initControl() {
|
||||
$("#F_CompanyId").bindSelect({
|
||||
url: "/SystemOrganize/SystemSet/GetListJson",
|
||||
id: "F_Id",
|
||||
text: "F_CompanyName"
|
||||
});
|
||||
$("#F_Type").bindSelect({
|
||||
data: top.clients.dataItems['RoleType'],
|
||||
id: "",
|
||||
});
|
||||
}
|
||||
var role;
|
||||
form.on('submit(formStep)', function (data) {
|
||||
role = data.field
|
||||
step.next('#stepForm');
|
||||
return false;
|
||||
});
|
||||
var moduleids = [];
|
||||
form.on('submit(formStep2)', function (data) {
|
||||
var params = dtree.getCheckbarNodesParam("demoTree1");
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
moduleids.push(params[i].nodeId);
|
||||
}
|
||||
// 初始化树
|
||||
var DemoTree2 = dtree.render({
|
||||
elem: "#demoTree2",
|
||||
width: '200px',
|
||||
method: "POST",
|
||||
async: false,
|
||||
checkbar: true,
|
||||
line: true, // 显示树线
|
||||
initLevel: 0,
|
||||
icon: "-1", // 隐藏二级图标
|
||||
checkbarType: "p-casc",
|
||||
scroll: "#toolbarDiv2", // 绑定div元素
|
||||
url: "/SystemOrganize/RoleAuthorize/GetPermissionFieldsTree?v=" + new Date().Format("yyyy-MM-dd hh:mm:ss"), // 使用url加载(可与data加载同时存在)
|
||||
request: { roleId: keyValue, moduleids: String(moduleids) }
|
||||
});
|
||||
step.next('#stepForm');
|
||||
return false;
|
||||
});
|
||||
form.on('submit(formStep3)', function (data) {
|
||||
var postData = role;
|
||||
var params = dtree.getCheckbarNodesParam("demoTree2");
|
||||
var note = [];
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
note.push(params[i].nodeId);
|
||||
}
|
||||
postData["permissionbuttonIds"] = String(moduleids);
|
||||
postData["permissionfieldsIds"] = String(note);
|
||||
common.submitForm({
|
||||
url: "/SystemOrganize/Role/SubmitForm?keyValue=" + keyValue,
|
||||
param: postData,
|
||||
success: function () {
|
||||
common.parentreload("data-search-btn");
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
$('.pre').click(function () {
|
||||
step.pre('#stepForm');
|
||||
});
|
||||
})
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-carousel" id="stepForm" lay-filter="stepForm">
|
||||
<div carousel-item>
|
||||
<div>
|
||||
<form class="layui-form">
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">归属公司</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_CompanyId" name="F_CompanyId" lay-verify="required">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">角色名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_FullName" name="F_FullName" lay-verify="required" class="layui-input" placeholder="请填写角色名称">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">角色编号</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_EnCode" name="F_EnCode" type="text" lay-verify="required" class="layui-input" placeholder="请输入角色编号" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">角色类型</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_Type" name="F_Type" lay-verify="required">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">显示顺序</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_SortCode" name="F_SortCode" type="number" pattern="[0-9]*" class="layui-input" lay-verify="required" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">选项</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="F_EnabledMark" id="F_EnabledMark" checked="" value="true" title="有效标识">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text layui-hide">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="F_Description" name="F_Description" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group-bottom text-right">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formStep">
|
||||
 下一步 
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<form class="layui-form layuimini-form">
|
||||
<div class="layui-form-item ">
|
||||
<div style="height: 350px;overflow: auto;" id="toolbarDiv1">
|
||||
<ul id="demoTree1" class="dtree" data-id="0"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group-bottom text-right">
|
||||
<div class="layui-input-block">
|
||||
<button type="button" class="layui-btn layui-btn-primary pre">上一步</button>
|
||||
<button class="layui-btn" lay-submit lay-filter="formStep2">
|
||||
 下一步 
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<form class="layui-form layuimini-form">
|
||||
<div class="layui-form-item ">
|
||||
<div style="height: 350px;overflow: auto;" id="toolbarDiv2">
|
||||
<ul id="demoTree2" class="dtree" data-id="0"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group-bottom text-right">
|
||||
<div class="layui-input-block">
|
||||
<button type="button" class="layui-btn layui-btn-primary pre">上一步</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
241
WaterCloud.Web/Areas/SystemOrganize/Views/Role/Form.cshtml
Normal file
241
WaterCloud.Web/Areas/SystemOrganize/Views/Role/Form.cshtml
Normal file
@@ -0,0 +1,241 @@
|
||||
@{
|
||||
ViewBag.Title = "Form";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<link href="~/css/stepcss.css" rel="stylesheet" />
|
||||
<script>
|
||||
layui.use(['form', 'step', 'common', 'dtree', 'optimizeSelectOption'], function () {
|
||||
var $ = layui.$,
|
||||
form = layui.form,
|
||||
dtree = layui.dtree,
|
||||
common = layui.common,
|
||||
step = layui.step;
|
||||
var keyValue = $.request("keyValue");
|
||||
//权限字段
|
||||
common.authorizeFields('stepForm');
|
||||
step.render({
|
||||
elem: '#stepForm',
|
||||
filter: 'stepForm',
|
||||
width: '85%', //设置容器宽度
|
||||
stepWidth: '300px',
|
||||
height: '450px',
|
||||
stepItems: [{
|
||||
title: '填写角色信息'
|
||||
}, {
|
||||
title: '设置功能权限'
|
||||
}, {
|
||||
title: '设置字段权限'
|
||||
}]
|
||||
});
|
||||
$(function () {
|
||||
initControl();
|
||||
if (!!keyValue) {
|
||||
common.ajax({
|
||||
url: "/SystemOrganize/Role/GetFormJson",
|
||||
dataType: "json",
|
||||
data: { keyValue: keyValue },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('stepForm', data);
|
||||
}
|
||||
});
|
||||
}
|
||||
form.render();
|
||||
});
|
||||
wcLoading.close();
|
||||
function initControl() {
|
||||
$("#F_CompanyId").bindSelect({
|
||||
url: "/SystemOrganize/SystemSet/GetListJson",
|
||||
id: "F_Id",
|
||||
text: "F_CompanyName"
|
||||
});
|
||||
$("#F_Type").bindSelect({
|
||||
data: top.clients.dataItems['RoleType'],
|
||||
id: "",
|
||||
});
|
||||
}
|
||||
//select验证
|
||||
form.verify({
|
||||
required: function (value, item) {
|
||||
var msg = "必填项不能为空";
|
||||
value = $.trim(value);
|
||||
var isEmpty = !value || value.length < 1;
|
||||
// 当前验证元素是select且为空时,将页面定位至layui渲染的select处,或自定义想定位的位置
|
||||
if (item.tagName == 'SELECT' && isEmpty) {
|
||||
$("html").animate({
|
||||
scrollTop: $(item).siblings(".layui-form-select").offset().top - 74
|
||||
}, 50);
|
||||
}
|
||||
if (isEmpty) {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
});
|
||||
// 初始化树
|
||||
var DemoTree1 = dtree.render({
|
||||
elem: "#demoTree1",
|
||||
width: '200px',
|
||||
method: "GET",
|
||||
async: false,
|
||||
checkbar: true,
|
||||
line: true, // 显示树线
|
||||
initLevel: 0,
|
||||
icon: "-1" , // 隐藏二级图标
|
||||
checkbarType: "p-casc",
|
||||
scroll:"#toolbarDiv1", // 绑定div元素
|
||||
url: "/SystemOrganize/RoleAuthorize/GetPermissionTree?v="+new Date().Format("yyyy-MM-dd hh:mm:ss"), // 使用url加载(可与data加载同时存在)
|
||||
request: { roleId: keyValue }
|
||||
});
|
||||
var role;
|
||||
form.on('submit(formStep)', function (data) {
|
||||
role = data.field
|
||||
if (!role["F_EnabledMark"]) role["F_EnabledMark"] = false;
|
||||
step.next('#stepForm');
|
||||
return false;
|
||||
});
|
||||
var moduleids = [];
|
||||
form.on('submit(formStep2)', function (data) {
|
||||
var params = dtree.getCheckbarNodesParam("demoTree1");
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
moduleids.push(params[i].nodeId);
|
||||
}
|
||||
// 初始化树
|
||||
var DemoTree2 = dtree.render({
|
||||
elem: "#demoTree2",
|
||||
width: '200px',
|
||||
method: "POST",
|
||||
async: false,
|
||||
checkbar: true,
|
||||
line: true, // 显示树线
|
||||
initLevel: 0,
|
||||
icon: "-1", // 隐藏二级图标
|
||||
checkbarType: "p-casc",
|
||||
scroll: "#toolbarDiv2", // 绑定div元素
|
||||
url: "/SystemOrganize/RoleAuthorize/GetPermissionFieldsTree?v=" + new Date().Format("yyyy-MM-dd hh:mm:ss"), // 使用url加载(可与data加载同时存在)
|
||||
request: { roleId: keyValue, moduleids: String(moduleids) }
|
||||
});
|
||||
step.next('#stepForm');
|
||||
return false;
|
||||
});
|
||||
form.on('submit(formStep3)', function (data) {
|
||||
var postData = role;
|
||||
var params = dtree.getCheckbarNodesParam("demoTree2");
|
||||
var note = [];
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
note.push(params[i].nodeId);
|
||||
}
|
||||
postData["permissionbuttonIds"] = String(moduleids);
|
||||
postData["permissionfieldsIds"] = String(note);
|
||||
common.submitForm({
|
||||
url: "/SystemOrganize/Role/SubmitForm?keyValue=" + keyValue,
|
||||
param: postData,
|
||||
success: function () {
|
||||
common.parentreload("data-search-btn");
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.pre').click(function () {
|
||||
step.pre('#stepForm');
|
||||
});
|
||||
})
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-carousel" id="stepForm" lay-filter="stepForm">
|
||||
<div carousel-item>
|
||||
<div>
|
||||
<form class="layui-form layuimini-form">
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">归属公司</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_CompanyId" name="F_CompanyId" lay-verify="required" lay-search>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">角色名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_FullName" name="F_FullName" maxlength="50" lay-verify="required" class="layui-input" placeholder="请填写角色名称">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">角色编号</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_EnCode" name="F_EnCode" type="text" maxlength="50" lay-verify="required" class="layui-input" placeholder="请输入角色编号" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">角色类型</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_Type" name="F_Type" lay-verify="required">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">显示顺序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" pattern="[0-9]*" id="F_SortCode" name="F_SortCode" lay-verify="required|number" oninput="if(value.length>8)value=value.slice(0,8)" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">选项</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="F_EnabledMark" id="F_EnabledMark" checked="" value="true" title="有效标识">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text layui-hide">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id="F_Description" name="F_Description" class="layui-textarea" placeholder="请输入备注"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group-bottom text-right">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formStep">
|
||||
 下一步 
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<form class="layui-form layuimini-form">
|
||||
<div class="layui-form-item ">
|
||||
<div style="height: 350px;overflow: auto;" id="toolbarDiv1">
|
||||
<ul id="demoTree1" class="dtree" data-id="0"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group-bottom text-right">
|
||||
<div class="layui-input-block">
|
||||
<button type="button" class="layui-btn layui-btn-primary pre">上一步</button>
|
||||
<button class="layui-btn" lay-submit lay-filter="formStep2">
|
||||
 下一步 
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<form class="layui-form layuimini-form">
|
||||
<div class="layui-form-item ">
|
||||
<div style="height: 350px;overflow: auto;" id="toolbarDiv2">
|
||||
<ul id="demoTree2" class="dtree" data-id="0"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group-bottom text-right">
|
||||
<div class="layui-input-block">
|
||||
<button type="button" class="layui-btn layui-btn-primary pre">上一步</button>
|
||||
<button class="layui-btn site-demo-active" lay-submit lay-filter="formStep3">
|
||||
确认保存
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
204
WaterCloud.Web/Areas/SystemOrganize/Views/Role/Index.cshtml
Normal file
204
WaterCloud.Web/Areas/SystemOrganize/Views/Role/Index.cshtml
Normal file
@@ -0,0 +1,204 @@
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['form', 'table', 'common', 'commonTable', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
table = layui.table,
|
||||
commonTable = layui.commonTable,
|
||||
common = layui.common;
|
||||
//加载数据
|
||||
wcLoading.close();
|
||||
//权限控制(js是值传递)
|
||||
currentTableBar.innerHTML = common.authorizeButtonNew(currentTableBar.innerHTML);
|
||||
toolbarDemo.innerHTML = common.authorizeButtonNew(toolbarDemo.innerHTML);
|
||||
commonTable.rendertable({
|
||||
elem: '#currentTableId',
|
||||
id: 'currentTableId',
|
||||
url: '/SystemOrganize/Role/GetGridJson',
|
||||
filter: {
|
||||
clearFilter: false
|
||||
},
|
||||
cols: [[
|
||||
{ type: "radio", width: 50, fixed: 'left' },
|
||||
{ field: 'F_FullName', title: '角色名称', width: 200, sort: true, filter: true },
|
||||
{ field: 'F_EnCode', title: '角色编号', width: 200, sort: true, filter: true },
|
||||
{
|
||||
field: 'F_Type', title: '角色类型', width: 120, sort: true, filter: true,
|
||||
templet: function (d) {
|
||||
return top.clients.dataItems["RoleType"][d.F_Type] == undefined ? "" : top.clients.dataItems["RoleType"][d.F_Type];
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'F_CompanyName', title: '归属公司', width: 120, sort: true, filter: true,
|
||||
},
|
||||
{
|
||||
field: 'F_EnabledMark', title: '状态', width: 80, sort: true, filter: true,
|
||||
templet: function (d) {
|
||||
if (d.F_EnabledMark == true) {
|
||||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>有效</span>";
|
||||
} else {
|
||||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>无效</span>";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'F_CreatorTime', title: '创建时间', width: 160, sort: true, filter: { type: 'date[yyyy/MM/dd HH:mm:ss]' }
|
||||
},
|
||||
{ field: 'F_Description', title: '备注', minWidth: 150, sort: true, filter: true },
|
||||
{ title: '操作', width: 160, toolbar: '#currentTableBar', align: "center", fixed: 'right'}
|
||||
]]
|
||||
});
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
//执行搜索重载
|
||||
commonTable.reloadtable({
|
||||
elem: 'currentTableId',
|
||||
curr: 1,
|
||||
where: { keyword: data.field.txt_keyword }
|
||||
});
|
||||
role = null;
|
||||
return false;
|
||||
});
|
||||
//行点击事件监听,控制按钮显示
|
||||
var oneList = ["NF-edit", "NF-details", "NF-delete"];//选择1条显示
|
||||
commonTable.tableRowClick("radio", "currentTableFilter", "currentTableId", oneList);
|
||||
/**
|
||||
* toolbar监听事件
|
||||
*/
|
||||
table.on('toolbar(currentTableFilter)', function (obj) {
|
||||
var data = table.checkStatus('currentTableId').data;
|
||||
var id = data.length > 0 ? data[0].F_Id : null;
|
||||
if (obj.event === 'add') { // 监听操作
|
||||
common.modalOpen({
|
||||
title: "添加角色",
|
||||
url: "/SystemOrganize/Role/Form",
|
||||
width: "550px",
|
||||
height: "550px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'delete') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.deleteForm({
|
||||
url: "/SystemOrganize/Role/DeleteForm",
|
||||
param: { keyValue: id },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "编辑角色",
|
||||
url: "/SystemOrganize/Role/Form?keyValue=" + id,
|
||||
width: "550px",
|
||||
height: "550px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'details') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "查看角色",
|
||||
url: "/SystemOrganize/Role/Details?keyValue=" + id,
|
||||
width: "550px",
|
||||
height: "550px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'TABLE_SEARCH') {
|
||||
var _that = $("#searchField");
|
||||
if (_that.hasClass("layui-hide")) {
|
||||
_that.removeClass('layui-hide');
|
||||
} else {
|
||||
_that.addClass('layui-hide');
|
||||
}
|
||||
table.resize();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//toolrow监听事件
|
||||
table.on('tool(currentTableFilter)', function (obj) {
|
||||
var id = obj.data.F_Id;
|
||||
if (obj.event === 'delete') {
|
||||
common.deleteForm({
|
||||
url: "/SystemOrganize/Role/DeleteForm",
|
||||
param: { keyValue: id },
|
||||
success: function () {
|
||||
obj.del();
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
common.modalOpen({
|
||||
title: "编辑角色",
|
||||
url: "/SystemOrganize/Role/Form?keyValue=" + id,
|
||||
width: "550px",
|
||||
height: "550px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'details') {
|
||||
common.modalOpen({
|
||||
title: "查看角色",
|
||||
url: "/SystemOrganize/Role/Details?keyValue=" + id,
|
||||
width: "550px",
|
||||
height: "550px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<fieldset class="table-search-fieldset layui-hide" id="searchField">
|
||||
@*<legend>搜索信息</legend>*@
|
||||
<div>
|
||||
<form class="layui-form layui-form-pane" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键字:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="txt_keyword" name="txt_keyword" autocomplete="off" class="layui-input" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container" id="toolbar">
|
||||
<button id="NF-add" authorize="yes" class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"></i>新增</button>
|
||||
<button id="NF-edit" name="NF-edit" authorize="yes" class="layui-btn layui-btn-sm layui-btn-warm layui-hide" lay-event="edit"><i class="layui-icon"></i>修改</button>
|
||||
<button id="NF-delete" name="NF-delete" authorize="yes" class="layui-btn layui-btn-sm layui-btn-danger layui-hide" lay-event="delete"> <i class="layui-icon"></i>删除</button>
|
||||
<button id="NF-details" name="NF-details" authorize="yes" class="layui-btn layui-btn-sm layui-btn-normal layui-hide" lay-event="details"> <i class="layui-icon"></i>查看</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="currentTableBar">
|
||||
<a id="NF-edit" authorize class="layui-btn layui-btn-xs layui-btn-warm" lay-event="edit">修改</a>
|
||||
<a id="NF-delete" authorize class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delete">删除</a>
|
||||
<a id="NF-details" authorize class="layui-btn layui-btn-xs layui-btn-normal" lay-event="details">查看</a>
|
||||
</script>
|
||||
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,285 @@
|
||||
@{
|
||||
ViewBag.Title = "Form";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<link href="~/css/stepcss.css" rel="stylesheet" />
|
||||
<script>
|
||||
layui.use(['form', 'step', 'common', 'laydate', 'dtree', 'optimizeSelectOption'], function () {
|
||||
var $ = layui.$,
|
||||
form = layui.form,
|
||||
dtree = layui.dtree,
|
||||
common = layui.common,
|
||||
upload = layui.upload,
|
||||
laydate = layui.laydate,
|
||||
step = layui.step;
|
||||
var keyValue = $.request("keyValue");
|
||||
//权限字段
|
||||
common.authorizeFields('stepForm');
|
||||
//类型为时间时
|
||||
laydate.render({
|
||||
elem: '#F_EndTime'
|
||||
, btns: ['clear', 'now']
|
||||
, trigger: 'click',
|
||||
format: 'yyyy-MM-dd',
|
||||
});
|
||||
step.render({
|
||||
elem: '#stepForm',
|
||||
filter: 'stepForm',
|
||||
width: '90%', //设置容器宽度
|
||||
stepWidth: '300px',
|
||||
height: '500px',
|
||||
stepItems: [{
|
||||
title: '填写租户信息'
|
||||
}, {
|
||||
title: '设置功能权限'
|
||||
}, {
|
||||
title: '设置字段权限'
|
||||
}]
|
||||
});
|
||||
$(function () {
|
||||
$("#F_DBProvider").bindSelect({
|
||||
url: "/SystemOrganize/SystemSet/GetDbTypeJson",
|
||||
id:""
|
||||
});
|
||||
if (!!keyValue) {
|
||||
common.ajax({
|
||||
url: "/SystemOrganize/SystemSet/GetFormJson",
|
||||
dataType: "json",
|
||||
data: { keyValue: keyValue },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('stepForm', data);
|
||||
$('#F_EndTime').val(new Date(data.F_EndTime).Format("yyyy-MM-dd"));
|
||||
$('#demo1').attr('src', data.F_Logo); //图片链接
|
||||
common.setReadOnly('stepForm');
|
||||
}
|
||||
});
|
||||
}
|
||||
form.render();
|
||||
});
|
||||
wcLoading.close();
|
||||
//select验证
|
||||
form.verify({
|
||||
required: function (value, item) {
|
||||
var msg = "必填项不能为空";
|
||||
value = $.trim(value);
|
||||
var isEmpty = !value || value.length < 1;
|
||||
// 当前验证元素是select且为空时,将页面定位至layui渲染的select处,或自定义想定位的位置
|
||||
if (item.tagName == 'SELECT' && isEmpty) {
|
||||
$("html").animate({
|
||||
scrollTop: $(item).siblings(".layui-form-select").offset().top - 74
|
||||
}, 50);
|
||||
}
|
||||
if (isEmpty) {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
});
|
||||
// 初始化树
|
||||
var DemoTree1 = dtree.render({
|
||||
elem: "#demoTree1",
|
||||
width: '200px',
|
||||
method: "GET",
|
||||
async: false,
|
||||
checkbar: true,
|
||||
line: true, // 显示树线
|
||||
initLevel: 0,
|
||||
icon: "-1", // 隐藏二级图标
|
||||
checkbarType: "p-casc",
|
||||
scroll: "#toolbarDiv1", // 绑定div元素
|
||||
url: "/SystemOrganize/RoleAuthorize/GetPermissionTree?v=" + new Date().Format("yyyy-MM-dd hh:mm:ss"), // 使用url加载(可与data加载同时存在)
|
||||
request: { roleId: keyValue }
|
||||
});
|
||||
var role;
|
||||
form.on('submit(formStep)', function (data) {
|
||||
role = data.field;
|
||||
if (!role["F_EnabledMark"]) role["F_EnabledMark"] = false;
|
||||
step.next('#stepForm');
|
||||
return false;
|
||||
});
|
||||
var moduleids = [];
|
||||
form.on('submit(formStep2)', function (data) {
|
||||
var params = dtree.getCheckbarNodesParam("demoTree1");
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
moduleids.push(params[i].nodeId);
|
||||
}
|
||||
// 初始化树
|
||||
var DemoTree2 = dtree.render({
|
||||
elem: "#demoTree2",
|
||||
width: '200px',
|
||||
method: "POST",
|
||||
async: false,
|
||||
checkbar: true,
|
||||
line: true, // 显示树线
|
||||
initLevel: 0,
|
||||
icon: "-1", // 隐藏二级图标
|
||||
checkbarType: "p-casc",
|
||||
scroll: "#toolbarDiv2", // 绑定div元素
|
||||
url: "/SystemOrganize/RoleAuthorize/GetPermissionFieldsTree?v=" + new Date().Format("yyyy-MM-dd hh:mm:ss"), // 使用url加载(可与data加载同时存在)
|
||||
request: { roleId: keyValue, moduleids: String(moduleids) }
|
||||
});
|
||||
step.next('#stepForm');
|
||||
return false;
|
||||
});
|
||||
$('.pre').click(function () {
|
||||
step.pre('#stepForm');
|
||||
});
|
||||
})
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-carousel" id="stepForm" lay-filter="stepForm">
|
||||
<div carousel-item>
|
||||
<div>
|
||||
<form class="layui-form layuimini-form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">项目名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_ProjectName" name="F_ProjectName" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">公司名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_CompanyName" name="F_CompanyName" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">联系人</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_PrincipalMan" name="F_PrincipalMan" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">联系方式</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_MobilePhone" name="F_MobilePhone" autocomplete="off" lay-verify="required|phone" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required" style="margin-top: 50px;">Logo图标</label>
|
||||
<div class="layui-input-block" style="padding-right: 0px;">
|
||||
<input class="layui-hide" hidden type="text" id="F_Logo" name="F_Logo">
|
||||
<div class="layui-upload-list">
|
||||
<img class="layui-upload-img" id="demo1">
|
||||
<p id="demoText"></p>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="test1" style="position: absolute;top: 0;right: 6px;cursor: pointer;margin-top: 50px;">选择</button>
|
||||
<button type="button" class="layui-hide" id="hideupload1">上传</button>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">Logo编号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_LogoCode" name="F_LogoCode" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">系统账户</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_AdminAccount" name="F_AdminAccount" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">系统密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" id="F_AdminPassword" name="F_AdminPassword" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">数据库类型</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_DBProvider" name="F_DBProvider" lay-verify="required">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">连接字符串</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_DbString" name="F_DbString" maxlength="255" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">域名</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_HostUrl" name="F_HostUrl" class="layui-input" autocomplete="off" maxlength="50" lay-verify="required" placeholder="请输入域名">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">数据库序号</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_DbNumber" name="F_DbNumber" class="layui-input" autocomplete="off" maxlength="50" lay-verify="required" placeholder="请输入数据库序号">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">有效</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="F_EnabledMark" id="F_EnabledMark" checked="" value="true" title="有效标识">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">到期时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_EndTime" name="F_EndTime" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group-bottom text-right">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formStep">
|
||||
 下一步 
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<form class="layui-form layuimini-form">
|
||||
<div class="layui-form-item ">
|
||||
<div style="height: 350px;overflow: auto;" id="toolbarDiv1">
|
||||
<ul id="demoTree1" class="dtree" data-id="0"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group-bottom text-right">
|
||||
<div class="layui-input-block">
|
||||
<button type="button" class="layui-btn layui-btn-primary pre">上一步</button>
|
||||
<button class="layui-btn" lay-submit lay-filter="formStep2">
|
||||
 下一步 
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<form class="layui-form layuimini-form">
|
||||
<div class="layui-form-item ">
|
||||
<div style="height: 350px;overflow: auto;" id="toolbarDiv2">
|
||||
<ul id="demoTree2" class="dtree" data-id="0"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group-bottom text-right">
|
||||
<div class="layui-input-block">
|
||||
<button type="button" class="layui-btn layui-btn-primary pre">上一步</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
361
WaterCloud.Web/Areas/SystemOrganize/Views/SystemSet/Form.cshtml
Normal file
361
WaterCloud.Web/Areas/SystemOrganize/Views/SystemSet/Form.cshtml
Normal file
@@ -0,0 +1,361 @@
|
||||
@{
|
||||
ViewBag.Title = "Form";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<link href="~/css/stepcss.css" rel="stylesheet" />
|
||||
<script>
|
||||
layui.use(['form', 'step', 'upload', 'laydate', 'common', 'dtree', 'optimizeSelectOption'], function () {
|
||||
var $ = layui.$,
|
||||
form = layui.form,
|
||||
dtree = layui.dtree,
|
||||
common = layui.common,
|
||||
upload = layui.upload,
|
||||
laydate = layui.laydate,
|
||||
step = layui.step;
|
||||
var keyValue = $.request("keyValue");
|
||||
//权限字段
|
||||
common.authorizeFields('stepForm');
|
||||
//类型为时间时
|
||||
laydate.render({
|
||||
elem: '#F_EndTime'
|
||||
, btns: ['clear', 'now']
|
||||
, trigger: 'click',
|
||||
format: 'yyyy-MM-dd',
|
||||
});
|
||||
//普通图片上传
|
||||
var uploadInst = upload.render({
|
||||
elem: '#test1'
|
||||
, url: '/FileManage/Uploadfile/Upload' //改成您自己的上传接口
|
||||
, size: 1024
|
||||
, accept: 'file'
|
||||
, data: { filetype: 1, fileby: '公司logo' }
|
||||
, auto: false//不自动提交
|
||||
, bindAction: "#hideupload1"//绑定真正提交的按钮
|
||||
, choose: function (obj) {
|
||||
//预读本地文件示例,不支持ie8
|
||||
obj.preview(function (index, file, result) {
|
||||
$('#demo1').attr('src', result); //图片链接(base64)
|
||||
});
|
||||
isUpload = true;//判断是否已上传,用于表单提交中控制跳转
|
||||
}
|
||||
, done: function (res) {
|
||||
//如果上传失败
|
||||
if (res.code > 0) {
|
||||
//失败状态,并实现重传
|
||||
var demoText = $('#demoText');
|
||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
||||
demoText.find('.demo-reload').on('click', function () {
|
||||
uploadInst.upload();
|
||||
});
|
||||
common.modalMsg(res.msg, "warning");
|
||||
return false;
|
||||
}
|
||||
postData.F_Logo = res.data[0].src;
|
||||
//上传成功
|
||||
common.submitForm({
|
||||
url: "/SystemOrganize/SystemSet/SubmitForm?keyValue=" + keyValue,
|
||||
param: postData,
|
||||
success: function () {
|
||||
common.parentreload('data-search-btn');
|
||||
}
|
||||
})
|
||||
}
|
||||
, error: function () {
|
||||
//演示失败状态,并实现重传
|
||||
var demoText = $('#demoText');
|
||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
||||
demoText.find('.demo-reload').on('click', function () {
|
||||
uploadInst.upload();
|
||||
});
|
||||
}
|
||||
});
|
||||
step.render({
|
||||
elem: '#stepForm',
|
||||
filter: 'stepForm',
|
||||
width: '90%', //设置容器宽度
|
||||
stepWidth: '300px',
|
||||
height: '500px',
|
||||
stepItems: [{
|
||||
title: '填写租户信息'
|
||||
}, {
|
||||
title: '设置功能权限'
|
||||
}, {
|
||||
title: '设置字段权限'
|
||||
}]
|
||||
});
|
||||
$(function () {
|
||||
$("#F_DBProvider").bindSelect({
|
||||
url: "/SystemOrganize/SystemSet/GetDbTypeJson",
|
||||
id:""
|
||||
});
|
||||
if (!!keyValue) {
|
||||
common.ajax({
|
||||
url: "/SystemOrganize/SystemSet/GetFormJson",
|
||||
dataType: "json",
|
||||
data: { keyValue: keyValue },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('stepForm', data);
|
||||
$('#F_EndTime').val(new Date(data.F_EndTime).Format("yyyy-MM-dd"));
|
||||
$('#demo1').attr('src', data.F_Logo); //图片链接
|
||||
}
|
||||
});
|
||||
}
|
||||
form.render();
|
||||
});
|
||||
wcLoading.close();
|
||||
//select验证
|
||||
form.verify({
|
||||
required: function (value, item) {
|
||||
var msg = "必填项不能为空";
|
||||
value = $.trim(value);
|
||||
var isEmpty = !value || value.length < 1;
|
||||
// 当前验证元素是select且为空时,将页面定位至layui渲染的select处,或自定义想定位的位置
|
||||
if (item.tagName == 'SELECT' && isEmpty) {
|
||||
$("html").animate({
|
||||
scrollTop: $(item).siblings(".layui-form-select").offset().top - 74
|
||||
}, 50);
|
||||
}
|
||||
if (isEmpty) {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
});
|
||||
// 初始化树
|
||||
var DemoTree1 = dtree.render({
|
||||
elem: "#demoTree1",
|
||||
width: '200px',
|
||||
method: "GET",
|
||||
async: false,
|
||||
checkbar: true,
|
||||
line: true, // 显示树线
|
||||
initLevel: 0,
|
||||
icon: "-1", // 隐藏二级图标
|
||||
checkbarType: "p-casc",
|
||||
scroll: "#toolbarDiv1", // 绑定div元素
|
||||
url: "/SystemOrganize/RoleAuthorize/GetPermissionTree?v=" + new Date().Format("yyyy-MM-dd hh:mm:ss"), // 使用url加载(可与data加载同时存在)
|
||||
request: { roleId: keyValue }
|
||||
});
|
||||
var isUpload = false;
|
||||
var role;
|
||||
form.on('submit(formStep)', function (data) {
|
||||
role = data.field;
|
||||
if (!role["F_EnabledMark"]) role["F_EnabledMark"] = false;
|
||||
step.next('#stepForm');
|
||||
return false;
|
||||
});
|
||||
var moduleids = [];
|
||||
form.on('submit(formStep2)', function (data) {
|
||||
moduleids = [];
|
||||
var params = dtree.getCheckbarNodesParam("demoTree1");
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
moduleids.push(params[i].nodeId);
|
||||
}
|
||||
// 初始化树
|
||||
var DemoTree2 = dtree.render({
|
||||
elem: "#demoTree2",
|
||||
width: '200px',
|
||||
method: "POST",
|
||||
async: false,
|
||||
checkbar: true,
|
||||
line: true, // 显示树线
|
||||
initLevel: 0,
|
||||
icon: "-1", // 隐藏二级图标
|
||||
checkbarType: "p-casc",
|
||||
scroll: "#toolbarDiv2", // 绑定div元素
|
||||
url: "/SystemOrganize/RoleAuthorize/GetPermissionFieldsTree?v=" + new Date().Format("yyyy-MM-dd hh:mm:ss"), // 使用url加载(可与data加载同时存在)
|
||||
request: { roleId: keyValue, moduleids: String(moduleids) }
|
||||
});
|
||||
step.next('#stepForm');
|
||||
return false;
|
||||
});
|
||||
var postData
|
||||
form.on('submit(formStep3)', function (data) {
|
||||
postData = role;
|
||||
var params = dtree.getCheckbarNodesParam("demoTree2");
|
||||
var note = [];
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
note.push(params[i].nodeId);
|
||||
}
|
||||
postData["permissionbuttonIds"] = String(moduleids);
|
||||
postData["permissionfieldsIds"] = String(note);
|
||||
if (isUpload) {
|
||||
$("#hideupload1").trigger('click');
|
||||
}
|
||||
else {
|
||||
common.submitForm({
|
||||
url: "/SystemOrganize/SystemSet/SubmitForm?keyValue=" + keyValue,
|
||||
param: postData,
|
||||
success: function () {
|
||||
common.parentreload('data-search-btn');
|
||||
}
|
||||
})
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.pre').click(function () {
|
||||
step.pre('#stepForm');
|
||||
});
|
||||
})
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-carousel" id="stepForm" lay-filter="stepForm">
|
||||
<div carousel-item>
|
||||
<div>
|
||||
<form class="layui-form layuimini-form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">项目名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_ProjectName" name="F_ProjectName" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">公司名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_CompanyName" name="F_CompanyName" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">联系人</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_PrincipalMan" name="F_PrincipalMan" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">联系方式</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_MobilePhone" name="F_MobilePhone" autocomplete="off" lay-verify="required|phone" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required" style="margin-top: 50px;">Logo图标</label>
|
||||
<div class="layui-input-block" style="padding-right: 0px;">
|
||||
<input class="layui-hide" hidden type="text" id="F_Logo" name="F_Logo">
|
||||
<div class="layui-upload-list">
|
||||
<img class="layui-upload-img" id="demo1">
|
||||
<p id="demoText"></p>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="test1" style="position: absolute;top: 0;right: 6px;cursor: pointer;margin-top: 50px;">选择</button>
|
||||
<button type="button" class="layui-hide" id="hideupload1">上传</button>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">Logo编号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_LogoCode" name="F_LogoCode" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">系统账户</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_AdminAccount" name="F_AdminAccount" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">系统密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" id="F_AdminPassword" name="F_AdminPassword" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">数据库类型</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_DBProvider" name="F_DBProvider" lay-verify="required">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">连接字符串</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_DbString" name="F_DbString" maxlength="255" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">域名</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_HostUrl" name="F_HostUrl" class="layui-input" autocomplete="off" maxlength="50" lay-verify="required" placeholder="请输入域名">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">数据库序号</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_DbNumber" name="F_DbNumber" class="layui-input" autocomplete="off" maxlength="50" lay-verify="required" placeholder="请输入数据库序号">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">有效</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="F_EnabledMark" id="F_EnabledMark" checked="" value="true" title="有效标识">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">到期时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_EndTime" name="F_EndTime" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group-bottom text-right">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formStep">
|
||||
 下一步 
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<form class="layui-form layuimini-form">
|
||||
<div class="layui-form-item ">
|
||||
<div style="height: 350px;overflow: auto;" id="toolbarDiv1">
|
||||
<ul id="demoTree1" class="dtree" data-id="0"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group-bottom text-right">
|
||||
<div class="layui-input-block">
|
||||
<button type="button" class="layui-btn layui-btn-primary pre">上一步</button>
|
||||
<button class="layui-btn" lay-submit lay-filter="formStep2">
|
||||
 下一步 
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<form class="layui-form layuimini-form">
|
||||
<div class="layui-form-item ">
|
||||
<div style="height: 350px;overflow: auto;" id="toolbarDiv2">
|
||||
<ul id="demoTree2" class="dtree" data-id="0"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group-bottom text-right">
|
||||
<div class="layui-input-block">
|
||||
<button type="button" class="layui-btn layui-btn-primary pre">上一步</button>
|
||||
<button class="layui-btn site-demo-active" lay-submit lay-filter="formStep3">
|
||||
确认保存
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
185
WaterCloud.Web/Areas/SystemOrganize/Views/SystemSet/Index.cshtml
Normal file
185
WaterCloud.Web/Areas/SystemOrganize/Views/SystemSet/Index.cshtml
Normal file
@@ -0,0 +1,185 @@
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<fieldset class="table-search-fieldset layui-hide" id="searchField">
|
||||
<div>
|
||||
<form class="layui-form layui-form-pane">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键字:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="txt_keyword" name="txt_keyword" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container" id="toolbar">
|
||||
<button id="NF-add" authorize="yes" class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"></i>新增</button>
|
||||
<button id="NF-edit" authorize="yes" class="layui-btn layui-btn-sm layui-btn-warm" lay-event="edit"><i class="layui-icon"></i>修改</button>
|
||||
<button id="NF-details" authorize="yes" class="layui-btn layui-btn-sm layui-btn-normal" lay-event="details"> <i class="layui-icon"></i>查看</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="currentTableBar">
|
||||
<a id="NF-edit" authorize class="layui-btn layui-btn-xs layui-btn-warm" lay-event="edit">修改</a>
|
||||
<a id="NF-details" authorize class="layui-btn layui-btn-xs layui-btn-normal" lay-event="details">查看</a>
|
||||
</script>
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'table', 'common','commonTable', 'layer', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
commonTable = layui.commonTable,
|
||||
table = layui.table,
|
||||
common = layui.common;
|
||||
wcLoading.close();
|
||||
//权限控制(js是值传递)
|
||||
currentTableBar.innerHTML = common.authorizeButtonNew(currentTableBar.innerHTML);
|
||||
toolbarDemo.innerHTML = common.authorizeButtonNew(toolbarDemo.innerHTML);
|
||||
commonTable.rendertable({
|
||||
elem: '#currentTableId',
|
||||
id: 'currentTableId',
|
||||
url: '/SystemOrganize/SystemSet/GetGridJson',
|
||||
cols: [[
|
||||
{ type: "radio", width: 50, fixed: 'left' },
|
||||
{ field: 'F_ProjectName', title: '项目名称', width: 120, sort: true },
|
||||
{ field: 'F_CompanyName', title: '公司名称', width: 120, sort: true },
|
||||
{ field: 'F_PrincipalMan', title: '联系人', width: 120, sort: true },
|
||||
{ field: 'F_MobilePhone', title: '联系方式', width: 120, sort: true },
|
||||
{ field: 'F_Logo', title: 'Logo图标', width: 120, sort: true },
|
||||
{ field: 'F_LogoCode', title: 'Logo编号', width: 120, sort: true },
|
||||
{ field: 'F_AdminAccount', title: '系统账户', width: 120, sort: true },
|
||||
{ field: 'F_DbString', title: '连接字符串', width: 120, sort: true },
|
||||
{ field: 'F_DBProvider', title: '数据库类型', width: 120, sort: true },
|
||||
{ field: 'F_DbNumber', title: '数据库序号', width: 120, sort: true },
|
||||
{ field: 'F_HostUrl', title: '域名', width: 120, sort: true },
|
||||
{
|
||||
field: 'F_CreatorTime', title: '创建时间', minWidth: 120, sort: true,
|
||||
templet: function (d) {
|
||||
if (d.F_CreatorTime) {
|
||||
var time = new Date(d.F_CreatorTime);
|
||||
return time.Format("yyyy-MM-dd");
|
||||
}
|
||||
return '';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'F_EndTime', title: '到期时间', width: 120, sort: true, templet: function (d) {
|
||||
if (d.F_EndTime) {
|
||||
var time = new Date(d.F_EndTime);
|
||||
return time.Format("yyyy-MM-dd");
|
||||
}
|
||||
return '';
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'F_EnabledMark', title: '状态', width: 80, sort: true,
|
||||
templet: function (d) {
|
||||
if (d.F_EnabledMark == true) {
|
||||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>有效</span>";
|
||||
} else {
|
||||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>无效</span>";
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'F_Description', title: '备注', minWidth: 120, sort: true },
|
||||
{ title: '操作', width: 120, toolbar: '#currentTableBar', align: "center", fixed: 'right' }
|
||||
]]
|
||||
});
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
//执行搜索重载
|
||||
commonTable.reloadtable({
|
||||
elem: 'currentTableId',
|
||||
curr: 1,
|
||||
where: { keyword: data.field.txt_keyword }
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//行点击事件监听,控制按钮显示
|
||||
var oneList = ["NF-edit", "NF-details", "NF-delete"];//选择1条显示
|
||||
commonTable.tableRowClick("radio", "currentTableFilter", "currentTableId", oneList);
|
||||
//toolbar监听事件
|
||||
table.on('toolbar(currentTableFilter)', function (obj) {
|
||||
var data = table.checkStatus('currentTableId').data;
|
||||
var id = data.length > 0 ? data[0].F_Id : null;
|
||||
if (obj.event === 'add') { // 监听添加操作
|
||||
common.modalOpen({
|
||||
title: "添加界面",
|
||||
url: "/SystemOrganize/SystemSet/Form",
|
||||
width: "780px",
|
||||
height: "650px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "编辑界面",
|
||||
url: "/SystemOrganize/SystemSet/Form?keyValue=" + id,
|
||||
width: "780px",
|
||||
height: "650px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'details') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "查看界面",
|
||||
url: "/SystemOrganize/SystemSet/Details?keyValue=" + id,
|
||||
width: "780px",
|
||||
height: "650px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'TABLE_SEARCH') {
|
||||
var _that = $("#searchField");
|
||||
if (_that.hasClass("layui-hide")) {
|
||||
_that.removeClass('layui-hide');
|
||||
} else {
|
||||
_that.addClass('layui-hide');
|
||||
}
|
||||
table.resize();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//toolrow监听事件
|
||||
table.on('tool(currentTableFilter)', function (obj) {
|
||||
var id = obj.data.F_Id;
|
||||
if (obj.event === 'edit') {
|
||||
common.modalOpen({
|
||||
title: "编辑界面",
|
||||
url: "/SystemOrganize/SystemSet/Form?keyValue=" + id,
|
||||
width: "780px",
|
||||
height: "650px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'details') {
|
||||
common.modalOpen({
|
||||
title: "查看界面",
|
||||
url: "/SystemOrganize/SystemSet/Details?keyValue=" + id,
|
||||
width: "780px",
|
||||
height: "650px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,202 @@
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'upload', 'form', 'laydate', 'common', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common,
|
||||
upload = layui.upload,
|
||||
laydate = layui.laydate;
|
||||
var keyValue = $.request("keyValue");
|
||||
//权限字段
|
||||
common.authorizeFields('adminform');
|
||||
var isUpload = false;
|
||||
var postData = {};
|
||||
//此处需修改
|
||||
//类型为时间时
|
||||
laydate.render({
|
||||
elem: '#F_EndTime'
|
||||
, btns: ['clear', 'now']
|
||||
, trigger: 'click',
|
||||
format: 'yyyy-MM-dd',
|
||||
});
|
||||
//普通图片上传
|
||||
var uploadInst = upload.render({
|
||||
elem: '#test1'
|
||||
, url: '/FileManage/Uploadfile/Upload' //改成您自己的上传接口
|
||||
, size: 1024
|
||||
, accept: 'file'
|
||||
,data: {filetype:1,fileby:'公司logo'}
|
||||
,auto: false//不自动提交
|
||||
,bindAction: "#hideupload1"//绑定真正提交的按钮
|
||||
, choose: function (obj) {
|
||||
//预读本地文件示例,不支持ie8
|
||||
obj.preview(function (index, file, result) {
|
||||
$('#demo1').attr('src', result); //图片链接(base64)
|
||||
});
|
||||
isUpload = true;//判断是否已上传,用于表单提交中控制跳转
|
||||
}
|
||||
, done: function (res) {
|
||||
//如果上传失败
|
||||
if (res.code > 0) {
|
||||
//失败状态,并实现重传
|
||||
var demoText = $('#demoText');
|
||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
||||
demoText.find('.demo-reload').on('click', function () {
|
||||
uploadInst.upload();
|
||||
});
|
||||
common.modalMsg(res.msg, "warning");
|
||||
return false;
|
||||
}
|
||||
postData.F_Logo = res.data[0].src;
|
||||
//上传成功
|
||||
common.submitForm({
|
||||
url: '/SystemOrganize/SystemSet/SetSubmitForm',
|
||||
param: postData,
|
||||
close: false,
|
||||
success: function () {
|
||||
//common.parentreload('data-search-btn');
|
||||
}
|
||||
})
|
||||
}
|
||||
, error: function () {
|
||||
//演示失败状态,并实现重传
|
||||
var demoText = $('#demoText');
|
||||
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
|
||||
demoText.find('.demo-reload').on('click', function () {
|
||||
uploadInst.upload();
|
||||
});
|
||||
}
|
||||
});
|
||||
$(function () {
|
||||
common.ajax({
|
||||
url: '/SystemOrganize/SystemSet/GetSetFormJson',
|
||||
dataType: 'json',
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('adminform', data);
|
||||
$('#F_EndTime').val(new Date(data.F_EndTime).Format("yyyy-MM-dd"));
|
||||
$('#demo1').attr('src', data.F_Logo); //图片链接
|
||||
}
|
||||
});
|
||||
form.render();
|
||||
});
|
||||
wcLoading.close();
|
||||
//监听提交
|
||||
form.on('submit(saveBtn)', function (data) {
|
||||
postData = data.field;
|
||||
if (isUpload) {
|
||||
$("#hideupload1").trigger('click');
|
||||
}
|
||||
else {
|
||||
common.submitForm({
|
||||
url: '/SystemOrganize/SystemSet/SetSubmitForm',
|
||||
param: postData,
|
||||
close: false,
|
||||
success: function () {
|
||||
}
|
||||
})
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-form layuimini-form" lay-filter="adminform">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">项目名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_ProjectName" name="F_ProjectName" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">公司名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_CompanyName" name="F_CompanyName" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">联系人</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_PrincipalMan" name="F_PrincipalMan" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">联系方式</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_MobilePhone" name="F_MobilePhone" autocomplete="off" lay-verify="required|phone" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required" style="margin-top: 50px;">Logo图标</label>
|
||||
<div class="layui-input-block" style="padding-right: 0px;">
|
||||
<input class="layui-hide" hidden type="text" id="F_Logo" name="F_Logo">
|
||||
<div class="layui-upload-list">
|
||||
<img class="layui-upload-img" id="demo1">
|
||||
<p id="demoText"></p>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="layui-btn" id="test1" style="position: absolute;top: 0;right: 6px;cursor: pointer;margin-top: 50px;">选择</button>
|
||||
<button type="button" class="layui-hide" id="hideupload1">上传</button>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">Logo编号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_LogoCode" name="F_LogoCode" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">系统账户</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_AdminAccount" name="F_AdminAccount" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">系统密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" id="F_AdminPassword" name="F_AdminPassword" maxlength="50" autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">有效</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="F_EnabledMark" disabled id="F_EnabledMark" checked="" value="true" title="有效标识">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">到期时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_EndTime" name="F_EndTime" disabled autocomplete="off" lay-verify="required" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">域名</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_HostUrl" name="F_HostUrl" class="layui-input" autocomplete="off" maxlength="50" lay-verify="required" placeholder="请输入域名">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="text-align:center">
|
||||
<button class="layui-btn site-demo-active" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
161
WaterCloud.Web/Areas/SystemOrganize/Views/User/AddForm.cshtml
Normal file
161
WaterCloud.Web/Areas/SystemOrganize/Views/User/AddForm.cshtml
Normal file
@@ -0,0 +1,161 @@
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'table', 'common', 'commonTable', 'optimizeSelectOption'], function () {
|
||||
var $ = layui.jquery,
|
||||
form = layui.form,
|
||||
table = layui.table,
|
||||
commonTable = layui.commonTable,
|
||||
common = layui.common;
|
||||
//加载数据
|
||||
wcLoading.close();
|
||||
var value = $.request("value");
|
||||
var currentWindow = common.parentWindow();
|
||||
var name = $.request("name");
|
||||
var ids = $.request("ids");
|
||||
commonTable.rendertable({
|
||||
elem: '#currentTableId',
|
||||
id: 'currentTableId',
|
||||
url: '/SystemOrganize/User/GetListJson',
|
||||
search: false,
|
||||
height: 'full-110',
|
||||
where: { ids: (!!ids ? ids : "") },
|
||||
limit: 99999,//每页数据 默认
|
||||
page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
|
||||
layout: ['count'] //自定义分页布局
|
||||
, first: false //不显示首页
|
||||
, last: false //不显示尾页
|
||||
},
|
||||
toolbar: false,//工具栏
|
||||
cols: [[
|
||||
{ type: 'checkbox' },
|
||||
|
||||
{ field: 'F_Account', title: '账户', width: 150, sort: true },
|
||||
{ field: 'F_RealName', title: '姓名', width: 120, sort: true },
|
||||
{
|
||||
field: 'F_CompanyName', title: '公司名称', width: 150, sort: true
|
||||
},
|
||||
{
|
||||
field: 'F_OrganizeName', title: '部门名称', width: 200, sort: true
|
||||
},
|
||||
{
|
||||
field: 'F_ManagerName', title: '直属上级', width: 200, sort: true
|
||||
},
|
||||
{
|
||||
field: 'F_EnabledMark', title: '状态', width: 80, sort: true,
|
||||
templet: function (d) {
|
||||
if (d.F_EnabledMark == true) {
|
||||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>有效</span>";
|
||||
} else {
|
||||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>无效</span>";
|
||||
}
|
||||
}
|
||||
},
|
||||
]]
|
||||
});
|
||||
commonTable.tableRowClick("checkbox", "currentTableFilter", "currentTableId");
|
||||
// 监听双击事件
|
||||
table.on('rowDouble(currentTableFilter)', function (obj) {
|
||||
var pvalue = obj.data.F_Id;
|
||||
var pname = obj.data.F_RealName;
|
||||
var pcode = obj.data.F_Account;
|
||||
common.modalConfirm("注:您确定要选择{账号:" + pcode + ",姓名:" + pname + "}的数据吗?", function (r) {
|
||||
if (r) {
|
||||
if (!!pvalue) {
|
||||
currentWindow.$('#' + value).val(pvalue);
|
||||
}
|
||||
if (!!pname) {
|
||||
currentWindow.$('#' + name).val(pname);
|
||||
}
|
||||
common.modalClose();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
//执行搜索重载
|
||||
commonTable.reloadtable({
|
||||
elem: 'currentTableId',
|
||||
page: false,
|
||||
where: { ids: (!!ids ? ids : ""), keyword: data.field.txt_keyword }
|
||||
});
|
||||
return false;
|
||||
});
|
||||
// 监听清除操作
|
||||
form.on('submit(data-clear-btn)', function (data) {
|
||||
ids = "";
|
||||
//执行搜索重载
|
||||
commonTable.reloadtable({
|
||||
elem: 'currentTableId',
|
||||
page: false,
|
||||
where: { ids: (!!ids ? ids : ""), keyword: data.field.txt_keyword }
|
||||
});
|
||||
return false;
|
||||
});
|
||||
// 监听提交操作
|
||||
form.on('submit(saveBtn)', function (data) {
|
||||
var checkStatus = table.checkStatus("currentTableId").data;
|
||||
var pvalue = [];
|
||||
var pname = [];
|
||||
var pcode = [];
|
||||
for (var i = 0; i < checkStatus.length; i++) {
|
||||
pvalue.push(checkStatus[i].F_Id);
|
||||
pname.push(checkStatus[i].F_RealName);
|
||||
pcode.push(checkStatus[i].F_Account);
|
||||
}
|
||||
if (pvalue.length == 0) {
|
||||
common.modalConfirm("注:您确定要清除选择的数据吗?", function (r) {
|
||||
if (r) {
|
||||
currentWindow.$('#' + name).val(null);
|
||||
currentWindow.$('#' + value).val(null);
|
||||
common.modalClose();
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
common.modalConfirm("注:您确定要选择{账号" + pcode.join(",") + ",姓名:" + pname.join(",") + "}的数据吗?", function (r) {
|
||||
if (r) {
|
||||
if (!!pvalue) {
|
||||
currentWindow.$('#' + value).val(pvalue.join(","));
|
||||
}
|
||||
if (!!pname) {
|
||||
currentWindow.$('#' + name).val(pname.join(","));
|
||||
}
|
||||
common.modalClose();
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<fieldset class="table-search-fieldset">
|
||||
@*<legend>搜索信息</legend>*@
|
||||
<div>
|
||||
<form class="layui-form layui-form-pane" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键字:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="txt_keyword" name="txt_keyword" autocomplete="off" class="layui-input" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||
<button type="submit" class="layui-btn layui-btn-danger" lay-submit lay-filter="data-clear-btn"><i class="layui-icon"></i> 清 除</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<button class="layui-btn" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
</div>
|
||||
</div>
|
||||
196
WaterCloud.Web/Areas/SystemOrganize/Views/User/Details.cshtml
Normal file
196
WaterCloud.Web/Areas/SystemOrganize/Views/User/Details.cshtml
Normal file
@@ -0,0 +1,196 @@
|
||||
@{
|
||||
ViewBag.Title = "Details";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'laydate', 'common', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common,
|
||||
laydate = layui.laydate;
|
||||
var keyValue = $.request("keyValue");
|
||||
//权限字段
|
||||
common.authorizeFields('adminform');
|
||||
//执行一个laydate实例
|
||||
laydate.render({
|
||||
elem: '#F_Birthday'
|
||||
, btns: ['clear', 'now']
|
||||
, trigger: 'click',
|
||||
format: 'yyyy-MM-dd',
|
||||
});
|
||||
function initControl() {
|
||||
$("#F_CompanyId").bindSelect({
|
||||
url: "/SystemOrganize/SystemSet/GetListJson",
|
||||
id: "F_Id",
|
||||
text: "F_CompanyName"
|
||||
});
|
||||
$("#F_DutyId").bindSelect({
|
||||
url: "/SystemOrganize/Duty/GetListJson",
|
||||
id: "F_Id",
|
||||
text: "F_FullName"
|
||||
});
|
||||
}
|
||||
$(function () {
|
||||
initControl();
|
||||
common.ajax({
|
||||
url: "/SystemOrganize/User/GetFormJson",
|
||||
data: { keyValue: keyValue },
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('adminform', data);
|
||||
common.setReadOnly('adminform');
|
||||
$("#F_UserPassword").val("******").attr('disabled', 'disabled');
|
||||
form.render();
|
||||
}
|
||||
});
|
||||
});
|
||||
wcLoading.close();
|
||||
});
|
||||
</script>
|
||||
<body>
|
||||
<div class="layuimini-container ">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-form layuimini-form" lay-filter="adminform">
|
||||
<div class="layui-form-item ">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">账号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_Account" name="F_Account" lay-verify="required" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" id="F_UserPassword" name="F_UserPassword" lay-verify="required" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">公司</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_CompanyId" name="F_CompanyId" lay-verify="required" lay-search="">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">部门</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_OrganizeName" name="F_OrganizeName" type="text" lay-verify="required" maxlength="50" autocomplete="off" class="layui-input" onclick="search('部门')" />
|
||||
<input id="F_OrganizeId" name="F_OrganizeId" type="text" hidden />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">角色</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_RoleName" name="F_RoleName" type="text" lay-verify="required" maxlength="50" autocomplete="off" class="layui-input" onclick="search('角色')" />
|
||||
<input id="F_RoleId" name="F_RoleId" type="text" hidden />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6">
|
||||
<label class="layui-form-label">职位</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_DutyId" name="F_DutyId" lay-verify="required" lay-search="">
|
||||
<option value="">==请选择==</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">姓名</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_RealName" name="F_RealName" type="text" lay-verify="required" autocomplete="off" class="layui-input" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">性别</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_Gender" name="F_Gender" lay-verify="required">
|
||||
<option value="true">男</option>
|
||||
<option value="false">女</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">手机</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_MobilePhone" name="F_MobilePhone" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">生日</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_Birthday" name="F_Birthday" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">微信</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_WeChat" name="F_WeChat" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">邮箱</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_Email" name="F_Email" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">高管</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_IsSenior" name="F_IsSenior" lay-verify="required">
|
||||
<option value="false">否</option>
|
||||
<option value="true">是</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">直属上级</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_ManagerName" name="F_ManagerName" type="text" lay-verify="required" maxlength="50" autocomplete="off" class="layui-input" onclick="search('部门')" />
|
||||
<input id="F_ManagerId" name="F_ManagerId" type="text" hidden />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">类型</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_IsAdministrator" name="F_IsSenior" lay-verify="required">
|
||||
<option value="false">普通用户</option>
|
||||
<option value="true">系统管理员</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">允许登录</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_EnabledMark" name="F_IsLeaderInDepts" lay-verify="required">
|
||||
<option value="true">是</option>
|
||||
<option value="false">否</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<div class="layui-row layui-hide">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
274
WaterCloud.Web/Areas/SystemOrganize/Views/User/Form.cshtml
Normal file
274
WaterCloud.Web/Areas/SystemOrganize/Views/User/Form.cshtml
Normal file
@@ -0,0 +1,274 @@
|
||||
@{
|
||||
ViewBag.Title = "Form";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'laydate', 'common', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common,
|
||||
laydate = layui.laydate;
|
||||
// 自定义验证规则
|
||||
form.verify({
|
||||
pass: function (value, elem) {
|
||||
var EXP = /^[\S]{6,12}$/;
|
||||
if (value && !EXP.test(value)) {
|
||||
return '密码必须6到12位,且不能出现空格';
|
||||
}
|
||||
}
|
||||
});
|
||||
var keyValue = $.request("keyValue");
|
||||
//权限字段
|
||||
common.authorizeFields('adminform');
|
||||
//执行一个laydate实例
|
||||
laydate.render({
|
||||
elem: '#F_Birthday'
|
||||
, btns: ['clear', 'now']
|
||||
, trigger: 'click',
|
||||
format: 'yyyy-MM-dd',
|
||||
});
|
||||
function initControl() {
|
||||
$("#F_CompanyId").bindSelect({
|
||||
url: "/SystemOrganize/SystemSet/GetListJson",
|
||||
id: "F_Id",
|
||||
text: "F_CompanyName"
|
||||
});
|
||||
$("#F_DutyId").bindSelect({
|
||||
url: "/SystemOrganize/Duty/GetListJson",
|
||||
id: "F_Id",
|
||||
text: "F_FullName"
|
||||
});
|
||||
}
|
||||
$(function () {
|
||||
initControl();
|
||||
if (!!keyValue) {
|
||||
common.ajax({
|
||||
url: "/SystemOrganize/User/GetFormJson",
|
||||
data: { keyValue: keyValue },
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('adminform', data);
|
||||
$("#F_UserPassword").val("******").attr('disabled', 'disabled');
|
||||
}
|
||||
});
|
||||
}
|
||||
form.render();
|
||||
});
|
||||
wcLoading.close();
|
||||
//select验证
|
||||
form.verify({
|
||||
required: function (value, item) {
|
||||
var msg = "必填项不能为空";
|
||||
value = $.trim(value);
|
||||
var isEmpty = !value || value.length < 1;
|
||||
// 当前验证元素是select且为空时,将页面定位至layui渲染的select处,或自定义想定位的位置
|
||||
if (item.tagName == 'SELECT' && isEmpty) {
|
||||
$("html").animate({
|
||||
scrollTop: $(item).siblings(".layui-form-select").offset().top - 74
|
||||
}, 50);
|
||||
}
|
||||
if (isEmpty) {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
});
|
||||
//监听提交
|
||||
form.on('submit(saveBtn)', function (data) {
|
||||
var postData = data.field;
|
||||
common.submitForm({
|
||||
url: "/SystemOrganize/User/SubmitForm?keyValue=" + keyValue,
|
||||
param: postData,
|
||||
success: function () {
|
||||
common.parentreload("data-search-btn");
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
});
|
||||
function search(fileds) {
|
||||
layui.use(['jquery', 'form', 'common'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common;
|
||||
//不同弹窗
|
||||
if (fileds == '角色') {
|
||||
common.modalOpen({
|
||||
title: "选择角色",
|
||||
url: "/SystemOrganize/Role/AddForm?name=" + "F_RoleName" + "&value=" + "F_RoleId" + "&ids=" + $('#F_RoleId').val(),
|
||||
width: "650px",
|
||||
height: "600px",
|
||||
});
|
||||
}
|
||||
else if (fileds == '部门') {
|
||||
common.modalOpen({
|
||||
title: "选择组织",
|
||||
url: "/SystemOrganize/Organize/AddForm?name=" + "F_OrganizeName" + "&value=" + "F_OrganizeId" + "&ids=" + $('#F_OrganizeId').val() + "&managerkey=" + $('#F_ManagerId').val() + "&managername=" + $('#F_ManagerName').val(),
|
||||
width: "650px",
|
||||
height: "600px",
|
||||
});
|
||||
}
|
||||
else if (fileds == '用户') {
|
||||
common.modalOpen({
|
||||
title: "选择用户",
|
||||
url: "/SystemOrganize/User/AddForm?name=" + "F_ManagerName" + "&value=" + "F_ManagerId" + "&ids=" + $('#F_ManagerId').val(),
|
||||
width: "650px",
|
||||
height: "600px",
|
||||
});
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<body>
|
||||
<div class="layuimini-container ">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-form layuimini-form" lay-filter="adminform">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">账号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_Account" name="F_Account" maxlength="50" lay-verify="required" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" id="F_UserPassword" name="F_UserPassword" lay-verify="required|pass" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">公司</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_CompanyId" name="F_CompanyId" lay-verify="required" lay-search="" >
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">部门</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_OrganizeName" name="F_OrganizeName" type="text" lay-verify="required" maxlength="50" autocomplete="off" class="layui-input" onclick="search('部门')" />
|
||||
<input id="F_OrganizeId" name="F_OrganizeId" type="text" hidden />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">角色</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_RoleName" name="F_RoleName" type="text" lay-verify="required" maxlength="50" autocomplete="off" class="layui-input" onclick="search('角色')" />
|
||||
<input id="F_RoleId" name="F_RoleId" type="text" hidden />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">职位</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_DutyId" name="F_DutyId" lay-verify="required" lay-search="">
|
||||
<option value="">==请选择==</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">姓名</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_RealName" name="F_RealName" type="text" lay-verify="required" maxlength="50" autocomplete="off" class="layui-input" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label required">性别</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_Gender" name="F_Gender">
|
||||
<option value="true">男</option>
|
||||
<option value="false">女</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">手机</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_MobilePhone" name="F_MobilePhone" autocomplete="off" lay-verify="phone" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">生日</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_Birthday" name="F_Birthday" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">邮箱</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_Email" name="F_Email" autocomplete="off" lay-verify="email" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">微信</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_WeChat" name="F_WeChat" autocomplete="off" maxlength="50" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">高管</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_IsSenior" name="F_IsSenior">
|
||||
<option value="false">否</option>
|
||||
<option value="true">是</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">直属上级</label>
|
||||
<div class="layui-input-block">
|
||||
<input id="F_ManagerName" name="F_ManagerName" type="text" maxlength="50" autocomplete="off" class="layui-input" onclick="search('用户')" />
|
||||
<input id="F_ManagerId" name="F_ManagerId" type="text" hidden />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">类型</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_IsAdmin" disabled name="F_IsAdmin">
|
||||
<option value="false" selected>普通用户</option>
|
||||
<option value="true">系统管理员</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md6 layui-col-sm6 layui-hide">
|
||||
<label class="layui-form-label">允许登录</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_EnabledMark" name="F_EnabledMark" lay-verify="required">
|
||||
<option value="true">是</option>
|
||||
<option value="false">否</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<div class="layui-row layui-hide">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea placeholder="请输入备注" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<button class="layui-btn site-demo-active" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
303
WaterCloud.Web/Areas/SystemOrganize/Views/User/Index.cshtml
Normal file
303
WaterCloud.Web/Areas/SystemOrganize/Views/User/Index.cshtml
Normal file
@@ -0,0 +1,303 @@
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['form', 'table', 'common', 'optimizeSelectOption', 'commonTable'], function () {
|
||||
var form = layui.form,
|
||||
table = layui.table,
|
||||
commonTable = layui.commonTable,
|
||||
common = layui.common;
|
||||
//加载数据
|
||||
wcLoading.close();
|
||||
//权限控制(js是值传递)
|
||||
currentTableBar.innerHTML = common.authorizeButtonNew(currentTableBar.innerHTML);
|
||||
toolbarDemo.innerHTML = common.authorizeButtonNew(toolbarDemo.innerHTML);
|
||||
commonTable.rendertable({
|
||||
elem: '#currentTableId',
|
||||
id: 'currentTableId',
|
||||
url: '/SystemOrganize/User/GetGridJson',
|
||||
cols: [[
|
||||
{ type: "radio", width: 50, fixed: 'left' },
|
||||
{ field: 'F_Account', title: '账户', width: 150, sort: true, filter: true},
|
||||
{ field: 'F_RealName', title: '姓名', width: 120, sort: true, filter: true },
|
||||
{
|
||||
field: 'F_Gender', title: '性别', width: 80, sort: true, filter: true,
|
||||
templet: function (d) {
|
||||
if (d.F_Gender == true) {
|
||||
return "男";
|
||||
} else {
|
||||
return "女";
|
||||
}
|
||||
}
|
||||
},
|
||||
{ field: 'F_MobilePhone', title: '手机', width: 120, sort: true, filter: true },
|
||||
{
|
||||
field: 'F_CompanyName', title: '公司名称', width: 150, sort: true, filter: true
|
||||
},
|
||||
{
|
||||
field: 'F_OrganizeName', title: '部门名称', width: 200, sort: true
|
||||
},
|
||||
{
|
||||
field: 'F_IsLeaderInDepts', title: '部门主管', width: 120,
|
||||
templet: function (d) {
|
||||
if (d.F_IsLeaderInDepts == true) {
|
||||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>是</span>";
|
||||
} else {
|
||||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>否</span>";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'F_ManagerName', title: '直属上级', width: 120, sort: true, filter: true
|
||||
},
|
||||
{
|
||||
field: 'F_DutyName', title: '岗位名称', width: 120, sort: true, filter: true
|
||||
},
|
||||
{
|
||||
field: 'F_RoleName', title: '角色', width: 120, sort: true
|
||||
},
|
||||
{
|
||||
field: 'F_EnabledMark', title: '状态', width: 80, sort: true, filter: true,
|
||||
templet: function (d) {
|
||||
if (d.F_EnabledMark == true) {
|
||||
return "<span class='layui-btn layui-btn-normal layui-btn-xs'>有效</span>";
|
||||
} else {
|
||||
return "<span class='layui-btn layui-btn-warm layui-btn-xs'>无效</span>";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'F_CreatorTime', title: '创建时间', width: 160, sort: true, filter: { type: 'date[yyyy/MM/dd HH:mm:ss]' }
|
||||
},
|
||||
{ field: 'F_Description', title: '备注', minWidth: 150, sort: true, filter: true },
|
||||
{ title: '操作', width: 250, toolbar: '#currentTableBar', align: "center", fixed: 'right'}
|
||||
]]
|
||||
});
|
||||
// 监听搜索操作
|
||||
form.on('submit(data-search-btn)', function (data) {
|
||||
//执行搜索重载
|
||||
commonTable.reloadtable({
|
||||
elem: 'currentTableId',
|
||||
curr: 1,
|
||||
where: { keyword: data.field.txt_keyword }
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//行点击事件监听,控制按钮显示
|
||||
var oneList = ["NF-edit", "NF-details", "NF-revisepassword", "NF-disabled", "NF-enabled","NF-delete"];//选择1条显示
|
||||
commonTable.tableRowClick("radio", "currentTableFilter", "currentTableId", oneList);
|
||||
/**
|
||||
* toolbar监听事件
|
||||
*/
|
||||
table.on('toolbar(currentTableFilter)', function (obj) {
|
||||
var data = table.checkStatus('currentTableId').data;
|
||||
var id = data.length > 0 ? data[0].F_Id : null;
|
||||
if (obj.event === 'add') { // 监听删除操作
|
||||
common.modalOpen({
|
||||
title: "添加用户",
|
||||
url: "/SystemOrganize/User/Form",
|
||||
width: "780px",
|
||||
height: "550px",
|
||||
//callBack: function (index) {
|
||||
// var iframe = "layui-layer-iframe" + index;
|
||||
// window.frames[iframe].submitForm();
|
||||
//}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'delete') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.deleteForm({
|
||||
url: "/SystemOrganize/User/DeleteForm",
|
||||
param: { keyValue: id },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'disabled') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.submitPost({
|
||||
prompt: "注:您确定要【禁用】该项账户吗?",
|
||||
url: "/SystemOrganize/User/DisabledAccount",
|
||||
param: { keyValue: id },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'enabled') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.submitPost({
|
||||
prompt: "注:您确定要【启用】该项账户吗?",
|
||||
url: "/SystemOrganize/User/EnabledAccount",
|
||||
param: { keyValue: id },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "编辑用户",
|
||||
url: "/SystemOrganize/User/Form?keyValue=" + id,
|
||||
width: "780px",
|
||||
height: "550px",
|
||||
//callBack: function (index) {
|
||||
// var iframe = "layui-layer-iframe" + index;
|
||||
// window.frames[iframe].submitForm();
|
||||
//}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'details') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "查看用户",
|
||||
url: "/SystemOrganize/User/Details?keyValue=" + id,
|
||||
width: "780px",
|
||||
height: "550px",
|
||||
btn: []
|
||||
//callBack: function (index) {
|
||||
// var iframe = "layui-layer-iframe" + index;
|
||||
// window.frames[iframe].submitForm();
|
||||
//}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'revisepassword') {
|
||||
if (id == null) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "重置密码",
|
||||
url: '/SystemOrganize/User/RevisePassword?keyValue=' + id,
|
||||
width: "400px",
|
||||
height: "300px",
|
||||
//callBack: function (index) {
|
||||
// var iframe = "layui-layer-iframe" + index;
|
||||
// window.frames[iframe].submitForm();
|
||||
//}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'TABLE_SEARCH') {
|
||||
var _that = $("#searchField");
|
||||
if (_that.hasClass("layui-hide")) {
|
||||
_that.removeClass('layui-hide');
|
||||
} else {
|
||||
_that.addClass('layui-hide');
|
||||
}
|
||||
table.resize();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//toolrow监听事件
|
||||
table.on('tool(currentTableFilter)', function (obj) {
|
||||
var id = obj.data.F_Id;
|
||||
if (obj.event === 'delete') {
|
||||
common.deleteForm({
|
||||
url: "/SystemOrganize/User/DeleteForm",
|
||||
param: { keyValue: id },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'disabled') {
|
||||
common.submitPost({
|
||||
prompt: "注:您确定要【禁用】该项账户吗?",
|
||||
url: "/SystemOrganize/User/DisabledAccount",
|
||||
param: { keyValue: id },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'enabled') {
|
||||
common.submitPost({
|
||||
prompt: "注:您确定要【启用】该项账户吗?",
|
||||
url: "/SystemOrganize/User/EnabledAccount",
|
||||
param: { keyValue: id },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
common.modalOpen({
|
||||
title: "编辑用户",
|
||||
url: "/SystemOrganize/User/Form?keyValue=" + id,
|
||||
width: "780px",
|
||||
height: "550px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'revisepassword') {
|
||||
common.modalOpen({
|
||||
title: "重置密码",
|
||||
url: '/SystemOrganize/User/RevisePassword?keyValue=' + id,
|
||||
width: "400px",
|
||||
height: "300px",
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<fieldset class="table-search-fieldset layui-hide" id="searchField">
|
||||
@*<legend>搜索信息</legend>*@
|
||||
<div>
|
||||
<form class="layui-form layui-form-pane" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">关键字:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="txt_keyword" name="txt_keyword" autocomplete="off" class="layui-input" placeholder="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container" id="toolbar">
|
||||
<button id="NF-add" authorize="yes" class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"></i>新增</button>
|
||||
<button id="NF-edit" name="NF-edit" authorize="yes" class="layui-btn layui-btn-sm layui-btn-warm layui-hide" lay-event="edit"><i class="layui-icon"></i>修改</button>
|
||||
<button id="NF-delete" name="NF-delete" authorize="yes" class="layui-btn layui-btn-sm layui-btn-danger layui-hide" lay-event="delete"> <i class="layui-icon"></i>删除</button>
|
||||
<button id="NF-details" name="NF-details" authorize="yes" class="layui-btn layui-btn-sm layui-btn-normal layui-hide" lay-event="details"> <i class="layui-icon"></i>查看</button>
|
||||
<button id="NF-revisepassword" name="NF-revisepassword" authorize="yes" class="layui-btn layui-btn-sm layui-btn-warm layui-hide" lay-event="revisepassword"><i class="layui-icon"></i>密码重置</button>
|
||||
<button id="NF-disabled" name="NF-disabled" authorize="yes" class="layui-btn layui-btn-sm layui-btn-danger layui-hide" lay-event="disabled"><i class="fa fa-stop-circle"></i>禁用</button>
|
||||
<button id="NF-enabled" name="NF-enabled" authorize="yes" class="layui-btn layui-btn-sm layui-hide" lay-event="enabled"> <i class="fa fa-play-circle"></i>启用</button>
|
||||
</div>
|
||||
</script>
|
||||
<script type="text/html" id="currentTableBar">
|
||||
<a id="NF-edit" authorize class="layui-btn layui-btn-xs layui-btn-warm" lay-event="edit">修改</a>
|
||||
<a id="NF-delete" authorize class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delete">删除</a>
|
||||
<a id="NF-revisepassword" authorize class="layui-btn layui-btn-xs layui-btn-warm" lay-event="revisepassword">重置</a>
|
||||
<a id="NF-disabled" authorize class="layui-btn layui-btn-xs layui-btn-danger" lay-event="disabled">禁用</a>
|
||||
<a id="NF-enabled" authorize class="layui-btn layui-btn-xs" lay-event="enabled">启用</a>
|
||||
</script>
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,76 @@
|
||||
@{
|
||||
ViewBag.Title = "RevisePassword";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'laydate', 'common', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
common = layui.common,
|
||||
laydate = layui.laydate;
|
||||
// 自定义验证规则
|
||||
form.verify({
|
||||
pass: function (value, elem) {
|
||||
var EXP = /^[\S]{6,12}$/;
|
||||
if (value && !EXP.test(value)) {
|
||||
return '密码必须6到12位,且不能出现空格';
|
||||
}
|
||||
}
|
||||
});
|
||||
var keyValue = $.request("keyValue");
|
||||
//权限字段
|
||||
common.authorizeFields('useradmin');
|
||||
$(function () {
|
||||
common.ajax({
|
||||
url: "/SystemOrganize/User/GetFormJson",
|
||||
data: { keyValue: keyValue },
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function (data) {
|
||||
form.val("useradmin", data);
|
||||
}
|
||||
});
|
||||
});
|
||||
wcLoading.close();
|
||||
//监听提交
|
||||
form.on('submit(saveBtn)', function (data) {
|
||||
var postData = data.field;
|
||||
postData["keyValue"] = keyValue;
|
||||
common.submitForm({
|
||||
loading: "正在修改数据...",
|
||||
url: "/SystemOrganize/User/SubmitRevisePassword",
|
||||
param: postData,
|
||||
success: function () {
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-form layuimini-form" lay-filter="useradmin">
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">账户</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_Account" name="F_Account" lay-verify="required" readonly class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">姓名</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="F_RealName" name="F_RealName" lay-verify="required" readonly class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label">密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" id="F_UserPassword" name="F_UserPassword" lay-verify="required|pass" class="layui-input ">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<button class="layui-btn site-demo-active" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,59 @@
|
||||
@{
|
||||
ViewBag.Title = "RevisePassword";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'common', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
common=layui.common,
|
||||
$ = layui.$;
|
||||
//自定义验证规则
|
||||
form.verify({
|
||||
equal: function (value, item) { //value:表单的值、item:表单的DOM对象
|
||||
if (value != layui.$('input[name="F_UserPassword"]').val()) {
|
||||
return '密码不相同请重新输入!'
|
||||
}
|
||||
},
|
||||
pass: function (value, elem) {
|
||||
var EXP = /^[\S]{6,12}$/;
|
||||
if (value && !EXP.test(value)) {
|
||||
return '密码必须6到12位,且不能出现空格';
|
||||
}
|
||||
}
|
||||
});
|
||||
wcLoading.close();
|
||||
//监听提交
|
||||
form.on('submit(saveBtn)', function (data) {
|
||||
var postData = data.field;
|
||||
common.submitForm({
|
||||
loading: "正在修改数据...",
|
||||
url: "/SystemOrganize/User/SubmitReviseSelfPassword",
|
||||
param: postData,
|
||||
success: function () {
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-form layuimini-form" lay-filter="useradmin">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">新密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" id="F_UserPassword" name="F_UserPassword" lay-verify="required|pass" class="layui-input ">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">确认密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" id="F_UserPasswordNew" name="F_UserPasswordNew" lay-verify="required|pass|equal" class="layui-input ">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<button class="layui-btn site-demo-active" lay-submit id="submit" lay-filter="saveBtn">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user