easyui数据回代到dialog中的form表单中

以edit为例:

一、js中

$("#editForm #btnSave").click(
                    function()
                    {
                        $('#editForm').form('submit', {   
                             url:'NoteController/Edit', 
                             data:"noteId="+noteId,
                             onSubmit: function(param){ 
                                 //得到申请人ID
                                 var employeeId = $("#editForm #employeeId").textbox("getValue");
                                 //张三丰( 1,1001001 )
                                 employeeId = employeeId.substring( employeeId.indexOf("(")+1 , 
                                      employeeId.indexOf(","));
                                 param.employeeId1 = employeeId;
                                 
                                 //得到代理人ID    
                                 var operatorId = $("#editForm #operatorId").textbox("getValue");
                                 //张三丰( 1,1001001 )
                                 operatorId = operatorId.substring( operatorId.indexOf("(")+1 , 
                                      operatorId.indexOf(","));
                                 param.operatorId1 = operatorId;
                              
                                var getValue = $("#editForm #typeName").combobox("getValue");
                                var typeid = $("#editForm #typeName").combobox("getText");
                                
                                param.noteTypeId=getValue;
                                  //alert("getValue="+getValue+",gettext="+typeid);
                                if( getValue.length == 0 )
                                {
                                    alert("必须选择请假类型!");
                                    return  false;
                                }
                                return $(this).form('validate');
                             },
                             success:function( data )
                             {
                                 var data = eval('(' + data + ')');
                                 $.messager.show({
                                    title:'消息',
                                    msg: data==true?"修改成功":"修改失败",//
                                    showType:'show'
                                });    
                                
                                $('#addForm').form("clear");
                                $('#editForm').form("clear");
                                $('#editDiv').dialog({   
                                    closed: true
                                });    
                                
                                $('#tblNote').datagrid('reload');
                             } 
                        });
                    }
            );

 

 

function initDialog(){
            $('#employeeListDiv').dialog({
                title:'员工列表',
                width:400,
                height:380,
                closed:true,
                modal:true
            });
            $('#employeeListDiv2').dialog({
                title:'员工列表',
                width:400,
                height:380,
                closed:true,
                modal:true
            });
            $('#addDiv').dialog({
                title:'请假单管理',
                width:550,
                height:400,
                closed:true,
                modal:true
            });
            $('#showDiv').dialog({
                title:'查看请假单',
                width:550,
                height:400,
                closed:true,
                modal:true
            });
            $('#editDiv').dialog({
                title:'编辑请假单',
                width:550,
                height:400,
                closed:true,
                modal:true
            });
        }

 

 

function edit(noteId) {
            $('#editDiv').dialog({
                closed : false
            });
            $.ajax({
                url : "http://localhost:8081/KQXT/NoteController/QueryOne",
                type : "POST",
                data : "noteId=" + noteId,
                success : function(data) {
                    var data = eval("(" + data + ")"); //
                    $('#editForm').form('load', {
                        noteId:data.noteId,
                        employeeId : data.employeeName+"("+data.employeeId+","+data.cardNumber+")",
                        operatorId : data.operatorName+"("+data.operatorId+","+data.operatorcardNumber+")",
                        typeName : data.noteTypeId,//
                        fillInTime : data.fillInTime,
                        cause : data.cause,
                        startDate : data.startDate,
                        startTime : data.startTime,
                        endDate : data.endDate,
                        endTime : data.endTime,
                        directorSign : data.directorSign,
                        administrationSign : data.administrationSign,
                        presidentSign : data.presidentSign,
                        isVerify : data.isVerify
                    });
                }
            });
        }

二、edit表单

