excelInitModule.jsp 20 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415

<%@ page language="java" contentType="text/html; charset=UTF-8" %> 
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ include file="/formmode/checkright4setting.jsp" %>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<link type="text/css" rel="stylesheet" href="/formmode/exceldesign/css/excel_wev8.css"/>
<%
	String modeid= Util.null2String(request.getParameter("modeid"));
	String formid = Util.null2String(request.getParameter("formid"));
	String opentype = Util.null2String(request.getParameter("opentype"));//是否e9打开 
	String layoutid = Util.null2String(request.getParameter("layoutid"));
	String layouttype = Util.null2String(request.getParameter("layouttype"));
	String isdefault = Util.null2String(request.getParameter("isdefault"));
	String fromwhere = Util.null2String(request.getParameter("fromwhere"));	//区分节点属性批量设置进来的

	int isecme = Util.getIntValue(request.getParameter("isecme"),0);	//是否集成建模
	int categoryid = Util.getIntValue(request.getParameter("categoryid"),-1);	//类型
	int feaid = Util.getIntValue(request.getParameter("feaid"),0);	//功能id
	int appid = Util.getIntValue(request.getParameter("appid"),0);	//应用id
	String isfieldisplay = "display:block";

%>
<HTML><HEAD>
	
</HEAD>
<BODY>
<div class="editor_nav newcolor">
    <div class="container">
        <div class="btns">
            <span title="<%=SystemEnv.getHtmlLabelName(128845,user.getLanguage())%>" class="close" onclick="parentDialog.close();"> </span>&nbsp;<!--关闭-->
        </div>
        <div class="moduleHeadStep">
        	<span name="ssstep" class="step1" style="padding-left:30px;"><%=SystemEnv.getHtmlLabelName(386383,user.getLanguage())%></span><!--设置字段属性-->
        </div>
        <div class="moduleHeadSplitLine" style="width:215px;"></div>
        <div class="moduleStep4Field"></div>
        <div class="moduleStep4Style"></div>
        <div class="moduleStep4Complete"></div>
    </div>
