from 表单提交
html端代码
1 <body> 2 <div id="dlg" class="easyui-panel" buttons="#dlg-buttons"> 3 <form id="saveHistory" method="post"> 4 <!-- <table class="edittable" > 5 <tr> 6 <td width="20%"><span key="file.filename" class="paltform-i18n">原文件或文件夹路径:</span></td> 7 <td width="80%"> 8 <input type="text" id="localPath" name='localPath' required="true" style="width: 525px" panelHeight="80px" class="easyui-validatebox input_bg"> 9 <!-- </td> 10 </tr> 11 <tr> 12 <td width="20%"><span key="file.filename" class="paltform-i18n">文档类别:</span></td> 13 <td width="80%"> 14 <select id ="foldreeventid" name="foldreeventid" required="true" class="easyui-combotree" style="width: 530px" panelHeight="80px" onclick="queryTree()"></select> 15 </td> 16 </tr> 17 </table> --> 18 <div style="margin-top: 10px;text-align: center;"> 19 <span key="file.filename" class="paltform-i18n">原文件或文件夹路径:</span> 20 <input type="text" id="localPath" name='localPath' required="true" style="width: 525px" panelHeight="80px" class="easyui-validatebox input_bg"> 21 </div> 22 <div style="margin-top: 10px"> 23 <span class="uploadpage_textStyle" > 文档分类:</span> 24 <input type="text" id="fileclassify1" name="fileclassify1" validType="fileclassify1" style="width:200px;" required="true" class="easyui-combotree input_bg" missingmessage="文档分类不能为空" panelHeight="180px"/> 25 <input type="text" id="fileclassify" name='fileclassify' validType="fileclassify" style="width: 200px;" required="true" class="easyui-combotree input_bg" missingmessage="文档分类不能为空" panelHeight="180px"/> 26 </div> 27 <br/> 28 <div> 29 温馨提示:<br/><br/> 30 1.导入文件夹路径下的文件不宜太多,如果文件太多,可以分多次导入<br/><br/> 31 </div> 32 <div class="button_area_absolute"> 33 <table width="100%"> 34 <tr> 35 <td align="center"> 36 <!-- <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="confirmMigration()"><span key="unit.save" class="paltform-i18n">迁移文件</span></a> 37 <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="modifyFileName()"><span key="unit.save" class="paltform-i18n">修改文件名称</span></a> 38 <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveFileToDatabase()"><span key="unit.save" class="paltform-i18n">保存文件信息至数据库</span></a> 39 <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="generateProfileAttribute()"><span key="unit.save" class="paltform-i18n">生成摘要属性</span></a> 40 <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="addWaterPrint()"><span key="unit.save" class="paltform-i18n">添加水印</span></a> 41 <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="generatePreview()"><span key="unit.save" class="paltform-i18n">生成预览</span></a> --> 42 <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="documentImport()"><span key="unit.save" class="paltform-i18n">一键导入</span></a> 43 <a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="cancelMigration()"><span key="unit.cancel" class="paltform-i18n">取消</span></a> 44 </td> 45 </tr> 46 </table> 47 </div> 48 </form> 49 50 </div> 51 </body>
JS端代码
1 $('#saveHistory').form('submit', { 2 url : "../doccenter/documentImport.do", 3 dataType : "json", 4 onSubmit : function() { 5 if(!($(this).form('validate'))){ 6 hiddenLoadingMessage(); 7 } 8 return $(this).form('validate'); 9 }, 10 // var localPath=$('#localPath').val(); 11 // var fileclassify1=$('#fileclassify1').combotree('getValue'); 12 // var fileclassify=$("#fileclassify").combotree('getValue'); 13 // $.ajax({ 14 // url: "../doccenter/documentImport.do", 15 // data:{"localPath":localPath,"fileclassify1":fileclassify1,"fileclassify":fileclassify}, 16 // type:'post', 17 // dataType : "json", 18 success : function(result) { 19 hiddenLoadingMessage(); 20 var result = eval('(' + result + ')'); 21 if (result.success){ 22 $.messager.confirm("提示", result.msg+"。是否继续导入文档?", function(f){ 23 if(f){ 24 $('#localPath').attr("value",""); 25 $("#foldreeventid").combotree("setValue",""); 26 }else{ 27 reloadData('queryFolder.htm', 'dg'); 28 cancelMigration(); 29 } 30 reloadData('queryFolder.htm', 'dg'); 31 }); 32 33 } else { 34 $.messager.alert('错误',result.msg,result.error); 35 } 36 } 37 });