243 lines
12 KiB
Plaintext
243 lines
12 KiB
Plaintext
![]() |
@{
|
||
|
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" name="NF-add" authorize class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"></i>申请</button>
|
||
|
<button id="NF-cancle" name="NF-delete" authorize class="layui-btn layui-btn-sm layui-btn-danger layui-hide" lay-event="cancle"> <i class="fa fa-undo"> </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-cancle" authorize class="layui-btn layui-btn-xs layui-btn-danger" lay-event="cancle">撤回</a>
|
||
|
<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>
|
||
|
<script>
|
||
|
layui.use(['jquery', 'form', 'table', 'common', 'commonTable','optimizeSelectOption'], function () {
|
||
|
var 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: '/FlowManage/Flowinstance/GetGridJson',
|
||
|
cols: [[
|
||
|
{ type: "radio", width: 50, fixed: 'left' },
|
||
|
{
|
||
|
field: 'F_IsFinish', title: '流程状态', width: 120, sort: true, filter: true,
|
||
|
templet: function (d) {
|
||
|
if (d.F_IsFinish == 0) {
|
||
|
return "<span class='layui-badge layui-bg-blue'>正在运行</span>";
|
||
|
}
|
||
|
else if (d.F_IsFinish == 2) {
|
||
|
return "<span class= 'layui-badge layui-bg-gray'>被撤回</span >";
|
||
|
}
|
||
|
else if (d.F_IsFinish == 3) {
|
||
|
return "<span class= 'layui-badge'>不同意</span >";
|
||
|
}
|
||
|
else if (d.F_IsFinish == 4) {
|
||
|
return "<span class= 'layui-badge layui-bg-gray'>被驳回</span >";
|
||
|
}
|
||
|
else{
|
||
|
return "<span class='layui-badge layui-bg-green'>审批通过</span>";
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{ field: 'F_Code', title: '实例编号', width: 150, sort: true, filter: true },
|
||
|
{ field: 'F_CustomName', title: '实例名称', minWidth: 150, sort: true, filter: true },
|
||
|
{ field: 'F_ActivityName', title: '当前节点名称', width: 140, filter: true },
|
||
|
{ field: 'F_Description', title: '实例备注', minWidth: 150, filter: true },
|
||
|
{
|
||
|
field: 'F_CreatorTime', title: '创建时间', width: 160, sort: true, filter: { type: 'date[yyyy/MM/dd HH:mm:ss]' }
|
||
|
},
|
||
|
{ field: 'F_CreatorUserName', title: '创建人', width: 120, sort: true, filter: true },
|
||
|
{ title: '操作', width: 205, 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}
|
||
|
});
|
||
|
entity = null;
|
||
|
return false;
|
||
|
});
|
||
|
wcLoading.close();
|
||
|
//行点击事件监听,控制按钮显示
|
||
|
var oneList = ["NF-edit", "NF-details", "NF-delete","NF-cancle"];//选择1条显示
|
||
|
commonTable.tableRowClick("radio", "currentTableFilter", "currentTableId", oneList);
|
||
|
//toolbar监听事件
|
||
|
table.on('toolbar(currentTableFilter)', function (obj) {
|
||
|
var data = table.checkStatus('currentTableId').data;
|
||
|
if (obj.event === 'add') { // 监听添加操作
|
||
|
common.openNewTabByIframe({
|
||
|
title: "添加申请",
|
||
|
href: "/FlowManage/Flowinstance/Form",
|
||
|
});
|
||
|
}
|
||
|
else if (obj.event === 'delete') {
|
||
|
if (data.length == 0) {
|
||
|
common.modalMsg("未选中数据", "warning");
|
||
|
return false;
|
||
|
}
|
||
|
if (data[0].F_IsFinish != 4 && data[0].F_IsFinish != 2) {
|
||
|
common.modalMsg("申请已处理,无法删除", "warning");
|
||
|
return false;
|
||
|
}
|
||
|
common.deleteForm({
|
||
|
url: "/FlowManage/Flowinstance/DeleteForm",
|
||
|
param: { keyValue: data[0].F_Id },
|
||
|
success: function () {
|
||
|
common.reload('data-search-btn');
|
||
|
entity = null;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
else if (obj.event === 'cancle') {
|
||
|
if (data.length == 0) {
|
||
|
common.modalMsg("未选中数据", "warning");
|
||
|
return false;
|
||
|
}
|
||
|
if (data[0].F_IsFinish != 0) {
|
||
|
common.modalMsg("申请已处理,无法撤回", "warning");
|
||
|
return false;
|
||
|
}
|
||
|
common.submitPost({
|
||
|
prompt:"注:您确定要撤回选中数据吗?",
|
||
|
url: "/FlowManage/Flowinstance/CancleForm",
|
||
|
param: { keyValue: data[0].F_Id },
|
||
|
success: function () {
|
||
|
common.reload('data-search-btn');
|
||
|
entity = null;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
else if (obj.event === 'edit') {
|
||
|
if (data.length == 0) {
|
||
|
common.modalMsg("未选中数据", "warning");
|
||
|
return false;
|
||
|
}
|
||
|
var userId = top.currentUser.F_Id;
|
||
|
if ((data[0].F_IsFinish != 4 && data[0].F_IsFinish != 2) || data[0].F_MakerList.indexOf(userId)<0 ) {
|
||
|
common.modalMsg("申请已处理,无法修改", "warning");
|
||
|
return false;
|
||
|
}
|
||
|
common.openNewTabByIframe({
|
||
|
title: "修改申请",
|
||
|
href: "/FlowManage/Flowinstance/Form?keyValue=" + data[0].F_Id,
|
||
|
});
|
||
|
}
|
||
|
else if (obj.event === 'details') {
|
||
|
if (data.length == 0) {
|
||
|
common.modalMsg("未选中数据", "warning");
|
||
|
return false;
|
||
|
}
|
||
|
common.modalOpen({
|
||
|
title: "查看进度",
|
||
|
url: "/FlowManage/Flowinstance/Details?keyValue=" + data[0].F_Id,
|
||
|
width: "700px",
|
||
|
height: "600px",
|
||
|
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) {
|
||
|
if (obj.event === 'delete') {
|
||
|
if (obj.data.F_IsFinish != 4 && obj.data.F_IsFinish != 2) {
|
||
|
common.modalMsg("申请已处理,无法删除", "warning");
|
||
|
return false;
|
||
|
}
|
||
|
common.deleteForm({
|
||
|
url: "/FlowManage/Flowinstance/DeleteForm",
|
||
|
param: { keyValue: obj.data.F_Id },
|
||
|
success: function () {
|
||
|
common.reload('data-search-btn');
|
||
|
entity = null;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
if (obj.event === 'cancle') {
|
||
|
if (obj.data.F_IsFinish != 0) {
|
||
|
common.modalMsg("申请已处理,无法撤回", "warning");
|
||
|
return false;
|
||
|
}
|
||
|
common.submitPost({
|
||
|
prompt:"注:您确定要撤回选中数据吗?",
|
||
|
url: "/FlowManage/Flowinstance/CancleForm",
|
||
|
param: { keyValue: obj.data.F_Id },
|
||
|
success: function () {
|
||
|
common.reload('data-search-btn');
|
||
|
entity = null;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
else if (obj.event === 'edit') {
|
||
|
var userId = top.currentUser.F_Id;
|
||
|
if ((obj.data.F_IsFinish != 4 && obj.data.F_IsFinish != 2) || obj.data.F_MakerList.indexOf(userId) < 0) {
|
||
|
common.modalMsg("申请已处理,无法修改", "warning");
|
||
|
return false;
|
||
|
}
|
||
|
common.openNewTabByIframe({
|
||
|
title: "修改申请",
|
||
|
href: "/FlowManage/Flowinstance/Form?keyValue=" + obj.data.F_Id,
|
||
|
});
|
||
|
}
|
||
|
else if (obj.event === 'details') {
|
||
|
common.modalOpen({
|
||
|
title: "查看进度",
|
||
|
url: "/FlowManage/Flowinstance/Details?keyValue=" + obj.data.F_Id,
|
||
|
width: "700px",
|
||
|
height: "600px",
|
||
|
btn: []
|
||
|
});
|
||
|
}
|
||
|
return false;
|
||
|
});
|
||
|
});
|
||
|
</script>
|