传统业务合同审批上传合同文件
This commit is contained in:
parent
51ca73eba1
commit
c3786fc1d4
108
WebContent/Tenwa/Comm/DocList/TriditionDocListInfo.jsp
Normal file
108
WebContent/Tenwa/Comm/DocList/TriditionDocListInfo.jsp
Normal file
@ -0,0 +1,108 @@
|
||||
<%@ page contentType="text/html; charset=GBK"%>
|
||||
<%@include file="/Frame/resources/include/include_begin_info.jspf"%>
|
||||
<%
|
||||
//定义变量
|
||||
String sObjectNo = "";//--对象编号
|
||||
//获得组件参数
|
||||
String flowNo=CurPage.getParameter("FlowNo");
|
||||
String contractid = CurPage.getParameter("contractid");
|
||||
String projectid = CurPage.getParameter("projectid");
|
||||
|
||||
ASObjectModel doTemp = new ASObjectModel("FlowDocListUpload");
|
||||
doTemp.setVisible("DOC_TYPE",false);
|
||||
doTemp.setVisible("ONE_CLASSIFY",false);
|
||||
doTemp.setVisible("Remark",false);
|
||||
doTemp.setDefaultValue("DOC_NAME", "合同文件");
|
||||
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
|
||||
dwTemp.Style="2"; // 设置DW风格 1:Grid 2:Freeform
|
||||
dwTemp.ReadOnly = "0"; // 设置是否只读 1:只读 0:可写
|
||||
dwTemp.genHTMLObjectWindow("");
|
||||
String[][] sButtons=null;
|
||||
sButtons=new String[][]{
|
||||
{"true","","Button","保存","保存所有修改","importRecord()","","","",""},
|
||||
{"true","","Button","取消","取消","viewAndEdit_attachment()","","","","btn_icon_close"}};
|
||||
%><%@include file="/Frame/resources/include/ui/include_info.jspf"%>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$("#FILE2").attr("type","file");
|
||||
$("#myiframe0").attr("enctype","multipart/form-data");
|
||||
var params={};
|
||||
params["OBJECTTYPE"]="TriditionContract";
|
||||
params["CONTRACTID"]="<%=contractid%>";
|
||||
params["PROJECTID"]="<%=projectid%>";
|
||||
params["FILENAMEX"]="";
|
||||
params["REMARK2"]="";
|
||||
params["FileSize2"]="";
|
||||
var sparma="";
|
||||
for(var key in params){
|
||||
sparma=sparma+"<input type=\"text\" name=\""+key+"\" id=\""+key+"\" value=\""+params[key]+"\">"
|
||||
}
|
||||
$("#FILE2").append(sparma);
|
||||
$("#myiframe0").attr("action","<%=sWebRootPath%>/Tenwa/Comm/DocList/TriditionDocListUpload.jsp?CompClientID=<%=CurComp.getClientID()%>");
|
||||
$("#myiframe0").attr("method","post");
|
||||
});
|
||||
|
||||
function viewAndEdit_attachment(){
|
||||
if(confirm("确认取消上传?")){
|
||||
parent.AsDialog.ClosePage("_CANCEL_");
|
||||
}
|
||||
}
|
||||
|
||||
function importRecord(){
|
||||
var o = document.forms["myiframe0"];
|
||||
var sFileName = o.FILE2.value;
|
||||
var nameArr = sFileName.split("\\");
|
||||
setItemValue(0,0,"FileName",encodeURI(nameArr[nameArr.length-1]));
|
||||
$("#FILENAMEX").val(encodeURI(nameArr[nameArr.length-1]));
|
||||
o.REMARK2.value= encodeURI(getItemValue(0,0,"REMARK"));
|
||||
if (typeof(sFileName) == "undefined" || sFileName==""){
|
||||
alert("请选上传的附件!");
|
||||
return false;
|
||||
}
|
||||
if(/[!@'"#$%&\^*]/.test(nameArr[nameArr.length-1])){
|
||||
alert("文件名不合法");
|
||||
return;
|
||||
}
|
||||
var flag=CheckStr(nameArr[nameArr.length-1].toLowerCase());
|
||||
if(flag!="true"){
|
||||
alert("只能上传后缀名为"+flag+"的文件");
|
||||
return ;
|
||||
}
|
||||
var fileSize;
|
||||
if(typeof(ActiveXObject) == "function"){ // IE
|
||||
var fso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
var f1 = fso.GetFile(sFileName);
|
||||
fileSize = f1.size;
|
||||
}else{
|
||||
fileSize = o.FILE2.files[0].size;
|
||||
}
|
||||
if(fileSize > 50*1024*1024){
|
||||
alert("文件大于50MB,不能上传!");
|
||||
return false;
|
||||
}
|
||||
$("#FileSize2").val(fileSize);
|
||||
return o.submit();
|
||||
}
|
||||
function CheckStr(filename){
|
||||
var s="word,pdf,docx,doc";
|
||||
var fileName =getItemValue(0,0,"DOC_NAME");
|
||||
// if("车辆视频"==fileName){
|
||||
// s="mp4,mov,m4v,avi,3gp,rm,rmvb,wmv,asf,mkv,vob";
|
||||
// }else if("其他"==fileName){
|
||||
// s="mp4,mov,m4v,avi,3gp,rm,rmvb,wmv,asf,mkv,vob,jpg,jpeg,png,bmp,gif,pdf,doc,docx,xls,xlsx";
|
||||
// }else{
|
||||
// s="jpg,jpeg,png,bmp,gif,pdf,doc,docx,xls,xlsx";
|
||||
// }
|
||||
var flag="false";
|
||||
var s2=s.split(",");
|
||||
var filenamelast = filename.lastIndexOf(".");
|
||||
var fileimage = filename.substr(filenamelast+1).toLowerCase();
|
||||
for(var i=0;i<s2.length;i++){
|
||||
if(fileimage==s2[i]){
|
||||
return "true";
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
</script>
|
||||
<%@ include file="/Frame/resources/include/include_end.jspf"%>
|
||||
104
WebContent/Tenwa/Comm/DocList/TriditionDocListUpload.jsp
Normal file
104
WebContent/Tenwa/Comm/DocList/TriditionDocListUpload.jsp
Normal file
@ -0,0 +1,104 @@
|
||||
<%@page import="java.net.URLDecoder"%>
|
||||
<%@page import="com.amarsoft.are.jbo.impl.BizObjectTableMapper"%>
|
||||
<%@page import="com.amarsoft.awe.util.DBKeyHelp"%>
|
||||
<%@page import="com.tenwa.reckon.util.UUIDUtil"%>
|
||||
<%@page import="com.amarsoft.awe.common.attachment.*"%>
|
||||
<%@ page contentType="text/html; charset=GBK"%>
|
||||
<%@ include file="/IncludeBegin.jsp"%><%
|
||||
AmarsoftUpload myAmarsoftUpload = new AmarsoftUpload();
|
||||
myAmarsoftUpload.initialize(pageContext);
|
||||
myAmarsoftUpload.upload();
|
||||
String FileSizejs=(String)myAmarsoftUpload.getRequest().getParameter("FileSize2");
|
||||
String docType=(String)myAmarsoftUpload.getRequest().getParameter("DOC_TYPE");
|
||||
String oneClassfiy=(String)myAmarsoftUpload.getRequest().getParameter("ONE_CLASSIFY");
|
||||
String twoClassfiy=(String)myAmarsoftUpload.getRequest().getParameter("TWO_CLASSIFY");
|
||||
String objectType=(String)myAmarsoftUpload.getRequest().getParameter("OBJECTTYPE");
|
||||
|
||||
String contractid=(String)myAmarsoftUpload.getRequest().getParameter("CONTRACTID");
|
||||
String projectid=(String)myAmarsoftUpload.getRequest().getParameter("PROJECTID");
|
||||
|
||||
String sFileName =URLDecoder.decode((String)myAmarsoftUpload.getRequest().getParameter("FILENAMEX"),"UTF-8"); //文件名称
|
||||
System.out.println("文件名"+sFileName);
|
||||
// System.out.println("文件名==="+ URLDecoder.decode((String)myAmarsoftUpload.getRequest().getParameter("FILENAMEX"),"UTF-8"));
|
||||
String Remark=URLDecoder.decode((String)myAmarsoftUpload.getRequest().getParameter("REMARK2"),"UTF-8"); //备注InputTime
|
||||
// String libraryId= (String)myAmarsoftUpload.getRequest().getParameter("ID"); //附件编号
|
||||
String InputTime= StringFunction.getTodayNow(); //附件编号上传时间
|
||||
BizObjectManager relaBm=JBOFactory.getBizObjectManager("jbo.app.tenwa.doc.LB_DOCRELATIVE");
|
||||
BizObjectManager libBm=JBOFactory.getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY");
|
||||
BizObjectManager attrBm=JBOFactory.getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE");
|
||||
String relaID = UUIDUtil.getUUID();
|
||||
BizObject rela = relaBm.newObject();
|
||||
rela.setAttributeValue("ID", relaID);
|
||||
rela.setAttributeValue("OBJECTTYPE", objectType);
|
||||
rela.setAttributeValue("CONTRACT_ID", contractid);
|
||||
rela.setAttributeValue("PROJ_ID", projectid);
|
||||
relaBm.saveObject(rela);
|
||||
|
||||
String libraryId = UUIDUtil.getUUID();
|
||||
BizObject lib = libBm.newObject();
|
||||
lib.setAttributeValue("ID", libraryId);
|
||||
lib.setAttributeValue("RELATIVE_ID", relaID);
|
||||
lib.setAttributeValue("Doc_Nature", "合同文件");
|
||||
lib.setAttributeValue("InputTime",InputTime);
|
||||
lib.setAttributeValue("DOC_NAME", sFileName.substring(0, sFileName.indexOf(".")));
|
||||
libBm.saveObject(lib);
|
||||
|
||||
BizObject attr=attrBm.newObject();
|
||||
attr.setAttributeValue("Library_Id", libraryId);
|
||||
attr.setAttributeValue("FileName", sFileName);
|
||||
attr.setAttributeValue("InputUserId", CurUser.getUserID());
|
||||
attr.setAttributeValue("InputOrgId", CurUser.getOrgID());
|
||||
attr.setAttributeValue("InputTime",InputTime);
|
||||
attr.setAttributeValue("objectType", objectType);
|
||||
|
||||
//得到不带路径的文件名
|
||||
sFileName = StringFunction.getFileName(sFileName);
|
||||
sFileName = URLDecoder.decode(URLDecoder.decode(sFileName,"UTF-8"),"UTF-8");
|
||||
//定义数据库操作变量
|
||||
SqlObject so = null;
|
||||
String sNewSql = "";
|
||||
String sFileSaveMode = CurConfig.getConfigure("FileSaveMode");
|
||||
String sFileSavePath = CurConfig.getConfigure("FileSavePath");
|
||||
String sFileNameType = CurConfig.getConfigure("FileNameType");
|
||||
|
||||
String trueTable = ((BizObjectTableMapper)attrBm).getTable(); //取得真实的表名
|
||||
String sAttachmentNo = DBKeyHelp.getSerialNo(trueTable,"Id");
|
||||
|
||||
if (!myAmarsoftUpload.getFiles().getFile(0).isMissing()){
|
||||
try {
|
||||
//System.out.println("sDocNo="+libraryId+"--sAttachmentNo="+sAttachmentNo+"--sFileName="+sFileName+"--sFileSavePath="+sFileSavePath);
|
||||
//System.out.println("sFileNameType="+sFileNameType+"--application="+application);
|
||||
//String sFullPath = com.amarsoft.awe.common.attachment.FileNameHelper.getFullPath(libraryId, sAttachmentNo,sFileName, sFileSavePath, sFileNameType, application);
|
||||
String uuid=java.util.UUID.randomUUID().toString().replaceAll("-", "");
|
||||
String sFullPath =com.tenwa.officetempalte.util.FileOperatorUtil.getuploadFileDir(sFileSavePath) +uuid+"_"+sFileName;
|
||||
if(myAmarsoftUpload.getFiles().getFile(0).getSize()!=Integer.parseInt(FileSizejs)){
|
||||
throw new Exception("上传文件失败,请联系管理员!");
|
||||
}
|
||||
myAmarsoftUpload.getFiles().getFile(0).saveAs(sFullPath);
|
||||
//得到带相对路径的文件名
|
||||
String sFilePath = sFullPath.replace(sFileSavePath, "");
|
||||
attr.setAttributeValue("FilePath",sFilePath);
|
||||
attr.setAttributeValue("FullPath",sFullPath);
|
||||
attr.setAttributeValue("Content_Type",DataConvert.toString(myAmarsoftUpload.getFiles().getFile(0).getContentType()));
|
||||
attr.setAttributeValue("FileSize",DataConvert.toString(String.valueOf(myAmarsoftUpload.getFiles().getFile(0).getSize())));
|
||||
attrBm.saveObject(attr);
|
||||
myAmarsoftUpload = null;
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
out.println("An error occurs : " + e.toString());
|
||||
attrBm.deleteObject(attr);
|
||||
myAmarsoftUpload = null;
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
alert("上传失败");//上传文件失败!
|
||||
parent.AsDialog.ClosePage();
|
||||
</script>
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
alert("上传成功");//上传文件成功!
|
||||
parent.AsDialog.ClosePage("success");
|
||||
</script>
|
||||
<%@ include file="/IncludeEnd.jsp"%>
|
||||
@ -0,0 +1,93 @@
|
||||
<%@page import="jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT"%>
|
||||
<%@ page contentType="text/html; charset=GBK"%>
|
||||
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
|
||||
/*
|
||||
Author: undefined 2018-07-16
|
||||
Content:
|
||||
History Log:
|
||||
*/
|
||||
String sObjectType = CurPage.getParameter("FlowNo");//流程类型
|
||||
String RightType= CurPage.getParameter("RightType");
|
||||
String contractid= CurPage.getParameter("ContractId");
|
||||
String projectid= CurPage.getParameter("ProjectId");
|
||||
String username=CurUser.getUserName();
|
||||
ASObjectModel doTemp = new ASObjectModel("TriditonContractList");
|
||||
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
|
||||
dwTemp.Style="1"; //--设置为Grid风格--
|
||||
dwTemp.ReadOnly = "1"; //只读模式
|
||||
dwTemp.setPageSize(10);
|
||||
dwTemp.genHTMLObjectWindow("");
|
||||
|
||||
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格
|
||||
String sButtons[][] = {
|
||||
{"true","All","Button","上传","上传合同","upload()","","","","btn_icon_save"},
|
||||
{"true","","Button","删除","删除","deletefile()","","","","btn_icon_delete",""},
|
||||
};
|
||||
sButtonPosition = "north";
|
||||
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
|
||||
<script type="text/javascript">
|
||||
//在加载完表格后调用
|
||||
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+'\')"> </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']+'\');"> </a>';
|
||||
}
|
||||
if(obj[file]['image']=="true"){
|
||||
html+='<a class="btn_icon btn_icon_search" onclick="showImage(\''+obj[file]['id']+'\',\''+obj[file]['filename']+'\');"> </a>';
|
||||
}
|
||||
if(obj[file]['word']=="true"){
|
||||
html+='<a class="btn_icon btn_icon_search" onclick="showWord(\''+obj[file]['id']+'\',\''+obj[file]['filename']+'\');"> </a>';
|
||||
}
|
||||
if(obj[file]['pdf']=="true"){
|
||||
html+='<a class="btn_icon btn_icon_search" onclick="showPDF(\''+obj[file]['id']+'\',\''+obj[file]['filename']+'\');"> </a>';
|
||||
}
|
||||
html+='</br>';
|
||||
}
|
||||
getObj(0,i,"filelist").innerHTML=html;
|
||||
getObj(0,i,"filelist").style["white-space"]="pre-wrap";
|
||||
};
|
||||
}
|
||||
|
||||
function upload(){
|
||||
var param="contractid=<%=contractid%>&projectid=<%=projectid%>";
|
||||
var sUrl="/Tenwa/Comm/DocList/TriditionDocListInfo.jsp";
|
||||
AsDialog.PopView(sUrl,param,"dialogWidth=480px;dialogHeight=400px;resizable=no;scrollbars=no;status:yes;maximize:no;help:no;",function(message){
|
||||
// var str=RunJavaMethodTrans("com.tenwa.doc.action.DocListAction","updateBussinessCheck","library_id="+id+",BussinessCheck=DocCheck_0");
|
||||
// reloadSelf();
|
||||
location.reload();
|
||||
heping();
|
||||
},"上传附件");
|
||||
}
|
||||
|
||||
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 deletefile(){
|
||||
var ID = getItemValue(0,getRow(0),"id");
|
||||
if(typeof(ID) == "undefined" || ID.length == 0 ){
|
||||
alert("请选择一条记录!");
|
||||
return;
|
||||
}
|
||||
if(confirm('确实要删除吗?')){
|
||||
as_delete(0);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<%@ include file="/Frame/resources/include/include_end.jspf"%>
|
||||
Loading…
x
Reference in New Issue
Block a user