EasyUI 对话框弹出文件输入框

  目前用的EasyUI的dialog,要实现弹出文件输入框(或者其他输入框和对话框),我的实现方案是,首先写一个close的div,然后里面就是样式和输入框的一些代码和一个确定按钮,然后页面上一个按钮,功能是open这个dialog,然后在dialog页面完成输入操作,然后dialog的确定按钮绑定的是提交dialog的form操作。

  

<div id="fileImport" class="easyui-dialog" title="请上传文件"
        style="width: 450px; padding: 10px 20px; height: 150px;" closed="true"
        buttons="#dlg-buttons">
        <form id="importfile"
            action="<%=request.getContextPath()%>/UploadModelCatecodeFile"
            method="post" enctype="multipart/form-data"
            style="margin-top: 20px; margin-left: 20px;">
            <div class="fitem">
                <table border="0">
                    <tr>
                        <td><label>选择文件:</label> <input type="file"
                            name="uploadCatecodeFile"></td>
                        <td><a href="#" class="easyui-linkbutton"
                            iconCls="icon-excel-import" id="importDataBtn2">确定导入</a></td>
                    </tr>
                </table>
            </div>
        </form>
    </div>
close的div
$('#importDataBtn1').bind('click',function(){
                $('#fileImport').window("open");
            });
页面按钮绑定open该dialog的功能
$('#importDataBtn2').bind('click',function(){
                $.messager.confirm("确认", "确认要导入车型Catecode数据吗?", function(r){
                    if(r){ 
                        $('#importfile').form('submit', {
                            success:function(data){
                                var jsonObj = eval('(' + data + ')');
                                if(jsonObj.flag==1){
                                    alert('导入车型Catecode数据成功!');
                                }
                                else{
                                    alert(jsonObj.flag);
                                }
                            },
                            onSubmit: function(param){   // 额外参数
                            }   
                        }
                        );
                     }
                }); 
            });
提交功能

猜你喜欢

转载自www.cnblogs.com/yanghanwen/p/10425430.html