2018-06-03 22:26:41 +08:00

139 lines
5.4 KiB
Plaintext

<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><%
/*
Author: undefined 2017-05-16
Content: 示例详情页面
History Log:
*/
String flowunid=CurPage.getParameter("ObjectNo");
if(flowunid==null){
flowunid="12345678";
}
String sFileSaveMode = CurConfig.getConfigure("FileSaveMode");
String sFileSavePath = CurConfig.getConfigure("FileSavePath");
String sFileNameType = CurConfig.getConfigure("FileNameType");
String compClientID = request.getParameter("CompClientID");
String sTempletNo = "ContractTemplate";//--模板号--
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
doTemp.setHtmlEvent("ONE_CLASSIFY","onchange","initTwoClass");
doTemp.setHtmlEvent("TWO_CLASSIFY","onchange","initFileTemplate");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
dwTemp.Style = "2";//freeform
//dwTemp.ReadOnly = "-2";//只读模式
dwTemp.genHTMLObjectWindow("");
String sparm="";
dwTemp.replaceColumn("contractlist", "<iframe type='iframe' id='frame_list' name=\"frame_list\" width=\"100%\" height=\"600px\" frameborder=\"0\" src=\""+sWebRootPath+"/Tenwa/Comm/ContractTemplate/LBContractList.jsp?CompClientID="+compClientID+"&flowunid="+flowunid+"\"></iframe>", CurPage.getObjectWindowOutput());
dwTemp.replaceColumn("contracttemplate", "<div id=\"filetemplatemodel\" style=\"heigth:100%,width:100px\"></div>", CurPage.getObjectWindowOutput());
String sButtons[][] = {
{"true","All","Button","生成合同","生成合同","createContractByTemplate()","","","",""},
};
//sButtonPosition = "south";
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
<script type="text/javascript">
window.onload=function(){
initOneClass();
}
function loadAttachment(){
var sparam="CompClientID=<%=compClientID%>&flowunid=<%=flowunid%>";
sparam=sparam+"&ObjectType=<%=CurPage.getParameter("ObjectType")%>&RightType=<%=CurPage.getParameter("RightType")%>";
sparam=sparam+"&DocType=contractTemplate"
AsControl.OpenView("/Tenwa/Comm/ContractTemplate/LBContractList.jsp", sparam, "frame_list");
}
//加载一级分类选项
function initOneClass(){
var sql="select itemno,itemname from code_library where codeno='OneClassify' and itemattribute='contractTemplate'";
initSelectOption(sql,"itemname","itemno","ONE_CLASSIFY");
initFileTemplate();
}
//加载二级分类选项
function initTwoClass(){
var oneClass=getItemValue(0,0,"ONE_CLASSIFY");
var sql="select itemno,itemname from code_library where codeno='TwoClassify' and itemattribute='"+oneClass+"'";
initSelectOption(sql,"itemname","itemno","TWO_CLASSIFY");
initFileTemplate();
}
//加载模板选项
function initFileTemplate(){
//console.info($("#filetemplatemodel"));
var sql="select id,templatename from BF_TEMPLATE where doctype='contractTemplate' "
var oneClass=getItemValue(0,0,"ONE_CLASSIFY");
var twoClass=getItemValue(0,0,"TWO_CLASSIFY");
if(oneClass.length>0){
sql+=" and oneclassify='"+oneClass+"'";
}
if(twoClass.length>0){
sql +=" and twoclassify='"+twoClass+"'";
}
var sReturn = AsControl.RunJsp("/Tenwa/Comm/ContractTemplate/select.jsp","sql="+sql+"&text=templatename&value=id");
var cnumber=4;
var fileTemplate="";
if(sReturn.length>0)
{
fileTemplate=eval("("+sReturn+")");
}
$("#filetemplatemodel").html("");
$("#filetemplatemodel").append("<table>");
for(var i=0;i<fileTemplate.length;i++){
if(i%cnumber==0)$("#filetemplatemodel").append("<tr>");
$("#filetemplatemodel").append("<td width='200px'><input type=\"checkbox\" name=\"fileTemplate\" value=\""+fileTemplate[i].value+"\">"+fileTemplate[i].text+"</input></td>");
if((i+1)%cnumber==0){$("#filetemplatemodel").append("</tr>");}
else{$("#filetemplatemodel").append("</tr>");}
}
$("#filetemplatemodel").append("</table>");
}
function createContractByTemplate(){
var checkbox=$("#filetemplatemodel").html()||"";
if(checkbox==""){alert("请选择合同模板下面的分类,或分类下面没有模板");return false;}
var tempids="";
var equipPledge="";//动产抵押合同(租赁物)
var boardTenant="";//股东会决议-承租人融资租赁
var index=0;
$('input[name="fileTemplate"]:checked').each(function(){
if(tempids.length>0){
tempids+=",";
}
tempids += $(this).attr('value');
index++;
});
if(index==0){alert("请选择要生成合同的模板");return false;}
var param={};
var tempParam={};
var sparam="";
tempParam["contract_id"]="C20191";
tempParam["CurUserId"]="<%=CurUser.getUserID()%>";
tempParam["CurOrgId"]="<%=CurUser.getOrgID()%>";
tempParam["OBJECTTYPE"]="<%=CurPage.getParameter("ObjectType")%>";
tempParam["FLOW_UNID"]="<%=flowunid%>";
tempParam["fileSaveMode"]="<%=sFileSaveMode%>";
tempParam["fileSavePath"]="<%=sFileSavePath%>";
tempParam["fileNameType"]="<%=sFileNameType%>";
var sReturn ="";
var sReturn0 ="";
if(tempids!=""){
param["templateNo"]=tempids.replace(/,/g,"@");//选择的模板ID
param["templateParam"]=JSON.stringify(tempParam).replace(/,/g,"@");//生成模板的参数据
for(var key in param){
if(sparam.length>0){sparam+=",";}
sparam+=key+"="+param[key];
}
sReturn0 = RunJavaMethodTrans("com.tenwa.officetempalte.action.CreateOfficeAction","createOfficeByTemplate",sparam);
if(sReturn0!="success") sReturn+=sReturn0;
}
if(sReturn.length>0){
alert(sReturn);
}
loadAttachment();
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>