excelUploadFormula_FieldBrowser.jsp 11 KB

<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<%@ taglib uri="/browser" prefix="brow"%>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%>
<%@ page import="weaver.workflow.exceldesign.ExcelFormula"%>
<%@ page import="weaver.workflow.exceldesign.SearchConditionOption"%>
<%
	//pagetype 为1:出口条件; 2:批次条件; 4:督办条件; 3:规则设计
	String pagetype = Util.null2String(request.getParameter("pagetype"));
	if(pagetype.equals("")) pagetype = "1";
	//pagetype = "2";
	//出口条件传过来的参数   start
	String formid = Util.null2String(request.getParameter("formid"));
	
	String isbill = Util.null2String(request.getParameter("isbill"));
	//System.out.println(formid+"+++"+isbill);
	String linkid = Util.null2String(request.getParameter("linkid"));
	
	String src = Util.null2String(request.getParameter("method"));
	String fshowname = Util.null2String(request.getParameter("fshowname"));
	String tableOptions = Util.null2String(request.getParameter("tableOptions"));
	
	//出口条件传过来的参数   end
%>
<HTML><HEAD>
<LINK REL=stylesheet type=text/css HREF=/css/Weaver_wev8.css>
<SCRIPT language="javascript" src="/js/weaver_wev8.js"></script>
<script type='text/javascript' src='/js/jquery-autocomplete/lib/jquery.bgiframe.min_wev8.js'></script>
<script type='text/javascript' src='/js/jquery-autocomplete/lib/jquery.ajaxQueue_wev8.js'></script>
<script type='text/javascript' src='/js/jquery-autocomplete/jquery.autocomplete_wev8.js'></script>
<script type='text/javascript' src='/js/jquery-autocomplete/browser_wev8.js'></script>
<link rel="stylesheet" type="text/css" href="/js/jquery-autocomplete/jquery.autocomplete_wev8.css" />
<link rel="stylesheet" type="text/css" href="/js/jquery-autocomplete/browser_wev8.css" />
</HEAD>

<BODY>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
	
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
<jsp:include page="/systeminfo/commonTabHead.jsp">
   <jsp:param name="mouldID" value="workflow" />
   <jsp:param name="navName" value="<%=SystemEnv.getHtmlLabelName(33331,user.getLanguage())+SystemEnv.getHtmlLabelName(320,user.getLanguage()) %>" />
