Przeglądaj źródła

优化和调整入职登记模块代码

user5 4 lat temu
rodzic
commit
3e7cd65424

+ 106 - 0
src/main/webapp/WEB-INF/tags/sys/treeselectOnNotRequest.tag

@@ -0,0 +1,106 @@
+<%@ tag language="java" pageEncoding="UTF-8"%>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<%@ attribute name="id" type="java.lang.String" required="true" description="编号"%>
+<%@ attribute name="name" type="java.lang.String" required="true" description="隐藏域名称(ID)"%>
+<%@ attribute name="value" type="java.lang.String" required="true" description="隐藏域值(ID)"%>
+<%@ attribute name="labelName" type="java.lang.String" required="true" description="输入框名称(Name)"%>
+<%@ attribute name="labelValue" type="java.lang.String" required="true" description="输入框值(Name)"%>
+<%@ attribute name="title" type="java.lang.String" required="true" description="选择框标题"%>
+<%@ attribute name="url" type="java.lang.String" required="true" description="树结构数据地址"%>
+<%@ attribute name="checked" type="java.lang.Boolean" required="false" description="是否显示复选框,如果不需要返回父节点,请设置notAllowSelectParent为true"%>
+<%@ attribute name="extId" type="java.lang.String" required="false" description="排除掉的编号(不能选择的编号)"%>
+<%@ attribute name="isAll" type="java.lang.Boolean" required="false" description="是否列出全部数据,设置true则不进行数据权限过滤(目前仅对Office有效)"%>
+<%@ attribute name="notAllowSelectRoot" type="java.lang.Boolean" required="false" description="不允许选择根节点"%>
+<%@ attribute name="notAllowSelectParent" type="java.lang.Boolean" required="false" description="不允许选择父节点"%>
+<%@ attribute name="module" type="java.lang.String" required="false" description="过滤栏目模型(只显示指定模型,仅针对CMS的Category树)"%>
+<%@ attribute name="selectScopeModule" type="java.lang.Boolean" required="false" description="选择范围内的模型(控制不能选择公共模型,不能选择本栏目外的模型)(仅针对CMS的Category树)"%>
+<%@ attribute name="allowClear" type="java.lang.Boolean" required="false" description="是否允许清除"%>
+<%@ attribute name="allowInput" type="java.lang.Boolean" required="false" description="文本框可填写"%>
+<%@ attribute name="cssClass" type="java.lang.String" required="false" description="css样式"%>
+<%@ attribute name="cssStyle" type="java.lang.String" required="false" description="css样式"%>
+<%@ attribute name="smallBtn" type="java.lang.Boolean" required="false" description="缩小按钮显示"%>
+<%@ attribute name="hideBtn" type="java.lang.Boolean" required="false" description="是否显示按钮"%>
+<%@ attribute name="disabled" type="java.lang.String" required="false" description="是否限制选择,如果限制,设置为disabled"%>
+<%@ attribute name="dataMsgRequired" type="java.lang.String" required="false" description=""%>
+<%@ attribute name="rule" type="java.lang.String" required="false" description="考勤规则模块用"%>
+	<input id="${id}Id" name="${name}" class="${cssClass}" type="hidden" value="${value}"/>
+	<div class="input-group">
+		<input id="${id}Name" name="${labelName}" ${allowInput?'':'readonly="readonly"'}  type="text" value="${labelValue}" data-msg-required="${dataMsgRequired}"
+		class="${cssClass}" style="${cssStyle}"/>
+       		 <span class="input-group-btn">
+	       		 <button type="button"  id="${id}Button" class="btn <c:if test="${fn:contains(cssClass, 'input-sm')}"> btn-sm </c:if><c:if test="${fn:contains(cssClass, 'input-lg')}"> btn-lg </c:if>  btn-primary ${disabled} ${hideBtn ? 'hide' : ''}"><i class="fa fa-search"></i>
+	             </button> 
+       		 </span>
+
+    </div>
+	 <label id="${id}Name-error" class="error" for="${id}Name" style="display:none"></label>
+<script type="text/javascript">
+	$("#${id}Button, #${id}Name").click(function(){
+		// 是否限制选择,如果限制,设置为disabled
+		if ($("#${id}Button").hasClass("disabled")){
+			return true;
+		}
+		// 正常打开
+		top.layer.open({
+		    type: 2,
+		    area: ['300px', '420px'],
+		    title:"选择${title}",
+		    ajaxData:{selectIds: $("#${id}Id").val()},
+		    content: "${ctx}/tag/treeselect?url="+encodeURIComponent("${url}")+"&module=${module}&checked=${checked}&extId=${extId}&isAll=${isAll}&unit=${unit}" ,
+		    btn: ['确定', '关闭']
+    	       ,yes: function(index, layero){ //或者使用btn1
+						var tree = layero.find("iframe")[0].contentWindow.tree;//h.find("iframe").contents();
+						var ids = [], names = [], nodes = [];
+						if ("${checked}" == "true"){
+							nodes = tree.getCheckedNodes(true);
+						}else{
+							nodes = tree.getSelectedNodes();
+						}
+						for(var i=0; i<nodes.length; i++) {//<c:if test="${checked && notAllowSelectParent}">
+							if (nodes[i].isParent){
+								continue; // 如果为复选框选择,则过滤掉父节点
+							}//</c:if><c:if test="${notAllowSelectRoot}">
+							if (nodes[i].level == 0){
+								//top.$.jBox.tip("不能选择根节点("+nodes[i].name+")请重新选择。");
+								top.layer.msg("不能选择根节点("+nodes[i].name+")请重新选择。", {icon: 0});
+								return false;
+							}//</c:if><c:if test="${notAllowSelectParent}">
+							if (nodes[i].isParent){
+								//top.$.jBox.tip("不能选择父节点("+nodes[i].name+")请重新选择。");
+								//layer.msg('有表情地提示');
+								top.layer.msg("不能选择父节点("+nodes[i].name+")请重新选择。", {icon: 0});
+								return false;
+							}//</c:if><c:if test="${not empty module && selectScopeModule}">
+							if (nodes[i].module == ""){
+								//top.$.jBox.tip("不能选择公共模型("+nodes[i].name+")请重新选择。");
+								top.layer.msg("不能选择公共模型("+nodes[i].name+")请重新选择。", {icon: 0});
+								return false;
+							}else if (nodes[i].module != "${module}"){
+								//top.$.jBox.tip("不能选择当前栏目以外的栏目模型,请重新选择。");
+								top.layer.msg("不能选择当前栏目以外的栏目模型,请重新选择。", {icon: 0});
+								return false;
+							}//</c:if>
+							ids.push(nodes[i].id);
+							names.push(nodes[i].name);//<c:if test="${!checked}">
+							break; // 如果为非复选框选择,则返回第一个选择  </c:if>
+						}
+						$("#${id}Id").val(ids.join(",").replace(/u_/ig,"")).change();
+						$("#${id}Name").val(names.join(",")).change();
+						$("#${id}Name").focus();
+						var rule="${rule}";
+						var id="${id}";
+						if(rule=='rule'){
+                            var _placeName =  id.split("_")[0]+"_placeName";
+                            var _itude =  id.split("_")[0]+"_itude";
+                            $("#"+_placeName).val("");
+                            $("#"+_itude).val("");
+						}
+						top.layer.close(index);
+				    	       },
+    	cancel: function(index){ //或者使用btn2
+    	           //按钮【按钮二】的回调
+    	       }
+		});
+
+	});
+</script>

