網(wǎng)頁:html.01

22.png

11.png
  <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/web/include/includes-web.jsp"%>
<html>
<head>
<script type="text/javascript">
        //功能實現(xiàn):在沒選擇時上面各種按鈕不能進(jìn)行選擇
        function datagridButtonAble(){
            jQuery("#edit").linkbutton('disable');
            jQuery("#remove").linkbutton('disable');
            jQuery("#show").linkbutton('disable');
            var checkeds=jQuery("#datagrid").datagrid("getChecked");
            for(var i in checkeds){
                if(checkeds.length==1){
                    jQuery("#edit").linkbutton('enable');
                    jQuery("#remove").linkbutton('enable');
                    jQuery("#show").linkbutton('enable');
                }else if(checkeds.length!=0){
                    jQuery("#remove").linkbutton('enable');//批量,需要后臺批量刪除
                }
            }
        }
        //添加數(shù)據(jù)的方法
        function add(){
            jQuery('#mergeForm').form('clear');
            jQuery('#merge-dialog').dialog('setTitle','添加').dialog('open');
        }
        //修改數(shù)據(jù)的方法
         function edit(){
            jQuery("#mergeForm").form("clear");
            var rows = jQuery("#datagrid").datagrid('getChecked')[0];
            jQuery("#mergeForm").form('load',rows);
            jQuery("#projectId").combogrid('setText',rows['projectInfo.name']);
            $('#chechDateStr').datebox('setValue', rows['CheckDate']?rows['CheckDate'].substr(0,10):"");
            $('#moveDateStr').datebox('setValue', rows['MoveDate']?rows['MoveDate'].substr(0,10):"");
            jQuery("#merge-dialog").dialog('setTitle','修改信息').dialog('open');
        }
        //刪除數(shù)據(jù)的方法
        function remove(){
            jQuery.messager.confirm('注意', '是否確定刪除?', function(r){
                 if (r){
                        var ids=new Array();
                        var checks=jQuery("#datagrid").datagrid('getChecked');
                        for(var i in checks){
                            ids.push(checks[i].id);
                        }
                    
            jsTool.ajax({
                    url:contextPath+"/web/hr/lianXi2/remove.do",
                    data:{id:ids+""},
                    dataType:'text',
                    success:function(data){
                        easyuiTool.show('成功', '執(zhí)行成功');
                        jQuery('#datagrid').datagrid('load');
                        }
                    });
                 }
             })
        }  
        //顯示具體信息的方法
        function show(){
            jQuery("#showForm").form("clear");
            var row=jQuery("#datagrid").datagrid('getChecked')[0];
            jQuery("#mergeForm").form('load',row);
            //jQuery("#對應(yīng)下面的網(wǎng)頁div的ID").html(row['對應(yīng)實體類中的名稱']);
            jQuery("#project").html(row['projectInfo.name']);
            jQuery("#chechData").html(row['CheckDate']?row['CheckDate'].substr(0,10):"");
            jQuery("#moveData").html(row['MoveDate']?row['MoveDate'].substr(0,10):"");
            jQuery("#weekData").html(row['WeekDate']);
            jQuery("#addressromm").html(row['address']);
            jQuery("#renCount").html(row['roomCount']);
            jQuery("#remarked").html(row['remarks']);
            jQuery("#show-dialog").dialog('setTitle','查看信息').dialog('open');
        }
        //主要是進(jìn)行選擇的菜單選項
        jQuery(function(){
            jQuery("#datagrid").datagrid({
                url:contextPath+"/web/hr/lianXi2/findpage.do",
                fit:true,
                pagination:true,
                nowrap:true,
                singleSelect:true,
                selectOnCheck:false,
                checkOnSelect:true, 
                toolbar:[
                    {
                        id:'add',
                        iconCls:'icon-erpadd',
                        text:'添加',
                        handler:function(){
                            add();
                        }
                    },'-',{
                        id:'edit',
                        iconCls:'icon-erprevise',
                        text:'修改',
                        handler:function(){
                            edit();
                        }
                    },'-',{
                        id:'remove',
                        iconCls:'icon-erpdelete',
                        text:'刪除',
                        handler:function(){
                            remove();
                        }
                    },'-',{
                        id:'show',
                        iconCls:'icon-erpinformation',
                        text:'查看',
                        handler:function(){
                            show();
                        }
                    },'->',{
                        name:'param',
                        type:'searchbox'
                    },'-',{
                        iconCls: 'icon-erpquest',
                        text:'高級查詢',
                        type:"extendButton",
                        extendDivStr:"#extendDiv"
                    }
            ],
            
            columns:[[
                        {field:'id',checkbox:true}, 
                        {field:'emp.name',title:'申請人',sortable:true,width:80},
                        {field:'emp.empSex.name',title:'性別',sortable:true,width:50},                        
                        {field:'projectInfo.name',title:'項目組',sortable:true,width:80},
                        {field:'CheckDate',title:'入住時期',sortable:true,width:80},
                        {field:'WeekDate',title:'入住周期',sortable:true,width:100},
                        {field:'MoveDate',title:'計劃搬離時期',sortable:true,width:100},
                        {field:'address',title:'入住地址',sortable:true,width:100},
                        {field:'roomCount',title:'入住人數(shù)',sortable:true,width:50},
                        {field:'remarks',title:'申請理由',sortable:true,width:50}
                    
                    ]],
                    onDblClickRow:function(rowIndex,rowData){
                        show();
                    },
                    onCheck:function(rowIndex,rowData){
                        datagridButtonAble();
                    },
                    onUncheck:function(rowIndex,rowData){
                        datagridButtonAble();
                    },
                    onCheckAll:function(rowIndex,rowData){
                        datagridButtonAble();
                    },
                    onUncheckAll:function(rowIndex,rowData){
                        datagridButtonAble();
                    },
                    onLoadSuccess:function(data){
                        datagridButtonAble();
                    }
             });
               $("#projectId").combogrid({
                   
               });
               //顯示修改的對話框
             jQuery("#merge-dialog").dialog({
                 width:800,
                 height:450,
                 modal:true,
                 collapsible:true,
                 maximizable:true,
                 closed:true,
                 buttons:[{
                     text:'保存',
                     iconCls:'icon-erpbaocun',
                     handler:function(){
                         if(jQuery("#mergeForm").form('validate')==true){
                            jQuery("#mergeForm").submit();
                        }else{
                            $.messager.alert('錯誤','您輸入的信息輸入不全,請輸入完整!','error');
                        }
                     }
                 },{
                     text:'關(guān)閉',
                     iconCls:'icon-erpexit',
                     handler:function(){
                         jQuery('#merge-dialog').dialog('close');
                     }
                 }]
             });
               //顯示具體信息的對話框
             jQuery("#show-dialog").dialog({
                    width : 800,
                    height : 450,
                    modal : true,
                    collapsible : true,
                    closed : true,
                    buttons : [ {
                        text : '關(guān)閉',
                        iconCls : 'icon-erpexit',
                        handler : function() {
                            jQuery('#show-dialog').dialog('close');
                        }
                    } ]
                });
             jsTool.form({
                    form:jQuery('#mergeForm'),
                    dataType:"text",
                    success:function(data){
                        easyuiTool.show('成功','執(zhí)行成功');
                        jQuery("#datagrid").datagrid('reload');
                        jQuery('#merge-dialog').dialog('close');
                    },error:function(){
                        $.messager.alert('錯誤','錯誤!','error');
                    }
            });

        });
    </script>
 </head>
 <body>
 <div class="easyui-layout" data-options="fit:true">
        <div data-options="region:'center',title:'入住信息'">   
            <div id="datagrid"  data-options="fitColumns:true" ></div>
        </div>
        <!-- 顯示修改的對話框 -->
        <div id="merge-dialog" class="easyui-dialog">
            <form id="mergeForm" method="post" action="${contextPath}/web/hr/lianXi2/merge.do" >
                <input name="id" type="hidden">
                <input name="empId" type="hidden" value="${hrRoom.empId!=null?hrRoom.empId:empId}"> <!-- //問題 -->
                
                <table class="forms-web">             
                    <tr>
                        <th>姓名:</th>
                        <td>${hrRoom.emp.name!=null?hrRoom.emp.name:curUser.emp.empName}</td>
                    </tr>
                    <tr>
                        <th>性別:</th>
                            <td>${hrRoom.emp.empSex.name!=null?hrRoom.emp.empSex.name:curUser.emp.empSex.name}</td>
                    </tr>
                    <tr>
                        <th>民族:</th>
                            <td>${empNation}</td>
                    </tr>
                    <tr>
                        <th>項目:</th>
                        <td>
                            <select id="projectId" class="easyui-combogrid" name="projectId" data-options="
                                    fit:true,
                                    readonly:true,
                                    pagination:true,
                                    editable:false,
                                    width:200,
                                    panelWidth: 400,
                                    idField: 'id',
                                    textField: 'name',
                                    fitColumns: true,
                                    url: contextPath+'/web/pm/projectInfo/findPage.do',
                                    value:'${HrRoom.projectId}',
                                    toolbar:[
                                            '->',{
                                                name:'param',
                                                type:'searchbox'
                                            }
                                        ],
                                    columns: [[
                                        {field:'id',hidden:true},
                                        {field:'code',title:'項目編號',width:40,sortable:true},
                                        {field:'name',title:'項目名稱',width:40,sortable:true}
                                        
                                    ]]
                                ">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>入住日期:</th>
                        <td><input  id="chechDateStr" name="chechDateStr" class="easyui-datebox" data-options="required:true"  style="width:200px"></td>
                    </tr>
                    <tr>
                        <th>入住周期:</th>
                        <td><input name="WeekDate" class="easyui-validatebox" data-options="required:true"></td>
                    </tr>
                    <tr>
                        <th>計劃搬離日期:</th>
                        <td><input id="moveDateStr" name="moveDateStr" class="easyui-datebox" data-options="required:true"  style="width:200px"></td>
                    </tr>
                    <tr>
                        <th>入住宿舍地址:</th>
                        <td><input name="address" class="easyui-validatebox" data-options="required:true"></td>
                    </tr>
                    <tr>
                        <th>已入住人數(shù):</th>
                        <td><input name="roomCount" class="easyui-validatebox" data-options="required:true"></td>
                    </tr>
                    <tr>
                        <th>申請理由:</th>
                        <td>
                            <textarea name="remarks"  style="width:200px"></textarea>
                        </td>
                    </tr>
                </table>
            </form> 
        </div> 
        <!-- 顯示具體信息的對話框的對話框 -->
        <div id="show-dialog" class="easyui-dialog">
            <form id="showForm" style="height: 100%;width: 100%;" >
              
                <table class="show-web">             
                    <tr>
                        <th>姓名:</th>
                        <td>${hrRoom.emp.name!=null?hrRoom.emp.name:curUser.emp.empName}</td>
                    </tr>
                    <tr>
                        <th>性別:</th>
                            <td>${hrRoom.emp.empSex.name!=null?hrRoom.emp.empSex.name:curUser.emp.empSex.name}</td>
                    </tr>
                    <tr>
                        <th>民族:</th>
                            <td>${empNation}</td>
                    </tr>
                    <tr>
                        <th>項目:</th>
                        <td id="project"></td>
                    </tr>
                    <tr>
                        <th>入住日期:</th>
                        <td id="chechData"></td>
                    </tr>
                    <tr>
                        <th>入住周期:</th>
                        <td id="weekData"></td>
                    </tr>
                    <tr>
                        <th>計劃搬離日期:</th>
                        <td id="moveData"></td>
                    </tr>
                    <tr>
                        <th>入住宿舍地址:</th>
                        <td id="addressromm"></td>
                    </tr>
                    <tr>
                        <th>已入住人數(shù):</th>
                        <td id="renCount"></td>
                    </tr>
                    <tr>
                        <th>申請理由:</th>
                        <td id="remarked">
                            <textarea name="remarks"  style="width:200px"></textarea>
                        </td>
                    </tr>
                </table>
            </form> 
        </div> 
    </div>  
 </body>
 </html>
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容