<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
|
<%
|
String path = request.getContextPath();
|
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
|
+ path + "/";
|
%>
|
|
<!DOCTYPE HTML>
|
<html>
|
<head>
|
<base href="<%=basePath%>">
|
|
<title>字段权限设置</title>
|
<link href="static/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
|
<link href="static/plugins/jquery-easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css">
|
<link rel="stylesheet" href="static/styles/material-teal.css" type="text/css">
|
<link rel="stylesheet" href="static/styles/initialize.css" type="text/css">
|
<link rel="stylesheet" href="static/styles/common.css" type="text/css">
|
|
<script type="text/javascript" src="static/plugins/jquery-easyui/jquery.min.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui/jquery.easyui.min.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
|
<script type="text/javascript" src="static/scripts/easyuiExtend.js"></script>
|
<script type="text/javascript" src="static/scripts/jquery-extend.js"></script>
|
<script type="text/javascript" src="static/plugins/layer/layer.js"></script>
|
<script type="text/javascript" src="static/plugins/slimScroll/jquery.slimscroll.min.js"></script>
|
|
<script type="text/javascript" src="static/plugins/spinjs/spin.js"></script>
|
<script type="text/javascript" src="static/plugins/spinjs/jquery.spin.js"></script>
|
<script type="text/javascript" src="static/plugins/jquery.blockUI.js"></script>
|
|
<script type="text/javascript" src="static/wcp/scripts/wcp.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.layer.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.blockUI.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.spin.js"></script>
|
<script type="text/javascript" src="static/wcp/scripts/libs/wcp.jquery.js"></script>
|
|
<!--[if lt IE 9]>
|
<script type="text/javascript" src="static/plugins/json2.js"></script>
|
<![endif]-->
|
<script type="text/javascript" src="static/scripts/ResizeScroll.js"></script>
|
<style>
|
html, body {
|
height: 100%;
|
width: 100%;
|
overflow: hidden;
|
}
|
|
/* .panel-body{}
|
.ptbody table td {font-size: 16px; color:#000;}
|
.ptbody table td p{margin-bottom: 10px;}
|
.pt-form-btn{bottom: 0;}
|
.datagrid-header td{ font-weight: 700;} */
|
.icheck {
|
background: url(static/images/flow/check.png) no-repeat;
|
width: 14px;
|
height: 14px;
|
display: inline-block;
|
vertical-align: -2px;
|
margin-right: 6px;
|
cursor: pointer;
|
}
|
|
.xuanzhong {
|
background: url(static/images/flow/check1.png) no-repeat;
|
}
|
</style>
|
</head>
|
|
<body>
|
<div class="" style="padding:10px 30px 0;">
|
<div class="clear">
|
<form id="form_fieldRight" method="post">
|
<div style="margin-bottom:10px;">
|
<input type="hidden" id="configId" name="configId" value="${config.configId }"/>
|
<input type="hidden" id="formId" name="formId" value="${config.formId }"/>
|
<input class="easyui-textbox" type="text" style="width:500px;" id="configName" name="configName"
|
required="true"
|
data-options="label:'字段权限名称',labelAlign:'right',labelWidth:100,prompt:'请输入字段权限名称...'"
|
value="${config.configName }"/>
|
</div>
|
</form>
|
|
</div>
|
|
<table id="dg_formfield" title="字段权限列表" style="width:100%;height:350px;">
|
</table>
|
|
<script type="text/javascript">
|
$(function () {
|
var dg_formfield = $('#dg_formfield').datagrid({
|
url: "config/flowDefinition/getFlowFieldsRightItems?formId=${config.formId}&configId=${config.configId}",
|
fitColumns: true,
|
columns: [[
|
{
|
field: 'fieldName',
|
title: '字段名称',
|
width: 200
|
},
|
{
|
field: 'fieldDisplayName',
|
title: '字段显示名称',
|
width: 200
|
},
|
{
|
field: 'enableSetRight',
|
title: '<i id="enableSetRightall" class="icheck" onclick="selectAll(this,\'enableSetRightck\');"></i>启用权限',
|
width: 120,
|
align: 'center',
|
formatter: function (value, record) {
|
return "<input id=\"chk_enableSetRight_" + record.itemId + "\" type=\"checkbox\" " + (value ? "checked" : "") + " name=\"enableSetRightck\" onclick='enableSetRightCheck(this)'/>"
|
}
|
},
|
{
|
field: 'fieldEdit',
|
title: '<i id="editall" class="icheck" onclick="selectAll(this,\'editck\');"></i>编辑',
|
width: 80,
|
align: 'center',
|
formatter: function (value, record) {
|
var enableSetRight = "true";
|
if (record.enableSetRight == null || record.enableSetRight == false) {
|
enableSetRight = "false";
|
}
|
return "<input id=\"chk_edit_" + record.itemId + "\" type=\"checkbox\" " + (value ? "checked" : "") + " name=\"editck\" onclick='return " + enableSetRight + ";'/>"
|
}
|
},
|
{
|
field: 'fieldRequired',
|
title: '<i class="icheck" id="requiredall" onclick="selectAll(this,\'requiredck\');"></i>必填',
|
width: 80,
|
align: 'center',
|
formatter: function (value, record) {
|
var enableSetRight = "true";
|
if (record.enableSetRight == null || record.enableSetRight == false) {
|
enableSetRight = "false";
|
}
|
return "<input id=\"chk_required_" + record.itemId + "\" type=\"checkbox\" " + (value ? "checked" : "") + " name=\"requiredck\" onclick='return " + enableSetRight + ";'/>"
|
}
|
},
|
{
|
field: 'fieldHidden',
|
title: '<i class="icheck" id="hiddenall" onclick="selectAll(this,\'hiddenck\');"></i>隐藏',
|
width: 80,
|
align: 'center',
|
formatter: function (value, record) {
|
var enableSetRight = "true";
|
if (record.enableSetRight == null || record.enableSetRight == false) {
|
enableSetRight = "false";
|
}
|
return "<input id=\"chk_hidden_" + record.itemId + "\" type=\"checkbox\" " + (value ? "checked" : "") + " name=\"hiddenck\" onclick='return " + enableSetRight + ";'/>"
|
}
|
}
|
]],
|
onCheckAll: function (rows) {
|
return false;
|
}
|
});
|
|
$(".datagrid-btable input[type=checkbox]").click(function () {
|
ckfun(this);
|
})
|
|
});
|
|
//启用、关闭权限设置
|
function enableSetRightCheck(e) {
|
if (e.checked == true) {
|
$("#" + e.id.replace('enableSetRight', 'edit')).removeAttr("onclick");
|
$("#" + e.id.replace('enableSetRight', 'required')).removeAttr("onclick");
|
$("#" + e.id.replace('enableSetRight', 'hidden')).removeAttr("onclick");
|
} else {
|
$("#" + e.id.replace('enableSetRight', 'edit')).attr("onclick", "return false");
|
$("#" + e.id.replace('enableSetRight', 'required')).attr("onclick", "return false");
|
$("#" + e.id.replace('enableSetRight', 'hidden')).attr("onclick", "return false");
|
}
|
}
|
|
function ckfun(obj) {
|
var trs = $(obj).closest("tr").find("input[type=checkbox]");
|
// if (obj.name == "editck") {
|
// if ($(obj).prop("checked")) {
|
// trs.eq(3).prop("checked", false);
|
// }
|
//
|
// } else
|
if (obj.name == "requiredck") {
|
if ($(obj).prop("checked")) {
|
trs.eq(1).prop("checked", true);
|
trs.eq(3).prop("checked", false);
|
}
|
}
|
// else if (obj.name == "hiddenck") {
|
// if ($(obj).prop("checked")) {
|
// trs.eq(0).prop("checked", false);
|
// trs.eq(1).prop("checked", false);
|
// trs.eq(2).prop("checked", false);
|
// }
|
// }
|
checkAll();
|
}
|
|
function checkAll() { //检查全选的情况
|
$(".icheck").each(function (i, elem) {
|
|
var name = elem.id.replace("all", "ck");
|
|
$(elem).addClass("xuanzhong");
|
$("[name=" + name + "]").each(function (index, ckelem) {
|
|
if (!$(ckelem).prop("checked")) {
|
$(elem).removeClass("xuanzhong");
|
return false;
|
}
|
|
})
|
})
|
|
}
|
|
function selectAll(obj, checkName) {
|
if ($(obj).hasClass("xuanzhong")) {
|
$("input[name=" + checkName + "]").each(function (index, elem) {
|
$(elem).prop("checked", false);
|
ckfun(elem);
|
})
|
$(obj).removeClass("xuanzhong");
|
} else {
|
$("input[name=" + checkName + "]").each(function (index, elem) {
|
$(elem).prop("checked", true);
|
ckfun(elem);
|
|
})
|
$(obj).addClass("xuanzhong");
|
}
|
return false;
|
}
|
</script>
|
|
<br/>
|
|
|
</div>
|
|
<div class="pt-form-btn" style="bottom:0;">
|
<div class="form-group">
|
<button class="pt-btn pt-btn-primary" onclick="save();">确定</button>
|
<button class="pt-btn pt-btn-default" onclick="cancel();">取消</button>
|
</div>
|
|
</div>
|
|
<script>
|
function cancel() {
|
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
|
parent.layer.close(index);
|
}
|
|
//保存
|
function save() {
|
if (!$("#form_fieldRight").form('validate')) {
|
wcp.notify.warn('请填写字段权限配置名称!');
|
return;
|
}
|
|
var rows = $("#dg_formfield").datagrid("getRows");
|
$.each(rows, function (i, elem) {
|
elem.enableSetRight = $("#chk_enableSetRight_" + elem.itemId).prop("checked");
|
elem.fieldEdit = $("#chk_edit_" + elem.itemId).prop("checked");
|
elem.fieldRequired = $("#chk_required_" + elem.itemId).prop("checked");
|
elem.fieldHidden = $("#chk_hidden_" + elem.itemId).prop("checked");
|
})
|
|
var config = $("#form_fieldRight").serializeObject();
|
|
wcp.ui.setBusy("body", wcp.ajax({
|
url: "config/flowDefinition/saveFlowFieldsRight",
|
contentType: 'application/x-www-form-urlencoded',
|
data: {
|
configStr: JSON.stringify(config),
|
itemsStr: JSON.stringify(rows)
|
}
|
}).done(function (result) {
|
config = result;
|
top.wcp.notify.success("保存成功!");
|
//保存后,如果是新的,加入到选择项中 返回名称和id。
|
parent.document.getElementById("hidden_fieldRightId").value = config.configId;
|
parent.document.getElementById("hidden_fieldRightName").value = config.configName;
|
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
|
parent.layer.close(index);
|
parent.retFieldRight();
|
}));
|
}
|
</script>
|
</body>
|
</html>
|