添加项目文件。
This commit is contained in:
165
WaterCloud.Web/Areas/SystemManage/Views/Coderule/Details.cshtml
Normal file
165
WaterCloud.Web/Areas/SystemManage/Views/Coderule/Details.cshtml
Normal file
@@ -0,0 +1,165 @@
|
||||
@{
|
||||
ViewBag.Title = "Details";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'laydate', 'tableEdit', 'commonTable', 'table', 'common', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
laydate = layui.laydate,
|
||||
tableEdit = layui.tableEdit,
|
||||
table = layui.table,
|
||||
commonTable = layui.commonTable,
|
||||
common = layui.common;
|
||||
var keyValue = $.request("keyValue");
|
||||
//权限字段
|
||||
common.authorizeFields('adminform');
|
||||
var listData = [];
|
||||
$(function () {
|
||||
initControl();
|
||||
if (!!keyValue) {
|
||||
common.ajax({
|
||||
url: '/SystemManage/Coderule/GetFormJson',
|
||||
dataType: 'json',
|
||||
data: { keyValue: keyValue },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('adminform', data);
|
||||
common.setReadOnly('adminform');
|
||||
if (!!data.F_RuleJson) {
|
||||
listData = JSON.parse(data.F_RuleJson);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
form.render();
|
||||
//1-固定参数 2-日期 3-年 4-月 5-日 6-周别 7-周几 8-小时 9-上午下午 10-班别 11-流水号 12-自定义
|
||||
var params = [{ name: '固定参数', value: 1 }, { name: '日期', value: 2 }, { name: '年', value: 3 }, { name: '月', value: 4 }, { name: '日', value: 5 },
|
||||
{ name: '周别', value: 6 }, { name: '周几', value: 7 }, { name: '小时', value: 8 }, { name: '上下午', value: 9 }, { name: '班别', value: 10 },
|
||||
{ name: '流水号', value: 11 }, { name: '自定义', value: 12 }
|
||||
];
|
||||
var cols = [[
|
||||
{ type: "radio", width: 50 },
|
||||
{
|
||||
field: 'FormatType', title: '编码类型', width: 90
|
||||
, templet: function (d) {
|
||||
if (d.FormatType || d.FormatType == 0) {
|
||||
if (d.FormatType.value || d.FormatType.value == 0) {
|
||||
return d.FormatType.name;
|
||||
}
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
if (params[i].value == d.FormatType) {
|
||||
return params[i].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ''
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'FormatString', title: '格式化字符串', width: 115
|
||||
},
|
||||
{ field: 'ToBase', title: '进制', width: 60},
|
||||
{ field: 'InitValue', title: '流水号初始值', width: 120},
|
||||
{ field: 'MaxValue', title: '最大值', width: 75},
|
||||
{ field: 'Increment', title: '步长', width: 60 },
|
||||
{
|
||||
field: 'DiyDate', title: '自定义', width: 130, templet: function (d) {
|
||||
if (d.DiyDate && d.DiyDate instanceof Array) {
|
||||
return d.DiyDate.join(",");
|
||||
}
|
||||
return d.DiyDate;
|
||||
}
|
||||
}
|
||||
]];
|
||||
commonTable.rendertable({
|
||||
elem: '#currentTableId',
|
||||
data: listData,
|
||||
defaultToolbar: [],
|
||||
search: false,
|
||||
limit: 9999,//每页数据 默认
|
||||
page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
|
||||
layout: ['count'] //自定义分页布局
|
||||
, first: false //不显示首页
|
||||
, last: false //不显示尾页
|
||||
},
|
||||
height: '300px',
|
||||
filter: {
|
||||
clearFilter: false,
|
||||
},
|
||||
cols: cols
|
||||
});
|
||||
var aopTable = tableEdit.aopObj(cols); //获取一个aop对象
|
||||
aopTable.on('tool(currentTableFilter)', function (obj) {
|
||||
var field = obj.field; //单元格字段
|
||||
var value = obj.value; //修改后的值
|
||||
var data = obj.data; //当前行旧数据
|
||||
var event = obj.event; //当前单元格事件属性值
|
||||
var update = {};
|
||||
update[field] = value;
|
||||
//把value更新到行中
|
||||
obj.update(update);
|
||||
});
|
||||
//行点击事件监听,控制按钮显示
|
||||
var oneList = ["NF-delete"];//选择1条显示
|
||||
commonTable.tableRowClick("radio", "currentTableFilter", "currentTableId", oneList, null);
|
||||
});
|
||||
wcLoading.close();
|
||||
function initControl() {
|
||||
//此处需修改
|
||||
$("#F_TemplateId").bindSelect({
|
||||
url: "/SystemManage/Template/GetListJson",
|
||||
id: "F_Id",
|
||||
text: "F_TemplateName"
|
||||
});
|
||||
$("#F_Reset").bindSelect({
|
||||
data: top.clients.dataItems["RuleReset"],
|
||||
id: ""
|
||||
});
|
||||
}
|
||||
});
|
||||
</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_RuleName" name="F_RuleName" 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">
|
||||
<select id="F_Reset" name="F_Reset" 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">
|
||||
<select id="F_TemplateId" name="F_TemplateId" lay-verify="required">
|
||||
<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="checkbox" name="F_EnabledMark" id="F_EnabledMark" checked="" value="true" title="有效">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">规则内容</label>
|
||||
<div class="layui-input-block">
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
363
WaterCloud.Web/Areas/SystemManage/Views/Coderule/Form.cshtml
Normal file
363
WaterCloud.Web/Areas/SystemManage/Views/Coderule/Form.cshtml
Normal file
@@ -0,0 +1,363 @@
|
||||
@{
|
||||
ViewBag.Title = "Form";
|
||||
Layout = "~/Views/Shared/_Form.cshtml";
|
||||
}
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'laydate', 'tableEdit', 'commonTable', 'table', 'common', 'optimizeSelectOption'], function () {
|
||||
var form = layui.form,
|
||||
$ = layui.$,
|
||||
laydate = layui.laydate,
|
||||
tableEdit = layui.tableEdit,
|
||||
table = layui.table,
|
||||
commonTable = layui.commonTable,
|
||||
common = layui.common;
|
||||
var keyValue = $.request("keyValue");
|
||||
//权限字段
|
||||
common.authorizeFields('adminform');
|
||||
var listData = [];
|
||||
$(function () {
|
||||
initControl();
|
||||
if (!!keyValue) {
|
||||
common.ajax({
|
||||
url: '/SystemManage/Coderule/GetFormJson',
|
||||
dataType: 'json',
|
||||
data: { keyValue: keyValue },
|
||||
async: false,
|
||||
success: function (data) {
|
||||
common.val('adminform', data);
|
||||
if (!!data.F_RuleJson) {
|
||||
listData = JSON.parse(data.F_RuleJson);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
form.render();
|
||||
//1-固定参数 2-日期 3-年 4-月 5-日 6-周别 7-周几 8-小时 9-上午下午 10-班别 11-流水号 12-自定义
|
||||
var params = [{ name: '固定参数', value: 1 }, { name: '日期', value: 2 }, { name: '年', value: 3 }, { name: '月', value: 4 }, { name: '日', value: 5 },
|
||||
{ name: '周别', value: 6 }, { name: '周几', value: 7 }, { name: '小时', value: 8 }, { name: '上下午', value: 9 }, { name: '班别', value: 10 },
|
||||
{ name: '流水号', value: 11 }, { name: '自定义', value: 12 }, { name: '预留码', value: 13 }
|
||||
];
|
||||
var cols = [[
|
||||
{ type: "radio", width: 50 },
|
||||
{
|
||||
field: 'FormatType', title: '编码类型', width: 90, event: 'formatType', config: { type: 'select', data: params, verify: { type: "required" } }
|
||||
, templet: function (d) {
|
||||
if (d.FormatType || d.FormatType == 0) {
|
||||
if (d.FormatType.value || d.FormatType.value == 0) {
|
||||
return d.FormatType.name;
|
||||
}
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
if (params[i].value == d.FormatType) {
|
||||
return params[i].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ''
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'FormatString', title: '格式化字符串', width: 115, event: 'formatString', config: { type: 'input', verify: { type: "required" } }
|
||||
},
|
||||
{ field: 'ToBase', title: '进制', width: 60, event: 'actualNum', config: { type: 'signedInput' } },
|
||||
{ field: 'InitValue', title: '流水号初始值', width: 120, event: 'initValue', config: { type: 'signedInput' } },
|
||||
{ field: 'MaxValue', title: '最大值', width: 75, event: 'maxValue', config: { type: 'signedInput' } },
|
||||
{ field: 'Increment', title: '步长', width: 60, event: 'increment', config: { type: 'signedInput' } },
|
||||
{
|
||||
field: 'DiyDate', title: '自定义', width: 130, event: 'diyDate', config: { type: 'input' }, templet: function (d) {
|
||||
if (!!d.DiyDate && d.DiyDate instanceof Array) {
|
||||
return d.DiyDate.join(",");
|
||||
}
|
||||
if (!d.DiyDate)
|
||||
return '';
|
||||
return d.DiyDate;
|
||||
}
|
||||
}
|
||||
]];
|
||||
commonTable.rendertable({
|
||||
elem: '#currentTableId',
|
||||
data: listData,
|
||||
defaultToolbar: [],
|
||||
search: false,
|
||||
limit: 9999,//每页数据 默认
|
||||
page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
|
||||
layout: ['count'] //自定义分页布局
|
||||
, first: false //不显示首页
|
||||
, last: false //不显示尾页
|
||||
},
|
||||
height: '300px',
|
||||
filter: {
|
||||
clearFilter: false,
|
||||
},
|
||||
cols: cols
|
||||
});
|
||||
var aopTable = tableEdit.aopObj(cols); //获取一个aop对象
|
||||
aopTable.on('tool(currentTableFilter)', function (obj) {
|
||||
var field = obj.field; //单元格字段
|
||||
var value = obj.value; //修改后的值
|
||||
var data = obj.data; //当前行旧数据
|
||||
var event = obj.event; //当前单元格事件属性值
|
||||
var update = {};
|
||||
update[field] = value;
|
||||
if (obj.field == "FormatType")
|
||||
obj.data.FormatType=value;
|
||||
switch (!!obj.data.FormatType.value ? obj.data.FormatType.value : obj.data.FormatType) {
|
||||
case 1:
|
||||
if (obj.field == "FormatType") {
|
||||
update["FormatString"] = "";
|
||||
}
|
||||
update["ToBase"] = null;
|
||||
update["InitValue"] = null;
|
||||
update["MaxValue"] = null;
|
||||
update["Increment"] = null;
|
||||
update["DiyDate"] = null;
|
||||
break;
|
||||
case 2:
|
||||
if (obj.field == "FormatType") {
|
||||
update["FormatString"] = "yyyyMMdd";
|
||||
}
|
||||
update["ToBase"] = null;
|
||||
update["InitValue"] = null;
|
||||
update["MaxValue"] = null;
|
||||
update["Increment"] = null;
|
||||
update["DiyDate"] = null;
|
||||
break;
|
||||
case 3:
|
||||
if (obj.field == "FormatType") {
|
||||
update["FormatString"] = "yyyy";
|
||||
}
|
||||
update["ToBase"] = null;
|
||||
update["InitValue"] = null;
|
||||
update["MaxValue"] = null;
|
||||
update["Increment"] = null;
|
||||
update["DiyDate"] = null;
|
||||
break;
|
||||
case 4:
|
||||
if (obj.field == "FormatType") {
|
||||
update["FormatString"] = "MM";
|
||||
update["DiyDate"] = [01, 02, 03, 04, 05, 06, 07,08, 09, 10, 11, 12];
|
||||
}
|
||||
update["ToBase"] = null;
|
||||
update["InitValue"] = null;
|
||||
update["MaxValue"] = null;
|
||||
update["Increment"] = null;
|
||||
break;
|
||||
case 5:
|
||||
if (obj.field == "FormatType") {
|
||||
update["FormatString"] = "dd";
|
||||
update["DiyDate"] = [01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31];
|
||||
}
|
||||
update["ToBase"] = null;
|
||||
update["InitValue"] = null;
|
||||
update["MaxValue"] = null;
|
||||
update["Increment"] = null;
|
||||
break;
|
||||
case 6:
|
||||
if (obj.field == "FormatType") {
|
||||
update["FormatString"] = "WW";
|
||||
}
|
||||
update["ToBase"] = null;
|
||||
update["InitValue"] = null;
|
||||
update["MaxValue"] = null;
|
||||
update["Increment"] = null;
|
||||
update["DiyDate"] = null;
|
||||
break;
|
||||
case 7:
|
||||
if (obj.field == "FormatType") {
|
||||
update["FormatString"] = "WD";
|
||||
update["DiyDate"] = [1,2,3,4,5,6,7];
|
||||
}
|
||||
update["ToBase"] = null;
|
||||
update["InitValue"] = null;
|
||||
update["MaxValue"] = null;
|
||||
update["Increment"] = null;
|
||||
break;
|
||||
case 8:
|
||||
if (obj.field == "FormatType") {
|
||||
update["FormatString"] = "HH";
|
||||
}
|
||||
update["ToBase"] = null;
|
||||
update["InitValue"] = null;
|
||||
update["MaxValue"] = null;
|
||||
update["Increment"] = null;
|
||||
update["DiyDate"] = null;
|
||||
break;
|
||||
case 9:
|
||||
if (obj.field == "FormatType") {
|
||||
update["FormatString"] = "TM";
|
||||
update["DiyDate"] = ["AM","PM"];
|
||||
}
|
||||
update["ToBase"] = null;
|
||||
update["InitValue"] = null;
|
||||
update["MaxValue"] = null;
|
||||
update["Increment"] = null;
|
||||
break;
|
||||
case 10:
|
||||
if (obj.field == "FormatType") {
|
||||
update["FormatString"] = "CS";
|
||||
update["DiyDate"] = ["A.8:30-20:30","B.20:30-8:30"];
|
||||
}
|
||||
update["ToBase"] = null;
|
||||
update["InitValue"] = null;
|
||||
update["MaxValue"] = null;
|
||||
update["Increment"] = null;
|
||||
break;
|
||||
case 12:
|
||||
if (obj.field == "FormatType") {
|
||||
update["FormatString"] = "";
|
||||
}
|
||||
update["ToBase"]=null;
|
||||
update["InitValue"]=null;
|
||||
update["MaxValue"] = null;
|
||||
update["Increment"] = null;
|
||||
update["DiyDate"] = null;
|
||||
break;
|
||||
case 13:
|
||||
if (obj.field == "FormatType") {
|
||||
update["FormatString"] = "*";
|
||||
}
|
||||
update["ToBase"] = null;
|
||||
update["InitValue"] = null;
|
||||
update["MaxValue"] = null;
|
||||
update["Increment"] = null;
|
||||
update["DiyDate"] = null;
|
||||
break;
|
||||
case 11:
|
||||
if (obj.field == "FormatType") {
|
||||
update["FormatString"] = "0000";
|
||||
update["ToBase"] = 10;
|
||||
update["InitValue"] = 1;
|
||||
update["MaxValue"] = -1;
|
||||
update["Increment"] = 1;
|
||||
}
|
||||
update["DiyDate"] = null;
|
||||
break;
|
||||
}
|
||||
//把value更新到行中
|
||||
obj.update(update);
|
||||
});
|
||||
//行点击事件监听,控制按钮显示
|
||||
var oneList = ["NF-delete"];//选择1条显示
|
||||
commonTable.tableRowClick("radio", "currentTableFilter", "currentTableId", oneList, null);
|
||||
});
|
||||
wcLoading.close();
|
||||
//toolbar监听事件
|
||||
table.on('toolbar(currentTableFilter)', function (obj) {
|
||||
var data = table.checkStatus('currentTableId').data;
|
||||
if (obj.event === 'add') { // 监听添加操作\
|
||||
var alldata = table.cache.currentTableId;
|
||||
alldata.push({ Id: uuid(), FormatType: '', FormatString: '', ToBase: null, InitValue: null, MaxValue: null, Increment: null, DiyDate: null })
|
||||
table.reload('currentTableId', { data: alldata })
|
||||
}
|
||||
else if (obj.event === 'delete') {
|
||||
if (data.length == 0) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalConfirm("注:您确定要删除选择的数据吗?", function (r) {
|
||||
if (r) {
|
||||
var alldata = table.cache.currentTableId;
|
||||
for (var j = 0; j < data.length; j++) {
|
||||
for (var i = alldata.length - 1; i >= 0; i--) {
|
||||
if (alldata[i].Id == data[j].Id) {
|
||||
alldata.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
table.reload('currentTableId', { data: alldata })
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
function initControl() {
|
||||
//此处需修改
|
||||
$("#F_TemplateId").bindSelect({
|
||||
url: "/SystemManage/Template/GetListJson",
|
||||
id: "F_Id",
|
||||
text: "F_TemplateName"
|
||||
});
|
||||
$("#F_Reset").bindSelect({
|
||||
data: top.clients.dataItems["RuleReset"],
|
||||
id: ""
|
||||
});
|
||||
}
|
||||
|
||||
//监听提交
|
||||
form.on('submit(saveBtn)', function (data) {
|
||||
var postData = data.field;
|
||||
if (!postData["F_EnabledMark"]) postData["F_EnabledMark"] = false;
|
||||
var list = table.cache.currentTableId;
|
||||
if (!list || list.length == 0) {
|
||||
common.modalMsg("产品明细不能为空!");
|
||||
return false;
|
||||
}
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
list[i].FormatType = !!list[i].FormatType.value ? list[i].FormatType.value : list[i].FormatType;
|
||||
list[i].DiyDate = !!list[i].DiyDate && list[i].DiyDate instanceof String ? list[i].DiyDate.split(",") : list[i].DiyDate;
|
||||
}
|
||||
postData.F_RuleJson = JSON.stringify(list);
|
||||
common.submitForm({
|
||||
url: '/SystemManage/Coderule/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_RuleName" name="F_RuleName" autocomplete="off" lay-verify="required" placeholder="请输入规则名称" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-hide">
|
||||
<label class="layui-form-label required">重设机制</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="F_Reset" name="F_Reset" 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">
|
||||
<select id="F_TemplateId" name="F_TemplateId" lay-verify="required">
|
||||
<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="checkbox" name="F_EnabledMark" id="F_EnabledMark" checked="" value="true" title="有效">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label required">规则内容</label>
|
||||
<div class="layui-input-block">
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
</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>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container" id="toolbar">
|
||||
<button id="NF-add" name="NF-add" class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"></i>添加</button>
|
||||
<button id="NF-delete" name="NF-delete" class="layui-btn layui-btn-sm layui-btn-danger layui-hide" lay-event="delete"><i class="layui-icon"></i>删除</button>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
224
WaterCloud.Web/Areas/SystemManage/Views/Coderule/Index.cshtml
Normal file
224
WaterCloud.Web/Areas/SystemManage/Views/Coderule/Index.cshtml
Normal file
@@ -0,0 +1,224 @@
|
||||
@{
|
||||
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-create" name="NF-create" authorize class="layui-btn layui-btn-normal layui-btn-sm layui-hide" lay-event="create"><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>
|
||||
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
|
||||
<script type="text/html" id="currentTableBar">
|
||||
<a id="NF-create" authorize class="layui-btn layui-btn-normal layui-btn-xs" lay-event="create">生成条码</a>
|
||||
<a id="NF-edit" authorize class="layui-btn layui-btn-xs" 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>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
layui.use(['jquery', 'form', 'table', 'commonTable', 'common', '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: '/SystemManage/Coderule/GetGridJson',
|
||||
cols: [[
|
||||
{ type: "checkbox", width: 50, fixed: 'left' },
|
||||
{ field: 'F_RuleName', title: '规则名称', minWidth: 150, sort: true, filter: true },
|
||||
{ field: 'F_RuleJson', title: '规则内容', minWidth: 150, sort: true, filter: true,hide:true },
|
||||
{ field: 'F_Reset', title: '重设机制', width: 150, sort: true, filter: true,
|
||||
templet: function (d) {
|
||||
return top.clients.dataItems["RuleReset"][d.F_Reset] == undefined ? "" : top.clients.dataItems["RuleReset"][d.F_Reset];
|
||||
}
|
||||
},
|
||||
{ field: 'F_TemplateId', title: '打印模板Id', width: 150, sort: true, hide: true },
|
||||
{ field: 'F_TemplateName', title: '打印模板', minWidth: 150, sort: true, filter: true },
|
||||
{
|
||||
field: 'F_PrintType', title: '打印方式', width: 140, sort: true, filter: true,
|
||||
templet: function (d) {
|
||||
return top.clients.dataItems["PrintType"][d.F_PrintType] == undefined ? "" : top.clients.dataItems["PrintType"][d.F_PrintType];
|
||||
}
|
||||
},
|
||||
{
|
||||
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>";
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '操作', width: 225, 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;
|
||||
});
|
||||
wcLoading.close();
|
||||
//行点击事件监听,控制按钮显示
|
||||
var oneList = ["NF-edit", "NF-create", "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: "/SystemManage/Coderule/Form",
|
||||
width: "900px",
|
||||
height: "650px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'create') {
|
||||
if (data.length == 0) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.submitForm({
|
||||
url: "/SystemManage/Coderule/CreateForm",
|
||||
param: { keyValue: id },
|
||||
close:false,
|
||||
success: function (data) {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
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: "/SystemManage/Coderule/DeleteForm",
|
||||
param: { keyValue: ids.join(',') },
|
||||
success: function () {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
if (data.length == 0) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "编辑界面",
|
||||
url: "/SystemManage/Coderule/Form?keyValue=" + id,
|
||||
width: "900px",
|
||||
height: "650px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'details') {
|
||||
if (data.length == 0) {
|
||||
common.modalMsg("未选中数据", "warning");
|
||||
return false;
|
||||
}
|
||||
common.modalOpen({
|
||||
title: "查看界面",
|
||||
url: "/SystemManage/Coderule/Details?keyValue=" + id,
|
||||
width: "900px",
|
||||
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 === 'delete') {
|
||||
common.deleteForm({
|
||||
url: "/SystemManage/Coderule/DeleteForm",
|
||||
param: { keyValue: id },
|
||||
success: function () {
|
||||
obj.del();
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'create') {
|
||||
common.submitForm({
|
||||
url: "/SystemManage/Coderule/CreateForm",
|
||||
param: { keyValue: id },
|
||||
close: false,
|
||||
success: function (data) {
|
||||
common.reload('data-search-btn');
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'edit') {
|
||||
common.modalOpen({
|
||||
title: "编辑界面",
|
||||
url: "/SystemManage/Coderule/Form?keyValue=" + id,
|
||||
width: "900px",
|
||||
height: "650px",
|
||||
});
|
||||
}
|
||||
else if (obj.event === 'details') {
|
||||
common.modalOpen({
|
||||
title: "查看界面",
|
||||
url: "/SystemManage/Coderule/Details?keyValue=" + id,
|
||||
width: "900px",
|
||||
height: "650px",
|
||||
btn: []
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user