+ 6 - 6
src/main/webapp/webpage/modules/workstaff/workStaffBasicInfoForm.jsp

@@ -440,9 +440,9 @@
                     </div>
                 </div>
                 <div class="layui-item layui-col-sm6 lw7">
-                    <label class="layui-form-label"><span class="require-item">*</span>移动电话:</label>
+                    <label class="layui-form-label">移动电话:</label>
                     <div class="layui-input-block">
-                        <form:input path="mobile" id="mobile" htmlEscape="false" class="form-control layui-input required isPhone"/>
+                        <form:input path="mobile" id="mobile" htmlEscape="false" class="form-control layui-input isPhone"/>
                         <span id="ph" style="color: #CC5965"></span>
                     </div>
                 </div>
@@ -487,9 +487,9 @@
                     </div>
                 </div>
                 <div class="layui-item layui-col-sm6 lw7">
-                    <label class="layui-form-label"><span class="require-item">*</span>籍    贯:</label>
+                    <label class="layui-form-label">籍    贯:</label>
                     <div class="layui-input-block with-icon">
-                        <sys:treeselect id="nativePlace" name="nativePlace.id" value="${workStaffBasicInfo.nativePlace.id}" labelName="" labelValue="${workStaffBasicInfo.nativePlace.name}"
+                        <sys:treeselectOnNotRequest id="nativePlace" name="nativePlace.id" value="${workStaffBasicInfo.nativePlace.id}" labelName="" labelValue="${workStaffBasicInfo.nativePlace.name}"
                                         title="区域" url="/sys/area/treeData" cssClass="form-control layui-input" allowClear="true" notAllowSelectParent="true"/>
                     </div>
                 </div>
@@ -536,9 +536,9 @@
                     </div>
                 </div>
                 <div class="layui-item layui-col-sm6 lw7">
-                    <label class="layui-form-label"><span class="require-item">*</span>入职日期:</label>
+                    <label class="layui-form-label">入职日期:</label>
                     <div class="layui-input-block">
-                        <input id="entryDate" name="entryDate" type="text" maxlength="20" readonly class="laydate-icondate form-control layui-input layer-date laydate-icon required"
+                        <input id="entryDate" name="entryDate" type="text" maxlength="20" readonly class="laydate-icondate form-control layui-input layer-date laydate-icon"
                                value="<fmt:formatDate value="${workStaffBasicInfo.entryDate}" pattern="yyyy-MM-dd"/>"/>
                     </div>
                 </div>

+ 3 - 3
src/main/webapp/webpage/modules/workstaff/workStaffBasicInfoView.jsp

@@ -134,7 +134,7 @@
                         </div>
                     </div>
                     <div class="layui-item layui-col-sm6 lw7">
-                        <label class="layui-form-label"><span class="require-item">*</span>移动电话:</label>
+                        <label class="layui-form-label">移动电话:</label>
                         <div class="layui-input-block">
                             <form:input path="mobile" htmlEscape="false" readonly="true" class="form-control  layui-input"/>
                         </div>
@@ -170,7 +170,7 @@
                         </div>
                     </div>
                     <div class="layui-item layui-col-sm6 lw7">
-                        <label class="layui-form-label"><span class="require-item">*</span>籍    贯:</label>
+                        <label class="layui-form-label">籍    贯:</label>
                         <div class="layui-input-block">
                             <input name="nativePlace.name" value="${workStaffBasicInfo.nativePlace.name}" type="text" readonly="true" class="form-control  layui-input" />
                         </div>
@@ -218,7 +218,7 @@
                         </div>
                     </div>
                     <div class="layui-item layui-col-sm6 lw7">
-                        <label class="layui-form-label"><span class="require-item">*</span>入职日期:</label>
+                        <label class="layui-form-label">入职日期:</label>
                         <div class="layui-input-block">
                             <input name="entryDate" value="<fmt:formatDate value="${workStaffBasicInfo.entryDate}" pattern="yyyy-MM-dd"/>" type="text" readonly="true" class="form-control  layui-input" />
                         </div>