处理form列表

This commit is contained in:
yubaolee 2018-02-28 17:34:27 +08:00
parent 0260031ca1
commit 1763bd7bad
15 changed files with 1120 additions and 1095 deletions

View File

@ -1,12 +1,11 @@
using System.Linq;
using OpenAuth.App.Request;
using OpenAuth.App.Request;
using OpenAuth.App.Response;
using OpenAuth.Repository.Domain;
namespace OpenAuth.App
{
public class FormApp : BaseApp<WFFrmMain>
public class FormApp : BaseApp<Form>
{
public RevelanceManagerApp ReleManagerApp { get; set; }
@ -15,30 +14,24 @@ namespace OpenAuth.App
/// </summary>
public TableData Load(QueryFormListReq request)
{
var forms = UnitWork.Find<WFFrmMain>(null)
.OrderBy(u => u.FrmCode)
.Skip((request.page - 1) * request.limit)
.Take(request.limit);
return new TableData
{
count = Repository.GetCount(null),
data = forms,
data = Repository.Find(request.page, request.limit,"CreateDate desc")
};
}
public void Add(WFFrmMain obj)
public void Add(Form obj)
{
Repository.Add(obj);
}
public void Update(WFFrmMain obj)
public void Update(Form obj)
{
UnitWork.Update<WFFrmMain>(u => u.Id == obj.Id, u => new WFFrmMain
UnitWork.Update<Form>(u => u.Id == obj.Id, u => new Form
{
FrmCode = obj.FrmCode,
FrmContent = obj.FrmContent
//todo:要修改的
});
}

View File

@ -122,7 +122,6 @@
<Compile Include="RevelanceManagerApp.cs" />
<Compile Include="SystemAuthService.cs" />
<Compile Include="RoleApp.cs" />
<Compile Include="WFFormService.cs" />
<Compile Include="WFProcessInstanceService.cs" />
<Compile Include="WFSchemeService.cs" />
<Compile Include="ModuleManagerApp.cs" />

View File

@ -1,59 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using OpenAuth.App.Response;
using OpenAuth.Repository.Domain;
using OpenAuth.Repository.Interface;
namespace OpenAuth.App
{
/// <summary>
/// 表单服务
/// <para>李玉宝新增于2017-01-13 17:48:00</para>
/// </summary>
public class WFFormService
{
public IUnitWork _unitWork { get; set; }
public List<WFFrmMain> GetAllList()
{
return _unitWork.Find<WFFrmMain>(null).ToList();
}
public WFFrmMain GetForm(string keyValue)
{
return _unitWork.FindSingle<WFFrmMain>(u => u.Id == keyValue);
}
public void RemoveForm(string[] keyValue)
{
_unitWork.Delete<WFFrmMain>(u =>keyValue.Contains(u.Id));
}
public TableData Load(int pageCurrent, int pageSize)
{
var result = new TableData
{
count = _unitWork.Find<WFFrmMain>(null).Count(),
data = _unitWork.Find<WFFrmMain>(pageCurrent, pageSize, "ModifyDate descending", null).ToList()
};
return result;
}
public void SaveForm(string keyValue, WFFrmMain entity)
{
if (string.IsNullOrEmpty(keyValue))
{
_unitWork.Add(entity);
}
else
{
entity.Id = keyValue;
_unitWork.Update(u =>u.Id, entity);
}
_unitWork.Save();
}
}
}

View File

@ -1,129 +0,0 @@
using System;
using System.Linq;
using System.Web.Mvc;
using Infrastructure;
using OpenAuth.App;
using OpenAuth.App.SSO;
using OpenAuth.Mvc.Controllers;
using OpenAuth.Repository.Domain;
namespace OpenAuth.Mvc.Areas.FlowManage.Controllers
{
public class FormDesignController : BaseController
{
public WFFormService WfFrmMainBll { get; set; }
#region
/// <summary>
/// 管理
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult Index()
{
return View();
}
/// <summary>
/// 预览表单
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult FormPreview()
{
return View();
}
/// <summary>
/// 创建表单
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult FrmBuider()
{
return View();
}
#endregion
#region
public string Load(int pageCurrent = 1, int pageSize = 30)
{
return JsonHelper.Instance.Serialize(WfFrmMainBll.Load(pageCurrent, pageSize));
}
/// <summary>
/// 设置表单
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
[HttpGet]
public ActionResult GetFormJson(string keyValue)
{
var data = WfFrmMainBll.GetForm(keyValue);
return Content(data.ToJson());
}
/// <summary>
/// 获取表单数据all
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult GetAllListJson()
{
var data = WfFrmMainBll.GetAllList();
var result = data.Select(u => new
{
id = u.Id.ToString(),
text = u.FrmName,
value = u.Id.ToString(),
isexpand = true,
complete = true,
hasChildren = false,
parentId = "0",
Attribute = "Sort",
AttributeValue = "Frm"
});
return Content(result.ToJson());
}
#endregion
#region
/// <summary>
/// 删除表单模板
/// </summary>
/// <param name="ids">主键值</param>
/// <returns></returns>
[HttpPost]
public string RemoveForm(string[] ids)
{
WfFrmMainBll.RemoveForm(ids);
return Result.ToJson();
}
///// <summary>
///// 保存用户表单(新增、修改)
///// </summary>
///// <param name="keyValue">主键值</param>
///// <param name="userEntity">用户实体</param>
///// <returns></returns>
[HttpPost]
public string SaveForm(string keyValue, WFFrmMain userEntity)
{
try
{
var user = AuthUtil.GetCurrentUser();
userEntity.ModifyUserId = user.User.Account;
userEntity.ModifyUserName = user.User.Name;
WfFrmMainBll.SaveForm(keyValue, userEntity);
}
catch (Exception e)
{
Result.Code = 500;
Result.Message = e.Message;
}
return Result.ToJson();
}
#endregion
}
}

View File

@ -27,7 +27,8 @@ namespace OpenAuth.Mvc.Controllers
//添加或修改
[System.Web.Mvc.HttpPost]
public string Add(WFFrmMain obj)
[ValidateInput(false)]
public string Add(Form obj)
{
try
{
@ -44,7 +45,7 @@ namespace OpenAuth.Mvc.Controllers
//添加或修改
[System.Web.Mvc.HttpPost]
public string Update(WFFrmMain obj)
public string Update(Form obj)
{
try
{

View File

@ -143,7 +143,6 @@
<Compile Include="App_Start\FilterConfig.cs" />
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="Areas\FlowManage\Controllers\FileController.cs" />
<Compile Include="Areas\FlowManage\Controllers\FormDesignController.cs" />
<Compile Include="Areas\FlowManage\Controllers\FlowDesignController.cs" />
<Compile Include="Areas\FlowManage\FlowManageAreaRegistration.cs" />
<Compile Include="Controllers\BaseController.cs" />
@ -605,6 +604,7 @@
<Content Include="js\ueditor\formdesign\textfield.html.ajax.bak" />
<None Include="Properties\PublishProfiles\default.pubxml" />
<Content Include="userJs\formBuilder.js" />
<Content Include="userJs\forms.js" />
<Content Include="Views\Home\git.cshtml" />
<Content Include="Web.config">
<SubType>Designer</SubType>

View File

@ -3,108 +3,10 @@
<link rel="stylesheet" href="/css/main.css" media="all" />
}
<form method="post" id="saveform" name="saveform" action="">
</form>
<form method="post" id="saveform" name="saveform" action="">
<input type="hidden" name="fields" id="fields" value="0">
<div class="alert">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<strong>提醒:</strong>单选框和复选框,如:<code>{|-</code>选项<code>-|}</code>两边边界是防止误删除控件,程序会把它们替换为空,请不要手动删除!
</div>
<div class="layui-row">
<div class="layui-col-xs2">
<ul class="layui-nav layui-nav-tree layui-inline" style="margin-right: 5px;">
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('text');" >文本框</a></li>
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('textarea');" >多行文本</a></li>
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('select');" >下拉菜单</a></li>
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('radios');" >单选框</a></li>
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('checkboxs');" class="btn btn-link">复选框</a></li>
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('macros');" class="btn btn-link">宏控件</a></li>
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('progressbar');" class="btn btn-link">进度条</a></li>
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('qrcode');" class="btn btn-link">二维码</a></li>
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('listctrl');" class="btn btn-link">列表控件</a></li>
</ul>
</div>
<div class="layui-col-xs10">
<script id="myFormDesign" type="text/plain" style="width:100%;">
<p style="text-align: center;">
<br />
</p>
<p style="text-align: center;">
<span style="font-size: 24px;">示例表</span>
</p>
<table class="table table-bordered">
<tbody>
<tr class="firstRow">
<td valign="top" style="word-break: break-all; border-color: rgb(221, 221, 221);">
文本框
</td>
<td valign="top" style="word-break: break-all; border-color: rgb(221, 221, 221);" width="227">
<input style="text-align: left; width: 150px;" title="文本框" value="雷劈网" name="leipiNewField" orgheight="" orgwidth="150" orgalign="left" orgfontsize="" orghide="0" leipiplugins="text" orgtype="text" />
</td>
<td valign="top" style="word-break: break-all; border-color: rgb(221, 221, 221);" width="85">
下拉菜单
</td>
<td valign="top" style="border-color: rgb(221, 221, 221);" width="312">
{|-<span leipiplugins="select">
<select name="leipiNewField" title="下拉菜单" leipiplugins="select" size="1" orgwidth="150" style="width: 150px;">
<option value="下拉">
下拉
</option>
<option value="菜单">
菜单
</option>
</select>&nbsp;&nbsp;
</span>-|}
</td>
</tr>
<tr>
<td valign="top" style="word-break: break-all; border-color: rgb(221, 221, 221);">
单选
</td>
<td valign="top" style="word-break: break-all; border-color: rgb(221, 221, 221);" width="41">
{|-<span leipiplugins="radios" title="单选" name="leipiNewField"><input value="单选1" type="radio" checked="checked" />单选1&nbsp;<input value="单选2" type="radio" />单选2&nbsp;</span>-|}
</td>
<td valign="top" style="word-break: break-all; border-color: rgb(221, 221, 221);" width="85">
复选
</td>
<td valign="top" style="word-break: break-all; border-color: rgb(221, 221, 221);" width="312">
{|-<span leipiplugins="checkboxs" title="复选"><input name="leipiNewField" value="复选1" type="checkbox" checked="checked" />复选1&nbsp;<input name="leipiNewField" value="复选2" type="checkbox" checked="checked" />复选2&nbsp;<input name="leipiNewField" value="复选3" type="checkbox" />复选3&nbsp;</span>-|}
</td>
</tr>
<tr>
<td valign="top" style="word-break: break-all; border-color: rgb(221, 221, 221);">
宏控件
</td>
<td valign="top" style="border-color: rgb(221, 221, 221);" width="41">
<input name="leipiNewField" type="text" value="{macros}" title="宏控件" leipiplugins="macros" orgtype="sys_date_cn" orghide="0" orgfontsize="12" orgwidth="150" style="font-size: 12px; width: 150px;" />
</td>
<td valign="top" style="word-break: break-all; border-color: rgb(221, 221, 221);" width="85">
二维码
</td>
<td valign="top" style="border-color: rgb(221, 221, 221);" width="312">
<img name="leipiNewField" title="雷劈网" value="http://www.leipi.org" orgtype="url" leipiplugins="qrcode" src="js/ueditor/formdesign/images/qrcode.gif" orgwidth="40" orgheight="40" style="width: 40px; height: 40px;" />
</td>
</tr>
</tbody>
</table>
<p>
<input name="leipiNewField" leipiplugins="listctrl" type="text" value="{列表控件}" readonly="readonly" title="采购商品列表" orgtitle="商品名称`数量`单价`小计`描述`" orgcoltype="text`int`int`int`text`" orgunit="```元``" orgsum="0`0`0`1`0`" orgcolvalue="`````" orgwidth="100%" style="width: 100%;" />
</p>
<p>
<textarea title="多行文本" name="leipiNewField" leipiplugins="textarea" value="" orgrich="0" orgfontsize="12" orgwidth="600" orgheight="80" style="font-size:12px;width:600px;height:80px;"></textarea>
</p>
<p>
<img name="leipiNewField" title="进度条" leipiplugins="progressbar" orgvalue="20" orgsigntype="progress-info" src="js/ueditor/formdesign/images/progressbar.gif" />
</p>
</script>
</div>
</div>
</form>
<button class="layui-btn layui-btn-normal" id="btnSubmit">提交</button>
<script type="text/javascript" charset="utf-8" src="/js/ueditor/ueditor.config.js?2023"></script>
<script type="text/javascript" charset="utf-8" src="/js/ueditor/ueditor.all.js?2023"> </script>

View File

@ -7,33 +7,32 @@
</blockquote>
<div style="display: flex;">
<ul id="tree" class="ztree" style="display: inline-block; width: 180px; padding: 10px; border: 1px solid #ddd; overflow: auto;"></ul>
<table class="layui-table"
lay-data="{height: 'full-80', page:true, id:'mainList'}"
lay-filter="list" lay-size="sm">
lay-filter="list" lay-size="sm">
<thead>
<tr>
<th lay-data="{checkbox:true, fixed: true}"></th>
<th lay-data="{field:'Id', width:150}">表单模板Id</th>
<th lay-data="{field:'FrmCode', width:150}">表单编号</th>
<th lay-data="{field:'FrmName', width:150}">表单名称</th>
<th lay-data="{field:'FrmType', width:150}">表单分类</th>
<th lay-data="{field:'FrmTable', width:150}">数据表</th>
<th lay-data="{field:'FrmTableId', width:150}">关联表的主键</th>
<th lay-data="{field:'isSystemTable', width:150}">是否需要建表0不建表,1建表</th>
<th lay-data="{field:'FrmContent', width:150}">表单内容</th>
<th lay-data="{field:'SortCode', width:150}">排序码</th>
<th lay-data="{field:'DeleteMark', width:150}">删除标记</th>
<th lay-data="{field:'FrmDbId', width:150}">数据库Id</th>
<th lay-data="{field:'EnabledMark', width:150}">有效</th>
<th lay-data="{field:'Description', width:150}">备注</th>
<th lay-data="{field:'CreateDate', width:150}">创建时间</th>
<th lay-data="{field:'CreateUserId', width:150}">创建用户主键</th>
<th lay-data="{field:'CreateUserName', width:150}">创建用户</th>
<th lay-data="{field:'ModifyDate', width:150}">修改时间</th>
<th lay-data="{field:'ModifyUserId', width:150}">修改用户主键</th>
<th lay-data="{field:'ModifyUserName', width:150}">修改用户</th>
<th lay-data="{fixed: 'right', width:160, align:'center', toolbar: '#barList'}"></th>
</tr>
<tr>
<th lay-data="{checkbox:true, fixed: true}"></th>
<th lay-data="{field:'Id', width:150}">表单模板Id</th>
<th lay-data="{field:'Name', width:150}">表单名称</th>
<th lay-data="{field:'Fields', width:150}">字段个数</th>
<th lay-data="{field:'ContentData', width:150}">表单中的字段数据</th>
<th lay-data="{field:'ContentParse', width:150}">表单替换的模板 经过处理</th>
<th lay-data="{field:'Content', width:150}">表单原html模板未经处理的</th>
<th lay-data="{field:'SortCode', width:150}">排序码</th>
<th lay-data="{field:'Delete', width:150}">删除标记</th>
<th lay-data="{field:'FrmDbId', width:150}">数据库Id</th>
<th lay-data="{field:'Enabled', width:150}">有效</th>
<th lay-data="{field:'Description', width:150}">备注</th>
<th lay-data="{field:'CreateDate', width:150}">创建时间</th>
<th lay-data="{field:'CreateUserId', width:150}">创建用户主键</th>
<th lay-data="{field:'CreateUserName', width:150}">创建用户</th>
<th lay-data="{field:'ModifyDate', width:150}">修改时间</th>
<th lay-data="{field:'ModifyUserId', width:150}">修改用户主键</th>
<th lay-data="{field:'ModifyUserName', width:150}">修改用户</th>
<th lay-data="{fixed: 'right', width:160, align:'center', toolbar: '#barList'}"></th>
</tr>
</thead>
</table>
</div>
@ -43,134 +42,96 @@
<!--用户添加/编辑窗口-->
<div id="divEdit" style="display: none">
<form class="layui-form" action="" id="formEdit">
<input type="hidden" name="Id" v-model="Id" />
<div class="layui-form-item">
<label class="layui-form-label">表单编号</label>
<div class="layui-input-block">
<input type="text" name="FrmCode" v-model="FrmCode" required lay-verify="required"
placeholder="表单编号" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">表单名称</label>
<div class="layui-input-block">
<input type="text" name="FrmName" v-model="FrmName" required lay-verify="required"
placeholder="表单名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">表单分类</label>
<div class="layui-input-block">
<input type="text" name="FrmType" v-model="FrmType" required lay-verify="required"
placeholder="表单分类" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">数据表</label>
<div class="layui-input-block">
<input type="text" name="FrmTable" v-model="FrmTable" required lay-verify="required"
placeholder="数据表" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">关联表的主键</label>
<div class="layui-input-block">
<input type="text" name="FrmTableId" v-model="FrmTableId" required lay-verify="required"
placeholder="关联表的主键" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">是否需要建表0不建表,1建表</label>
<div class="layui-input-block">
<input type="radio" name="isSystemTable" value="1" title="value1" checked>
<input type="radio" name="isSystemTable" value="0" title="value2">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">表单内容</label>
<div class="layui-input-block">
<input type="text" name="FrmContent" v-model="FrmContent" required lay-verify="required"
placeholder="表单内容" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">排序码</label>
<div class="layui-input-block">
<input type="radio" name="SortCode" value="1" title="value1" checked>
<input type="radio" name="SortCode" value="0" title="value2">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">删除标记</label>
<div class="layui-input-block">
<input type="radio" name="DeleteMark" value="1" title="value1" checked>
<input type="radio" name="DeleteMark" value="0" title="value2">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">数据库Id</label>
<div class="layui-input-block">
<input type="text" name="FrmDbId" v-model="FrmDbId" required lay-verify="required"
placeholder="数据库Id" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">有效</label>
<div class="layui-input-block">
<input type="radio" name="EnabledMark" value="1" title="value1" checked>
<input type="radio" name="EnabledMark" value="0" title="value2">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">备注</label>
<div class="layui-input-block">
<input type="text" name="Description" v-model="Description" required lay-verify="required"
placeholder="备注" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">创建时间</label>
<div class="layui-input-block">
<input type="text" name="CreateDate" v-model="CreateDate" required lay-verify="required"
placeholder="创建时间" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">创建用户主键</label>
<div class="layui-input-block">
<input type="text" name="CreateUserId" v-model="CreateUserId" required lay-verify="required"
placeholder="创建用户主键" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">创建用户</label>
<div class="layui-input-block">
<input type="text" name="CreateUserName" v-model="CreateUserName" required lay-verify="required"
placeholder="创建用户" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">修改时间</label>
<div class="layui-input-block">
<input type="text" name="ModifyDate" v-model="ModifyDate" required lay-verify="required"
placeholder="修改时间" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">修改用户主键</label>
<div class="layui-input-block">
<input type="text" name="ModifyUserId" v-model="ModifyUserId" required lay-verify="required"
placeholder="修改用户主键" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">修改用户</label>
<div class="layui-input-block">
<input type="text" name="ModifyUserName" v-model="ModifyUserName" required lay-verify="required"
placeholder="修改用户" autocomplete="off" class="layui-input">
</div>
</div>
<form class="layui-form" action="" id="formEdit">
<input type="hidden" name="Id" v-model="Id" />
<div class="layui-tab layui-tab-brief" lay-filter="tab">
<ul class="layui-tab-title">
<li class="layui-this">基本信息</li>
<li>表单设计</li>
</ul>
<div class="layui-tab-content" style="height: 100px;">
<div class="layui-tab-item layui-show">
<div class="layui-form-item">
<label class="layui-form-label">表单名称</label>
<div class="layui-input-block">
<input type="text" name="Name" v-model="Name" required lay-verify="required"
placeholder="表单名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">排序码</label>
<div class="layui-input-block">
<input type="radio" name="SortCode" value="1" title="value1" checked>
<input type="radio" name="SortCode" value="0" title="value2">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">删除标记</label>
<div class="layui-input-block">
<input type="radio" name="Delete" value="1" title="value1" checked>
<input type="radio" name="Delete" value="0" title="value2">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">有效</label>
<div class="layui-input-block">
<input type="radio" name="Enabled" value="1" title="value1" checked>
<input type="radio" name="Enabled" value="0" title="value2">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">备注</label>
<div class="layui-input-block">
<input type="text" name="Description" v-model="Description" required lay-verify="required"
placeholder="备注" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-tab-item">
<input type="hidden" name="fields" id="fields" value="0">
<div class="alert">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<strong>提醒:</strong>单选框和复选框,如:<code>{|-</code>选项<code>-|}</code>两边边界是防止误删除控件,程序会把它们替换为空,请不要手动删除!
</div>
<div class="layui-row">
<div class="layui-col-xs2">
<ul class="layui-nav layui-nav-tree layui-inline" style="margin-right: 5px;">
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('text');">文本框</a></li>
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('textarea');">多行文本</a></li>
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('select');">下拉菜单</a></li>
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('radios');">单选框</a></li>
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('checkboxs');" class="btn btn-link">复选框</a></li>
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('macros');" class="btn btn-link">宏控件</a></li>
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('progressbar');" class="btn btn-link">进度条</a></li>
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('qrcode');" class="btn btn-link">二维码</a></li>
<li class="layui-nav-item"><a href="javascript:void(0);" onclick="leipiFormDesign.exec('listctrl');" class="btn btn-link">列表控件</a></li>
</ul>
</div>
<div class="layui-col-xs10">
<script id="myFormDesign" type="text/plain" style="width:100%;">
<input style="text-align: left; width: 150px;" title="文本框" value="OpenAuth.Net"
name="leipiNewField" orgheight="" orgwidth="150" orgalign="left"
orgfontsize="" orghide="0" leipiplugins="text" orgtype="text" />
<br />
{|-
<span leipiplugins="radios" title="单选" name="leipiNewField">
<input value="单选1"
type="radio" checked="checked" />单选1&nbsp;<input value="单选2" type="radio" />单选2&nbsp;
</span>-|}
</script>
</div>
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
@ -179,8 +140,12 @@
</div>
</form>
</div>
<script type="text/javascript" charset="utf-8" src="/js/ueditor/ueditor.config.js?2023"></script>
<script type="text/javascript" charset="utf-8" src="/js/ueditor/ueditor.all.js?2023"> </script>
<script type="text/javascript" charset="utf-8" src="/js/ueditor/lang/zh-cn/zh-cn.js?2023"></script>
<script type="text/javascript" charset="utf-8" src="/js/ueditor/formdesign/leipi.formdesign.v4.js?2023"></script>
<script type="text/javascript" src="/layui/layui.js"></script>
<script type="text/javascript" src="/js/forms.js"></script>
<script type="text/javascript" src="/userJs/forms.js"></script>

View File

@ -0,0 +1,404 @@
layui.config({
base: "/js/"
}).use(['form','vue', 'ztree', 'layer', 'jquery', 'table','droptree','openauth','element'], function () {
var form = layui.form,
element = layui.element,
//layer = (parent == undefined || parent.layer === undefined )? layui.layer : parent.layer,
layer = layui.layer,
$ = layui.jquery;
var table = layui.table;
var openauth = layui.openauth;
//标签切换
element.on('tab(tab)', function (data) {
console.log(data);
});
//表单设计器
var leipiEditor = UE.getEditor('myFormDesign', {
//allowDivTransToP: false,//阻止转换div 为p
toolleipi: true,//是否显示,设计器的 toolbars
textarea: 'design_content',
//这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
toolbars: [[
'fullscreen', 'source', '|', 'undo', 'redo', '|', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', '|', 'fontfamily', 'fontsize', '|', 'indent', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'link', 'unlink', '|', 'horizontal', 'spechars', 'wordimage', '|', 'inserttable', 'deletetable', 'mergecells', 'splittocells']],
//focus时自动清空初始化时的内容
//autoClearinitialContent:true,
//关闭字数统计
wordCount: false,
//关闭elementPath
elementPathEnabled: false,
//默认的编辑区域高度
initialFrameHeight: 300
///,iframeCssUrl:"css/bootstrap/css/bootstrap.css" //引入自身 css使编辑器兼容你网站css
//更多其他参数请参考ueditor.config.js中的配置项
});
leipiFormDesign = {
/*执行控件*/
exec: function (method) {
leipiEditor.execCommand(method);
},
/*
Javascript 解析表单
template 表单设计器里的Html内容
fields 字段总数
*/
parse_form: function (template, fields) {
//正则 radios|checkboxs|select 匹配的边界 |--| 因为当使用 {} 时js报错
var preg = /(\|-<span(((?!<span).)*leipiplugins=\"(radios|checkboxs|select)\".*?)>(.*?)<\/span>-\||<(img|input|textarea|select).*?(<\/select>|<\/textarea>|\/>))/gi, preg_attr = /(\w+)=\"(.?|.+?)\"/gi, preg_group = /<input.*?\/>/gi;
if (!fields) fields = 0;
var template_parse = template, template_data = new Array(), add_fields = new Object(), checkboxs = 0;
var pno = 0;
template.replace(preg, function (plugin, p1, p2, p3, p4, p5, p6) {
var parse_attr = new Array(), attr_arr_all = new Object(), name = '', select_dot = '', is_new = false;
var p0 = plugin;
var tag = p6 ? p6 : p4;
//alert(tag + " \n- t1 - "+p1 +" \n-2- " +p2+" \n-3- " +p3+" \n-4- " +p4+" \n-5- " +p5+" \n-6- " +p6);
if (tag == 'radios' || tag == 'checkboxs') {
plugin = p2;
} else if (tag == 'select') {
plugin = plugin.replace('|-', '');
plugin = plugin.replace('-|', '');
}
plugin.replace(preg_attr, function (str0, attr, val) {
if (attr == 'name') {
if (val == 'leipiNewField') {
is_new = true;
fields++;
val = 'data_' + fields;
}
name = val;
}
if (tag == 'select' && attr == 'value') {
if (!attr_arr_all[attr]) attr_arr_all[attr] = '';
attr_arr_all[attr] += select_dot + val;
select_dot = ',';
} else {
attr_arr_all[attr] = val;
}
var oField = new Object();
oField[attr] = val;
parse_attr.push(oField);
})
/*alert(JSON.stringify(parse_attr));return;*/
if (tag == 'checkboxs') /*复选组 多个字段 */ {
plugin = p0;
plugin = plugin.replace('|-', '');
plugin = plugin.replace('-|', '');
var name = 'checkboxs_' + checkboxs;
attr_arr_all['parse_name'] = name;
attr_arr_all['name'] = '';
attr_arr_all['value'] = '';
attr_arr_all['content'] = '<span leipiplugins="checkboxs" title="' + attr_arr_all['title'] + '">';
var dot_name = '', dot_value = '';
p5.replace(preg_group, function (parse_group) {
var is_new = false, option = new Object();
parse_group.replace(preg_attr, function (str0, k, val) {
if (k == 'name') {
if (val == 'leipiNewField') {
is_new = true;
fields++;
val = 'data_' + fields;
}
attr_arr_all['name'] += dot_name + val;
dot_name = ',';
}
else if (k == 'value') {
attr_arr_all['value'] += dot_value + val;
dot_value = ',';
}
option[k] = val;
});
if (!attr_arr_all['options']) attr_arr_all['options'] = new Array();
attr_arr_all['options'].push(option);
//if(!option['checked']) option['checked'] = '';
var checked = option['checked'] != undefined ? 'checked="checked"' : '';
attr_arr_all['content'] += '<input type="checkbox" name="' + option['name'] + '" value="' + option['value'] + '" ' + checked + '/>' + option['value'] + '&nbsp;';
if (is_new) {
var arr = new Object();
arr['name'] = option['name'];
arr['leipiplugins'] = attr_arr_all['leipiplugins'];
add_fields[option['name']] = arr;
}
});
attr_arr_all['content'] += '</span>';
//parse
template = template.replace(plugin, attr_arr_all['content']);
template_parse = template_parse.replace(plugin, '{' + name + '}');
template_parse = template_parse.replace('{|-', '');
template_parse = template_parse.replace('-|}', '');
template_data[pno] = attr_arr_all;
checkboxs++;
} else if (name) {
if (tag == 'radios') /*单选组 一个字段*/ {
plugin = p0;
plugin = plugin.replace('|-', '');
plugin = plugin.replace('-|', '');
attr_arr_all['value'] = '';
attr_arr_all['content'] = '<span leipiplugins="radios" name="' + attr_arr_all['name'] + '" title="' + attr_arr_all['title'] + '">';
var dot = '';
p5.replace(preg_group, function (parse_group) {
var option = new Object();
parse_group.replace(preg_attr, function (str0, k, val) {
if (k == 'value') {
attr_arr_all['value'] += dot + val;
dot = ',';
}
option[k] = val;
});
option['name'] = attr_arr_all['name'];
if (!attr_arr_all['options']) attr_arr_all['options'] = new Array();
attr_arr_all['options'].push(option);
//if(!option['checked']) option['checked'] = '';
var checked = option['checked'] != undefined ? 'checked="checked"' : '';
attr_arr_all['content'] += '<input type="radio" name="' + attr_arr_all['name'] + '" value="' + option['value'] + '" ' + checked + '/>' + option['value'] + '&nbsp;';
});
attr_arr_all['content'] += '</span>';
} else {
attr_arr_all['content'] = is_new ? plugin.replace(/leipiNewField/, name) : plugin;
}
//attr_arr_all['itemid'] = fields;
//attr_arr_all['tag'] = tag;
template = template.replace(plugin, attr_arr_all['content']);
template_parse = template_parse.replace(plugin, '{' + name + '}');
template_parse = template_parse.replace('{|-', '');
template_parse = template_parse.replace('-|}', '');
if (is_new) {
var arr = new Object();
arr['name'] = name;
arr['leipiplugins'] = attr_arr_all['leipiplugins'];
add_fields[arr['name']] = arr;
}
template_data[pno] = attr_arr_all;
}
pno++;
})
var parse_form = new Object({
'Fields': fields,//总字段数
'Content': template,//完整html
'ContentParse': template_parse,//控件替换为{data_1}的html
'ContentData': JSON.stringify(template_data),//控件属性
'add_fields': add_fields//新增控件
});
return parse_form;
},
/*type = save 保存设计 versions 保存版本 close关闭 */
fnCheckForm: function (type) {
if (leipiEditor.queryCommandState('source'))
leipiEditor.execCommand('source');//切换到编辑模式才提交否则有bug
if (leipiEditor.hasContents()) {
leipiEditor.sync();/*同步内容*/
return false;
} else {
alert('表单内容不能为空!')
$('#submitbtn').button('reset');
return false;
}
},
/*预览表单*/
fnReview: function () {
if (leipiEditor.queryCommandState('source'))
leipiEditor.execCommand('source');/*切换到编辑模式才提交否则部分浏览器有bug*/
if (leipiEditor.hasContents()) {
leipiEditor.sync(); /*同步内容*/
alert("你点击了预览,请自行处理....");
return false;
//--------------以下仅参考-------------------------------------------------------------------
/*设计form的target 然后提交至一个新的窗口进行预览*/
document.saveform.target = "mywin";
window.open('', 'mywin', "menubar=0,toolbar=0,status=0,resizable=1,left=0,top=0,scrollbars=1,width=" + (screen.availWidth - 10) + ",height=" + (screen.availHeight - 50) + "\"");
document.saveform.action = "/index.php?s=/index/preview.html";
document.saveform.submit(); //提交表单
} else {
alert('表单内容不能为空!');
return false;
}
}
};
layui.droptree("/UserSession/GetOrgs", "#Organizations", "#OrganizationIds");
//主列表加载,可反复调用进行刷新
var config= {}; //table的参数如搜索key点击tree的id
var mainList = function (options) {
if (options != undefined) {
$.extend(config, options);
}
table.reload('mainList', {
url: '/Forms/Load',
where: config
});
}
//左边树状机构列表
var ztree = function () {
var url = '/UserSession/GetOrgs';
var zTreeObj;
var setting = {
view: { selectedMulti: false },
data: {
key: {
name: 'Name',
title: 'Name'
},
simpleData: {
enable: true,
idKey: 'Id',
pIdKey: 'ParentId',
rootPId: 'null'
}
},
callback: {
onClick: function (event, treeId, treeNode) {
mainList({ orgId: treeNode.Id });
}
}
};
var load = function () {
$.getJSON(url, function (json) {
zTreeObj = $.fn.zTree.init($("#tree"), setting);
var newNode = { Name: "根节点", Id: null, ParentId: "" };
json.push(newNode);
zTreeObj.addNodes(null, json);
mainList({ orgId: "" });
zTreeObj.expandAll(true);
});
};
load();
return {
reload: load
}
}();
//添加(编辑)对话框
var editDlg = function() {
var vm = new Vue({
el: "#formEdit"
});
var update = false; //是否为更新
var show = function (data) {
var title = update ? "编辑信息" : "添加";
layer.open({
title: title,
area: ["500px", "400px"],
type: 1,
content: $('#divEdit'),
success: function() {
vm.$set('$data', data);
},
end: mainList
});
var url = "/Forms/Add";
if (update) {
url = "/Forms/Update";
}
//提交数据
form.on('submit(formSubmit)',
function (data) {
//解析表单数据
var formid = 0, fields = $("#fields").val(), formeditor = '';
//获取表单设计器里的内容
formeditor = leipiEditor.getContent();
//解析表单设计器控件
var parseForm = leipiFormDesign.parse_form(formeditor, fields);
//alert(parse_form);\
$.extend(data.field, parseForm);
$.post(url,
data.field,
function(data) {
layer.msg(data.Message);
},
"json");
return false;
});
}
return {
add: function() { //弹出添加
update = false;
show({
Id: ''
});
},
update: function(data) { //弹出编辑框
update = true;
show(data);
}
};
}();
//监听表格内部按钮
table.on('tool(list)', function (obj) {
var data = obj.data;
if (obj.event === 'detail') { //查看
layer.msg('ID' + data.Id + ' 的查看操作');
}
});
//监听页面主按钮操作
var active = {
btnDel: function () { //批量删除
var checkStatus = table.checkStatus('mainList')
, data = checkStatus.data;
openauth.del("/Forms/Delete",
data.map(function (e) { return e.Id; }),
mainList);
}
, btnAdd: function () { //添加
editDlg.add();
}
, btnEdit: function () { //编辑
var checkStatus = table.checkStatus('mainList')
, data = checkStatus.data;
if (data.length != 1) {
layer.msg("请选择编辑的行,且同时只能编辑一行");
return;
}
editDlg.update(data[0]);
}
, search: function () { //搜索
mainList({ key: $('#key').val() });
}
, btnRefresh: function() {
mainList();
}
};
$('.toolList .layui-btn').on('click', function () {
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
//监听页面主按钮操作 end
})

View File

@ -16,17 +16,19 @@ namespace OpenAuth.Repository.Domain
/// <summary>
/// 表单模板表
/// </summary>
public partial class WFFrmMain : Entity
public partial class Form : Entity
{
public WFFrmMain()
public Form()
{
this.FrmCode= string.Empty;
this.FrmName= string.Empty;
this.FrmType= string.Empty;
this.FrmTable= string.Empty;
this.FrmTableId= string.Empty;
this.FrmContent= string.Empty;
this.Name= string.Empty;
this.Fields= 0;
this.ContentData= string.Empty;
this.ContentParse= string.Empty;
this.Content= string.Empty;
this.SortCode= 0;
this.Delete= 0;
this.FrmDbId= string.Empty;
this.Enabled= 0;
this.Description= string.Empty;
this.CreateDate= DateTime.Now;
this.CreateUserId= string.Empty;
@ -36,42 +38,34 @@ namespace OpenAuth.Repository.Domain
this.ModifyUserName= string.Empty;
}
/// <summary>
/// 表单编号
/// </summary>
public string FrmCode { get; set; }
/// <summary>
/// 表单名称
/// </summary>
public string FrmName { get; set; }
public string Name { get; set; }
/// <summary>
/// 表单分类
/// 字段个数
/// </summary>
public string FrmType { get; set; }
public int Fields { get; set; }
/// <summary>
/// 数据
/// 表单中的字段数据
/// </summary>
public string FrmTable { get; set; }
public string ContentData { get; set; }
/// <summary>
/// 关联表的主键
/// 表单替换的模板 经过处理
/// </summary>
public string FrmTableId { get; set; }
public string ContentParse { get; set; }
/// <summary>
/// 是否需要建表0不建表,1建
/// 单原html模板未经处理的
/// </summary>
public int? IsSystemTable { get; set; }
/// <summary>
/// 表单内容
/// </summary>
public string FrmContent { get; set; }
public string Content { get; set; }
/// <summary>
/// 排序码
/// </summary>
public int? SortCode { get; set; }
public int SortCode { get; set; }
/// <summary>
/// 删除标记
/// </summary>
public int? DeleteMark { get; set; }
public int Delete { get; set; }
/// <summary>
/// 数据库Id
/// </summary>
@ -79,7 +73,7 @@ namespace OpenAuth.Repository.Domain
/// <summary>
/// 有效
/// </summary>
public int? EnabledMark { get; set; }
public int Enabled { get; set; }
/// <summary>
/// 备注
/// </summary>
@ -87,7 +81,7 @@ namespace OpenAuth.Repository.Domain
/// <summary>
/// 创建时间
/// </summary>
public System.DateTime? CreateDate { get; set; }
public System.DateTime CreateDate { get; set; }
/// <summary>
/// 创建用户主键
/// </summary>

View File

@ -12,13 +12,13 @@ using System.ComponentModel.DataAnnotations;
namespace OpenAuth.Repository.Mapping
{
public partial class WFFrmMainMap
: System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<OpenAuth.Repository.Domain.WFFrmMain>
public partial class FormMap
: System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<OpenAuth.Repository.Domain.Form>
{
public WFFrmMainMap()
public FormMap()
{
// table
ToTable("WF_FrmMain", "dbo");
ToTable("Form", "dbo");
// keys
HasKey(t => t.Id);
@ -28,53 +28,42 @@ namespace OpenAuth.Repository.Mapping
.HasColumnName("Id")
.HasMaxLength(50)
.IsRequired();
Property(t => t.FrmCode)
.HasColumnName("FrmCode")
.HasMaxLength(50)
.IsOptional();
Property(t => t.FrmName)
.HasColumnName("FrmName")
Property(t => t.Name)
.HasColumnName("Name")
.HasMaxLength(200)
.IsOptional();
Property(t => t.FrmType)
.HasColumnName("FrmType")
.HasMaxLength(50)
Property(t => t.Fields)
.HasColumnName("Fields")
.IsRequired();
Property(t => t.ContentData)
.HasColumnName("ContentData")
.IsOptional();
Property(t => t.FrmTable)
.HasColumnName("FrmTable")
.HasMaxLength(50)
Property(t => t.ContentParse)
.HasColumnName("ContentParse")
.IsOptional();
Property(t => t.FrmTableId)
.HasColumnName("FrmTableId")
.HasMaxLength(50)
.IsOptional();
Property(t => t.IsSystemTable)
.HasColumnName("isSystemTable")
.IsOptional();
Property(t => t.FrmContent)
.HasColumnName("FrmContent")
.HasMaxLength(16)
Property(t => t.Content)
.HasColumnName("Content")
.IsOptional();
Property(t => t.SortCode)
.HasColumnName("SortCode")
.IsOptional();
Property(t => t.DeleteMark)
.HasColumnName("DeleteMark")
.IsOptional();
.IsRequired();
Property(t => t.Delete)
.HasColumnName("Delete")
.IsRequired();
Property(t => t.FrmDbId)
.HasColumnName("FrmDbId")
.HasMaxLength(50)
.IsOptional();
Property(t => t.EnabledMark)
.HasColumnName("EnabledMark")
.IsOptional();
Property(t => t.Enabled)
.HasColumnName("Enabled")
.IsRequired();
Property(t => t.Description)
.HasColumnName("Description")
.HasMaxLength(200)
.IsOptional();
Property(t => t.CreateDate)
.HasColumnName("CreateDate")
.IsOptional();
.IsRequired();
Property(t => t.CreateUserId)
.HasColumnName("CreateUserId")
.HasMaxLength(50)

View File

@ -60,6 +60,7 @@
<Compile Include="Domain\Category.cs" />
<Compile Include="Domain\CategoryType.cs" />
<Compile Include="Core\Entity.cs" />
<Compile Include="Domain\Form.cs" />
<Compile Include="Domain\Module.cs" />
<Compile Include="Domain\ModuleElement.cs" />
<Compile Include="Domain\Org.cs" />
@ -69,7 +70,6 @@
<Compile Include="Domain\Stock.cs" />
<Compile Include="Domain\User.cs" />
<Compile Include="Domain\UserExt.cs" />
<Compile Include="Domain\WFFrmMain.cs" />
<Compile Include="Domain\WFProcessInstance.cs" />
<Compile Include="Domain\WFProcessOperationHistory.cs" />
<Compile Include="Domain\WFProcessScheme.cs" />
@ -80,7 +80,7 @@
<Compile Include="Interface\IUnitWork.cs" />
<Compile Include="Mapping\ApplicationMap.cs" />
<Compile Include="Mapping\CategoryTypeMap.cs" />
<Compile Include="Mapping\WFFrmMainMap.cs" />
<Compile Include="Mapping\FormMap.cs" />
<Compile Include="Mapping\WFProcessInstanceMap.cs" />
<Compile Include="Mapping\WFProcessOperationHistoryMap.cs" />
<Compile Include="Mapping\WFProcessSchemeMap.cs" />

View File

@ -38,7 +38,9 @@ namespace OpenAuth.Repository
public System.Data.Entity.DbSet<Role> Roles { get; set; }
public System.Data.Entity.DbSet<Stock> Stocks { get; set; }
public System.Data.Entity.DbSet<User> Users { get; set; }
public System.Data.Entity.DbSet<WFFrmMain> WFFrmMains { get; set; }
public System.Data.Entity.DbSet<Form> Forms { get; set; }
public System.Data.Entity.DbSet<WFProcessInstance> WFProcessInstances { get; set; }
public System.Data.Entity.DbSet<WFProcessOperationHistory> WFProcessOperationHistories { get; set; }
public System.Data.Entity.DbSet<WFProcessScheme> WFProcessSchemes { get; set; }
@ -59,7 +61,7 @@ namespace OpenAuth.Repository
modelBuilder.Configurations.Add(new RoleMap());
modelBuilder.Configurations.Add(new StockMap());
modelBuilder.Configurations.Add(new UserMap());
modelBuilder.Configurations.Add(new WFFrmMainMap());
modelBuilder.Configurations.Add(new FormMap());
modelBuilder.Configurations.Add(new WFProcessInstanceMap());
modelBuilder.Configurations.Add(new WFProcessOperationHistoryMap());
modelBuilder.Configurations.Add(new WFProcessSchemeMap());

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff