This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
k18-ntcs-web-ntc/src/main/webapp/WEB-INF/views/basics/sysDictForm.jsp
zhangshilin fc2af8ba04 融合代码
更新:辅助字典移动到basics目录下,
              修订数据类型条件查询无效bug,
              优化无条件分页查询代码,
              配置编码自增,用户不需手动输入(app强特征作用域选着配置功能待添加)
             无上级,改为根节点,
2018-03-06 10:06:42 +08:00

248 lines
8.7 KiB
Plaintext

<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="${ctxStatic}/pages/css/dictInfo.css" />
<script type="text/javascript" src="${ctxStatic}/pages/scripts/dict.js"></script>
<title>配置管理</title>
<script type="text/javascript">
//上级选择数据类型自动改变
function sysDictInfoTreeselectCallBack(){
var parent = $("#sysDictInfoId").val();
$.ajax({
type:'post',
async:true,
cache:false,
url:'${ctx}/basics/sysDictInfo/ajaxItemType',
data:{parent:parent},
success:function(data){
$("#itemType option").each(function(){
$(this).attr("selected",false);
});
$("#itemType").find("option[value='"+data+"']").attr("selected",true);
}
});
}
$(document).ready(function() {
//校验itemCode数值
jQuery.validator.addMethod("codeNumber",function(value,element){
return value>=0&value<=20000000},"请填写正确的数值");
jQuery.validator.addMethod("typeSame",function(value,element){
var flag=false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/sysDictInfo/ajaxType',
data:{parent:$("#sysDictInfoId").val(),child:$("#itemType option:selected").val()},
success:function(data){
flag=data;
}
});
return flag;
},"请选择正确的数据类型");
//校验更改数据类型后校验数据类型是否与下级冲突
jQuery.validator.addMethod("typeChild",function(value,element){
var flag=false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/sysDictInfo/ajaxChildrenType',
data:{parent:"${sysDictInfo.sysDictId}",newItemType:$("#itemType option:selected").val()},
success:function(data){
flag=data;
}
});
return flag;
},"该配置包含下级配置,数据类型更改后上下级类型不一致");
//校验叶子节点有下级不得更改为叶子节点
jQuery.validator.addMethod("leafChange",function(value,element){
var flag=false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/sysDictInfo/ajaxLeafChange',
data:{parent:"${sysDictInfo.sysDictId}",newIsLeaf:$("#isLeaf option:selected").val()},
success:function(data){
flag=data;
}
});
return flag;
},"该配置包含下级配置,不得改为叶子节点");
//校验叶子节点无上级不得选为叶子节点
jQuery.validator.addMethod("leafHasTree",function(value,element){
var flag=false;
$.ajax({
type:'post',
async:false,
url:'${ctx}/basics/sysDictInfo/ajaxLeafHasTree',
data:{sysDictId:"${sysDictInfo.sysDictId}",newIsLeaf:$("#isLeaf option:selected").val(),parentId:$("#sysDictInfoId").val()},
success:function(data){
flag=data;
}
});
return flag;
},"该配置上级为根节点,不得设为叶子节点");
$("#name").focus();
$("#inputForm").validate({
//需验证 item_code item_value
rules: {
'itemValue':{
required:true
},
'itemType':{
typeSame:true,
typeChild:true
},
'isLeaf':{
leafChange:true,
leafHasTree:true
}
},
messages: {
'itemValue':{
required:'编码对应值必须填写'
},
'itemType':{
typeSame:'请选择一致的上下级配置数据类型',
typeChild:'该配置包含下级配置,数据类型更改后与子类不一致'
},
'isLeaf':{
leafChange:'该配置包含下级配置,不得改为叶子节点',
leafHasTree:'该配置上级为根节点,不得设为叶子节点'
}
},
submitHandler: function(form){
loading('正在提交,请稍等...');
form.submit();
},
errorContainer: "#messageBox",
errorPlacement: function(error, element) {
$("#messageBox").text("输入有误,请先更正。");
if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
error.appendTo(element.parent().parent());
} else {
error.insertAfter(element);
}
}
});
});
</script>
</head>
<body>
<div class="page-content">
<div class="theme-panel hidden-xs hidden-sm">
<button type="button" class="btn btn-default" onclick="history.go(-1)">返回</button>
</div>
<h3 class="page-title">
配置管理
</h3>
<div class="row">
<div class="col-md-12">
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>配置<shiro:hasPermission name="sys:menu:edit">${not empty sysDictInfo.sysDictId?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="sys:menu:edit">查看</shiro:lacksPermission></div>
<div class="tools">
<!-- <a href="javascript:;" class="collapse"> </a>
<a href="#portlet-config" data-toggle="modal" class="config"> </a>
<a href="javascript:;" class="reload"> </a>
<a href="javascript:;" class="remove"> </a> -->
</div>
</div>
<div class="portlet-body form">
<div class="form-body">
<!-- BEGIN FORM-->
<form:form id="inputForm" modelAttribute="sysDictInfo" action="${ctx}/basics/sysDictInfo/saveOrUpdate?itType=${itType}" method="post" class="form-horizontal">
<form:hidden path="sysDictId"/>
<sys:message content="${message}"/>
<div class="form-group">
<label class="col-md-3 control-label">上级配置:</label>
<div class="col-md-4">
<sys:treeselect id="sysDictInfo" name="parent.sysDictId" value="${sysDictInfo.parent.sysDictId}" labelName="parent.itemValue" labelValue="${sysDictInfo.parent.itemValue eq '根节点'?'根节点':fns:getSysDictInfoById(sysDictInfo.parent.sysDictId).itemValue}"
title="菜单" url="/basics/sysDictInfo/treeData?itType=${itType}" extId="${sysDictInfo.sysDictId}" cssClass="required form-control"/>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label radio-lable"><font color="red">*</font> 数据类型:</label>
<div class="col-md-4">
<select id="itemType" name="itemType" class="form-control">
<c:forEach items="${fns:getDictList('SYS_DICT_ITM_TYPE')}" var="dict">
<c:forEach items="${intArr}" var="itTemp">
<c:if test="${dict.itemCode eq itTemp}">
<option value="${dict.itemCode}"
<c:if test="${sysDictInfo.itemType eq dict.itemCode}">selected="selected"</c:if>
>${dict.itemValue}</option>
</c:if>
</c:forEach>
</c:forEach>
</select>
</div>
</div>
<%-- <div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font>配置编码:</label>
<div class="col-md-4">
<form:input path="itemCode" htmlEscape="false" maxlength="50" class="form-control"/>
</div>
</div> --%>
<div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font>配置内容:</label>
<div class="col-md-4">
<form:input path="itemValue" htmlEscape="false" maxlength="2000" class="form-control"/>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"><font color="red">*</font>是否为叶子节点:</label>
<div class="col-md-4">
<%-- <form:radiobuttons path="isLeaf" items="${fns:getDictOption('SYS_YES_NO')}" /> --%>
<form:select path="isLeaf" class="form-control">
<form:options items="${fns:getDictList('SYS_YES_NO')}" itemLabel="itemValue" itemValue="itemCode" htmlEscape="false"/>
</form:select>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">描述信息:</label>
<div class="col-md-4">
<form:textarea path="itemDesc" htmlEscape="false" maxlength="2000" class="form-control"/>
</div>
</div>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-3 col-md-9">
<shiro:hasPermission name="sys:menu:edit"><button type="submit" class="btn btn-circle blue">保存</button></shiro:hasPermission>
<button type="button" class="btn btn-circle grey-salsa btn-outline" onclick="history.go(-1)">Cancel</button>
</div>
</div>
</div>
</form:form>
<!-- END FORM-->
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>