</div>
<div id="loadingdiv" style="font-size: 14px;text-align: center;line-height: 400px;"><span style="border: 1px solid #e1e1e1;text-align: center;color: #59627c;padding:9px;padding-left:15px;padding-right:15px;"><img src="/formmode/exceldesign/image/shortBtn/onload_wev8.png" border="no" style="position: relative;top: 3px;margin-right: 10px;" /> <span><%=SystemEnv.getHtmlLabelName(128943,user.getLanguage())%></span></span></div><!--正在加载,请稍候...-->
<div style="width:100%;height:100%;">
	<div class="moduleContainter" style="display:none;">
		<div class="fieldContainer" style="width:100%;height:100%;overflow-x:hidden;overflow-y:auto;border-top: 1px solid #ececec;<%=isfieldisplay %>">
			<%if("initdetail".equals(fromwhere)){ %>
                <jsp:include page="/formmode/exceldesign/editDetailFieldAttr.jsp">
                    <jsp:param name="layoutid" value="<%=layoutid %>" />
                    <jsp:param name="modeId" value="<%=modeid %>" />
                    <jsp:param name="layouttype" value="<%=layouttype %>" />
                    <jsp:param name="formid" value='<%=request.getParameter("formid") %>' />
                    <jsp:param name="isbill" value='<%=request.getParameter("isbill") %>' />
                    <jsp:param name="detailindex" value='<%=request.getParameter("detailindex") %>' />
                    <jsp:param name="viewonly" value='<%=Util.null2String(request.getParameter("viewonly")) %>' />
					<jsp:param name="isecme" value='<%=request.getParameter("isecme") %>' />
					<jsp:param name="feaid" value='<%=feaid %>' />
					<jsp:param name="appid" value='<%=appid %>' />
					<jsp:param name="categoryid" value='<%=categoryid %>' />
                </jsp:include>
            <%}else{  %>
			<jsp:include page="/formmode/setup/EditHtmlField.jsp">
				<jsp:param name="modeId" value="<%=modeid %>" />
				<jsp:param name="formId" value="<%=formid %>" />
				<jsp:param name="opentype" value="<%=opentype %>" />
				<jsp:param name="Id" value="<%=layoutid %>"/>
				<jsp:param name="type" value="<%=layouttype %>" />
				<jsp:param name="isdefault" value="<%=isdefault %>" />
				<jsp:param name="isExcel" value="1"/>
				<jsp:param name="design" value="0"/>
				<jsp:param name="fromwhere" value="<%=fromwhere %>"/>
				<jsp:param name="isecme" value='<%=isecme %>' />
				<jsp:param name="feaid" value='<%=feaid %>' />
				<jsp:param name="appid" value='<%=appid %>' />
				<jsp:param name="categoryid" value='<%=categoryid %>' />
			</jsp:include>
			<%} %>
		</div>
		
		<div class="styleContainer" style="display:none;overflow-y:auto;">
			<div class="styleDiv">
				<input type=checkbox notBeauty=true name="styleCheck" checked /> <span name="checkstylename"><%=SystemEnv.getHtmlLabelName(24518,user.getLanguage())%></span><!--蓝色-->
				<div target=1 class="style1 selected" issys="sys">
					<div name="e_style_1" class="tylelement" style="text-align:left;">
						<div name="_label1" style="width: 60px;height:31px;line-height:31px;float: left;border: 1px solid #90badd;padding-left: 10px;background:#e7f3fc"><%=SystemEnv.getHtmlLabelName(31644,user.getLanguage())%></div><!--字段名-->
						<div name="_field1" style="border: 1px solid #90badd;padding-left: 80px;height:31px;line-height:31px;"><%=SystemEnv.getHtmlLabelName(33473,user.getLanguage())%></div><!--表单内容-->
						<div name="_label1" style="float: left;width: 60px;height:31px;line-height:31px;border: 1px solid #90badd;padding-left: 10px;margin-top: -1px;background:#e7f3fc;"><%=SystemEnv.getHtmlLabelName(31644,user.getLanguage())%></div><!--字段名-->
						<div name="_field1" style="border: 1px solid #90badd;margin-top: -1px;padding-left: 80px;height:31px;line-height:31px;"><%=SystemEnv.getHtmlLabelName(33473,user.getLanguage())%></div><!--表单内容-->
						<div name="_label1" style="width: 95px;height:31px;line-height:31px;float: left;border: 1px solid #90badd;padding-left: 10px;background:#e7f3fc;margin-top: -1px;"><%=SystemEnv.getHtmlLabelName(31644,user.getLanguage())%></div><!--字段名-->
						<div name="_label1" style="border: 1px solid #90badd;padding-left: 115px;margin-top: -1px;background:#e7f3fc;height:31px;line-height:31px;"><%=SystemEnv.getHtmlLabelName(31644,user.getLanguage())%></div><!--字段名-->
						<div name="_field1" style="float: left;width: 95px;border: 1px solid #90badd;padding-left: 10px;margin-top: -1px;height:31px;line-height:31px;"><%=SystemEnv.getHtmlLabelName(33473,user.getLanguage())%></div><!--表单内容-->
						<div name="_field1" style="border: 1px solid #90badd;margin-top: -1px;padding-left: 115px;height:31px;line-height:31px;"><%=SystemEnv.getHtmlLabelName(33473,user.getLanguage())%></div><!--表单内容-->
					</div>
				</div>
			</div>
			
		</div>
		<div class="completeContainer" style="display:none;">
			<%=SystemEnv.getHtmlLabelName(128944,user.getLanguage())%>
		</div><!--正在初始化模板,请稍候……-->
	</div>
    <div id="zDialog_div_bottom" class="zDialog_div_bottom">
		<wea:layout needImportDefaultJsAndCss="false">
			<wea:group context=""  attributes="{groupDisplay:none}">
				<wea:item type="toolbar">
					<input type="button" value="<%=SystemEnv.getHtmlLabelName(1876,user.getLanguage())%>" id="prevStepBtn" style="display:none" class="zd_btn_cancle" onclick="onPrevStep()"><!--上一步-->
					<%if(!"batchset".equals(fromwhere)&&!"initdetail".equals(fromwhere)){ %>
					<!--<input type="button" value="<%=SystemEnv.getHtmlLabelName(383323,user.getLanguage())%>" id="saveAttrBtn" class="zd_btn_cancle" onclick="onSaveSttr()">--><!--保存-->
					<%} %>
					<input type="button" value="<%=SystemEnv.getHtmlLabelName(1402,user.getLanguage())%>" id="nextStepBtn"  class="zd_btn_cancle" onclick="onNextStep()"><!--下一步-->
					<input type="button" value="<%=SystemEnv.getHtmlLabelName(201,user.getLanguage())%>" id="cancelBtn"  class="zd_btn_cancle" onclick="dialog.closeByHand()"><!--取消-->
				</wea:item>
			</wea:group>
		</wea:layout>      
	  </div>
