apzl_leasing/WebContent/Tenwa/Comm/DocList/TelAttachmentUpload.jsp
2018-06-03 22:26:41 +08:00

104 lines
3.3 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_info.jspf"%><%
/*
Author: undefined 2018-05-31
Content: 示例详情页面
History Log:
*/
String Library_id = CurPage.getParameter("Library_id");
//定义变量
String sObjectNo = "";//--对象编号
//获得组件参数
String flowNo=CurPage.getParameter("FlowNo");
String sPrevUrl = CurPage.getParameter("PrevUrl");
//if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/FamilyVisit/fieldSurvey/FieldSurveyList.jsp";
String sTempletNo = "TelAttachmentUpload";//--模板号--
ASObjectModel doTemp = new ASObjectModel(sTempletNo);
ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request);
dwTemp.Style = "2";//freeform
//dwTemp.ReadOnly = "-2";//只读模式
dwTemp.genHTMLObjectWindow(Library_id);
String sButtons[][] = {
{"true","","Button","保存","保存所有修改","importRecord()","","","",""},
{"true","All","Button","取消","返回列表","pull()","","","","btn_icon_close"}
};
/* sButtonPosition = "south"; */
%><%@ 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"]="<%=flowNo%>";
var sparma="";
for(var key in params){
sparma=sparma+"<input type=\"text\" name=\""+key+"\" value=\""+params[key]+"\">"
}
$("#FILE2").append(sparma);
$("#myiframe0").attr("action","<%=sWebRootPath%>/Tenwa/Comm/DocList/DocListUploadTwo.jsp?CompClientID=<%=CurComp.getClientID()%>");
$("#myiframe0").attr("method","post");
});
var lock = false;
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]));
if (typeof(sFileName) == "undefined" || sFileName==""){
alert("请选上传的附件!");
return false;
}
if(/[!@'"#$%&\^*]/.test(nameArr[nameArr.length-1])){
alert("文件名不合法");
return;
}
var flag=CheckStr(nameArr[nameArr.length-1]);
/* 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;
}
if(lock){
//锁已经开启,在提交只会被阻断
AsDebug.showMessage('提醒:','请勿重复点击','','',true);
return false;
}else {
//锁开启,锁关闭只能是数据被处理完毕或者刷新页面,文档重新加载
lock = true;
}
return o.submit();
}
function CheckStr(filename){
var s="jpg,jpeg,png,bmp,gif,pdf,doc,docx,xls,xlsx,txt";
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;
}
function pull(){
// AsControl.OpenView("/Tenwa/Lease/FamilyVisit/fieldSurvey/FieldSurveyList.jsp", "","_self","");
parent.AsDialog.ClosePage("_CANCEL_");
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>