</jsp:include>
<div class="zDialog_div_content">
	<FORM NAME=SearchForm STYLE="margin-bottom:0" action="/workflow/exceldesign/excelUploadFormula_FieldBrowser.jsp" method=post>
	<input type="hidden" name="method" value="search" >
	<input type="hidden" name="pagetype" value="<%=pagetype %>" >
	<input type="hidden" name="formid" value="<%=formid %>" >
	<input type="hidden" name="isbill" value="<%=isbill %>" >
	<input type="hidden" name="linkid" value="<%=linkid %>" >
	<table id="topTitle" cellpadding="0" cellspacing="0" >
		<tr>
			<td>
			</td>
			<td class="rightSearchSpan">
				<input type="button" value="<%=SystemEnv.getHtmlLabelName(197, user.getLanguage()) %>" class="e8_btn_top"  onclick="onSearch();"/>&nbsp;&nbsp;
				<span title="<%=SystemEnv.getHtmlLabelName(23036, user.getLanguage())%>" class="cornerMenu"></span>
			</td>
		</tr>
	</table> 
	<wea:layout type="4col" attributes="{'cw1':'20%','cw2':'30%','cw3':'20%','cw4':'30%'}">
		<wea:group context='<%=SystemEnv.getHtmlLabelName(15774,user.getLanguage()) %>'>
			<wea:item><%=SystemEnv.getHtmlLabelName(15456,user.getLanguage()) %></wea:item>
			<wea:item><input name="fshowname" type="text" style="width:130px"/></wea:item>
			<%
			if(isbill.equals("1")) {
			%>
			<wea:item><%=SystemEnv.getHtmlLabelName(21900,user.getLanguage()) %></wea:item>
			<wea:item>
				<select name="tableOptions" class="tableOptions" style="width:100px;" onChange="onSearch()">
        			<%
    					ArrayList<SearchConditionOption> alTableOptions = ExcelFormula.getBrowserFieldTableOptions(formid, isbill, user);
    					SearchConditionOption tableOption;
    					for (int i = 0; i < alTableOptions.size(); i++) {
    						tableOption = alTableOptions.get(i);
    						if (tableOptions != null && tableOptions.equals(tableOption.getKey())) {
    							out.println("<option value=\""+tableOption.getKey()+"\" selected><STRONG>"+tableOption.getShowname()+"</strong></option>");
    						} else {
        						out.println("<option value=\""+tableOption.getKey()+"\"><STRONG>"+tableOption.getShowname()+"</strong></option>");
        					}
    					}
        			%>
        		</select>
			</wea:item>
			<% } %>
		</wea:group>
	</wea:layout>
	</FORM>
	<div id="fieldTableDiv">
		<%
		String tableString = "";
		String backfields = "";
		String fromSql="";
		String sqlWhere = "";
		String orderkey = "";
		String pageIdStr = "16";
		if(isbill.equals("0")) {
			backfields = " workflow_formfield.fieldid as id,fieldname as name,workflow_fieldlable.fieldlable as label,workflow_formdict.fieldhtmltype as htmltype,workflow_formdict.type as type,workflow_formdict.fielddbtype as dbtype,workflow_formfield.isdetail as isdetail, '' as detailtable, workflow_formfield.groupid,workflow_formfield.fieldorder ";
			fromSql = " from workflow_formfield,workflow_formdict,workflow_fieldlable ";
			sqlWhere = " where workflow_fieldlable.formid = workflow_formfield.formid and workflow_fieldlable.isdefault = '1' and workflow_formdict.fieldhtmltype!=6 and not(workflow_formdict.fieldhtmltype=2 and workflow_formdict.type=2) and workflow_formdict.fieldhtmltype<>7 and workflow_fieldlable.fieldid =workflow_formfield.fieldid and workflow_formdict.id = workflow_formfield.fieldid and (workflow_formfield.isdetail<>'1' or workflow_formfield.isdetail is null) and workflow_formfield.formid="+formid+" ";
			if(src.equals("search") && !fshowname.equals(""))
				sqlWhere += " and workflow_fieldlable.fieldlable like '%"+fshowname+"%'";
			orderkey = " workflow_formfield.isdetail,workflow_formfield.groupid,workflow_formfield.fieldorder ";
		}else if(isbill.equals("1")){
			backfields = " t1.id as id,t1.fieldname as name,t1.fieldlabel as label,t1.fieldhtmltype as htmltype,t1.type as type, t1.fielddbtype as dbtype,t1.viewtype as isdetail,t1.detailtable as detailtable,t1.dsporder ";
			if(src.equals("search") && !fshowname.equals("")){
				fromSql = " from workflow_billfield t1,HtmlLabelInfo t2";
				sqlWhere = " where t1.billid = "+formid + " and t1.fieldhtmltype!=6 and not(t1.fieldhtmltype=2 and t1.type=2) and t1.fieldhtmltype<>7 ";
				sqlWhere += " and t2.indexid=t1.fieldlabel and t2.languageid="+user.getLanguage()+" and t2.labelname like '%"+fshowname+"%'";
			} else{
				fromSql = " from workflow_billfield t1 ";
				sqlWhere = " where t1.billid = "+formid + " and t1.fieldhtmltype!=6 and not(t1.fieldhtmltype=2 and t1.type=2) and t1.fieldhtmltype<>7 ";
			}
			if (tableOptions != null && tableOptions.length() > 0) {
				if (tableOptions.indexOf("dt") < 0) {
					sqlWhere += " and t1.detailtable = '' ";
				} else {
					sqlWhere += " and t1.detailtable = '" + tableOptions + "' ";
				}
			}
			orderkey = " t1.viewtype,t1.detailtable,t1.dsporder ";
		}
		tableString ="<table instanceid=\"\" name=\"fieldList\" tabletype=\"none\"  pagesize=\""+PageIdConst.getPageSize(PageIdConst.getWFPageId(pageIdStr),user.getUID())+"\" >"+
	    "<sql backfields=\""+backfields+"\" sqlform=\""+fromSql+"\" sqlwhere=\""+Util.toHtmlForSplitPage(sqlWhere)+"\"  sqlorderby=\""+orderkey+"\"  sqlprimarykey=\"id\" sqlsortway=\"asc\" sqlisdistinct=\"true\" />";
	    tableString += " <head>";
	    tableString+="<col hide=\"true\"  text=\"\" column=\"id\" />";
	    tableString+="<col hide=\"true\"  text=\"\" column=\"htmltype\" />";
	    tableString+="<col hide=\"true\"  text=\"\" column=\"type\" />";
	    tableString+="<col hide=\"true\"  text=\"\" column=\"dbtype\" />";
	    tableString+="<col width=\"34%\"  text=\""+SystemEnv.getHtmlLabelName(15456,user.getLanguage())+"\" column=\"label\" otherpara=\""+user.getLanguage()+"+"+isbill+"\" transmethod=\"weaver.workflow.design.WFDesignTransMethod.getFieldLabel\"/>";
	   	tableString+="<col width=\"33%\"  text=\""+SystemEnv.getHtmlLabelName(17997,user.getLanguage())+"\" column=\"detailtable\"  otherpara=\""+formid+"+"+isbill+"+"+user.getLanguage()+"\" transmethod=\"weaver.workflow.exceldesign.ExcelFormula.getFieldViewType\"  />";
	   	tableString+="<col width=\"33%\"  text=\""+SystemEnv.getHtmlLabelName(687,user.getLanguage())+"\" column=\"htmltype\"  otherpara=\"column:type"+"+"+user.getLanguage()+"+"+"column:id"+"\" transmethod=\"weaver.workflow.design.WFDesignTransMethod.getFieldShowType\"  />";
	   	//tableString+="<col width=\"14%\"  text=\""+SystemEnv.getHtmlLabelName(686,user.getLanguage())+"\" column=\"id\"  otherpara=\""+user.getLanguage()+"+"+pagetype+"\" transmethod=\"weaver.workflow.design.WFDesignTransMethod.getFieldType\"  />";
	   	tableString+="<col hide=\"true\"  text=\"\" column=\"htmltype\" otherpara=\"column:id\" transmethod=\"weaver.workflow.design.WFDesignTransMethod.getSelectVal\" />";
	   	tableString+="</head></table>";
		%>
		<input type="hidden" name="pageId" _showCol="false" id="pageId" value="<%=PageIdConst.getWFPageId(pageIdStr)%>"/>
		<wea:SplitPageTag tableString='<%=tableString%>' mode="run"/>
	</div>