<div id="editDiv">
    <form id="editForm">
        <table cellspacing="10">
            <tr style="display:none">
                    <td style="text-align: right"><label for="noteId">请假单编号:</label></td>
                    <td><input id="noteId" name="noteId"
                        class="easyui-textbox easyui-validatebox"
                        data-options="required:true,editable:false" style="width: 300px">
                    </td>
            </tr>
            <tr>
                <td style="text-align:right"><label for="employeeId">申请人:</label></td>
                <td><input id="employeeId" name="employeeId" class="easyui-textbox easyui-validatebox" data-options="required:true,editable:false" style="width:300px">
                </td>
            </tr>
            <tr>
                <td style="text-align:right"><label for="operatorId">代理人:</label></td>
                <td><input id="operatorId" name="operatorId" class="easyui-textbox easyui-validatebox" data-options="required:true,editable:false" style="width:300px">
            <!-- <input id="operatorId" name="operatorId" class="easyui-combobox" data-options="required:true,iconCls:'icon-search'" style="width:300px"/> -->
                </td>
            </tr>
            <tr>
                <td style="text-align:right"><label for="typeName">请假类型:</label></td>
                <td><input id="typeName" class="easyui-combobox" name="typeName" data-options="valueField:'typeId',textField:'typeName',url:'http://localhost:8081/KQXT/AttendancetypeController/QueryNoteType',editable:false">
                </td>
            </tr>
            <tr>
                <td style="text-align:right"><label for="fillInTime">填表时间:</label></td>
                <td><input class="easyui-datebox" name="fillInTime" id="fillInTime" data-options="required:true,editable:false" style="width:150px">
            <!--  <input class="easyui-datetimebox" name="fillInTime" id="fillInTime" data-options="required:true,editable:false" style="width:150px">-->
                </td>
            </tr>
            <tr>
                <td style="text-align:right"><label for="cause">请假事由:</label></td>
                <td><input class="easyui-textbox" id="cause" name="cause" data-options="required:true,multiline:true" style="width:300px;height:50px;">
                </td>
            </tr>
            <tr>
                <td style="text-align:right"><label for="startDate">请假起始时间:</label></td>
                <td><input id="startDate" name="startDate" type="text" class="easyui-datebox" data-options="required:true,editable:false"/>
                    <select id="startTime" class="easyui-combobox" name="startTime" style="width:200px;" data-options="editable:false">
                        <option value="上午">上午</option>
                        <option value="下午">下午</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td style="text-align:right"><label for="endDate">请假结束时间:</label></td>
                <td>
                    <input id="endDate" name="endDate" type="text" class="easyui-datebox" data-options="required:true,editable:false"/>
                    <select id="endTime" name="endTime" class="easyui-combobox" style="width:200px;" data-options="editable:false">
                        <option value="上午">上午</option>
                        <option value="下午">下午</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td style="text-align:right"><label for="directorSign">主管经理意见:</label></td>
                <td><input class="easyui-textbox" id="directorSign" name="directorSign" data-options="required:true,multiline:true" style="width:300px;height:50px;">
                </td>
            </tr>
            <tr>
                <td style="text-align:right"><label for="administrationSign">行政部经理意见:</label></td>
                <td><input class="easyui-textbox" id="administrationSign" name="administrationSign" data-options="required:true,multiline:true" style="width:300px;height:50px;">
                </td>
            </tr>
            <tr>
                <td style="text-align:right"><label for="presidentSign">总裁意见:</label></td>
                <td><input class="easyui-textbox" id="presidentSign" name="presidentSign" data-options="required:true,multiline:true" style="width:300px;height:50px;" />
                </td>
            </tr>
            <tr>
                <td style="text-align:right"><label for="isVerify">是否审核通过:</label></td>
                <td>
                    <input type="radio" value="1" checked="checked" name="isVerify">通过
                    <input type="radio" value="0"  name="isVerify">不通过
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align:center"><a id="btnSave" class="easyui-linkbutton" data-options="iconCls:'icon-save',plain:true">保存</a>
                </td>
            </tr>
        </table>
    </form>
</div>

三、http://localhost:8081/KQXT/AttendancetypeController/QueryNoteType

controller

private void QueryNoteType(HttpServletRequest request, HttpServletResponse response) throws IOException {
        List<Attendancetype> list=biz.queryNoteType();
        String str=JSON.toJSONString(list);
        PrintWriter out=response.getWriter();
        out.print(str);
        out.flush();
        out.close();
        
    }

Bizimpl

public List<Attendancetype> queryNoteType() {
        String sql="select * from attendancetype where typeCategory=1";
        return (List<Attendancetype>)dao.query(sql, Attendancetype.class, new Object[] {});
    }

pojo

package com.kosys.pojo;

public class Attendancetype {
    private int typeId;
    private String typeName;
    private int typeCategory;
    public int getTypeId() {
        return typeId;
    }
    public void setTypeId(int typeId) {
        this.typeId = typeId;
    }
    public String getTypeName() {
        return typeName;
    }
    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }
    public int getTypeCategory() {
        return typeCategory;
    }
    public void setTypeCategory(int typeCategory) {
        this.typeCategory = typeCategory;
    }
    @Override
    public String toString() {
        return "Attendancetype [typeId=" + typeId + ", typeName=" + typeName + ", typeCategory=" + typeCategory + "]";
    }

    
}
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值