entry.js - genscript-lz/manufacturing GitHub Wiki

$("#upload_btn").click( function(){ $('#upload_btn').attr("disabled", true); var upURL = "workorder_entry!uploadFile.action" +"?docType=" + $('#pdt_docType_sel').fieldValue(); //ajax form post var options = { success:function(data){ var documentList = data; var tmpStr = getFileListHtml(documentList); $("#save_form").find("#fileListTable").append(tmpStr); var file = $("#upload_file"); file.after(file.clone().val("")); file.remove(); $('#upload_btn').attr("disabled", false); }, error: function(data){ if(data.responseText){ alert(data.responseText); }else{ alert("File too large."); } $('#upload_btn').attr("disabled", false); }, dataType:"json", resetForm:false, url: upURL, type: "post" }; $("#save_form").ajaxForm(options); $("#save_form").submit(); });

function deleteFile() { var docIds = ""; var indexArray = new Array(); $("#fileListTable input[type='checkbox']").each(function(){ if(this.checked) { if(docIds=="") { docIds = docIds +this.value; } else { docIds = docIds +","+this.value; } var trObj = $(this).parent().parent(); indexArray.push(trObj.get(0).rowIndex); } }); if(docIds=="") { alert("Please select one file at least."); return; } if (confirm("Are you confirm delete these files ?")) {
$.ajax({ type: "POST", url: "workorder_entry!deleteFile.action", data: "sessId=" + $("#sessId").val() + "&docIds=" + docIds, success: function(data, textStatus) { alert("Success"); for(var i =0;i<indexArray.length;i++) { $("#save_form").find("#fileListTable").get(0).deleteRow(indexArray[0]); } }, error: function(xhr, textStatus){ alert("failure"); } });

}

}

//获取附件列表html字符串 function getFileListHtml(documentList){ var tmpStr = ""; $.each(documentList, function(key, value) { tmpStr += '

'; tmpStr += ''; tmpStr += ''; tmpStr += ''; tmpStr += ''; tmpStr += '<a href="#" onclick="downLoadFile(''+value["filePath"]+'',''+value["docName"]+'')">'+value.docName+''; tmpStr += ''; tmpStr += 'Uploaded By'; tmpStr += ''; var now = new Date().getFullYear()+"-"; now = now + (new Date().getMonth()+1)+"-"; now = now + new Date().getDate()+" "; tmpStr += 'Uploaded Date'; tmpStr += ''; tmpStr += 'Type:'+value["docType"]; tmpStr += ''; tmpStr += '';
}); return tmpStr; }
⚠️ **GitHub.com Fallback** ⚠️