</div>
<script language=javascript>
	var dialog = parent.parent.getDialog(parent);
	$(document).ready(function(){
  		resizeDialog(document);
	});
</script>
<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(311,user.getLanguage()) %>" id="zd_btn_cancle"  class="zd_btn_cancle" onclick="submitClear();">
				<input type="button" value="<%=SystemEnv.getHtmlLabelName(201,user.getLanguage()) %>" id="zd_btn_cancle"  class="zd_btn_cancle" onclick="dialog.close();">
	    </wea:item>
		</wea:group>
	</wea:layout>
</div>	
<script type="text/javascript">

function onSearch()
{
	var currentTableOption = $(".tableOptions option:selected").val();
	console.log("currentTableOption:"+currentTableOption);
	SearchForm.submit();
}

function afterDoWhenLoaded(){
	ontrclick();
}

var weaverSplit = "||~WEAVERSPLIT~||";
function ontrclick()
{
	jQuery(".ListStyle").find("tbody tr:not([class='Spacing'])").click(function(){
		var fieldid=$(this).children("td").eq(1).html();
		var htmltype = $(this).children("td").eq(2).html()+"";
		var type = $(this).children("td").eq(3).html()+"";
		var dbtype = $(this).children("td").eq(4).html()+"";
		var label = $(this).children("td").eq(5).html()+"";
		if(htmltype==="")htmltype="0";
		if(type==="")type="0";
		if(dbtype==="")dbtype="-1";
		//保证组合个值不为空,不然截取会有问题;
		var pfieldstr = htmltype + weaverSplit + type + weaverSplit + dbtype;
		if(htmltype === "5") //下拉框需要值
		{
			var selectVal = $(this).children("td").eq(8).html()+"";
			pfieldstr+= weaverSplit + selectVal;
		}
		var returnjson = {id:fieldid,name:label,pfiled:pfieldstr};		
		if(dialog){
			dialog.callback(returnjson);
		}else
		{
			window.parent.parent.returnValue = returnjson;
		  	window.parent.parent.close();
		}
	});
}


function submitClear()
{
	if(dialog) {
		dialog.callback({id:"",name:""});
	} else {
		window.parent.returnValue = {id:"",name:""};
		window.parent.close()
	}
}

</script>
<jsp:include page="/systeminfo/commonTabFoot.jsp"></jsp:include>
</BODY>
</HTML>