mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-09 02:44:44 +08:00
ru
This commit is contained in:
81
OpenAuth.Mvc/Controllers/FormsController.cs
Normal file
81
OpenAuth.Mvc/Controllers/FormsController.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Web.Http;
|
||||
using System.Web.Mvc;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.App.Request;
|
||||
using OpenAuth.Mvc.Models;
|
||||
using OpenAuth.Repository.Domain;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
public class FormsController : BaseController
|
||||
{
|
||||
public FormApp App { get; set; }
|
||||
|
||||
//
|
||||
[Authenticate]
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
//添加或修改
|
||||
[System.Web.Mvc.HttpPost]
|
||||
public string Add(WFFrmMain obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
App.Add(obj);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Result.Code = 500;
|
||||
Result.Message = ex.Message;
|
||||
}
|
||||
return JsonHelper.Instance.Serialize(Result);
|
||||
}
|
||||
|
||||
//添加或修改
|
||||
[System.Web.Mvc.HttpPost]
|
||||
public string Update(WFFrmMain obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
App.Update(obj);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Result.Code = 500;
|
||||
Result.Message = ex.Message;
|
||||
}
|
||||
return JsonHelper.Instance.Serialize(Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载列表
|
||||
/// </summary>
|
||||
public string Load([FromUri]QueryFormListReq request)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(App.Load(request));
|
||||
}
|
||||
|
||||
[System.Web.Mvc.HttpPost]
|
||||
public string Delete(string[] ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
App.Delete(ids);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Result.Code = 500;
|
||||
Result.Message = e.Message;
|
||||
}
|
||||
|
||||
return JsonHelper.Instance.Serialize(Result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,6 +150,7 @@
|
||||
<Compile Include="Controllers\CategoriesController.cs" />
|
||||
<Compile Include="Controllers\ErrorController.cs" />
|
||||
<Compile Include="Areas\FlowManage\Controllers\FlowInstancesController.cs" />
|
||||
<Compile Include="Controllers\FormsController.cs" />
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
<Compile Include="Controllers\LoginController.cs" />
|
||||
<Compile Include="Controllers\ModuleManagerController.cs" />
|
||||
@@ -168,6 +169,7 @@
|
||||
<ItemGroup>
|
||||
<Content Include="js\categories.js" />
|
||||
<Content Include="js\assign.js" />
|
||||
<Content Include="js\forms.js" />
|
||||
<Content Include="js\openauth.js" />
|
||||
<Content Include="js\droptree.js" />
|
||||
<Content Include="css\images.css" />
|
||||
@@ -354,6 +356,7 @@
|
||||
<Content Include="Views\Categories\Index.cshtml" />
|
||||
<Content Include="Views\ModuleManager\Assign.cshtml" />
|
||||
<Content Include="Views\RoleManager\Index.cshtml" />
|
||||
<Content Include="Views\Forms\index.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Areas\FlowManage\Models\" />
|
||||
|
||||
186
OpenAuth.Mvc/Views/Forms/index.cshtml
Normal file
186
OpenAuth.Mvc/Views/Forms/index.cshtml
Normal file
@@ -0,0 +1,186 @@
|
||||
@section header
|
||||
{
|
||||
<link rel="stylesheet" href="/css/treetable.css" />
|
||||
}
|
||||
<blockquote class="layui-elem-quote news_search toolList">
|
||||
@Html.Action("MenuHeader", "Home")
|
||||
</blockquote>
|
||||
|
||||
<div style="display: flex;">
|
||||
<table class="layui-table"
|
||||
lay-data="{height: 'full-80', page:true, id:'mainList'}"
|
||||
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>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<script type="text/html" id="barList">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-mini" lay-event="detail">查看</a>
|
||||
</script>
|
||||
|
||||
<!--用户添加/编辑窗口-->
|
||||
<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>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/layui/layui.js"></script>
|
||||
<script type="text/javascript" src="/js/forms.js"></script>
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
layui.config({
|
||||
base: "/js/"
|
||||
}).use(['form','vue', 'ztree', 'layer', 'jquery', 'table','droptree','openauth','queryString'], function () {
|
||||
}).use(['form','vue', 'ztree', 'layer', 'jquery','queryString'], function () {
|
||||
var //layer = (parent == undefined || parent.layer === undefined )? layui.layer : parent.layer,
|
||||
layer = layui.layer,
|
||||
$ = layui.jquery;
|
||||
var table = layui.table;
|
||||
var openauth = layui.openauth;
|
||||
var id = $.getUrlParam("id"); //待分配的id
|
||||
var type = $.getUrlParam("type"); //待分配的类型
|
||||
var menuType = $.getUrlParam("menuType"); //待分配菜单的类型
|
||||
@@ -146,8 +144,8 @@ layui.config({
|
||||
zTreeObj.checkNode(node, true, false);
|
||||
});
|
||||
});
|
||||
|
||||
menutree.load({ moduleId: json[0].Id });
|
||||
$("#menutree").html("点击左边的模块开始分配菜单");
|
||||
// menutree.load({ moduleId: json[0].Id });
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
};
|
||||
|
||||
119
OpenAuth.Mvc/js/forms.js
Normal file
119
OpenAuth.Mvc/js/forms.js
Normal file
@@ -0,0 +1,119 @@
|
||||
layui.config({
|
||||
base: "/js/"
|
||||
}).use(['form','vue', 'ztree', 'layer', 'jquery', 'table','droptree','openauth'], function () {
|
||||
var form = layui.form,
|
||||
//layer = (parent == undefined || parent.layer === undefined )? layui.layer : parent.layer,
|
||||
layer = layui.layer,
|
||||
$ = layui.jquery;
|
||||
var table = layui.table;
|
||||
var openauth = layui.openauth;
|
||||
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
|
||||
});
|
||||
}
|
||||
|
||||
mainList();
|
||||
|
||||
//添加(编辑)对话框
|
||||
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) {
|
||||
$.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
|
||||
})
|
||||
Reference in New Issue
Block a user