</div>
	<script type="text/javascript">
		var dialog;
		var layouttype = "<%=layouttype%>";
		var fromwhere = "<%=fromwhere%>";
		jQuery(document).ready(function(){
			dialog = window.top.getDialog(window);
			$("#loadingdiv").hide();
			$(".moduleContainter").show();
			$("span.e8_sep_line:first").css("display","none");
			var h = jQuery(document.body).height();
			if(dialog){
				h = dialog.Height;
			}
			var h1 = jQuery(".editor_nav").height();
			var h2 = jQuery(".zDialog_div_bottom").height();
			h = h - h1 - h2 - 40;
			$(".moduleContainter").css("height",h+"px")
			$(".styleContainer").css("height",h+"px")
			//导致Chrome下页面空白 liuzy
			//$(".styleContainer").perfectScrollbar();
			
			
			//if(layouttype === "0" || layouttype === "3" || layouttype== "4")
			//	$("#nextStepBtn").trigger("click");
				
			var e_style_1 = $(".styleContainer").children("div.styleDiv").eq(0);
		//	e_style_1.attr("issys","sys");
    		//初始化样式2
			var e_style_2 = $(e_style_1).clone();
			$(e_style_2).find("div[name^=_label],div[name^=_field]").css("border-color","#dcc68f");
			$(e_style_2).find("div[name^=_label]").css("background","#fbf7e7");
			$(e_style_2).find("div.style1").attr("target","2").removeClass("selected").attr("issys","sys");
			$(e_style_2).find("span[name=checkstylename]").text("<%=SystemEnv.getHtmlLabelName(127980,user.getLanguage())%>");<!--橙色-->
			$(e_style_2).find("[name=styleCheck]").attr("checked",false);
			$(e_style_2).find(".jNiceCheckbox").removeClass("jNiceChecked");
			$(".styleContainer").append(e_style_2);
			
			//初始化样式3
			var e_style_3 = $(e_style_1).clone();
			$(e_style_3).find("div[name^=_label],div[name^=_field]").css("border-color","#8acc97");
			$(e_style_3).find("div[name^=_label]").css("background","#e7fdec");
			$(e_style_3).find("div.style1").attr("target","3").removeClass("selected").attr("issys","sys");
			$(e_style_3).find("span[name=checkstylename]").text("<%=SystemEnv.getHtmlLabelName(127981,user.getLanguage())%>");<!--绿色-->
			$(e_style_3).find("[name=styleCheck]").attr("checked",false);
			$(e_style_3).find(".jNiceCheckbox").removeClass("jNiceChecked");
			$(".styleContainer").append(e_style_3);
			
			//初始化样式4
			var e_style_4 = $(e_style_1).clone();
			$(e_style_4).find("div[name^=_label],div[name^=_field]").css("border-color","#dba8a8");
			$(e_style_4).find("div[name^=_label]").css("background","#fce9e8");
			$(e_style_4).find("div.style1").attr("target","4").removeClass("selected").attr("issys","sys");
			$(e_style_4).find("span[name=checkstylename]").text("<%=SystemEnv.getHtmlLabelName(24520,user.getLanguage())%>");<!--红色-->
			$(e_style_4).find("[name=styleCheck]").attr("checked",false);
			$(e_style_4).find(".jNiceCheckbox").removeClass("jNiceChecked");
			$(".styleContainer").append(e_style_4);
			
			//初始化样式5
			var e_style_5 = $(e_style_1).clone();
			$(e_style_5).find("div[name^=_label],div[name^=_field]").css("border-color","#c3a2d4");
			$(e_style_5).find("div[name^=_label]").css("background","#f6eafb");
			$(e_style_5).find("div.style1").attr("target","5").removeClass("selected").attr("issys","sys");
			$(e_style_5).find("span[name=checkstylename]").text("<%=SystemEnv.getHtmlLabelName(127982,user.getLanguage())%>");<!--紫色-->
			$(e_style_5).find("[name=styleCheck]").attr("checked",false);
			$(e_style_5).find(".jNiceCheckbox").removeClass("jNiceChecked");
			$(".styleContainer").append(e_style_5);
			
			//初始化样式6
			var e_style_6 = $(e_style_1).clone();
			$(e_style_6).find("div[name^=_label],div[name^=_field]").css("border-color","#d7db9b");
			$(e_style_6).find("div[name^=_label]").css("background","#fcfde8");
			$(e_style_6).find("div.style1").attr("target","6").removeClass("selected").attr("issys","sys");
			$(e_style_6).find("span[name=checkstylename]").text("<%=SystemEnv.getHtmlLabelName(24519,user.getLanguage())%>");<!--黄色-->
			$(e_style_6).find("[name=styleCheck]").attr("checked",false);
			$(e_style_6).find(".jNiceCheckbox").removeClass("jNiceChecked");
			$(".styleContainer").append(e_style_6);
			
			$.ajax({
				url : "/formmode/exceldesign/excelStyleOperation.jsp",
				type : "post",
				data : {method:"searchall"},
				dataType:"JSON",
				success : function do4Success(msg){
					try{
						msg = jQuery.trim(msg);
						var result = JSON.parse(msg);
						for(var key in result){
							var cloneObj = $(e_style_1).clone();
							$(cloneObj).find("div[name^=_label],div[name^=_field]").css("border-color",result[key].main_border);
							$(cloneObj).find("div[name^=_label]").css("background",result[key].main_label_bgcolor);
							$(cloneObj).find("div[name^=_field]").css("background",result[key].main_field_bgcolor);
							$(cloneObj).find("div.style1").attr("target",result[key].styleid).removeClass("selected").attr("issys","cus");
							$(cloneObj).find("span[name=checkstylename]").text(result[key].stylename);
							$(cloneObj).find("[name=styleCheck]").attr("checked",false);
							$(cloneObj).find(".jNiceCheckbox").removeClass("jNiceChecked");
							$(".styleContainer").append(cloneObj);
						}
						jQuery(".styleContainer [type=checkbox]").removeAttr("notBeauty");
						jQuery('body').jNice(); 
						$("[name=styleCheck]").click(function(){
							if($(this).closest("div").children("div").is(".selected"))
								return;
							$(".styleDiv").each(function(){
								if($(this).children("div").is(".selected")){
									$(this).children("div").removeClass("selected");
									$(this).find("input[type=checkbox]").attr("checked",false);
									$(this).find(".jNiceCheckbox").removeClass("jNiceChecked");
								}
							});
							$(this).closest("div").children("div").addClass("selected");
						});
						$(".styleDiv").click(function(){
							if($(this).is(".selected"))
								return;
							$(".styleDiv").each(function(){
								if($(this).children("div").is(".selected")){
									$(this).children("div").removeClass("selected");
									$(this).find("input[type=checkbox]").attr("checked",false);
									$(this).find(".jNiceCheckbox").removeClass("jNiceChecked");
								}
							});
							$(this).find("input[type=checkbox]").attr("checked",true);
							$(this).find(".jNiceCheckbox").addClass("jNiceChecked");
							$(this).children("div").addClass("selected");
						});
					}catch(e){
						window.top.Dialog.alert(e.message)
					}
				}
			});
			
			jQuery(".fieldContainer").scroll(function(){
				jQuery("select").selectbox("close");
			});
		});
		
		var _step = 0;
		function onPrevStep(){
			_step --;
			if(_step <0)_step=0;
			if(_step == 0){
				jQuery("#prevStepBtn").css("display","none").next().css("display","none");
			}
			if(_step == 0){
				jQuery("#nextStepBtn").val("<%=SystemEnv.getHtmlLabelName(1402,user.getLanguage())%>");<!--下一步-->
				jQuery("#saveAttrBtn").css("display","").next().css("display","");
			}
			transformStep(_step);
		}
		
		function onNextStep(){
			if(_step==0){
				if(checkFieldValue("layoutname")){
					var url = "/formmode/exceldesign/excelLayoutOperation.jsp";
					var modeid = jQuery("#modeId").val();
					var formid =  jQuery("#formId").val();
					var layoutid = jQuery("#Id").val();
					var layouttype = jQuery("#type").val();
					var layoutname = jQuery("#layoutname").val();
					var paramData = {method:"checklayoutname",modeid:modeid,formid:formid,layoutid:layoutid,layouttype:layouttype,layoutname:layoutname,isecme:<%=isecme%>,feaid:<%=feaid%>};
					$.ajax({
					    url: url,
					    data: paramData, 
					    dataType: 'json',
					    type: 'POST',
					    success: function (res) {
					    	var result = res.result;
							if(result==0){
								window.top.Dialog.alert("<%=SystemEnv.getHtmlLabelName(127983,user.getLanguage())%>");<!--当前模板名称已被使用,请修改模板名称再保存!-->
								return;
							}else{
								onNextStepExec();
								if( $(".tableBody.ecmeCloneDom")){
									$(".tableBody.ecmeCloneDom").remove();
								}
							}
					    }
					});
				}else{
					return;
				}
			}else if(_step == 1){
				onNextStepExec();
			}
		}
		
		function onNextStepExec(){
		    if(_step == 0 && fromwhere === "initdetail"){ //明细初始化未勾选字段不允许下一步
                if(judgeHavaCheckField())
                    return;
            }
			_step ++;
			$("#prevStepBtn").css("display","").next().css("display","");;
			if(_step>2)_step=2
			if(_step == 1){
				jQuery("#nextStepBtn").val("  <%=SystemEnv.getHtmlLabelName(382584,user.getLanguage())%> ");<!--完成-->
				jQuery("#saveAttrBtn").css("display","none").next().css("display","none");
			}
			transformStep(_step);
			if(_step == 2)
				submitInit();
		}
		//切换  上/下 一步
		function transformStep(whichstep){
			if(whichstep == 0){
				jQuery(".moduleStep4Style").removeClass("moduleStep4Style_hot");
				jQuery(".moduleStep4Complete").removeClass("moduleStep4Complete_hot");
				jQuery(".moduleHeadSplitLine").css("width","215px");
				jQuery("span[name=ssstep]").removeAttr("class").addClass("step1");
				jQuery("span[name=ssstep]").text("<%=SystemEnv.getHtmlLabelName(386383,user.getLanguage())%>");<!--设置字段属性-->
				jQuery(".fieldContainer").show();
				jQuery(".styleContainer").hide();
				jQuery(".completeContainer").hide();
			}else if(whichstep == 1){
				jQuery(".moduleStep4Style").addClass("moduleStep4Style_hot");
				jQuery(".moduleStep4Complete").removeClass("moduleStep4Complete_hot");
				jQuery(".moduleHeadSplitLine").css("width","415px");
				jQuery("span[name=ssstep]").removeAttr("class").addClass("step2");
				jQuery("span[name=ssstep]").text("<%=SystemEnv.getHtmlLabelName(128945,user.getLanguage())%>");<!--选择样式-->
				jQuery(".fieldContainer").hide();
				jQuery(".styleContainer").show();
				jQuery(".completeContainer").hide();
			}else if(whichstep == 2){
				jQuery(".moduleStep4Style").addClass("moduleStep4Style_hot");
				jQuery(".moduleStep4Complete").addClass("moduleStep4Complete_hot");
				jQuery(".moduleHeadSplitLine").css("width","615px");
				jQuery("span[name=ssstep]").removeAttr("class").addClass("step3");
				jQuery("span[name=ssstep]").text("<%=SystemEnv.getHtmlLabelName(382584,user.getLanguage())%>");<!--完成-->
				jQuery(".fieldContainer").hide();
				jQuery(".styleContainer").hide();
				jQuery(".completeContainer").show();
			}
		}
		
		function submitInit(){
			$("#zDialog_div_bottom").hide();
			//var wc = 0;
			// wc = $(".styleDiv").find(".selected").attr("target");
			//var issys = $(".styleDiv").find(".selected").attr("issys");
			var wc = $(".styleDiv").find(".style1.selected").attr("target");
            var issys = $(".styleDiv").find(".style1.selected").attr("issys");
			
			jQuery(".fieldContainer").find("#excelStyle").val(wc);
			jQuery(".fieldContainer").find("#excelIssys").val(issys);
			if(fromwhere === "initdetail"){
                confirmInitDetail();    //调用editDetailFieldAttr.jsp方法
                return;
            }else if("<%=fromwhere %>" == "batchset"){
				jQuery("#saveAttrFlag").val("2");
			}else{
				jQuery("#saveAttrFlag").val("3");
			}
			fieldbatchsave();	//其实是提交 edithtmlnodefield.jsp中的提交 表单字段方法
		}
		
		//只保存字段属性
		function onSaveSttr(){
			jQuery("#saveAttrFlag").val("1");
			fieldbatchsave();
		}
		
		//在 wf_operation.jsp 中 src = nodefieldhtml 保存表单字段后 返回给iframe,iframe初始化后调用 此方法,只要调了,说明字段已保存完毕
		function initExcel(excelStyle,modeid){
			var parentWin = parent.getParentWindow(window);
			parentWin.setInitModule(excelStyle,modeid);
			var setimeut;
			setimeut = setTimeout(function (){
				clearTimeout(setimeut);
				dialog.close();
			},3000);
		}
		
		//关闭dialog
		function closeCurDialog(){
			var parentWin = parent.getParentWindow(window);
			parentWin.location.reload();
			dialog.close();
		}
		
		//关闭dialog
		function doCloseAndCallBack(paramObj){
			if(dialog.callbackfun){
				dialog.callbackfun(paramObj);
			}
			dialog.close();
		}
		
		function checkFieldValue(ids){
			var idsArr = ids.split(",");
			for(var i=0;i<idsArr.length;i++){
				var obj = document.getElementById(idsArr[i]);
				if(obj&&obj.value==""){
					window.top.Dialog.alert("<%=SystemEnv.getHtmlLabelName(15859,user.getLanguage())%>",function(){displayAllmenu();});//必要信息不完整!
					return false;
				}
			}
			return true;
	   }
	</script>
</BODY>
</HTML>