<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
|
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
<%
|
String path = request.getContextPath();
|
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
|
+ path + "/";
|
%>
|
|
<!DOCTYPE HTML>
|
<html>
|
<head>
|
<base href="<%=basePath%>">
|
<meta name="viewport" charset="width=device-width, initial-scale=1.0">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<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/initialize.css" type="text/css">
|
<link rel="stylesheet" href="static/styles/common.css" type="text/css">
|
<link rel="stylesheet" href="static/plugins/layer/skin/default/layer.css" type="text/css">
|
<script type="text/javascript" src="static/plugins/jquery/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/layer/layer.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>
|
<!-- wcp组件 -->
|
<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/wcp/scripts/libs/wcp.infoPicker.js"></script>
|
<style>
|
.combobox-group {
|
clear: both;
|
}
|
|
.combobox-gitem {
|
float: left;
|
padding-right: 10px;
|
}
|
|
|
/*--------------------------------------------------- online layer ------------------------------------*/
|
.takenum0 {
|
display: table;
|
text-align: center;
|
margin: 0 auto;
|
}
|
|
.takenum0label {
|
display: table-cell;
|
vertical-align: middle;
|
text-align: center;
|
}
|
|
/*.takenum0label span{margin: 0 4px 10px 4px;}*/
|
.takenum0label span {
|
margin: 0 0 10px 0;
|
}
|
|
.takenum0label input {
|
margin: 0 0 10px 0;
|
}
|
|
.takenum1 {
|
display: table;
|
text-align: center;
|
margin: 0 auto;
|
}
|
|
.takenum1label {
|
display: table-cell;
|
vertical-align: middle;
|
text-align: center;
|
}
|
|
.takenum1 .fa {
|
font-size: 30px;
|
float: left;
|
margin: 0 20px 0 0;
|
}
|
|
.takenum1 p {
|
float: left;
|
line-height: 30px;
|
}
|
</style>
|
|
</head>
|
<body>
|
<div class="container">
|
<div class="takenum0" style="height: 106px;">
|
<div class="takenum0label">
|
<form id="getCodingForm" method="post">
|
<c:forEach var="section" items="${codingSectionList}" varStatus="staturs">
|
|
<c:if test="${section.sectionType == '1' }">
|
<!-- 数据字典 -->
|
<c:if test="${section.splitPre != null && section.splitPre != ''}">
|
<span id="coding_${staturs.index}_start">${section.splitPre}</span>
|
</c:if>
|
<input id="coding_${staturs.index}_input" style="width:100px;" class="easyui-combobox"
|
data-options="required:true,panelHeight:'95px',editable:false,valueField: 'paramValue',textField: 'paramName',url: 'management/keywordParam/listKeywordParamBykeywordId?keywordId=${section.sectionRuleKeywordId}'"
|
/>
|
<c:if test="${section.splitSign != null && section.splitSign != ''}">
|
<span id="coding_${staturs.index}_end">${section.splitSign}</span>
|
</c:if>
|
</c:if>
|
<c:if test="${section.sectionType == '3' }">
|
<!-- 流水号 -->
|
<c:if test="${section.splitPre != null && section.splitPre != ''}">
|
<span id="coding_${staturs.index}_start">${section.splitPre}</span>
|
</c:if>
|
<input class="easyui-numberbox" id="coding_${staturs.index}_input" type="text"
|
style="width:70px"
|
data-options="required:true,editable:true,validType:'number',min:${section.minValue},max:${section.maxValue}"
|
value=""/>
|
<c:if test="${section.splitSign != null && section.splitSign != ''}">
|
<span id="coding_${staturs.index}_end">${section.splitSign}</span>
|
</c:if>
|
</c:if>
|
<c:if test="${section.sectionType == '2' || section.sectionType == '4' || section.sectionType == '5' }">
|
<c:if test="${section.splitPre != null && section.splitPre != ''}">
|
<span id="coding_${staturs.index}_start">${section.splitPre}</span>
|
</c:if>
|
<input class="easyui-textbox" id="coding_${staturs.index}_input" type="text" style="width:70px"
|
data-options="required:true,editable:true" value=""/>
|
<c:if test="${section.splitSign != null && section.splitSign != ''}">
|
<span id="coding_${staturs.index}_end">${section.splitSign}</span>
|
</c:if>
|
</c:if>
|
<input id="coding_${staturs.index}_sectionType" type="hidden" style="width:0px;"
|
value="${section.sectionType}"/>
|
<input id="coding_${staturs.index}_sectionRule" type="hidden" style="width:0px;"
|
value="${section.sectionRule}"/>
|
</c:forEach>
|
<%-- <input class="easyui-textbox" type="text" style="width:100px" /><span>-</span><input class="easyui-textbox" type="text" style="width:100px" /><span>-</span><input class="easyui-textbox" type="text" style="width:100px" /><span>-</span><input class="easyui-textbox" type="text" style="width:100px" />--%>
|
</form>
|
</div>
|
</div>
|
<div class="pt-form-btn" style="bottom:0px;">
|
<div class="form-group">
|
<button type="button" class="pt-btn pt-btn-success" id="btnGetCoding">取号</button>
|
<button type="button" class="pt-btn pt-btn-primary" id="btnSave">确定</button>
|
<button type="reset" class="pt-btn pt-btn-default" id="btnClose">取消</button>
|
</div>
|
</div>
|
</div>
|
</body>
|
<script type="text/javascript" src="static/scripts/ResizeScroll.js"></script>
|
<script>
|
//窗口参数,用于弹窗传递
|
var params = {
|
parent: null,
|
callBack: null,
|
callBackParams: null,
|
controlNames: null,
|
formData: null
|
};
|
|
|
var _sectionLen = ${codingSectionList.size()};
|
var _sectionSelectData = {};
|
//递归调用 getCodingSnPre 次数,增加机制防止死循环
|
var _count = 0
|
$(function () {
|
getCodingSnPre();
|
/**
|
* 确定按钮点击事件
|
*/
|
$("#btnSave").click(function () {
|
|
if (!$("#getCodingForm").form('validate')) {
|
wcp.notify.warn('表单验证有误,请检查表单输入项!');
|
return;
|
}
|
//easyui校验没有去空格,增加额外的校验
|
if (!checkFormData()) {
|
wcp.notify.warn('表单验证有误,请检查表单输入项!');
|
return;
|
}
|
getFormData();
|
var _code = getCoding();
|
|
|
var obj = {};
|
if (params.formData) {
|
obj = params.formData;
|
}
|
obj._sectionSelectData = _sectionSelectData;
|
obj._codeValue = _code;
|
//console.info(JSON.stringify(obj));
|
$.ajax({
|
type: 'POST',
|
contentType: "application/json; charset=utf-8",
|
url: "config/coding/getCodingSnPopupToCache?codingId=${coding.codingId}",
|
dataType: 'json',
|
data: JSON.stringify(obj),
|
success: function (data) {
|
//回调函数
|
if (params.callBack) {
|
if (params.callBackParams) {
|
params.callBack(params.callBackParams);
|
} else {
|
params.callBack(params.controlNames, _code, _sectionSelectData);
|
}
|
}
|
closeWindow();
|
}
|
});
|
|
});
|
|
/**
|
* 取消按钮点击事件
|
*/
|
$("#btnClose").click(function () {
|
closeWindow();
|
});
|
|
/**
|
* 取号按钮点击事件
|
*/
|
$("#btnGetCoding").click(function () {
|
getCodingSn();
|
});
|
|
/**
|
* 下拉框注册事件 onSelect
|
*/
|
// $('.easyui-combobox').combobox({
|
// onSelect: function(params){
|
// if(params){
|
// var _id = this.id.replace('_input','');
|
// var _ids = _id+"_start";
|
// var _ide = _id+"_end";
|
// $("#"+_id).val($("#"+_ids).text()+params.paramName+$("#"+_ide).text());
|
// }
|
// }
|
// })
|
|
/**
|
*校验是否所有的 字典类型 用户都选择了相应的值 校验
|
*/
|
// function checkSelectElementValue() {
|
// _sectionSelectData = {};
|
// var _r = true;
|
// for (var i = 0; i < _sectionLen; i++) {
|
// if($("#coding_"+i+"_sectionType").val() == '1'){
|
// var _selectV = $("#coding_"+i+"_input").val();
|
// if(_selectV == ''){
|
// return false;
|
// }else{
|
// var _key="select_"+i;
|
// _sectionSelectData[_key] = $("#coding_"+i+"_input").combobox('getText');
|
// }
|
// }
|
// }
|
// return _r;
|
// }
|
|
/**
|
* 组装解析所有号段,生成最新的号码
|
*/
|
function getCodingSn() {
|
var obj = {};
|
if (params.formData) {
|
obj = params.formData;
|
}
|
//标记是弹出
|
obj._isPopup = "1";
|
obj._sectionSelectData = getFormData();
|
//console.info(JSON.stringify(obj));
|
$.ajax({
|
type: 'POST',
|
contentType: "application/json; charset=utf-8",
|
url: "config/coding/getCodingSn?codingId=${coding.codingId}",
|
dataType: 'json',
|
data: JSON.stringify(obj),
|
success: function (data) {
|
//console.info(data);
|
var codingData = $.parseJSON(data);
|
for (var i = 0; i < _sectionLen; i++) {
|
if ($("#coding_" + i + "_sectionType").val() == '1') {
|
$("#coding_" + i + "_input").combobox('setValue', codingData["coding_" + i + "_input"]);
|
} else {
|
$("#coding_" + i + "_input").textbox("setValue", codingData["coding_" + i + "_input"]);
|
}
|
|
|
}
|
}
|
});
|
}
|
|
|
//进入页面预调用 getCodingSn ,递归操作,直到params.formData不为null或 _count机制触发
|
function getCodingSnPre() {
|
if (_count > 10) {
|
return;
|
}
|
setTimeout(function () {
|
if (params.formData == null) {
|
_count++;
|
getCodingSnPre();
|
} else {
|
getCodingSn();
|
}
|
}, 100);
|
}
|
|
//获取用户输入项
|
function getFormData() {
|
_sectionSelectData = {};
|
for (var i = 0; i < _sectionLen; i++) {
|
var _key = "input_" + i;
|
if ($("#coding_" + i + "_sectionType").val() == '1') {
|
_sectionSelectData[_key] = $.trim($("#coding_" + i + "_input").combobox('getValue'));
|
} else {
|
_sectionSelectData[_key] = $.trim($("#coding_" + i + "_input").val());
|
}
|
}
|
return _sectionSelectData;
|
}
|
|
//获取生成的码 包含前缀 后缀
|
function getCoding() {
|
var code = '';
|
for (var i = 0; i < _sectionLen; i++) {
|
if ($("#coding_" + i + "_sectionType").val() == '1') {
|
code += $.trim($("#coding_" + i + "_start").text());
|
code += $.trim($("#coding_" + i + "_input").combobox('getValue'));
|
code += $.trim($("#coding_" + i + "_end").text());
|
} else if ($("#coding_" + i + "_sectionType").val() == '3') {
|
//流水号
|
code += $.trim($("#coding_" + i + "_start").text());
|
var _sectionRule = $("#coding_" + i + "_sectionRule").val()
|
var _input = $.trim($("#coding_" + i + "_input").val());
|
code += PrefixZero(Number(_input), Number(_sectionRule));
|
code += $.trim($("#coding_" + i + "_end").text());
|
} else {
|
code += $.trim($("#coding_" + i + "_start").text());
|
code += $.trim($("#coding_" + i + "_input").val());
|
code += $.trim($("#coding_" + i + "_end").text());
|
}
|
}
|
return code;
|
}
|
|
//校验用户输入项是否有空值
|
function checkFormData() {
|
for (var i = 0; i < _sectionLen; i++) {
|
if ($.trim($("#coding_" + i + "_input").val()) == '') {
|
return false;
|
}
|
}
|
return true;
|
}
|
|
});
|
|
|
/**
|
* 关闭窗口
|
*/
|
function closeWindow() {
|
var index = top.layer.getFrameIndex(window.name); //获取窗口索引
|
top.layer.close(index);
|
}
|
|
|
/**
|
* 自定义函数名:PrefixZero
|
* @param num: 被操作数
|
* @param n: 固定的总位数
|
*/
|
function PrefixZero(num, n) {
|
return (Array(n).join(0) + num).slice(-n);
|
}
|
</script>
|
</html>
|