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

252 lines
10 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_simplelist.jspf"%>
<%@ page import="com.tenwa.doc.action.DocListInitAction" %>
<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %>
<%
/*
Author: undefined 2016-09-01
Content:
History Log:
*/
String custid=CurPage.getParameter("customerid");//客户ID
if(custid==""||custid==null){
custid="custid";
}
String mainType=CurPage.getParameter("mainType");
if(mainType==null){
mainType="";
}
String flowunid=CurPage.getParameter("ObjectNo");//流程号
if(flowunid==""||flowunid==null){
flowunid="flowunid";
}
String flowno=CurPage.getParameter("FlowNo");//流程号
if(flowno==null){
flowno="";
}
String phaseno=CurPage.getParameter("PhaseNo");//流程号
if(phaseno==null){
phaseno="";
}
String type=CurPage.getParameter("type");
if(type==null)type="";
String sObjectType = CurPage.getParameter("FlowNo");//流程类型
//System.out.println(sObjectType);
String ishistory=CurPage.getParameter("IsHistory");
String nodeNo=CurPage.getParameter("NodeNo");
String RightType= CurPage.getParameter("RightType");
if(RightType==null){
RightType="";
}
//CurPage.getCurComp().setAttribute("RightType",null);
String sTempletNo=CurPage.getParameter("TempletNo");//模板号
if(sTempletNo==null){
sTempletNo="FlowDocList";
}
BizObject flow=GetFlowAction.getFlowBussinessObject(flowunid);//流程对象
String projid=flow.getAttribute("PROJ_ID").getString();
String docClassItemno= CurPage.getParameter("docClassItemno");
String compClientID = request.getParameter("CompClientID");
String username=CurUser.getUserName();
BizObject ent=JBOFactory.createBizObjectQuery("jbo.app.tenwa.customer.CUSTOMER_COMPANY","CUSTOMERID=:customerid").setParameter("customerid", custid).getSingleResult(false);
if(ent!=null||mainType.equals("Payfiles")||mainType.equals("Customer_Fact")){
docClassItemno+="001";
}else{
docClassItemno+="002";
}
Map<String,String> docParam=new HashMap<String,String>();
Map<String,String> other=new HashMap<String,String>();
docParam.put("ObjectType",sObjectType);
docParam.put("cust_id",custid);
docParam.put("proj_id", projid);
docParam.put("contract_id", flow.getAttribute("contract_id").getString());
docParam.put("flow_unid", flowunid);
//判断是否存在,不存在就从配置表倒到临时表
DocListInitAction.initDocList(docParam,other,docClassItemno,CurConfig);
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
String otherWhere=DocListInitAction.getFlowWhere(flow,"","rela");
doTemp.appendJboWhere(otherWhere);
doTemp.appendJboWhere(" and O.doc_Class_Itemno='"+docClassItemno+"' and rela.cust_id='"+custid+"'");
doTemp.setLockCount(2);
if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){
doTemp.setVisible("operation", false);
}
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.ReadOnly = "0";
dwTemp.MultiSelect=true;//多选
dwTemp.setPageSize(50);
if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){
dwTemp.ReadOnly = "1";//只读模式
isShowButton=false;
}else{
isShowButton=true;
}
dwTemp.genHTMLObjectWindow("");
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] =null;
if(flowno.equals("ProjectCreditFlow")&&phaseno.equals("0030")){
sButtons=new String[][]{
{"true","","Button","保存","保存所有修改","saveRecord()","","","","btn_icon_save"},
{"true","","Button","批量下载","批量下载","downloadZipFile()","","","","btn_icon_down"},
{"true","","Button","批量已提交","批量已提交","updateReviewCheck()","","","","btn_icon_down"}
};
}else{
sButtons=new String[][]{
{"true","","Button","保存","保存所有修改","saveRecord()","","","","btn_icon_save"},
{"true","","Button","批量下载","批量下载","downloadZipFile()","","","","btn_icon_down"}
};
}
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
window.onload=function(){
$("#DWTD").width( document.body.offsetWidth - 10);
$("#DWTD").width( document.body.offsetHeight - 20);
document.getElementById('DWTD').innerHTML = '<div style="width:'+(document.body.offsetWidth - 10)+'px;height:'+(document.body.offsetHeight - 40)+'px;overflow: scroll;">'+document.getElementById('DWTD').innerHTML+'</div>';
}
function saveRecord(){
as_save("myiframe0");
}
//在加载完表格后调用
function afterSearch(){
var sRightType="<%=RightType%>";
var sObjectType="<%=sObjectType%>";//该流程类型
var isReview="<%=CurPage.getParameter("isReview")%>";
var username="<%=username%>";
for(var i=0;i<getRowCount(0);i++){
if(getObj(0,i,"operation")!=null&&getObj(0,i,"operation")!="null"){
getObj(0,i,"operation").innerHTML='<a class="box" onclick="upload(\''+getItemValue(0,i,"id")+'\')" style={color:#000;text-decoration:underline;}><font color="blue">上传</font></a>';
}
var filelist=getObj(0,i,"filelist").innerHTML;
var obj=eval('('+filelist+')');
var html="";
for(var file in obj){
html+='<a onclick=downloadFile(\''+obj[file]['id']+'\')><font color="blue">'+obj[file]['filename']+'</font></a>';
html+='【上传时间:'+obj[file]['inputtime']+'】';
html+='【上传人:'+obj[file]['inputuser']+'】';
html+='【大小:'+Math.floor(obj[file]['FileSize']/1024*100)/100+'kb】<a class="btn_icon_detail" onclick="editOffice(\''+obj[file]['id']+'\',\''+obj[file]['filename']+'\',\''+sRightType+'\')">&nbsp;</a> ';
if(isReview!="true"&&sRightType!="ReadOnly"&&(sObjectType==obj[file]['objecttype'])&&username==obj[file]['inputuser']){
html+='<a class="btn_icon btn_icon_close" onclick="deleteFile(\''+obj[file]['id']+'\');">&nbsp;</a>'
}
if(obj[file]['image']=="true"){
html+='<a class="btn_icon btn_icon_search" onclick="showImage(\''+obj[file]['id']+'\',\''+obj[file]['filename']+'\');">&nbsp;</a>';
}
if(obj[file]['word']=="true"){
html+='<a class="btn_icon btn_icon_search" onclick="showWord(\''+obj[file]['id']+'\',\''+obj[file]['filename']+'\');">&nbsp;</a>';
}
if(obj[file]['pdf']=="true"){
html+='<a class="btn_icon btn_icon_search" onclick="showPDF(\''+obj[file]['id']+'\',\''+obj[file]['filename']+'\');">&nbsp;</a>';
}
html+='</br>';
}
getObj(0,i,"filelist").innerHTML=html;
getObj(0,i,"filelist").style["white-space"]="pre-wrap";
};
}
function showPDF(id,name){
var sUrl="/Tenwa/Comm/DocList/showPDF.jsp";
var param="attrid="+id;
AsControl.OpenPage(sUrl,param,"","");
}
function showWord(id,name){
var sUrl="/Tenwa/Comm/DocList/showWord.jsp";
var param="attrid="+id;
AsControl.OpenPage(sUrl,param,"","");
}
//在线编辑
function editOffice(id,filename,sRightType){
var filetype=filename.substr(filename.indexOf(".")+1);
var status=2;
if(sRightType=="ReadOnly"){
status=1;
}
AsDialog.PopView("/Tenwa/Core/OfficeTemplate/OnlineOperation/online/editOfficeOnLine.jsp","filetype="+filetype+"&status="+status+"&id="+id+"&CompClientID=<%=compClientID%>","dialogWidth=1024px;dialogHeight=1000px;resizable=no;scrollbars=no;status:yes;maximize:no;help:no;",function(sPhaseInfo){
if(typeof(sPhaseInfo)=="undefined" || sPhaseInfo=="" || sPhaseInfo==null || sPhaseInfo=="null" || sPhaseInfo=="_CANCEL_") {
return;
}else if(sPhaseInfo == "Success" || sPhaseInfo == "success"){
alert("提交成功!");
reloadSelf();
}else{
alert("提交失败!");
}
},"编辑文档");
}
function showImage(id,name){
var sUrl="/Tenwa/Comm/DocList/showImage.jsp";
var param="attrid="+id;
AsDialog.PopView(sUrl,param,"dialogWidth=480px;dialogHeight=400px;",function(message){
},name);
}
//上传
function upload(){
var id=getItemValue(0,getRow(),"id");
var param="Library_id="+id;
var sUrl="/Tenwa/Comm/DocList/DocListInfo.jsp";
AsDialog.PopView(sUrl,param,"dialogWidth=480px;dialogHeight=400px;resizable=no;scrollbars=no;status:yes;maximize:no;help:no;",function(message){
if(message=="success"){
//reloadSelf();
//setItemValue(0,getRow(),"BUSINESS_CHECK","DocCheck_0");
var str=RunJavaMethodTrans("com.tenwa.doc.action.DocListAction","updateBussinessCheck","library_id="+id+",BussinessCheck=DocCheck_0");
}
reloadSelf();
//setItemValue(0,0,"BUSINESS_CHECK","DocCheck_0");
},"上传附件");
}
//删除
function deleteFile(id){
var sParams="attId="+id+",BussinessCheck=DocCheck_2";
var sReturnInfo = RunJavaMethodTrans("com.tenwa.doc.action.DocListAction","deleteAttr",sParams);
reloadSelf();
}
function downloadFile(id){
if(!frames["downloadTemplate"]) $("<iframe name='downloadTemplate' style='display:none;'></iframe>").appendTo("body");
window.open(sWebRootPath+"/servlet/view/docDownloadServlet?CompClientID=<%=sCompClientID%>&sqlString=save@"+id, "downloadTemplate");
}
function downloadZipFile(){
var id=getItemValueArray(0,'Id')+"";
var ids=id.replace(/\,/g,"@");
var filePath="<%=CurConfig.getConfigure("FileSavePath")%>";
<%-- var param="&flowunid=<%=flowunid%>&type=<%=type%>&proj_id=<%=CurPage.getParameter("proj_id")%>&contract_id=<%=CurPage.getParameter("contract_id")%>";
--%>
var param="&flowunid=<%=flowunid%>&type=<%=type%>&ids="+ids;
if(!frames["downloadTemplate"]) $("<iframe name='downloadTemplate' style='display:none;'></iframe>").appendTo("body");
window.open(sWebRootPath+"/servlet/view/docFlowDownloadZipServlet?CompClientID=<%=sCompClientID%>&filePath="+filePath+param, "downloadTemplate");
<%-- var id=getItemValue(0,getRow(0),'id');
var filePath="<%=CurConfig.getConfigure("FileSavePath")%>";
var param="&flowunid=<%=flowunid%>&type=<%=mainType%>&custid=<%=custid%>";
if(!frames["downloadTemplate"]) $("<iframe name='downloadTemplate' style='display:none;'></iframe>").appendTo("body");
window.open(sWebRootPath+"/servlet/view/docDownloadZipServlet?CompClientID=<%=sCompClientID%>&id="+id+"&filePath="+filePath+param, "downloadTemplate");
--%>
}
function updateReviewCheck(){
var id=getItemValueArray(0,'Id')+"";
if (typeof(id) == "undefined" || id.length == 0){
alert(getMessageText('AWEW1001'));//请选择一条信息!
return;
}
var lids=id.replace(/\,/g,"@");
var str=RunJavaMethodTrans("com.tenwa.doc.action.DocListAction","updateReviewCheck","lids="+lids);
if(str=="success"){
alert("已批量提交!");
reloadSelf();
}
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>